diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-11-16 16:16:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-11-16 16:16:08 +0000 |
commit | 32922227664108ea3bdf3840415d46ecd47b6c33 (patch) | |
tree | 0fc1ed540a8604f9a09281922b73205f9029769c /sys | |
parent | 131b5909bb58cef481f3bb87af3f5dc30421be92 (diff) |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/bus_space.c | 50 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/cpu.c | 8 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/db_interface.c | 22 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/lapic.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mainbus.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mpbios.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/include/bus.h | 89 | ||||
-rw-r--r-- | sys/arch/amd64/include/cpu.h | 8 | ||||
-rw-r--r-- | sys/arch/amd64/include/mpconfig.h | 16 | ||||
-rw-r--r-- | sys/arch/amd64/include/rbus_machdep.h | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/cpu.c | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_interface.c | 18 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_mp.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmapae.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 8 | ||||
-rw-r--r-- | sys/dev/acpi/acpi.c | 9 | ||||
-rw-r--r-- | sys/dev/acpi/acpicpu.c | 8 | ||||
-rw-r--r-- | sys/dev/acpi/acpimadt.c | 6 |
19 files changed, 117 insertions, 169 deletions
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, diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index 6e9202f114b..5439a8b6986 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.26 2007/10/10 15:53:51 art Exp $ */ +/* $OpenBSD: cpu.c,v 1.27 2007/11/16 16:16:06 deraadt Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -137,7 +137,7 @@ void cpu_set_tss_gates(struct cpu_info *); * curproc, etc. are used early. */ -struct cpu_info *cpu_info[I386_MAXPROCS] = { &cpu_info_primary }; +struct cpu_info *cpu_info[MAXCPUS] = { &cpu_info_primary }; void cpu_hatch(void *); void cpu_boot_secondary(struct cpu_info *); @@ -364,7 +364,7 @@ cpu_boot_secondary_processors() struct cpu_info *ci; u_long i; - for (i = 0; i < I386_MAXPROCS; i++) { + for (i = 0; i < MAXCPUS; i++) { ci = cpu_info[i]; if (ci == NULL) continue; @@ -384,7 +384,7 @@ cpu_init_idle_pcbs() struct cpu_info *ci; u_long i; - for (i=0; i < I386_MAXPROCS; i++) { + for (i=0; i < MAXCPUS; i++) { ci = cpu_info[i]; if (ci == NULL) continue; diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index a929e362c7c..f0d01c29d96 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.24 2007/11/14 17:52:36 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.25 2007/11/16 16:16:06 deraadt Exp $ */ /* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */ /* @@ -215,7 +215,7 @@ db_cpuid2apic(int id) { int apic; - for (apic = 0; apic < I386_MAXPROCS; apic++) { + for (apic = 0; apic < MAXCPUS; apic++) { if (cpu_info[apic] != NULL && cpu_info[apic]->ci_dev.dv_unit == id) return (apic); @@ -228,7 +228,7 @@ db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { int i; - for (i = 0; i < I386_MAXPROCS; i++) { + for (i = 0; i < MAXCPUS; i++) { if (cpu_info[i] != NULL) { db_printf("%c%4d: ", (i == cpu_number()) ? '*' : ' ', cpu_info[i]->ci_dev.dv_unit); @@ -264,13 +264,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 < I386_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 < I386_MAXPROCS; apic++) { + for (apic = 0; apic < MAXCPUS; apic++) { if (cpu_info[apic] != NULL && apic != cpu_number()) { db_startcpu(apic); } @@ -285,13 +285,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 < I386_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 < I386_MAXPROCS; apic++) { + for (apic = 0; apic < MAXCPUS; apic++) { if (cpu_info[apic] != NULL && apic != cpu_number()) { db_stopcpu(apic); } @@ -306,7 +306,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 < I386_MAXPROCS && + if (apic >= 0 && apic < MAXCPUS && cpu_info[apic] != NULL && apic != cpu_number()) { db_stopcpu(apic); db_switch_to_cpu = apic; @@ -354,7 +354,7 @@ db_machine_init(void) db_machine_commands_install(db_machine_command_table); #ifdef MULTIPROCESSOR - for (i = 0; i < I386_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/i386/i386/db_mp.c b/sys/arch/i386/i386/db_mp.c index 9fd899d1f69..e11001a99a0 100644 --- a/sys/arch/i386/i386/db_mp.c +++ b/sys/arch/i386/i386/db_mp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_mp.c,v 1.4 2004/07/20 20:18:53 art Exp $ */ +/* $OpenBSD: db_mp.c,v 1.5 2007/11/16 16:16:06 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Andreas Gunnarsson <andreas@openbsd.org> @@ -54,7 +54,7 @@ db_enter_ddb() ddb_state = DDB_STATE_RUNNING; curcpu()->ci_ddb_paused = CI_DDB_INDDB; mtx_leave(&ddb_mp_mutex); - for (i = 0; i < I386_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; @@ -66,7 +66,7 @@ db_enter_ddb() /* 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 < I386_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/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index d02f95d15e6..e2297cea182 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.119 2007/06/27 16:16:53 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.120 2007/11/16 16:16:06 deraadt Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -293,7 +293,7 @@ struct pool pmap_pmap_pool; /* * MULTIPROCESSOR: special VA's/ PTE's are actually allocated inside a - * I386_MAXPROCS*NPTECL array of PTE's, to avoid cache line thrashing + * MAXCPUS*NPTECL array of PTE's, to avoid cache line thrashing * due to false sharing. */ @@ -877,8 +877,8 @@ pmap_bootstrap(vaddr_t kva_start) ptpp = (caddr_t) virtual_avail+PAGE_SIZE*3; ptp_pte = pte+3; - virtual_avail += PAGE_SIZE * I386_MAXPROCS * NPTECL; - pte += I386_MAXPROCS * NPTECL; + virtual_avail += PAGE_SIZE * MAXCPUS * NPTECL; + pte += MAXCPUS * NPTECL; #else csrcp = (caddr_t) virtual_avail; csrc_pte = pte; /* allocate */ virtual_avail += PAGE_SIZE; pte++; /* advance */ diff --git a/sys/arch/i386/i386/pmapae.c b/sys/arch/i386/i386/pmapae.c index 09b61eff209..1438f652965 100644 --- a/sys/arch/i386/i386/pmapae.c +++ b/sys/arch/i386/i386/pmapae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmapae.c,v 1.13 2007/07/20 19:48:15 mk Exp $ */ +/* $OpenBSD: pmapae.c,v 1.14 2007/11/16 16:16:06 deraadt Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -530,7 +530,7 @@ extern boolean_t pmap_initialized; /* pmap_init done yet? */ /* * MULTIPROCESSOR: special VA's/ PTE's are actually allocated inside a - * I386_MAXPROCS*NPTECL array of PTE's, to avoid cache line thrashing + * MAXCPUS*NPTECL array of PTE's, to avoid cache line thrashing * due to false sharing. */ diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index f796c8061d5..22cf9b9c1e4 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.97 2007/11/03 03:37:08 weingart Exp $ */ +/* $OpenBSD: cpu.h,v 1.98 2007/11/16 16:16:06 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -180,7 +180,7 @@ extern struct cpu_info *cpu_info_list; #ifdef MULTIPROCESSOR -#define I386_MAXPROCS 32 /* because we use a bitmask */ +#define MAXCPUS 32 /* because we use a bitmask */ #define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci)) #define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci)) @@ -203,7 +203,7 @@ curcpu(void) #define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) -extern struct cpu_info *cpu_info[I386_MAXPROCS]; +extern struct cpu_info *cpu_info[MAXCPUS]; extern u_long cpus_running; extern void cpu_boot_secondary_processors(void); @@ -211,7 +211,7 @@ extern void cpu_init_idle_pcbs(void); #else /* MULTIPROCESSOR */ -#define I386_MAXPROCS 1 +#define MAXCPUS 1 #define cpu_number() 0 #define curcpu() (&cpu_info_primary) diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index a160f86eb0e..393c846266d 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.100 2007/11/15 22:19:14 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.101 2007/11/16 16:16:04 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -104,15 +104,8 @@ struct cfdriver acpi_cd = { struct acpi_softc *acpi_softc; int acpi_s5, acpi_evindex; -#ifdef __i386__ #define acpi_bus_space_map _bus_space_map #define acpi_bus_space_unmap _bus_space_unmap -#elif defined(__amd64__) -#define acpi_bus_space_map _x86_memio_map -#define acpi_bus_space_unmap _x86_memio_unmap -#else -#error ACPI supported on i386/amd64 only -#endif #define pch(x) (((x)>=' ' && (x)<='z') ? (x) : ' ') diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c index 130f18427bb..cd842919443 100644 --- a/sys/dev/acpi/acpicpu.c +++ b/sys/dev/acpi/acpicpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpicpu.c,v 1.32 2007/11/15 19:05:58 mikeb Exp $ */ +/* $OpenBSD: acpicpu.c,v 1.33 2007/11/16 16:16:04 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -123,11 +123,7 @@ struct cfdriver acpicpu_cd = { extern int setperf_prio; -#ifdef __i386__ -struct acpicpu_softc *acpicpu_sc[I386_MAXPROCS]; -#elif __amd64__ -struct acpicpu_softc *acpicpu_sc[X86_MAXPROCS]; -#endif +struct acpicpu_softc *acpicpu_sc[MAXCPUS]; void acpicpu_set_throttle(struct acpicpu_softc *sc, int level) diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c index 9a4ac7a3b61..fdfd2638756 100644 --- a/sys/dev/acpi/acpimadt.c +++ b/sys/dev/acpi/acpimadt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpimadt.c,v 1.12 2007/11/15 22:16:31 mikeb Exp $ */ +/* $OpenBSD: acpimadt.c,v 1.13 2007/11/16 16:16:04 deraadt Exp $ */ /* * Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org> * @@ -38,10 +38,6 @@ #include "ioapic.h" -#ifdef __amd64__ /* XXX */ -#define mp_nintrs mp_nintr -#endif - u_int8_t acpi_lapic_flags[LAPIC_MAP_SIZE]; int acpimadt_match(struct device *, void *, void *); |