summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2004-01-03 09:20:48 +0000
committerwpaul <wpaul@FreeBSD.org>2004-01-03 09:20:48 +0000
commit50be20979b31ad104954608328dc1f1ebb65e4ff (patch)
treee7710fff0be7d66088edf26ae338d9efad40daae /sys
parent2d3799107ff75049bef788fec5215335f07adcc6 (diff)
downloadFreeBSD-src-50be20979b31ad104954608328dc1f1ebb65e4ff.zip
FreeBSD-src-50be20979b31ad104954608328dc1f1ebb65e4ff.tar.gz
subr_hal.c: implement WRITE_PORT_BUFFER_xxx() and READ_PORT_BUFFER_xxx()
subr_ndis.c: implement NdisDprAllocatePacket() and NdisDprFreePacket() (which are aliased to NdisAllocatePacket() and NdisFreePacket()), and bump the value we return in ndis_mapreg_cnt() to something ridiculously large, since some drivers apparently expect to be able to allocate way more than just 64. These changes allow the Level 1 1000baseSX driver to work for the following card: ndis0: <SMC TigerCard 1000 Adapter> port 0xe000-0xe0ff mem 0xda004000-0xda0043ff irq 10 at device 9.0 on pci0 ndis0: Ethernet address: 00:e0:29:6f:cc:04 This is already supported by the lge(4) driver, but I decided to take a try at making the Windows driver that came with it work too, since I still had the floppy diskette for it lying around.
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/ndis/subr_hal.c84
-rw-r--r--sys/compat/ndis/subr_ndis.c8
2 files changed, 91 insertions, 1 deletions
diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c
index 4c5313a..cc51c0a 100644
--- a/sys/compat/ndis/subr_hal.c
+++ b/sys/compat/ndis/subr_hal.c
@@ -59,12 +59,24 @@ __FBSDID("$FreeBSD$");
#define FUNC void(*)(void)
__stdcall static void hal_stall_exec_cpu(uint32_t);
+__stdcall static void hal_writeport_buf_ulong(uint32_t *,
+ uint32_t *, uint32_t);
+__stdcall static void hal_writeport_buf_ushort(uint16_t *,
+ uint16_t *, uint32_t);
+__stdcall static void hal_writeport_buf_uchar(uint8_t *,
+ uint8_t *, uint32_t);
__stdcall static void hal_writeport_ulong(uint32_t *, uint32_t);
__stdcall static void hal_writeport_ushort(uint16_t *, uint16_t);
__stdcall static void hal_writeport_uchar(uint8_t *, uint8_t);
__stdcall static uint32_t hal_readport_ulong(uint32_t *);
__stdcall static uint16_t hal_readport_ushort(uint16_t *);
__stdcall static uint8_t hal_readport_uchar(uint8_t *);
+__stdcall static void hal_readport_buf_ulong(uint32_t *,
+ uint32_t *, uint32_t);
+__stdcall static void hal_readport_buf_ushort(uint16_t *,
+ uint16_t *, uint32_t);
+__stdcall static void hal_readport_buf_uchar(uint8_t *,
+ uint8_t *, uint32_t);
__stdcall static uint8_t hal_lock(/*kspin_lock * */void);
__stdcall static void hal_unlock(/*kspin_lock *, uint8_t*/void);
__stdcall static uint8_t hal_irql(void);
@@ -105,6 +117,39 @@ hal_writeport_uchar(port, val)
return;
}
+__stdcall static void
+hal_writeport_buf_ulong(port, val, cnt)
+ uint32_t *port;
+ uint32_t *val;
+ uint32_t cnt;
+{
+ bus_space_write_multi_4(I386_BUS_SPACE_IO, 0x0,
+ (bus_size_t)port, val, cnt);
+ return;
+}
+
+__stdcall static void
+hal_writeport_buf_ushort(port, val, cnt)
+ uint16_t *port;
+ uint16_t *val;
+ uint32_t cnt;
+{
+ bus_space_write_multi_2(I386_BUS_SPACE_IO, 0x0,
+ (bus_size_t)port, val, cnt);
+ return;
+}
+
+__stdcall static void
+hal_writeport_buf_uchar(port, val, cnt)
+ uint8_t *port;
+ uint8_t *val;
+ uint32_t cnt;
+{
+ bus_space_write_multi_1(I386_BUS_SPACE_IO, 0x0,
+ (bus_size_t)port, val, cnt);
+ return;
+}
+
__stdcall static uint16_t
hal_readport_ushort(port)
uint16_t *port;
@@ -126,6 +171,39 @@ hal_readport_uchar(port)
return(bus_space_read_1(I386_BUS_SPACE_IO, 0x0, (uint32_t)port));
}
+__stdcall static void
+hal_readport_buf_ulong(port, val, cnt)
+ uint32_t *port;
+ uint32_t *val;
+ uint32_t cnt;
+{
+ bus_space_read_multi_4(I386_BUS_SPACE_IO, 0x0,
+ (bus_size_t)port, val, cnt);
+ return;
+}
+
+__stdcall static void
+hal_readport_buf_ushort(port, val, cnt)
+ uint16_t *port;
+ uint16_t *val;
+ uint32_t cnt;
+{
+ bus_space_read_multi_2(I386_BUS_SPACE_IO, 0x0,
+ (bus_size_t)port, val, cnt);
+ return;
+}
+
+__stdcall static void
+hal_readport_buf_uchar(port, val, cnt)
+ uint8_t *port;
+ uint8_t *val;
+ uint32_t cnt;
+{
+ bus_space_read_multi_1(I386_BUS_SPACE_IO, 0x0,
+ (bus_size_t)port, val, cnt);
+ return;
+}
+
__stdcall static uint8_t
hal_lock(/*lock*/void)
{
@@ -167,9 +245,15 @@ image_patch_table hal_functbl[] = {
{ "WRITE_PORT_ULONG", (FUNC)hal_writeport_ulong },
{ "WRITE_PORT_USHORT", (FUNC)hal_writeport_ushort },
{ "WRITE_PORT_UCHAR", (FUNC)hal_writeport_uchar },
+ { "WRITE_PORT_BUFFER_ULONG", (FUNC)hal_writeport_buf_ulong },
+ { "WRITE_PORT_BUFFER_USHORT", (FUNC)hal_writeport_buf_ushort },
+ { "WRITE_PORT_BUFFER_UCHAR", (FUNC)hal_writeport_buf_uchar },
{ "READ_PORT_ULONG", (FUNC)hal_readport_ulong },
{ "READ_PORT_USHORT", (FUNC)hal_readport_ushort },
{ "READ_PORT_UCHAR", (FUNC)hal_readport_uchar },
+ { "READ_PORT_BUFFER_ULONG", (FUNC)hal_readport_buf_ulong },
+ { "READ_PORT_BUFFER_USHORT", (FUNC)hal_readport_buf_ushort },
+ { "READ_PORT_BUFFER_UCHAR", (FUNC)hal_readport_buf_uchar },
{ "KfAcquireSpinLock", (FUNC)hal_lock },
{ "KfReleaseSpinLock", (FUNC)hal_unlock },
{ "KeGetCurrentIrql", (FUNC)hal_irql },
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index a396a7e..78aa6f1 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -1001,7 +1001,11 @@ ndis_cancel_timer(timer, cancelled)
{
struct callout *ch;
+ if (timer == NULL)
+ return;
ch = timer->nmt_dpc.nk_deferredctx;
+ if (ch == NULL)
+ return;
callout_stop(ch);
*cancelled = timer->nmt_ktimer.nk_header.dh_sigstate;
@@ -1102,7 +1106,7 @@ ndis_mapreg_cnt(bustype, cnt)
uint32_t bustype;
uint32_t *cnt;
{
- *cnt = 64;
+ *cnt = 8192;
return(NDIS_STATUS_SUCCESS);
}
@@ -2376,6 +2380,8 @@ image_patch_table ndis_functbl[] = {
{ "NdisAllocatePacket", (FUNC)ndis_alloc_packet },
{ "NdisFreePacket", (FUNC)ndis_release_packet },
{ "NdisFreePacketPool", (FUNC)ndis_free_packetpool },
+ { "NdisDprAllocatePacket", (FUNC)ndis_alloc_packet },
+ { "NdisDprFreePacket", (FUNC)ndis_release_packet },
{ "NdisAllocateBufferPool", (FUNC)ndis_alloc_bufpool },
{ "NdisAllocateBuffer", (FUNC)ndis_alloc_buf },
{ "NdisQueryBuffer", (FUNC)ndis_query_buf },
OpenPOWER on IntegriCloud