From 32922227664108ea3bdf3840415d46ecd47b6c33 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 16 Nov 2007 16:16:08 +0000 Subject: fix the bus_space #define nightmare, so that amd64 and i386 are much more uniform. as a result shared code like acpi needs less #ifdef's ok marco kettenis --- sys/arch/amd64/amd64/bus_space.c | 50 ++++++++++---------- sys/arch/amd64/amd64/cpu.c | 8 ++-- sys/arch/amd64/amd64/db_interface.c | 22 ++++----- sys/arch/amd64/amd64/lapic.c | 4 +- sys/arch/amd64/amd64/mainbus.c | 4 +- sys/arch/amd64/amd64/mpbios.c | 4 +- sys/arch/amd64/include/bus.h | 89 +++++++++++------------------------ sys/arch/amd64/include/cpu.h | 8 ++-- sys/arch/amd64/include/mpconfig.h | 16 +++---- sys/arch/amd64/include/rbus_machdep.h | 6 +-- 10 files changed, 87 insertions(+), 124 deletions(-) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/amd64/bus_space.c b/sys/arch/amd64/amd64/bus_space.c index 1ac53b0b6bc..9a3a97059f1 100644 --- a/sys/arch/amd64/amd64/bus_space.c +++ b/sys/arch/amd64/amd64/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.7 2007/08/31 20:11:09 marco Exp $ */ +/* $OpenBSD: bus_space.c,v 1.8 2007/11/16 16:16:06 deraadt Exp $ */ /* $NetBSD: bus_space.c,v 1.2 2003/03/14 18:47:53 christos Exp $ */ /*- @@ -102,7 +102,7 @@ x86_bus_space_mallocok(void) } int -x86_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, +bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { int error; @@ -118,7 +118,7 @@ x86_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, } else if (t == X86_BUS_SPACE_MEM) ex = iomem_ex; else - panic("x86_memio_map: bad bus space tag"); + panic("bus_space_map: bad bus space tag"); /* * Before we go any further, let's make sure that this @@ -150,9 +150,9 @@ x86_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, if (error) { if (extent_free(ex, bpa, size, EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) { - printf("x86_memio_map: pa 0x%lx, size 0x%lx\n", + printf("bus_space_map: pa 0x%lx, size 0x%lx\n", bpa, size); - printf("x86_memio_map: can't free region\n"); + printf("bus_space_map: can't free region\n"); } } @@ -160,7 +160,7 @@ x86_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, } int -_x86_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, +_bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { @@ -180,7 +180,7 @@ _x86_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, } int -x86_memio_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, +bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap, bus_space_handle_t *bshp) { @@ -196,13 +196,13 @@ x86_memio_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, } else if (t == X86_BUS_SPACE_MEM) ex = iomem_ex; else - panic("x86_memio_alloc: bad bus space tag"); + panic("bus_space_alloc: bad bus space tag"); /* * Sanity check the allocation against the extent's boundaries. */ if (rstart < ex->ex_start || rend > ex->ex_end) - panic("x86_memio_alloc: bad region start/end"); + panic("bus_space_alloc: bad region start/end"); /* * Do the requested allocation. @@ -231,9 +231,9 @@ x86_memio_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, if (error) { if (extent_free(iomem_ex, bpa, size, EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) { - printf("x86_memio_alloc: pa 0x%lx, size 0x%lx\n", + printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n", bpa, size); - printf("x86_memio_alloc: can't free region\n"); + printf("bus_space_alloc: can't free region\n"); } } @@ -254,17 +254,17 @@ x86_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, } /* - * void _x86_memio_unmap(bus_space_tag bst, bus_space_handle bsh, + * void _bus_space_unmap(bus_space_tag bst, bus_space_handle bsh, * bus_size_t size, bus_addr_t *adrp) * * This function unmaps memory- or io-space mapped by the function - * _x86_memio_map(). This function works nearly as same as - * x86_memio_unmap(), but this function does not ask kernel + * _bus_space_map(). This function works nearly as same as + * bus_space_unmap(), but this function does not ask kernel * built-in extents and returns physical address of the bus space, * for the convenience of the extra extent manager. */ void -_x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, +_bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, bus_addr_t *adrp) { bus_addr_t bpa; @@ -285,7 +285,7 @@ _x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, bpa = PMAP_DIRECT_UNMAP(bsh); } } else { - panic("_x86_memio_unmap: bad bus space tag"); + panic("_bus_space_unmap: bad bus space tag"); } if (adrp != NULL) { @@ -294,7 +294,7 @@ _x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, } void -x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) +bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) { struct extent *ex; bus_addr_t bpa; @@ -320,27 +320,27 @@ x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) else bpa = PMAP_DIRECT_UNMAP(bsh); } else - panic("x86_memio_unmap: bad bus space tag"); + panic("bus_space_unmap: bad bus space tag"); ok: if (extent_free(ex, bpa, size, EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) { - printf("x86_memio_unmap: %s 0x%lx, size 0x%lx\n", + printf("bus_space_unmap: %s 0x%lx, size 0x%lx\n", (t == X86_BUS_SPACE_IO) ? "port" : "pa", bpa, size); - printf("x86_memio_unmap: can't free region\n"); + printf("bus_space_unmap: can't free region\n"); } } void -x86_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) +bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) { - /* x86_memio_unmap() does all that we need to do. */ - x86_memio_unmap(t, bsh, size); + /* bus_space_unmap() does all that we need to do. */ + bus_space_unmap(t, bsh, size); } int -x86_memio_subregion(bus_space_tag_t t, bus_space_handle_t bsh, +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) { @@ -349,7 +349,7 @@ x86_memio_subregion(bus_space_tag_t t, bus_space_handle_t bsh, } paddr_t -x86_memio_mmap(bus_space_tag_t t, bus_addr_t addr, off_t off, int prot, int flags) +bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t off, int prot, int flags) { /* Can't mmap I/O space. */ diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index 554a62ef344..5e212349c25 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.15 2007/10/10 15:53:51 art Exp $ */ +/* $OpenBSD: cpu.c,v 1.16 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -149,7 +149,7 @@ u_int32_t cpus_attached = 0; * Array of CPU info structures. Must be statically-allocated because * curproc, etc. are used early. */ -struct cpu_info *cpu_info[X86_MAXPROCS] = { &cpu_info_primary }; +struct cpu_info *cpu_info[MAXCPUS] = { &cpu_info_primary }; u_int32_t cpus_running = 0; @@ -409,7 +409,7 @@ cpu_boot_secondary_processors(void) struct cpu_info *ci; u_long i; - for (i=0; i < X86_MAXPROCS; i++) { + for (i=0; i < MAXCPUS; i++) { ci = cpu_info[i]; if (ci == NULL) continue; @@ -429,7 +429,7 @@ cpu_init_idle_pcbs(void) struct cpu_info *ci; u_long i; - for (i=0; i < X86_MAXPROCS; i++) { + for (i=0; i < MAXCPUS; i++) { ci = cpu_info[i]; if (ci == NULL) continue; diff --git a/sys/arch/amd64/amd64/db_interface.c b/sys/arch/amd64/amd64/db_interface.c index 7926f3c8ad4..6072bd7d5a9 100644 --- a/sys/arch/amd64/amd64/db_interface.c +++ b/sys/arch/amd64/amd64/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.12 2007/11/14 17:52:35 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.13 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: db_interface.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /* @@ -167,7 +167,7 @@ db_cpuid2apic(int id) { int apic; - for (apic = 0; apic < X86_MAXPROCS; apic++) { + for (apic = 0; apic < MAXCPUS; apic++) { if (cpu_info[apic] != NULL && CPU_INFO_UNIT(cpu_info[apic]) == id) return (apic); @@ -180,7 +180,7 @@ db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { int i; - for (i = 0; i < X86_MAXPROCS; i++) { + for (i = 0; i < MAXCPUS; i++) { if (cpu_info[i] != NULL) { db_printf("%c%4d: ", (i == cpu_number()) ? '*' : ' ', CPU_INFO_UNIT(cpu_info[i])); @@ -216,13 +216,13 @@ db_startproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) if (have_addr) { apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < X86_MAXPROCS && + if (apic >= 0 && apic < MAXCPUS && cpu_info[apic] != NULL && apic != cpu_number()) db_startcpu(apic); else db_printf("Invalid cpu %d\n", (int)addr); } else { - for (apic = 0; apic < X86_MAXPROCS; apic++) { + for (apic = 0; apic < MAXCPUS; apic++) { if (cpu_info[apic] != NULL && apic != cpu_number()) { db_startcpu(apic); } @@ -237,13 +237,13 @@ db_stopproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) if (have_addr) { apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < X86_MAXPROCS && + if (apic >= 0 && apic < MAXCPUS && cpu_info[apic] != NULL && apic != cpu_number()) db_stopcpu(apic); else db_printf("Invalid cpu %d\n", (int)addr); } else { - for (apic = 0; apic < X86_MAXPROCS; apic++) { + for (apic = 0; apic < MAXCPUS; apic++) { if (cpu_info[apic] != NULL && apic != cpu_number()) { db_stopcpu(apic); } @@ -258,7 +258,7 @@ db_ddbproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) if (have_addr) { apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < X86_MAXPROCS && + if (apic >= 0 && apic < MAXCPUS && cpu_info[apic] != NULL && apic != cpu_number()) { db_stopcpu(apic); db_switch_to_cpu = apic; @@ -285,7 +285,7 @@ db_enter_ddb(void) ddb_state = DDB_STATE_RUNNING; curcpu()->ci_ddb_paused = CI_DDB_INDDB; mtx_leave(&ddb_mp_mutex); - for (i = 0; i < X86_MAXPROCS; i++) { + for (i = 0; i < MAXCPUS; i++) { if (cpu_info[i] != NULL && i != cpu_number() && cpu_info[i]->ci_ddb_paused != CI_DDB_STOPPED) { cpu_info[i]->ci_ddb_paused = CI_DDB_SHOULDSTOP; @@ -297,7 +297,7 @@ db_enter_ddb(void) /* Leaving ddb completely. Start all other CPUs and return 0 */ if (ddb_active_cpu == cpu_number() && ddb_state == DDB_STATE_EXITING) { - for (i = 0; i < X86_MAXPROCS; i++) { + for (i = 0; i < MAXCPUS; i++) { if (cpu_info[i] != NULL) { cpu_info[i]->ci_ddb_paused = CI_DDB_RUNNING; } @@ -404,7 +404,7 @@ db_machine_init(void) db_machine_commands_install(db_machine_command_table); #ifdef MULTIPROCESSOR - for (i = 0; i < X86_MAXPROCS; i++) { + for (i = 0; i < MAXCPUS; i++) { if (cpu_info[i] != NULL) cpu_info[i]->ci_ddb_paused = CI_DDB_RUNNING; } diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c index c07be9e57b1..4ea242b074e 100644 --- a/sys/arch/amd64/amd64/lapic.c +++ b/sys/arch/amd64/amd64/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.10 2007/05/25 16:22:11 art Exp $ */ +/* $OpenBSD: lapic.c,v 1.11 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */ /*- @@ -164,7 +164,7 @@ lapic_set_lvt(void) } #endif - for (i = 0; i < mp_nintr; i++) { + for (i = 0; i < mp_nintrs; i++) { mpi = &mp_intrs[i]; if (mpi->ioapic == NULL && (mpi->cpu_id == MPS_ALL_APICS || mpi->cpu_id == ci->ci_apicid)) { diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c index ff51813cd17..3b5bc9743b8 100644 --- a/sys/arch/amd64/amd64/mainbus.c +++ b/sys/arch/amd64/amd64/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.12 2007/05/06 03:37:08 gwk Exp $ */ +/* $OpenBSD: mainbus.c,v 1.13 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */ /* @@ -116,7 +116,7 @@ struct isabus_attach_args mba_iba = { struct mp_bus *mp_busses; int mp_nbus; struct mp_intr_map *mp_intrs; -int mp_nintr; +int mp_nintrs; struct mp_bus *mp_isa_bus; struct mp_bus *mp_eisa_bus; diff --git a/sys/arch/amd64/amd64/mpbios.c b/sys/arch/amd64/amd64/mpbios.c index ee0c7e2a7a6..47a305ddedc 100644 --- a/sys/arch/amd64/amd64/mpbios.c +++ b/sys/arch/amd64/amd64/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.10 2007/09/17 15:34:38 chl Exp $ */ +/* $OpenBSD: mpbios.c,v 1.11 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */ /*- @@ -640,7 +640,7 @@ mpbios_scan(struct device *self) (u_char*)position += mp_conf[type].length; } - mp_nintr = cur_intr; + mp_nintrs = cur_intr; if (mp_verbose && mp_cth->ext_len) printf("%s: MP WARNING: %d bytes of extended entries not examined\n", diff --git a/sys/arch/amd64/include/bus.h b/sys/arch/amd64/include/bus.h index def7bd18ca4..af355103a00 100644 --- a/sys/arch/amd64/include/bus.h +++ b/sys/arch/amd64/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.7 2007/09/01 03:41:17 marco Exp $ */ +/* $OpenBSD: bus.h,v 1.8 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -93,25 +93,17 @@ typedef u_long bus_size_t; typedef int bus_space_tag_t; typedef u_long bus_space_handle_t; -#define bus_space_map(t, a, s, f, hp) x86_memio_map((t),(a),(s),(f),(hp)) -#define bus_space_unmap(t, h, s) x86_memio_unmap((t),(h),(s)) -#define bus_space_subregion(t, h, o, s, nhp) \ - x86_memio_subregion((t), (h), (o), (s), (nhp)) - -int x86_memio_map(bus_space_tag_t t, bus_addr_t addr, +int bus_space_map(bus_space_tag_t t, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp); /* like map, but without extent map checking/allocation */ -int _x86_memio_map(bus_space_tag_t t, bus_addr_t addr, +int _bus_space_map(bus_space_tag_t t, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp); -#define bus_space_alloc(t,beg,end,sz,align,bound,flag,addrp,h) \ - x86_memio_alloc((t),(beg),(end),(sz),(align),(bound),(flag),(addrp),(h)) -int x86_memio_alloc(bus_space_tag_t t, bus_addr_t rstart, +int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t align, bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *bshp); -#define bus_space_free(t,h,z) x86_memio_free((t),(h),(z)) -void x86_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, +void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); /* @@ -121,9 +113,9 @@ void x86_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, * Unmap a region of bus space. */ -void x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, +void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); -void _x86_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, +void _bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, bus_addr_t *); /* like bus_space_map(), but without extent map checking/allocation */ @@ -138,7 +130,7 @@ int _bus_space_map(bus_space_tag_t t, bus_addr_t addr, * Get a new handle for a subregion of an already-mapped area of bus space. */ -int x86_memio_subregion(bus_space_tag_t t, bus_space_handle_t bsh, +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); /* @@ -653,24 +645,15 @@ do { \ * by tag/handle/offset `count' times. */ -static __inline void x86_memio_set_multi_1(bus_space_tag_t, +static __inline void bus_space_set_multi_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t, size_t); -static __inline void x86_memio_set_multi_2(bus_space_tag_t, +static __inline void bus_space_set_multi_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t, size_t); -static __inline void x86_memio_set_multi_4(bus_space_tag_t, +static __inline void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t, size_t); -#define bus_space_set_multi_1(t, h, o, v, c) \ - x86_memio_set_multi_1((t), (h), (o), (v), (c)) - -#define bus_space_set_multi_2(t, h, o, v, c) \ - x86_memio_set_multi_2((t), (h), (o), (v), (c)) - -#define bus_space_set_multi_4(t, h, o, v, c) \ - x86_memio_set_multi_4((t), (h), (o), (v), (c)) - static __inline void -x86_memio_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, +bus_space_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t v, size_t c) { bus_addr_t addr = h + o; @@ -684,7 +667,7 @@ x86_memio_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, } static __inline void -x86_memio_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, +bus_space_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t v, size_t c) { bus_addr_t addr = h + o; @@ -698,7 +681,7 @@ x86_memio_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, } static __inline void -x86_memio_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, +bus_space_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v, size_t c) { bus_addr_t addr = h + o; @@ -725,24 +708,15 @@ x86_memio_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, * by tag/handle starting at `offset'. */ -static __inline void x86_memio_set_region_1(bus_space_tag_t, +static __inline void bus_space_set_region_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t, size_t); -static __inline void x86_memio_set_region_2(bus_space_tag_t, +static __inline void bus_space_set_region_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t, size_t); -static __inline void x86_memio_set_region_4(bus_space_tag_t, +static __inline void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t, size_t); -#define bus_space_set_region_1(t, h, o, v, c) \ - x86_memio_set_region_1((t), (h), (o), (v), (c)) - -#define bus_space_set_region_2(t, h, o, v, c) \ - x86_memio_set_region_2((t), (h), (o), (v), (c)) - -#define bus_space_set_region_4(t, h, o, v, c) \ - x86_memio_set_region_4((t), (h), (o), (v), (c)) - static __inline void -x86_memio_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, +bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int8_t v, size_t c) { bus_addr_t addr = h + o; @@ -756,7 +730,7 @@ x86_memio_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, } static __inline void -x86_memio_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, +bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int16_t v, size_t c) { bus_addr_t addr = h + o; @@ -770,7 +744,7 @@ x86_memio_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, } static __inline void -x86_memio_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, +bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v, size_t c) { bus_addr_t addr = h + o; @@ -803,27 +777,18 @@ x86_memio_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, #define bus_space_copy_4 bus_space_copy_region_4 #define bus_space_copy_8 bus_space_copy_region_8 -static __inline void x86_memio_copy_region_1(bus_space_tag_t, +static __inline void bus_space_copy_region_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, size_t); -static __inline void x86_memio_copy_region_2(bus_space_tag_t, +static __inline void bus_space_copy_region_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, size_t); -static __inline void x86_memio_copy_region_4(bus_space_tag_t, +static __inline void bus_space_copy_region_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, size_t); -#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ - x86_memio_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) - -#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ - x86_memio_copy_region_2((t), (h1), (o1), (h2), (o2), (c)) - -#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ - x86_memio_copy_region_4((t), (h1), (o1), (h2), (o2), (c)) - static __inline void -x86_memio_copy_region_1(bus_space_tag_t t, +bus_space_copy_region_1(bus_space_tag_t t, bus_space_handle_t h1, bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, size_t c) { @@ -858,7 +823,7 @@ x86_memio_copy_region_1(bus_space_tag_t t, } static __inline void -x86_memio_copy_region_2(bus_space_tag_t t, +bus_space_copy_region_2(bus_space_tag_t t, bus_space_handle_t h1, bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, size_t c) { @@ -893,7 +858,7 @@ x86_memio_copy_region_2(bus_space_tag_t t, } static __inline void -x86_memio_copy_region_4(bus_space_tag_t t, +bus_space_copy_region_4(bus_space_tag_t t, bus_space_handle_t h1, bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, size_t c) { @@ -1144,7 +1109,7 @@ int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size, * Mmap an area of bus space. */ -paddr_t x86_memio_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); +paddr_t bus_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); #endif /* _X86_BUS_DMA_PRIVATE */ diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 3c2d109fe9f..437e8adb10f 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.32 2007/11/01 23:30:46 mikeb Exp $ */ +/* $OpenBSD: cpu.h,v 1.33 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -164,7 +164,7 @@ extern void need_resched(struct cpu_info *); #if defined(MULTIPROCESSOR) -#define X86_MAXPROCS 32 /* bitmask; can be bumped to 64 */ +#define MAXCPUS 32 /* bitmask; can be bumped to 64 */ #define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci)) #define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci)) @@ -177,14 +177,14 @@ extern void need_resched(struct cpu_info *); #define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) -extern struct cpu_info *cpu_info[X86_MAXPROCS]; +extern struct cpu_info *cpu_info[MAXCPUS]; void cpu_boot_secondary_processors(void); void cpu_init_idle_pcbs(void); #else /* !MULTIPROCESSOR */ -#define X86_MAXPROCS 1 +#define MAXCPUS 1 #ifdef _KERNEL extern struct cpu_info cpu_info_primary; diff --git a/sys/arch/amd64/include/mpconfig.h b/sys/arch/amd64/include/mpconfig.h index 922f4e0e31e..3ad87939f47 100644 --- a/sys/arch/amd64/include/mpconfig.h +++ b/sys/arch/amd64/include/mpconfig.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpconfig.h,v 1.4 2006/11/25 16:59:31 niklas Exp $ */ +/* $OpenBSD: mpconfig.h,v 1.5 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: mpconfig.h,v 1.2 2003/05/11 00:05:52 fvdl Exp $ */ /* @@ -6,8 +6,8 @@ * MP config as well. */ -#ifndef _X86_MPCONFIG_H -#define _X86_MPCONFIG_H +#ifndef _AMD64_MPCONFIG_H +#define _AMD64_MPCONFIG_H /* * Interrupt typess @@ -29,8 +29,7 @@ struct mpbios_int; -struct mp_bus -{ +struct mp_bus { char *mb_name; /* XXX bus name */ int mb_idx; /* XXX bus index */ void (*mb_intr_print)(int); @@ -39,8 +38,7 @@ struct mp_bus u_int32_t mb_data; /* random bus-specific datum. */ }; -struct mp_intr_map -{ +struct mp_intr_map { struct mp_intr_map *next; struct mp_bus *bus; int bus_pin; @@ -58,11 +56,11 @@ struct mp_intr_map extern int mp_verbose; extern struct mp_bus *mp_busses; extern struct mp_intr_map *mp_intrs; -extern int mp_nintr; +extern int mp_nintrs; extern struct mp_bus *mp_isa_bus; extern struct mp_bus *mp_eisa_bus; extern int mp_nbus; #endif #endif -#endif /* _X86_MPCONFIG_H */ +#endif /* _AMD64_MPCONFIG_H */ diff --git a/sys/arch/amd64/include/rbus_machdep.h b/sys/arch/amd64/include/rbus_machdep.h index c6fac0e1255..18a60e13e39 100644 --- a/sys/arch/amd64/include/rbus_machdep.h +++ b/sys/arch/amd64/include/rbus_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rbus_machdep.h,v 1.1 2005/10/05 21:48:34 tdeval Exp $ */ +/* $OpenBSD: rbus_machdep.h,v 1.2 2007/11/16 16:16:07 deraadt Exp $ */ /* $NetBSD: rbus_machdep.h,v 1.2 1999/10/15 06:43:05 haya Exp $ */ /* @@ -38,10 +38,10 @@ struct pci_attach_args; /* XXX */ #define md_space_map(bt, physaddr, size, flags, bshp) \ - _x86_memio_map((bt), (physaddr), (size), (flags), (bshp)) + _bus_space_map((bt), (physaddr), (size), (flags), (bshp)) #define md_space_unmap(bt, bsh, size, adrp) \ - _x86_memio_unmap((bt), (bsh), (size), (adrp)) + _bus_space_unmap((bt), (bsh), (size), (adrp)) rbus_tag_t rbus_pccbb_parent_io(struct device *self, -- cgit v1.2.3