VirtualBox

source: vbox/trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp@ 43428

Last change on this file since 43428 was 43428, checked in by vboxsync, 13 years ago

Devices/Parallel: Extra Debug statements to debug issue with user. Will revert the changes soon.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 37.2 KB
Line 
1/* $Id: DrvHostParallel.cpp 43428 2012-09-25 12:35:17Z vboxsync $ */
2/** @file
3 * VirtualBox Host Parallel Port Driver.
4 *
5 * Initial Linux-only code contributed by: Alexander Eichner
6 */
7
8/*
9 * Copyright (C) 2006-2012 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.215389.xyz. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20/*******************************************************************************
21* Header Files *
22*******************************************************************************/
23#define LOG_GROUP LOG_GROUP_DRV_HOST_PARALLEL
24#include <VBox/vmm/pdmdrv.h>
25#include <VBox/vmm/pdmthread.h>
26#include <iprt/asm.h>
27#include <iprt/assert.h>
28#include <iprt/file.h>
29#include <iprt/pipe.h>
30#include <iprt/semaphore.h>
31#include <iprt/stream.h>
32#include <iprt/uuid.h>
33#include <iprt/cdefs.h>
34#include <iprt/ctype.h>
35
36#ifdef RT_OS_LINUX
37# include <sys/ioctl.h>
38# include <sys/types.h>
39# include <sys/stat.h>
40# include <sys/poll.h>
41# include <fcntl.h>
42# include <unistd.h>
43# include <linux/ppdev.h>
44# include <linux/parport.h>
45# include <errno.h>
46#endif
47
48/** @def VBOX_WITH_WIN_PARPORT_SUP *
49 * Indicates whether to use the generic direct hardware access or host specific
50 * code to access the parallel port.
51 */
52#if defined(RT_OS_LINUX)
53# undef VBOX_WITH_WIN_PARPORT_SUP
54#elif defined(RT_OS_WINDOWS)
55#else
56# error "Not ported"
57#endif
58
59#if defined(VBOX_WITH_WIN_PARPORT_SUP) && defined(IN_RING0)
60# include <iprt/asm-amd64-x86.h>
61#endif
62
63#if defined(VBOX_WITH_WIN_PARPORT_SUP) && defined(IN_RING3)
64# include <Windows.h>
65# include <setupapi.h>
66# include <cfgmgr32.h>
67# include <iprt/mem.h>
68# include <iprt/string.h>
69#endif
70
71#include "VBoxDD.h"
72
73
74/*******************************************************************************
75* Structures and Typedefs *
76*******************************************************************************/
77/**
78 * Host parallel port driver instance data.
79 * @implements PDMIHOSTPARALLELCONNECTOR
80 */
81typedef struct DRVHOSTPARALLEL
82{
83 /** Pointer to the driver instance structure. */
84 PPDMDRVINS pDrvIns;
85 /** Pointer to the driver instance. */
86 PPDMDRVINSR3 pDrvInsR3;
87 PPDMDRVINSR0 pDrvInsR0;
88 /** Pointer to the char port interface of the driver/device above us. */
89 PPDMIHOSTPARALLELPORT pDrvHostParallelPort;
90 /** Our host device interface. */
91 PDMIHOSTPARALLELCONNECTOR IHostParallelConnector;
92 /** Our host device interface. */
93 PDMIHOSTPARALLELCONNECTOR IHostParallelConnectorR3;
94 /** Device Path */
95 char *pszDevicePath;
96 /** Device Handle */
97 RTFILE hFileDevice;
98#ifndef VBOX_WITH_WIN_PARPORT_SUP
99 /** Thread waiting for interrupts. */
100 PPDMTHREAD pMonitorThread;
101 /** Wakeup pipe read end. */
102 RTPIPE hWakeupPipeR;
103 /** Wakeup pipe write end. */
104 RTPIPE hWakeupPipeW;
105 /** Current mode the parallel port is in. */
106 PDMPARALLELPORTMODE enmModeCur;
107#endif
108
109#ifdef VBOX_WITH_WIN_PARPORT_SUP
110 /** Data register. */
111 uint32_t u32LptAddr;
112 /** Status register. */
113 uint32_t u32LptAddrStatus;
114 /** Control register. */
115 uint32_t u32LptAddrControl;
116 /** Data read buffer. */
117 uint8_t u8ReadIn;
118 /** Control read buffer. */
119 uint8_t u8ReadInControl;
120 /** Status read buffer. */
121 uint8_t u8ReadInStatus;
122 /** Parallel port name */
123 char szParportName[6];
124 /** Whether the parallel port is available or not. */
125 bool fParportAvail;
126 /** Device Handle */
127 RTFILE hWinFileDevice;
128#endif /* VBOX_WITH_WIN_PARPORT_SUP */
129} DRVHOSTPARALLEL, *PDRVHOSTPARALLEL;
130
131
132/**
133 * Ring-0 operations.
134 */
135typedef enum DRVHOSTPARALLELR0OP
136{
137 /** Invalid zero value. */
138 DRVHOSTPARALLELR0OP_INVALID = 0,
139 /** Perform R0 initialization. */
140 DRVHOSTPARALLELR0OP_INITR0STUFF,
141 /** Read data. */
142 DRVHOSTPARALLELR0OP_READ,
143 /** Read status register. */
144 DRVHOSTPARALLELR0OP_READSTATUS,
145 /** Read control register. */
146 DRVHOSTPARALLELR0OP_READCONTROL,
147 /** Write data. */
148 DRVHOSTPARALLELR0OP_WRITE,
149 /** Write control register. */
150 DRVHOSTPARALLELR0OP_WRITECONTROL,
151 /** Set port direction. */
152 DRVHOSTPARALLELR0OP_SETPORTDIRECTION
153} DRVHOSTPARALLELR0OP;
154
155/** Converts a pointer to DRVHOSTPARALLEL::IHostDeviceConnector to a PDRHOSTPARALLEL. */
156#define PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector))) )
157
158
159/*******************************************************************************
160* Defined Constants And Macros *
161*******************************************************************************/
162#define CTRL_REG_OFFSET 2
163#define STATUS_REG_OFFSET 1
164#define LPT_CONTROL_ENABLE_BIDIRECT 0x20
165
166
167
168#ifdef VBOX_WITH_WIN_PARPORT_SUP
169# ifdef IN_RING0
170
171/**
172 * R0 mode function to write byte value to data port.
173 * @returns VBox status code.
174 * @param pDrvIns Driver instance.
175 * @param u64Arg Data to be written to data register.
176 *
177 */
178static int drvR0HostParallelReqWrite(PPDMDRVINS pDrvIns, uint64_t u64Arg)
179{
180 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
181 LogFlowFunc(("write to data port=%#x val=%#x\n", pThis->u32LptAddr, u64Arg));
182 ASMOutU8(pThis->u32LptAddr, (uint8_t)(u64Arg));
183 return VINF_SUCCESS;
184}
185
186/**
187 * R0 mode function to write byte value to parallel port control
188 * register.
189 * @returns VBox status code.
190 * @param pDrvIns Driver instance.
191 * @param u64Arg Data to be written to control register.
192 */
193static int drvR0HostParallelReqWriteControl(PPDMDRVINS pDrvIns, uint64_t u64Arg)
194{
195 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
196 LogFlowFunc(("write to ctrl port=%#x val=%#x\n", pThis->u32LptAddrControl, u64Arg));
197 ASMOutU8(pThis->u32LptAddrControl, (uint8_t)(u64Arg));
198 return VINF_SUCCESS;
199}
200
201/**
202 * R0 mode function to ready byte value from the parallel port
203 * data register
204 * @returns VBox status code.
205 * @param pDrvIns Driver instance.
206 * @param u64Arg Not used.
207 */
208static int drvR0HostParallelReqRead(PPDMDRVINS pDrvIns, uint64_t u64Arg)
209{
210 uint8_t u8Data;
211 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
212 u8Data = ASMInU8(pThis->u32LptAddr);
213 LogFlowFunc(("read from data port=%#x val=%#x\n", pThis->u32LptAddr, u8Data));
214 pThis->u8ReadIn = u8Data;
215 return VINF_SUCCESS;
216}
217
218/**
219 * R0 mode function to ready byte value from the parallel port
220 * control register.
221 * @returns VBox status code.
222 * @param pDrvIns Driver instance.
223 * @param u64Arg Not used.
224 */
225static int drvR0HostParallelReqReadControl(PPDMDRVINS pDrvIns, uint64_t u64Arg)
226{
227 uint8_t u8Data;
228 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
229 u8Data = ASMInU8(pThis->u32LptAddrControl);
230 LogFlowFunc(("read from ctrl port=%#x val=%#x\n", pThis->u32LptAddr, u8Data));
231 pThis->u8ReadInControl = u8Data;
232 return VINF_SUCCESS;
233}
234
235/**
236 * R0 mode function to ready byte value from the parallel port
237 * status register.
238 * @returns VBox status code.
239 * @param pDrvIns Driver instance.
240 * @param u64Arg Not used.
241 */
242static int drvR0HostParallelReqReadStatus(PPDMDRVINS pDrvIns, uint64_t u64Arg)
243{
244 uint8_t u8Data;
245 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
246 u8Data = ASMInU8(pThis->u32LptAddrStatus);
247 LogFlowFunc(("read from status port=%#x val=%#x\n", pThis->u32LptAddr, u8Data));
248 pThis->u8ReadInStatus = u8Data;
249 return VINF_SUCCESS;
250}
251
252/**
253 * R0 mode function to set the direction of parallel port -
254 * operate in bidirectional mode or single direction.
255 * @returns VBox status code.
256 * @param pDrvIns Driver instance.
257 * @param u64Arg Mode.
258 */
259static int drvR0HostParallelReqSetPortDir(PPDMDRVINS pDrvIns, uint64_t u64Arg)
260{
261 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
262 uint8_t u8ReadControlVal;
263 uint8_t u8WriteControlVal;
264
265 if (u64Arg)
266 {
267 u8ReadControlVal = ASMInU8(pThis->u32LptAddrControl);
268 u8WriteControlVal = u8ReadControlVal | LPT_CONTROL_ENABLE_BIDIRECT; /* enable input direction */
269 ASMOutU8(pThis->u32LptAddrControl, u8WriteControlVal);
270 }
271 else
272 {
273 u8ReadControlVal = ASMInU8(pThis->u32LptAddrControl);
274 u8WriteControlVal = u8ReadControlVal & ~LPT_CONTROL_ENABLE_BIDIRECT; /* disable input direction */
275 ASMOutU8(pThis->u32LptAddrControl, u8WriteControlVal);
276 }
277 return VINF_SUCCESS;
278}
279
280/**
281 * @interface_method_impl{FNPDMDRVREQHANDLERR0}
282 */
283PDMBOTHCBDECL(int) drvR0HostParallelReqHandler(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
284{
285 int rc;
286
287 LogFlowFuncEnter();
288 /* I have included break after each case. Need to work on this. */
289 switch ((DRVHOSTPARALLELR0OP)uOperation)
290 {
291 case DRVHOSTPARALLELR0OP_READ:
292 rc = drvR0HostParallelReqRead(pDrvIns, u64Arg);
293 break;
294 case DRVHOSTPARALLELR0OP_READSTATUS:
295 rc = drvR0HostParallelReqReadStatus(pDrvIns, u64Arg);
296 break;
297 case DRVHOSTPARALLELR0OP_READCONTROL:
298 rc = drvR0HostParallelReqReadControl(pDrvIns, u64Arg);
299 break;
300 case DRVHOSTPARALLELR0OP_WRITE:
301 rc = drvR0HostParallelReqWrite(pDrvIns, u64Arg);
302 break;
303 case DRVHOSTPARALLELR0OP_WRITECONTROL:
304 rc = drvR0HostParallelReqWriteControl(pDrvIns, u64Arg);
305 break;
306 case DRVHOSTPARALLELR0OP_SETPORTDIRECTION:
307 rc = drvR0HostParallelReqSetPortDir(pDrvIns, u64Arg);
308 break;
309 default: /* not supported */
310 rc = VERR_NOT_SUPPORTED;
311 }
312 LogFlowFuncLeave();
313 return rc;
314}
315
316# endif /* IN_RING0 */
317#endif /* VBOX_WITH_WIN_PARPORT_SUP */
318
319#ifdef IN_RING3
320# ifdef VBOX_WITH_WIN_PARPORT_SUP
321
322/**
323 * Find IO port range for the parallel port and return the lower address.
324 *
325 * @returns parallel port IO address.
326 * @param DevInst Device Instance for parallel port.
327 */
328static uint32_t drvHostWinFindIORangeResource(const DEVINST DevInst)
329{
330 uint8_t *pBuf = NULL;
331 short wHeaderSize;
332 uint32_t u32Size;
333 CONFIGRET cmRet;
334 LOG_CONF firstLogConf;
335 LOG_CONF nextLogConf;
336 RES_DES rdPrevResDes;
337 uint32_t u32ParportAddr;
338
339 wHeaderSize = sizeof(IO_DES);
340 cmRet = CM_Get_First_Log_Conf(&firstLogConf, DevInst, ALLOC_LOG_CONF);
341 if (cmRet != CR_SUCCESS)
342 {
343 cmRet = CM_Get_First_Log_Conf(&firstLogConf, DevInst, BOOT_LOG_CONF);
344 if (cmRet != CR_SUCCESS)
345 return 0;
346 }
347 cmRet = CM_Get_Next_Res_Des(&nextLogConf, firstLogConf, 2, 0L, 0L);
348 if (cmRet != CR_SUCCESS)
349 {
350 CM_Free_Res_Des_Handle(firstLogConf);
351 return 0;
352 }
353
354 for (;;)
355 {
356 u32Size = 0;
357 if ((cmRet = CM_Get_Res_Des_Data_Size((PULONG)(&u32Size), nextLogConf, 0L)) != CR_SUCCESS
358 && !(pBuf = (uint8_t *)RTMemAlloc(u32Size + 1))
359 && (cmRet = CM_Get_Res_Des_Data(nextLogConf, pBuf, u32Size, 0L)) != CR_SUCCESS
360 )
361 {
362 CM_Free_Res_Des_Handle(nextLogConf);
363 if (pBuf)
364 RTMemFree(pBuf);
365 break;
366
367 }
368 LogFlowFunc(("call GetIOResource\n"));
369 u32ParportAddr = ((IO_DES *)pBuf)->IOD_Alloc_Base;
370 LogFlowFunc(("called GetIOResource, ret=%#x\n", u32ParportAddr));
371 rdPrevResDes = 0;
372 cmRet = CM_Get_Next_Res_Des(&rdPrevResDes,
373 nextLogConf,
374 2,
375 0L,
376 0L);
377 RTMemFree(pBuf);
378 if (cmRet != CR_SUCCESS)
379 break;
380
381 CM_Free_Res_Des_Handle(nextLogConf);
382 nextLogConf = rdPrevResDes;
383 }
384 CM_Free_Res_Des_Handle(nextLogConf);
385 LogFlowFunc(("return u32ParportAddr=%#x", u32ParportAddr));
386 return u32ParportAddr;
387}
388
389/**
390 * Get Parallel port address and update the shared data
391 * structure.
392 * @returns VBox status code.
393 * @param pThis The host parallel port instance data.
394 */
395static int drvWinHostGetparportAddr(PDRVHOSTPARALLEL pThis)
396{
397 HDEVINFO hDevInfo;
398 SP_DEVINFO_DATA DeviceInfoData;
399 uint32_t u32Idx;
400 uint32_t u32ParportAddr;
401 int rc = VINF_SUCCESS;
402
403 hDevInfo = SetupDiGetClassDevs(NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES);
404 if (hDevInfo == INVALID_HANDLE_VALUE)
405 {
406 LogFlowFunc(("Invalid Handle \n"));
407 return VERR_INVALID_HANDLE;
408 }
409
410 /* Enumerate through all devices in Set. */
411 DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
412 for (u32Idx = 0; SetupDiEnumDeviceInfo(hDevInfo, u32Idx, &DeviceInfoData); u32Idx++)
413 {
414 DWORD dwDataType;
415 uint8_t *pBuf = NULL;
416 DWORD dwBufSize = 0;
417
418 while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME,
419 (PDWORD)&dwDataType, (uint8_t *)pBuf,
420 dwBufSize, (PDWORD)&dwBufSize))
421 {
422 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
423 {
424 LogFlow(("ERROR_INSUFF_BUFF = %d. dwBufSz = %d\n", GetLastError(), dwBufSize));
425 if (pBuf)
426 RTMemFree(pBuf);
427 /* Max size will never be more than 2048 bytes */
428 if (dwBufSize > 1024 || dwBufSize < 0)
429 dwBufSize = 1024;
430 pBuf = (uint8_t *)RTMemAlloc(dwBufSize * 2);
431 }
432 else
433 {
434 LogFlow(("GetDevProp Error = %d & dwBufSz = %d\n", GetLastError(), dwBufSize));
435 break;
436 }
437 }
438 if(!pBuf)
439 {
440 LogFlowFunc(("No Memory to save ParportString\n"));
441 /* Trying once more with fixed length, assuming friendly name
442 * will not be bigger than 2048
443 */
444 pBuf = (uint8_t *)RTMemAlloc(2048);
445 if (!pBuf)
446 {
447 LogFlowFunc(("Fixed allocation failed\n"));
448 return VERR_NO_MEMORY;
449 }
450 if (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME,
451 (PDWORD)&dwDataType, (uint8_t *)pBuf,
452 2048, NULL))
453 {
454 LogFlowFunc(("GetDevProp failed with ERR = %d\n", GetLastError()));
455 return VERR_GENERAL_FAILURE;
456
457 }
458 }
459 if (RTStrStr((char*)pBuf, "LPT"))
460 {
461 u32ParportAddr = drvHostWinFindIORangeResource(DeviceInfoData.DevInst);
462 if (u32ParportAddr)
463 {
464 /* Find parallel port name and update the shared data struncture */
465 char *pCh = RTStrStr((char*)pBuf, "(");
466 char *pTmpCh = RTStrStr((char *)pBuf, ")");
467 /* check for the confirmation for the availability of parallel port */
468 if (!(pCh && pTmpCh))
469 {
470 LogFlowFunc(("Parallel port Not Found. \n"));
471 return VERR_NOT_FOUND;
472
473 }
474 if (((pTmpCh - (char *)pBuf) - (pCh - (char *)pBuf)) < 0) {
475 LogFlowFunc(("Parallel port string not properly formatted.\n"));
476 return VERR_NOT_FOUND;
477 }
478 /* check for the confirmation for the availability of parallel port */
479 if (RTStrCopyEx((char *)(pThis->szParportName), sizeof(pThis->szParportName),
480 pCh+1, ((pTmpCh - (char *)pBuf) - (pCh - (char *)pBuf)) - 1))
481 {
482 LogFlowFunc(("Parallel Port Not Found.\n"));
483 return VERR_NOT_FOUND;
484 }
485 *((char *)pThis->szParportName + (pTmpCh - (char *)pBuf) - (pCh - (char *)pBuf) + 1 ) = '\0';
486
487 /* checking again to make sure that we have got a valid name and in valid format too. */
488 if (RTStrNCmp((char *)pThis->szParportName, "LPT", 3)) {
489 LogFlowFunc(("Parallel Port name \"LPT\" Not Found.\n"));
490 return VERR_NOT_FOUND;
491 }
492 if (!RTStrStr((char *)pThis->szParportName, "LPT")
493 || !(pThis->szParportName[3] >= '0'
494 && pThis->szParportName[3] <= '9'))
495 {
496 RT_BZERO(pThis->szParportName, sizeof(pThis->szParportName));
497 LogFlowFunc(("Printer Port Name Not Found.\n"));
498 return VERR_NOT_FOUND;
499 }
500 pThis->fParportAvail = true;
501 pThis->u32LptAddr = u32ParportAddr;
502 pThis->u32LptAddrControl = pThis->u32LptAddr + CTRL_REG_OFFSET;
503 pThis->u32LptAddrStatus = pThis->u32LptAddr + STATUS_REG_OFFSET;
504 }
505 else
506 LogFlowFunc(("u32Parport Addr No Available \n"));
507 if (pThis->fParportAvail)
508 {
509 LogFlow(("Parport found . Break from inner loop \n"));
510 break;
511 }
512 }
513 else
514 {
515 LogFlow(("LPT: Parallel Port not available \n"));
516 }
517 if (pBuf)
518 RTMemFree(pBuf);
519 if (pThis->fParportAvail)
520 {
521 LogFlow(("Parport Available. Break from outer loop \n"));
522 /* Parallel port address has been found. No need to iterate further. */
523 break;
524 }
525 }
526
527 if (GetLastError() != NO_ERROR && GetLastError() != ERROR_NO_MORE_ITEMS)
528 rc = VERR_GENERAL_FAILURE;
529
530 SetupDiDestroyDeviceInfoList(hDevInfo);
531 return rc;
532
533}
534# endif /* VBOX_WITH_WIN_PARPORT_SUP */
535
536/**
537 * Changes the current mode of the host parallel port.
538 *
539 * @returns VBox status code.
540 * @param pThis The host parallel port instance data.
541 * @param enmMode The mode to change the port to.
542 */
543static int drvHostParallelSetMode(PDRVHOSTPARALLEL pThis, PDMPARALLELPORTMODE enmMode)
544{
545 int iMode = 0;
546 int rc = VINF_SUCCESS;
547 LogFlowFunc(("mode=%d\n", enmMode));
548
549# ifndef VBOX_WITH_WIN_PARPORT_SUP
550 int rcLnx;
551 if (pThis->enmModeCur != enmMode)
552 {
553 switch (enmMode)
554 {
555 case PDM_PARALLEL_PORT_MODE_SPP:
556 iMode = IEEE1284_MODE_COMPAT;
557 break;
558 case PDM_PARALLEL_PORT_MODE_EPP_DATA:
559 iMode = IEEE1284_MODE_EPP | IEEE1284_DATA;
560 break;
561 case PDM_PARALLEL_PORT_MODE_EPP_ADDR:
562 iMode = IEEE1284_MODE_EPP | IEEE1284_ADDR;
563 break;
564 case PDM_PARALLEL_PORT_MODE_ECP:
565 case PDM_PARALLEL_PORT_MODE_INVALID:
566 default:
567 return VERR_NOT_SUPPORTED;
568 }
569
570 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPSETMODE, &iMode);
571 if (RT_UNLIKELY(rcLnx < 0))
572 rc = RTErrConvertFromErrno(errno);
573 else
574 pThis->enmModeCur = enmMode;
575 }
576
577 return rc;
578# else /* VBOX_WITH_WIN_PARPORT_SUP */
579 return VINF_SUCCESS;
580# endif /* VBOX_WITH_WIN_PARPORT_SUP */
581}
582
583/* -=-=-=-=- IBase -=-=-=-=- */
584
585/**
586 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
587 */
588static DECLCALLBACK(void *) drvHostParallelQueryInterface(PPDMIBASE pInterface, const char *pszIID)
589{
590 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
591 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
592
593 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
594 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTPARALLELCONNECTOR, &pThis->CTX_SUFF(IHostParallelConnector));
595 return NULL;
596}
597
598
599/* -=-=-=-=- IHostDeviceConnector -=-=-=-=- */
600
601/** @copydoc PDMICHARCONNECTOR::pfnWrite */
602static DECLCALLBACK(int) drvHostParallelWrite(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t cbWrite, PDMPARALLELPORTMODE enmMode)
603{
604 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
605 //PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
606 PDRVHOSTPARALLEL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
607 int rc = VINF_SUCCESS;
608 int rcLnx = 0;
609
610 LogFlowFunc(("pvBuf=%#p cbWrite=%d\n", pvBuf, cbWrite));
611
612 rc = drvHostParallelSetMode(pThis, enmMode);
613 if (RT_FAILURE(rc))
614 return rc;
615# ifndef VBOX_WITH_WIN_PARPORT_SUP
616 if (enmMode == PDM_PARALLEL_PORT_MODE_SPP)
617 {
618 /* Set the data lines directly. */
619 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPWDATA, pvBuf);
620 }
621 else
622 {
623 /* Use write interface. */
624 rcLnx = write(RTFileToNative(pThis->hFileDevice), pvBuf, cbWrite);
625 }
626 if (RT_UNLIKELY(rcLnx < 0))
627 rc = RTErrConvertFromErrno(errno);
628# else /* VBOX_WITH_WIN_PARPORT_SUP */
629 if (!pThis->fParportAvail)
630 LogFlowFunc(("Parport Not Available\n"));
631 //if (pThis->fParportAvail)
632 {
633 for (size_t i = 0; i < cbWrite; i++)
634 {
635 uint64_t u64Data = (uint8_t) *((uint8_t *)(pvBuf) + i);
636 LogFlowFunc(("calling R0 to write to parallel port, data=%#x\n", u64Data));
637 rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_WRITE, u64Data);
638 AssertRC(rc);
639 }
640 }
641# endif /* VBOX_WITH_WIN_PARPORT_SUP */
642 return rc;
643}
644
645/**
646 * @interface_method_impl{PDMIBASE,pfnRead}
647 */
648static DECLCALLBACK(int) drvHostParallelRead(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t cbRead, PDMPARALLELPORTMODE enmMode)
649{
650 PDRVHOSTPARALLEL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
651 int rc = VINF_SUCCESS;
652
653# ifndef VBOX_WITH_WIN_PARPORT_SUP
654 int rcLnx = 0;
655 LogFlowFunc(("pvBuf=%#p cbRead=%d\n", pvBuf, cbRead));
656
657 rc = drvHostParallelSetMode(pThis, enmMode);
658 if (RT_FAILURE(rc))
659 return rc;
660
661 if (enmMode == PDM_PARALLEL_PORT_MODE_SPP)
662 {
663 /* Set the data lines directly. */
664 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPWDATA, pvBuf);
665 }
666 else
667 {
668 /* Use write interface. */
669 rcLnx = read(RTFileToNative(pThis->hFileDevice), pvBuf, cbRead);
670 }
671 if (RT_UNLIKELY(rcLnx < 0))
672 rc = RTErrConvertFromErrno(errno);
673# else /* VBOX_WITH_WIN_PARPORT_SUP */
674 if (!pThis->fParportAvail)
675 LogFlowFunc(("Parport Not Available\n"));
676 //if (pThis->fParportAvail)
677 {
678 *((uint8_t*)(pvBuf)) = 0; /* Initialize the buffer. */
679 for (size_t i = 0; i < cbRead; i++)
680 {
681 LogFlowFunc(("calling R0 to read from parallel port\n"));
682 int rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_READ, 0);
683 AssertRC(rc);
684 *((uint8_t *)pvBuf + i) = (uint8_t)pThis->u8ReadIn;
685 }
686 }
687# endif /* VBOX_WITH_WIN_PARPORT_SUP */
688 return rc;
689}
690
691static DECLCALLBACK(int) drvHostParallelSetPortDirection(PPDMIHOSTPARALLELCONNECTOR pInterface, bool fForward)
692{
693 PDRVHOSTPARALLEL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
694 int rc = VINF_SUCCESS;
695 int iMode = 0;
696 if (!fForward)
697 iMode = 1;
698# ifndef VBOX_WITH_WIN_PARPORT_SUP
699 int rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPDATADIR, &iMode);
700 if (RT_UNLIKELY(rcLnx < 0))
701 rc = RTErrConvertFromErrno(errno);
702
703# else /* VBOX_WITH_WIN_PARPORT_SUP */
704 uint64_t u64Data;
705 u64Data = (uint8_t)iMode;
706 if (!pThis->fParportAvail)
707 LogFlowFunc(("Parport Not available\n"));
708 //if (pThis->fParportAvail)
709 {
710 LogFlowFunc(("calling R0 to SetPortDirection, data=%#x\n", u64Data));
711 rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_SETPORTDIRECTION, u64Data);
712 AssertRC(rc);
713 }
714# endif /* VBOX_WITH_WIN_PARPORT_SUP */
715 return rc;
716}
717
718/**
719 * @interface_method_impl{PDMIBASE,pfnWriteControl}
720 */
721static DECLCALLBACK(int) drvHostParallelWriteControl(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg)
722{
723 PDRVHOSTPARALLEL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
724 int rc = VINF_SUCCESS;
725 int rcLnx = 0;
726
727 LogFlowFunc(("fReg=%#x\n", fReg));
728# ifndef VBOX_WITH_WIN_PARPORT_SUP
729 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPWCONTROL, &fReg);
730 if (RT_UNLIKELY(rcLnx < 0))
731 rc = RTErrConvertFromErrno(errno);
732# else /* VBOX_WITH_WIN_PARPORT_SUP */
733 uint64_t u64Data;
734 u64Data = (uint8_t)fReg;
735 if (!pThis->fParportAvail)
736 LogFlowFunc(("Parport Not Available\n"));
737 //if (pThis->fParportAvail)
738 {
739 LogFlowFunc(("calling R0 to write CTRL, data=%#x\n", u64Data));
740 rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_WRITECONTROL, u64Data);
741 AssertRC(rc);
742 }
743# endif /* VBOX_WITH_WIN_PARPORT_SUP */
744 return rc;
745}
746
747
748/**
749 * @interface_method_impl{PDMIBASE,pfnReadControl}
750 */
751static DECLCALLBACK(int) drvHostParallelReadControl(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg)
752{
753 PDRVHOSTPARALLEL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
754 int rc = VINF_SUCCESS;
755 int rcLnx = 0;
756 uint8_t fReg = 0;
757
758# ifndef VBOX_WITH_WIN_PARPORT_SUP
759 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPRCONTROL, &fReg);
760 if (RT_UNLIKELY(rcLnx < 0))
761 rc = RTErrConvertFromErrno(errno);
762 else
763 {
764 LogFlowFunc(("fReg=%#x\n", fReg));
765 *pfReg = fReg;
766 }
767# else /* VBOX_WITH_WIN_PARPORT_SUP */
768 *pfReg = 0; /* Initialize the buffer*/
769 if (!pThis->fParportAvail)
770 LogFlowFunc(("Parport Not Available\n"));
771 //if (pThis->fParportAvail)
772 {
773 LogFlowFunc(("calling R0 to read control from parallel port\n"));
774 rc = PDMDrvHlpCallR0(pThis-> CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_READCONTROL, 0);
775 AssertRC(rc);
776 *pfReg = pThis->u8ReadInControl;
777 }
778# endif /* VBOX_WITH_WIN_PARPORT_SUP */
779 return rc;
780}
781
782/**
783 * @interface_method_impl{PDMIBASE,pfnReadStatus}
784 */
785static DECLCALLBACK(int) drvHostParallelReadStatus(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg)
786{
787 PDRVHOSTPARALLEL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
788 int rc = VINF_SUCCESS;
789 int rcLnx = 0;
790 uint8_t fReg = 0;
791 LogFlowFunc(("%d Status Reg\n", *pfReg));
792# ifndef VBOX_WITH_WIN_PARPORT_SUP
793 rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPRSTATUS, &fReg);
794 if (RT_UNLIKELY(rcLnx < 0))
795 rc = RTErrConvertFromErrno(errno);
796 else
797 {
798 LogFlowFunc(("fReg=%#x\n", fReg));
799 *pfReg = fReg;
800 }
801# else /* VBOX_WITH_WIN_PARPORT_SUP */
802 *pfReg = 0; /* Intialize the buffer. */
803 if (!pThis->fParportAvail)
804 LogFlowFunc(("fParport Not Available.. Error!!!!!!!!!! \n"));
805 //if (pThis->fParportAvail)
806 {
807 LogFlowFunc(("calling R0 to read status from parallel port. fParport should be available\n"));
808 rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_READSTATUS, 0);
809 AssertRC(rc);
810 LogFlow(("value read from status = %d\n", *pfReg));
811 *pfReg = pThis->u8ReadInStatus;
812 }
813
814# endif /* VBOX_WITH_WIN_PARPORT_SUP */
815 return rc;
816}
817
818# ifndef VBOX_WITH_WIN_PARPORT_SUP
819
820static DECLCALLBACK(int) drvHostParallelMonitorThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
821{
822 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
823 struct pollfd aFDs[2];
824
825 /*
826 * We can wait for interrupts using poll on linux hosts.
827 */
828 while (pThread->enmState == PDMTHREADSTATE_RUNNING)
829 {
830 int rc;
831
832 aFDs[0].fd = RTFileToNative(pThis->hFileDevice);
833 aFDs[0].events = POLLIN;
834 aFDs[0].revents = 0;
835 aFDs[1].fd = RTPipeToNative(pThis->hWakeupPipeR);
836 aFDs[1].events = POLLIN | POLLERR | POLLHUP;
837 aFDs[1].revents = 0;
838 rc = poll(aFDs, RT_ELEMENTS(aFDs), -1);
839 if (rc < 0)
840 {
841 AssertMsgFailed(("poll failed with rc=%d\n", RTErrConvertFromErrno(errno)));
842 return RTErrConvertFromErrno(errno);
843 }
844
845 if (pThread->enmState != PDMTHREADSTATE_RUNNING)
846 break;
847 if (rc > 0 && aFDs[1].revents)
848 {
849 if (aFDs[1].revents & (POLLHUP | POLLERR | POLLNVAL))
850 break;
851 /* notification to terminate -- drain the pipe */
852 char ch;
853 size_t cbRead;
854 RTPipeRead(pThis->hWakeupPipeR, &ch, 1, &cbRead);
855 continue;
856 }
857
858 /* Interrupt occurred. */
859 rc = pThis->pDrvHostParallelPort->pfnNotifyInterrupt(pThis->pDrvHostParallelPort);
860 AssertRC(rc);
861 }
862
863 return VINF_SUCCESS;
864}
865
866/**
867 * Unblock the monitor thread so it can respond to a state change.
868 *
869 * @returns a VBox status code.
870 * @param pDrvIns The driver instance.
871 * @param pThread The send thread.
872 */
873static DECLCALLBACK(int) drvHostParallelWakeupMonitorThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
874{
875 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
876 size_t cbIgnored;
877 return RTPipeWrite(pThis->hWakeupPipeW, "", 1, &cbIgnored);
878}
879
880# endif /* VBOX_WITH_WIN_PARPORT_SUP */
881
882/**
883 * Destruct a host parallel driver instance.
884 *
885 * Most VM resources are freed by the VM. This callback is provided so that
886 * any non-VM resources can be freed correctly.
887 *
888 * @param pDrvIns The driver instance data.
889 */
890static DECLCALLBACK(void) drvHostParallelDestruct(PPDMDRVINS pDrvIns)
891{
892 int rc;
893 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
894 LogFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
895 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
896
897#ifndef VBOX_WITH_WIN_PARPORT_SUP
898 if (pThis->hFileDevice != NIL_RTFILE)
899 ioctl(RTFileToNative(pThis->hFileDevice), PPRELEASE);
900
901 rc = RTPipeClose(pThis->hWakeupPipeW); AssertRC(rc);
902 pThis->hWakeupPipeW = NIL_RTPIPE;
903
904 rc = RTPipeClose(pThis->hWakeupPipeR); AssertRC(rc);
905 pThis->hWakeupPipeR = NIL_RTPIPE;
906
907 rc = RTFileClose(pThis->hFileDevice); AssertRC(rc);
908 pThis->hFileDevice = NIL_RTFILE;
909
910 if (pThis->pszDevicePath)
911 {
912 MMR3HeapFree(pThis->pszDevicePath);
913 pThis->pszDevicePath = NULL;
914 }
915#else /* VBOX_WITH_WIN_PARPORT_SUP */
916 if (pThis->hWinFileDevice != NIL_RTFILE)
917 rc = RTFileClose(pThis->hWinFileDevice); AssertRC(rc);
918#endif /* VBOX_WITH_WIN_PARPORT_SUP */
919}
920
921/**
922 * Construct a host parallel driver instance.
923 *
924 * @copydoc FNPDMDRVCONSTRUCT
925 */
926static DECLCALLBACK(int) drvHostParallelConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
927{
928 PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
929 LogFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
930
931 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
932
933 /*
934 * Init basic data members and interfaces.
935 *
936 * Must be done before returning any failure because we've got a destructor.
937 */
938 pThis->hFileDevice = NIL_RTFILE;
939#ifndef VBOX_WITH_WIN_PARPORT_SUP
940 pThis->hWakeupPipeR = NIL_RTPIPE;
941 pThis->hWakeupPipeW = NIL_RTPIPE;
942#else /* VBOX_WITH_WIN_PARPORT_SUP */
943 pThis->hWinFileDevice = NIL_RTFILE;
944#endif
945
946 pThis->pDrvInsR3 = pDrvIns;
947#ifdef VBOX_WITH_DRVINTNET_IN_R0
948 pThis->pDrvInsR0 = PDMDRVINS_2_R0PTR(pDrvIns);
949#endif
950
951 /* IBase. */
952 pDrvIns->IBase.pfnQueryInterface = drvHostParallelQueryInterface;
953 /* IHostParallelConnector. */
954 pThis->IHostParallelConnectorR3.pfnWrite = drvHostParallelWrite;
955 pThis->IHostParallelConnectorR3.pfnRead = drvHostParallelRead;
956 pThis->IHostParallelConnectorR3.pfnSetPortDirection = drvHostParallelSetPortDirection;
957 pThis->IHostParallelConnectorR3.pfnWriteControl = drvHostParallelWriteControl;
958 pThis->IHostParallelConnectorR3.pfnReadControl = drvHostParallelReadControl;
959 pThis->IHostParallelConnectorR3.pfnReadStatus = drvHostParallelReadStatus;
960
961 /*
962 * Validate the config.
963 */
964 if (!CFGMR3AreValuesValid(pCfg, "DevicePath\0"))
965 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
966 N_("Unknown host parallel configuration option, only supports DevicePath"));
967
968 /*
969 * Query configuration.
970 */
971 /* Device */
972 int rc = CFGMR3QueryStringAlloc(pCfg, "DevicePath", &pThis->pszDevicePath);
973 if (RT_FAILURE(rc))
974 {
975 AssertMsgFailed(("Configuration error: query for \"DevicePath\" string returned %Rra.\n", rc));
976 return rc;
977 }
978
979 /*
980 * Open the device
981 */
982 rc = RTFileOpen(&pThis->hFileDevice, pThis->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
983 if (RT_FAILURE(rc))
984 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Parallel#%d could not open '%s'"),
985 pDrvIns->iInstance, pThis->pszDevicePath);
986
987#ifndef VBOX_WITH_WIN_PARPORT_SUP
988 /*
989 * Try to get exclusive access to parallel port
990 */
991 rc = ioctl(RTFileToNative(pThis->hFileDevice), PPEXCL);
992 if (rc < 0)
993 return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
994 N_("Parallel#%d could not get exclusive access for parallel port '%s'"
995 "Be sure that no other process or driver accesses this port"),
996 pDrvIns->iInstance, pThis->pszDevicePath);
997
998 /*
999 * Claim the parallel port
1000 */
1001 rc = ioctl(RTFileToNative(pThis->hFileDevice), PPCLAIM);
1002 if (rc < 0)
1003 return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
1004 N_("Parallel#%d could not claim parallel port '%s'"
1005 "Be sure that no other process or driver accesses this port"),
1006 pDrvIns->iInstance, pThis->pszDevicePath);
1007
1008 /*
1009 * Get the IHostParallelPort interface of the above driver/device.
1010 */
1011 pThis->pDrvHostParallelPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIHOSTPARALLELPORT);
1012 if (!pThis->pDrvHostParallelPort)
1013 return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, RT_SRC_POS, N_("Parallel#%d has no parallel port interface above"),
1014 pDrvIns->iInstance);
1015
1016 /*
1017 * Create wakeup pipe.
1018 */
1019 rc = RTPipeCreate(&pThis->hWakeupPipeR, &pThis->hWakeupPipeW, 0 /*fFlags*/);
1020 AssertRCReturn(rc, rc);
1021
1022 /*
1023 * Start in SPP mode.
1024 */
1025 pThis->enmModeCur = PDM_PARALLEL_PORT_MODE_INVALID;
1026 rc = drvHostParallelSetMode(pThis, PDM_PARALLEL_PORT_MODE_SPP);
1027 if (RT_FAILURE(rc))
1028 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostParallel#%d cannot change mode of parallel mode to SPP"), pDrvIns->iInstance);
1029
1030 /*
1031 * Start waiting for interrupts.
1032 */
1033 rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0,
1034 RTTHREADTYPE_IO, "ParMon");
1035 if (RT_FAILURE(rc))
1036 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostParallel#%d cannot create monitor thread"), pDrvIns->iInstance);
1037
1038#else /* VBOX_WITH_WIN_PARPORT_SUP */
1039 HANDLE hPort;
1040 pThis->fParportAvail = false;
1041 pThis->u32LptAddr = 0;
1042 pThis->u32LptAddrControl = 0;
1043 pThis->u32LptAddrStatus = 0;
1044 rc = drvWinHostGetparportAddr(pThis);
1045
1046 /* If we have the char port availabe use it , else I am not getting exclusive access to parallel port.
1047 Read and write will be done only if addresses are available
1048 */
1049 if (pThis->szParportName)
1050 {
1051 rc = RTFileOpen(&pThis->hWinFileDevice, (char *)pThis->szParportName,
1052 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
1053 LogFlowFunc(("RTFileOpen Return = %d\n", rc));
1054 }
1055#endif
1056 return VINF_SUCCESS;
1057}
1058
1059
1060/**
1061 * Char driver registration record.
1062 */
1063const PDMDRVREG g_DrvHostParallel =
1064{
1065 /* u32Version */
1066 PDM_DRVREG_VERSION,
1067 /* szName */
1068 "HostParallel",
1069 /* szRCMod */
1070 "",
1071 /* szR0Mod */
1072 "VBoxDDR0.r0",
1073 /* pszDescription */
1074 "Parallel host driver.",
1075 /* fFlags */
1076# if defined(VBOX_WITH_WIN_PARPORT_SUP)
1077 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DRVREG_FLAGS_R0,
1078# else
1079 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
1080# endif
1081 /* fClass. */
1082 PDM_DRVREG_CLASS_CHAR,
1083 /* cMaxInstances */
1084 ~0U,
1085 /* cbInstance */
1086 sizeof(DRVHOSTPARALLEL),
1087 /* pfnConstruct */
1088 drvHostParallelConstruct,
1089 /* pfnDestruct */
1090 drvHostParallelDestruct,
1091 /* pfnRelocate */
1092 NULL,
1093 /* pfnIOCtl */
1094 NULL,
1095 /* pfnPowerOn */
1096 NULL,
1097 /* pfnReset */
1098 NULL,
1099 /* pfnSuspend */
1100 NULL,
1101 /* pfnResume */
1102 NULL,
1103 /* pfnAttach */
1104 NULL,
1105 /* pfnDetach */
1106 NULL,
1107 /* pfnPowerOff */
1108 NULL,
1109 /* pfnSoftReset */
1110 NULL,
1111 /* u32EndVersion */
1112 PDM_DRVREG_VERSION
1113};
1114#endif /*IN_RING3*/
1115
1116
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette