From e16c3e24aa86aeb4b9ada1912aad07d5d65aac3d Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 19 Apr 2005 21:07:00 +0000 Subject: There's no need to include all the detauls of struct bus_space_{tag,handle} in _bus.h when the typedef of the struct pointer will do. --- sys/pc98/include/_bus.h | 82 ----------------------------------------------- sys/pc98/include/bus.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 83 deletions(-) (limited to 'sys') diff --git a/sys/pc98/include/_bus.h b/sys/pc98/include/_bus.h index 2e8e148..8070792 100644 --- a/sys/pc98/include/_bus.h +++ b/sys/pc98/include/_bus.h @@ -37,89 +37,7 @@ typedef u_int bus_addr_t; typedef u_int bus_size_t; -#define BUS_SPACE_IAT_MAXSIZE 33 - -/* - * bus space tag - */ -#define _PASCAL_CALL (void) - -#define _BUS_SPACE_CALL_FUNCS_TAB(NAME,TYPE,BWN) \ - NAME##_space_read_##BWN, \ - NAME##_space_read_multi_##BWN, \ - NAME##_space_read_region_##BWN, \ - NAME##_space_write_##BWN, \ - NAME##_space_write_multi_##BWN, \ - NAME##_space_write_region_##BWN, \ - NAME##_space_set_multi_##BWN, \ - NAME##_space_set_region_##BWN, \ - NAME##_space_copy_region_##BWN - -#define _BUS_SPACE_CALL_FUNCS_PROTO(NAME,TYPE,BWN) \ - TYPE NAME##_space_read_##BWN _PASCAL_CALL; \ - void NAME##_space_read_multi_##BWN _PASCAL_CALL; \ - void NAME##_space_read_region_##BWN _PASCAL_CALL; \ - void NAME##_space_write_##BWN _PASCAL_CALL; \ - void NAME##_space_write_multi_##BWN _PASCAL_CALL; \ - void NAME##_space_write_region_##BWN _PASCAL_CALL; \ - void NAME##_space_set_multi_##BWN _PASCAL_CALL; \ - void NAME##_space_set_region_##BWN _PASCAL_CALL; \ - void NAME##_space_copy_region_##BWN _PASCAL_CALL; - -#define _BUS_SPACE_CALL_FUNCS(NAME,TYPE,BWN) \ - TYPE (* NAME##_read_##BWN) _PASCAL_CALL; \ - void (* NAME##_read_multi_##BWN) _PASCAL_CALL; \ - void (* NAME##_read_region_##BWN) _PASCAL_CALL; \ - void (* NAME##_write_##BWN) _PASCAL_CALL; \ - void (* NAME##_write_multi_##BWN) _PASCAL_CALL; \ - void (* NAME##_write_region_##BWN) _PASCAL_CALL; \ - void (* NAME##_set_multi_##BWN) _PASCAL_CALL; \ - void (* NAME##_set_region_##BWN) _PASCAL_CALL; \ - void (* NAME##_copy_region_##BWN) _PASCAL_CALL; - -struct bus_space_access_methods { - /* 8 bits access methods */ - _BUS_SPACE_CALL_FUNCS(bs,u_int8_t,1) - - /* 16 bits access methods */ - _BUS_SPACE_CALL_FUNCS(bs,u_int16_t,2) - - /* 32 bits access methods */ - _BUS_SPACE_CALL_FUNCS(bs,u_int32_t,4) -}; - -/* - * Access methods for bus resources and address space. - */ -struct bus_space_tag { -#define BUS_SPACE_IO 0 -#define BUS_SPACE_MEM 1 - u_int bs_tag; /* bus space flags */ - - struct bus_space_access_methods bs_da; /* direct access */ - struct bus_space_access_methods bs_ra; /* relocate access */ -#if 0 - struct bus_space_access_methods bs_ida; /* indexed direct access */ -#endif -}; typedef struct bus_space_tag *bus_space_tag_t; - -/* - * bus space handle - */ -struct bus_space_handle { - bus_addr_t bsh_base; - size_t bsh_sz; - - bus_addr_t bsh_iat[BUS_SPACE_IAT_MAXSIZE]; - size_t bsh_maxiatsz; - size_t bsh_iatsz; - - struct resource **bsh_res; - size_t bsh_ressz; - - struct bus_space_access_methods bsh_bam; -}; typedef struct bus_space_handle *bus_space_handle_t; #endif /* PC98_INCLUDE__BUS_H */ diff --git a/sys/pc98/include/bus.h b/sys/pc98/include/bus.h index d73647c..64a8194 100644 --- a/sys/pc98/include/bus.h +++ b/sys/pc98/include/bus.h @@ -92,13 +92,96 @@ #define BUS_SPACE_UNRESTRICTED (~0) +#define BUS_SPACE_IAT_MAXSIZE 33 + /* * Access methods for bus resources and address space. */ struct resource; /* - * Values for the i386 bus space tag, not to be used directly by MI code. + * bus space tag + */ +#define _PASCAL_CALL (void) + +#define _BUS_SPACE_CALL_FUNCS_TAB(NAME,TYPE,BWN) \ + NAME##_space_read_##BWN, \ + NAME##_space_read_multi_##BWN, \ + NAME##_space_read_region_##BWN, \ + NAME##_space_write_##BWN, \ + NAME##_space_write_multi_##BWN, \ + NAME##_space_write_region_##BWN, \ + NAME##_space_set_multi_##BWN, \ + NAME##_space_set_region_##BWN, \ + NAME##_space_copy_region_##BWN + +#define _BUS_SPACE_CALL_FUNCS_PROTO(NAME,TYPE,BWN) \ + TYPE NAME##_space_read_##BWN _PASCAL_CALL; \ + void NAME##_space_read_multi_##BWN _PASCAL_CALL; \ + void NAME##_space_read_region_##BWN _PASCAL_CALL; \ + void NAME##_space_write_##BWN _PASCAL_CALL; \ + void NAME##_space_write_multi_##BWN _PASCAL_CALL; \ + void NAME##_space_write_region_##BWN _PASCAL_CALL; \ + void NAME##_space_set_multi_##BWN _PASCAL_CALL; \ + void NAME##_space_set_region_##BWN _PASCAL_CALL; \ + void NAME##_space_copy_region_##BWN _PASCAL_CALL; + +#define _BUS_SPACE_CALL_FUNCS(NAME,TYPE,BWN) \ + TYPE (* NAME##_read_##BWN) _PASCAL_CALL; \ + void (* NAME##_read_multi_##BWN) _PASCAL_CALL; \ + void (* NAME##_read_region_##BWN) _PASCAL_CALL; \ + void (* NAME##_write_##BWN) _PASCAL_CALL; \ + void (* NAME##_write_multi_##BWN) _PASCAL_CALL; \ + void (* NAME##_write_region_##BWN) _PASCAL_CALL; \ + void (* NAME##_set_multi_##BWN) _PASCAL_CALL; \ + void (* NAME##_set_region_##BWN) _PASCAL_CALL; \ + void (* NAME##_copy_region_##BWN) _PASCAL_CALL; + +struct bus_space_access_methods { + /* 8 bits access methods */ + _BUS_SPACE_CALL_FUNCS(bs,u_int8_t,1) + + /* 16 bits access methods */ + _BUS_SPACE_CALL_FUNCS(bs,u_int16_t,2) + + /* 32 bits access methods */ + _BUS_SPACE_CALL_FUNCS(bs,u_int32_t,4) +}; + +/* + * Access methods for bus resources and address space. + */ +struct bus_space_tag { +#define BUS_SPACE_IO 0 +#define BUS_SPACE_MEM 1 + u_int bs_tag; /* bus space flags */ + + struct bus_space_access_methods bs_da; /* direct access */ + struct bus_space_access_methods bs_ra; /* relocate access */ +#if 0 + struct bus_space_access_methods bs_ida; /* indexed direct access */ +#endif +}; + +/* + * bus space handle + */ +struct bus_space_handle { + bus_addr_t bsh_base; + size_t bsh_sz; + + bus_addr_t bsh_iat[BUS_SPACE_IAT_MAXSIZE]; + size_t bsh_maxiatsz; + size_t bsh_iatsz; + + struct resource **bsh_res; + size_t bsh_ressz; + + struct bus_space_access_methods bsh_bam; +}; + +/* + * Values for the pc98 bus space tag, not to be used directly by MI code. */ extern struct bus_space_tag SBUS_io_space_tag; extern struct bus_space_tag SBUS_mem_space_tag; -- cgit v1.1