From 909db6af61bee69faa1bf964ad229c0d93aa4444 Mon Sep 17 00:00:00 2001 From: nyan Date: Sun, 7 Sep 2008 04:44:24 +0000 Subject: - Add the i386_memio_map_load() function to load I/O address table. - Add the bus_space_compare macro for bus_space consistency. - Switch using the bus_space_map_load() in isa_load_resourcev(). --- sys/pc98/include/bus.h | 22 ++++++++++++++++++++++ sys/pc98/pc98/busiosubr.c | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) (limited to 'sys/pc98') diff --git a/sys/pc98/include/bus.h b/sys/pc98/include/bus.h index 39111f5..07b7ea3 100644 --- a/sys/pc98/include/bus.h +++ b/sys/pc98/include/bus.h @@ -92,7 +92,13 @@ #define BUS_SPACE_UNRESTRICTED (~0) +/* + * address relocation table + */ #define BUS_SPACE_IAT_MAXSIZE 33 +typedef bus_addr_t *bus_space_iat_t; + +#define BUS_SPACE_IAT_SZ(IOTARRAY) (sizeof(IOTARRAY)/sizeof(bus_addr_t)) /* * Access methods for bus resources and address space. @@ -224,6 +230,19 @@ void i386_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, i386_memio_unmap((t), (h), (s)) /* + * int bus_space_map_load (bus_space_tag_t t, bus_space_handle_t bsh, + * bus_size_t size, bus_space_iat_t iat, u_int flags); + * + * Load I/O address table of bus space. + */ + +int i386_memio_map_load(bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t size, bus_space_iat_t iat, u_int flags); + +#define bus_space_map_load(t, h, s, iat, f) \ + i386_memio_map_load((t), (h), (s), (iat), (f)) + +/* * int bus_space_subregion (bus_space_tag_t t, * bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, * bus_space_handle_t *nbshp); @@ -260,6 +279,9 @@ void i386_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, int i386_memio_compare(bus_space_tag_t t1, bus_space_handle_t bsh1, bus_space_tag_t t2, bus_space_handle_t bsh2); +#define bus_space_compare(t1, h1, t2, h2) \ + i386_memio_compare((t1), (h1), (t2), (h2)) + /* * Access methods for bus resources and address space. */ diff --git a/sys/pc98/pc98/busiosubr.c b/sys/pc98/pc98/busiosubr.c index 79b06ce..dffe5ff 100644 --- a/sys/pc98/pc98/busiosubr.c +++ b/sys/pc98/pc98/busiosubr.c @@ -221,6 +221,31 @@ i386_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) } int +i386_memio_map_load(bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t size, bus_space_iat_t iat, u_int flags __unused) +{ + int i; + + if (size > bsh->bsh_maxiatsz) { + printf("i386_memio_map_load: map size too large\n"); + return EINVAL; + } + + for (i = 0; i < bsh->bsh_maxiatsz; i++) { + if (i < size) + bsh->bsh_iat[i] = iat[i]; + else + bsh->bsh_iat[i] = 0; + bsh->bsh_iat[i] += bsh->bsh_base; + } + + bsh->bsh_iatsz = size; + bsh->bsh_bam = t->bs_ra; /* relocate access */ + + return 0; +} + +int i386_memio_subregion(bus_space_tag_t t, bus_space_handle_t pbsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *tbshp) -- cgit v1.1