From 32b034d034b5eb777a4e1f90afab9e5da09082db Mon Sep 17 00:00:00 2001 From: obrien Date: Thu, 15 Jan 2004 19:34:56 +0000 Subject: [PATCH] Create NDIS_BUS_SPACE_{IO,MEM} to abstract MD BUS_SPACE macros. Provide appropriate definitions for i386 and AMD64. --- sys/compat/ndis/pe_var.h | 8 ++++++-- sys/compat/ndis/subr_hal.c | 24 ++++++++++++------------ sys/compat/ndis/subr_ntoskrnl.c | 12 ++++++------ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sys/compat/ndis/pe_var.h b/sys/compat/ndis/pe_var.h index e62e5ebd141c..06ec2e1e77be 100644 --- a/sys/compat/ndis/pe_var.h +++ b/sys/compat/ndis/pe_var.h @@ -417,9 +417,13 @@ typedef struct image_patch_table image_patch_table; */ #ifdef __amd64__ -#define __stdcall +#define __stdcall +#define NDIS_BUS_SPACE_IO AMD64_BUS_SPACE_IO +#define NDIS_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM #else -#define __stdcall __attribute__((__stdcall__)) +#define __stdcall __attribute__((__stdcall__)) +#define NDIS_BUS_SPACE_IO I386_BUS_SPACE_IO +#define NDIS_BUS_SPACE_MEM I386_BUS_SPACE_MEM #endif __BEGIN_DECLS diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c index 9c8e86b126aa..f3bb2fd73aed 100644 --- a/sys/compat/ndis/subr_hal.c +++ b/sys/compat/ndis/subr_hal.c @@ -96,7 +96,7 @@ hal_writeport_ulong(port, val) uint32_t *port; uint32_t val; { - bus_space_write_4(I386_BUS_SPACE_IO, 0x0, (uint32_t)port, val); + bus_space_write_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val); return; } @@ -105,7 +105,7 @@ hal_writeport_ushort(port, val) uint16_t *port; uint16_t val; { - bus_space_write_2(I386_BUS_SPACE_IO, 0x0, (uint32_t)port, val); + bus_space_write_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val); return; } @@ -114,7 +114,7 @@ hal_writeport_uchar(port, val) uint8_t *port; uint8_t val; { - bus_space_write_1(I386_BUS_SPACE_IO, 0x0, (uint32_t)port, val); + bus_space_write_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val); return; } @@ -124,7 +124,7 @@ hal_writeport_buf_ulong(port, val, cnt) uint32_t *val; uint32_t cnt; { - bus_space_write_multi_4(I386_BUS_SPACE_IO, 0x0, + bus_space_write_multi_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); return; } @@ -135,7 +135,7 @@ hal_writeport_buf_ushort(port, val, cnt) uint16_t *val; uint32_t cnt; { - bus_space_write_multi_2(I386_BUS_SPACE_IO, 0x0, + bus_space_write_multi_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); return; } @@ -146,7 +146,7 @@ hal_writeport_buf_uchar(port, val, cnt) uint8_t *val; uint32_t cnt; { - bus_space_write_multi_1(I386_BUS_SPACE_IO, 0x0, + bus_space_write_multi_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); return; } @@ -155,21 +155,21 @@ __stdcall static uint16_t hal_readport_ushort(port) uint16_t *port; { - return(bus_space_read_2(I386_BUS_SPACE_IO, 0x0, (uint32_t)port)); + return(bus_space_read_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port)); } __stdcall static uint32_t hal_readport_ulong(port) uint32_t *port; { - return(bus_space_read_4(I386_BUS_SPACE_IO, 0x0, (uint32_t)port)); + return(bus_space_read_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port)); } __stdcall static uint8_t hal_readport_uchar(port) uint8_t *port; { - return(bus_space_read_1(I386_BUS_SPACE_IO, 0x0, (uint32_t)port)); + return(bus_space_read_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port)); } __stdcall static void @@ -178,7 +178,7 @@ hal_readport_buf_ulong(port, val, cnt) uint32_t *val; uint32_t cnt; { - bus_space_read_multi_4(I386_BUS_SPACE_IO, 0x0, + bus_space_read_multi_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); return; } @@ -189,7 +189,7 @@ hal_readport_buf_ushort(port, val, cnt) uint16_t *val; uint32_t cnt; { - bus_space_read_multi_2(I386_BUS_SPACE_IO, 0x0, + bus_space_read_multi_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); return; } @@ -200,7 +200,7 @@ hal_readport_buf_uchar(port, val, cnt) uint8_t *val; uint32_t cnt; { - bus_space_read_multi_1(I386_BUS_SPACE_IO, 0x0, + bus_space_read_multi_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); return; } diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index 1d9c1cc0e1d5..923dc1ff1d7b 100644 --- a/sys/compat/ndis/subr_ntoskrnl.c +++ b/sys/compat/ndis/subr_ntoskrnl.c @@ -282,7 +282,7 @@ ntoskrnl_writereg_ushort(reg, val) uint16_t *reg; uint16_t val; { - bus_space_write_2(I386_BUS_SPACE_MEM, 0x0, (uint32_t)reg, val); + bus_space_write_2(NDIS_BUS_SPACE_MEM, 0x0, (bus_size_t)reg, val); return; } @@ -290,7 +290,7 @@ __stdcall static uint16_t ntoskrnl_readreg_ushort(reg) uint16_t *reg; { - return(bus_space_read_2(I386_BUS_SPACE_MEM, 0x0, (uint32_t)reg)); + return(bus_space_read_2(NDIS_BUS_SPACE_MEM, 0x0, (bus_size_t)reg)); } __stdcall static void @@ -298,7 +298,7 @@ ntoskrnl_writereg_ulong(reg, val) uint32_t *reg; uint32_t val; { - bus_space_write_4(I386_BUS_SPACE_MEM, 0x0, (uint32_t)reg, val); + bus_space_write_4(NDIS_BUS_SPACE_MEM, 0x0, (bus_size_t)reg, val); return; } @@ -306,14 +306,14 @@ __stdcall static uint32_t ntoskrnl_readreg_ulong(reg) uint32_t *reg; { - return(bus_space_read_4(I386_BUS_SPACE_MEM, 0x0, (uint32_t)reg)); + return(bus_space_read_4(NDIS_BUS_SPACE_MEM, 0x0, (bus_size_t)reg)); } __stdcall static uint8_t ntoskrnl_readreg_uchar(reg) uint8_t *reg; { - return(bus_space_read_1(I386_BUS_SPACE_MEM, 0x0, (uint32_t)reg)); + return(bus_space_read_1(NDIS_BUS_SPACE_MEM, 0x0, (bus_size_t)reg)); } __stdcall static void @@ -321,7 +321,7 @@ ntoskrnl_writereg_uchar(reg, val) uint8_t *reg; uint8_t val; { - bus_space_write_1(I386_BUS_SPACE_MEM, 0x0, (uint32_t)reg, val); + bus_space_write_1(NDIS_BUS_SPACE_MEM, 0x0, (bus_size_t)reg, val); return; }