summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2005-05-08 23:07:51 +0000
committerwpaul <wpaul@FreeBSD.org>2005-05-08 23:07:51 +0000
commitebc77ad8939abbd4361290c615b7ad4b3c52fdfb (patch)
tree4e6bc7c75c9d9968ddf02e3220b8910641043fbb /sys/compat
parent072d05d6e995d5d2aece606732e0048517a31cd9 (diff)
downloadFreeBSD-src-ebc77ad8939abbd4361290c615b7ad4b3c52fdfb.zip
FreeBSD-src-ebc77ad8939abbd4361290c615b7ad4b3c52fdfb.tar.gz
Fix support for Windows drivers that support both PCI and PCMCIA devices at
the same time. Fix if_ndis_pccard.c so that it sets sc->ndis_dobj and sc->ndis_regvals. Correct IMPORT_SFUNC() macros for the READ_PORT_BUFFER_xxx() routines, which take 3 arguments, not 2. This fixes it so that the Windows driver for my Cisco Aironet 340 PCMCIA card works again. (Yes, I know the an(4) driver supports this card natively, but it's the only PCMCIA device I have with a Windows XP driver.)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ndis/kern_windrv.c11
-rw-r--r--sys/compat/ndis/subr_hal.c6
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/compat/ndis/kern_windrv.c b/sys/compat/ndis/kern_windrv.c
index 11a5824..afaf638 100644
--- a/sys/compat/ndis/kern_windrv.c
+++ b/sys/compat/ndis/kern_windrv.c
@@ -307,6 +307,8 @@ windrv_unload(mod, img, len)
return(0);
}
+#define WINDRV_LOADED htonl(0x42534F44)
+
/*
* Loader routine for actual Windows driver modules, ultimately
* calls the driver's DriverEntry() routine.
@@ -327,12 +329,17 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
struct drvdb_ent *new;
struct driver_object *drv;
int status;
+ uint32_t *ptr;
/*
* First step: try to relocate and dynalink the executable
* driver image.
*/
+ ptr = (uint32_t *)(img + 8);
+ if (*ptr == WINDRV_LOADED)
+ goto skipreloc;
+
/* Perform text relocation */
if (pe_relocate(img))
return(ENOEXEC);
@@ -357,6 +364,10 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
return(ENOEXEC);
}
+ *ptr = WINDRV_LOADED;
+
+skipreloc:
+
/* Next step: find the driver entry point. */
pe_get_optional_header(img, &opt_hdr);
diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c
index 96ecd37..c6508ed 100644
--- a/sys/compat/ndis/subr_hal.c
+++ b/sys/compat/ndis/subr_hal.c
@@ -394,9 +394,9 @@ image_patch_table hal_functbl[] = {
IMPORT_SFUNC(READ_PORT_ULONG, 1),
IMPORT_SFUNC(READ_PORT_USHORT, 1),
IMPORT_SFUNC(READ_PORT_UCHAR, 1),
- IMPORT_SFUNC(READ_PORT_BUFFER_ULONG, 2),
- IMPORT_SFUNC(READ_PORT_BUFFER_USHORT, 2),
- IMPORT_SFUNC(READ_PORT_BUFFER_UCHAR, 2),
+ IMPORT_SFUNC(READ_PORT_BUFFER_ULONG, 3),
+ IMPORT_SFUNC(READ_PORT_BUFFER_USHORT, 3),
+ IMPORT_SFUNC(READ_PORT_BUFFER_UCHAR, 3),
IMPORT_FFUNC(KfAcquireSpinLock, 1),
IMPORT_FFUNC(KfReleaseSpinLock, 1),
IMPORT_SFUNC(KeGetCurrentIrql, 0),
OpenPOWER on IntegriCloud