From e126caf11a991b0259cfd9d12ebfced467a60f52 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 21 Feb 2004 06:37:08 +0000 Subject: [PATCH] Synchronize a bunch of things from FreeBSD-5 in preparation for the new ACPICA driver support. * Bring in a lot of new bus and pci DEV_METHODs from FreeBSD-5 * split apic.h into apicreg.h and apicio.h * rename INTR_TYPE_FAST -> INTR_FAST and move the #define * rename INTR_TYPE_EXCL -> INTR_EXCL and move the #define * rename some PCIR_ registers and add additional macros from FreeBSD-5 * note: new pcib bus call, host_pcib_get_busno() imported. * kern/subr_power.c no longer optional. Other changes: * machine/smp.h machine smp/smptests.h can now be #included unconditionally, and some APIC_IO vs SMP separation has been done as well. * gd_acpi_id and gd_apic_id added to machine/globaldata.h prep for new ACPI code. Despite all the changes, the generated code should be virtually the same. These were mostly additions which the pre-existing code does not (yet) use. --- sys/amd64/amd64/genassym.c | 4 +- sys/boot/i386/libi386/Makefile | 6 +- sys/boot/pc32/libi386/Makefile | 6 +- sys/bus/isa/i386/isa_compat.h | 6 +- sys/bus/isa/isavar.h | 5 +- sys/bus/mca/mca_bus.c | 24 +- sys/bus/pci/i386/pcibus.c | 4 +- sys/bus/pci/pci.c | 249 +++++++++++++++--- sys/bus/pci/pci_compat.c | 6 +- sys/bus/pci/pci_if.m | 16 +- sys/bus/pci/pci_private.h | 43 ++- sys/bus/pci/pcireg.h | 75 +++++- sys/bus/pci/pcisupport.c | 106 +++++++- sys/conf/files | 4 +- sys/conf/files.i386 | 7 +- sys/cpu/i386/misc/in_cksum2.s | 4 +- sys/dev/acpica/Osd/OsdHardware.c | 4 +- sys/dev/misc/puc/puc.c | 6 +- sys/dev/pccard/cardbus/cardbus.c | 4 +- sys/dev/raid/aac/aac_pci.c | 5 +- sys/dev/raid/amr/amr_compat.h | 3 +- sys/dev/raid/mlx/mlx_compat.h | 3 +- sys/dev/raid/twe/twe_compat.h | 3 +- sys/dev/serial/sio/sio.c | 4 +- sys/i386/apic/apic_vector.s | 4 +- sys/i386/{include/apic.h => apic/apicreg.h} | 6 +- sys/i386/apic/apicvar.h | 159 +++++++++++ sys/i386/apic/mpapic.h | 7 +- sys/i386/i386/db_interface.c | 4 +- sys/i386/i386/exception.s | 4 +- sys/i386/i386/genassym.c | 4 +- sys/i386/i386/in_cksum2.s | 4 +- sys/i386/i386/mp_machdep.c | 10 +- sys/i386/i386/mpboot.s | 4 +- sys/i386/i386/mplock.s | 4 +- sys/i386/i386/nexus.c | 6 +- sys/i386/i386/pmap.c | 4 +- sys/i386/i386/pmap_inval.c | 4 +- sys/i386/i386/swtch.s | 6 +- .../include/apic.h => i386/include/apicreg.h} | 6 +- sys/i386/include/apicvar.h | 159 +++++++++++ sys/i386/include/globaldata.h | 4 +- sys/i386/include/mpapic.h | 7 +- sys/i386/include/smp.h | 4 +- sys/i386/include/smptests.h | 108 ++------ sys/i386/isa/apic_vector.s | 4 +- sys/i386/isa/clock.c | 3 +- sys/i386/isa/intr_machdep.c | 4 +- sys/i386/isa/intr_machdep.h | 5 +- sys/kern/bus_if.m | 24 +- sys/kern/subr_bus.c | 142 +++++++++- sys/platform/pc32/apic/apic_vector.s | 4 +- .../pc32/{include/apic.h => apic/apicreg.h} | 6 +- sys/platform/pc32/apic/apicvar.h | 159 +++++++++++ sys/platform/pc32/apic/mpapic.h | 7 +- sys/platform/pc32/i386/db_interface.c | 4 +- sys/platform/pc32/i386/exception.s | 4 +- sys/platform/pc32/i386/genassym.c | 4 +- sys/platform/pc32/i386/mp_machdep.c | 10 +- sys/platform/pc32/i386/mpboot.s | 4 +- sys/platform/pc32/i386/mplock.s | 4 +- sys/platform/pc32/i386/nexus.c | 6 +- sys/platform/pc32/i386/pmap.c | 4 +- sys/platform/pc32/i386/pmap_inval.c | 4 +- sys/platform/pc32/i386/swtch.s | 6 +- .../pc32/include/{apic.h => apicreg.h} | 6 +- sys/platform/pc32/include/apicvar.h | 159 +++++++++++ sys/platform/pc32/include/globaldata.h | 4 +- sys/platform/pc32/include/mpapic.h | 7 +- sys/platform/pc32/include/smp.h | 4 +- sys/platform/pc32/include/smptests.h | 108 ++------ sys/platform/pc32/isa/apic_vector.s | 4 +- sys/platform/pc32/isa/clock.c | 3 +- sys/platform/pc32/isa/intr_machdep.c | 4 +- sys/platform/pc32/isa/intr_machdep.h | 5 +- sys/platform/vkernel/i386/genassym.c | 4 +- sys/sys/bus.h | 48 +++- 77 files changed, 1462 insertions(+), 417 deletions(-) rename sys/i386/{include/apic.h => apic/apicreg.h} (99%) create mode 100644 sys/i386/apic/apicvar.h copy sys/{platform/pc32/include/apic.h => i386/include/apicreg.h} (99%) create mode 100644 sys/i386/include/apicvar.h copy sys/platform/pc32/{include/apic.h => apic/apicreg.h} (99%) create mode 100644 sys/platform/pc32/apic/apicvar.h rename sys/platform/pc32/include/{apic.h => apicreg.h} (99%) create mode 100644 sys/platform/pc32/include/apicvar.h diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index d8d1146365..e73417aaee 100644 --- a/sys/amd64/amd64/genassym.c +++ b/sys/amd64/amd64/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/amd64/amd64/Attic/genassym.c,v 1.2 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/amd64/amd64/Attic/genassym.c,v 1.3 2004/02/21 06:37:02 dillon Exp $ */ #include @@ -64,7 +64,7 @@ #include #include #ifdef SMP -#include +#include #endif #include #include diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile index eca13b92ec..a493b52895 100644 --- a/sys/boot/i386/libi386/Makefile +++ b/sys/boot/i386/libi386/Makefile @@ -1,8 +1,10 @@ # $FreeBSD: src/sys/boot/i386/libi386/Makefile,v 1.32 2003/07/02 12:45:45 ru Exp $ -# $DragonFly: src/sys/boot/i386/libi386/Attic/Makefile,v 1.3 2003/11/10 06:08:36 dillon Exp $ +# $DragonFly: src/sys/boot/i386/libi386/Attic/Makefile,v 1.4 2004/02/21 06:37:05 dillon Exp $ # LIB= i386 INTERNALLIB= true +SYSACPICA?= contrib/dev/acpica +#SYSACPICA?= contrib/dev/acpica-unix-20031203 SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \ biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ @@ -27,7 +29,7 @@ CFLAGS+= -DDISK_DEBUG CFLAGS+= -DTERM_EMU CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ - -I${.CURDIR}/../../../contrib/dev/acpica \ + -I${.CURDIR}/../../../${SYSACPICA} \ -I${.CURDIR}/../../.. -I. # the location of libstand CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ diff --git a/sys/boot/pc32/libi386/Makefile b/sys/boot/pc32/libi386/Makefile index 952aea7909..cc6d2874b3 100644 --- a/sys/boot/pc32/libi386/Makefile +++ b/sys/boot/pc32/libi386/Makefile @@ -1,8 +1,10 @@ # $FreeBSD: src/sys/boot/i386/libi386/Makefile,v 1.32 2003/07/02 12:45:45 ru Exp $ -# $DragonFly: src/sys/boot/pc32/libi386/Makefile,v 1.3 2003/11/10 06:08:36 dillon Exp $ +# $DragonFly: src/sys/boot/pc32/libi386/Makefile,v 1.4 2004/02/21 06:37:05 dillon Exp $ # LIB= i386 INTERNALLIB= true +SYSACPICA?= contrib/dev/acpica +#SYSACPICA?= contrib/dev/acpica-unix-20031203 SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \ biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ @@ -27,7 +29,7 @@ CFLAGS+= -DDISK_DEBUG CFLAGS+= -DTERM_EMU CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ - -I${.CURDIR}/../../../contrib/dev/acpica \ + -I${.CURDIR}/../../../${SYSACPICA} \ -I${.CURDIR}/../../.. -I. # the location of libstand CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ diff --git a/sys/bus/isa/i386/isa_compat.h b/sys/bus/isa/i386/isa_compat.h index 6317503f12..cac9c6c92b 100644 --- a/sys/bus/isa/i386/isa_compat.h +++ b/sys/bus/isa/i386/isa_compat.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/isa_compat.h,v 1.27.2.11 2002/10/05 18:31:48 scottl Exp $ - * $DragonFly: src/sys/bus/isa/i386/isa_compat.h,v 1.5 2003/12/07 19:23:35 dillon Exp $ + * $DragonFly: src/sys/bus/isa/i386/isa_compat.h,v 1.6 2004/02/21 06:37:05 dillon Exp $ */ #include "use_vt.h" @@ -134,7 +134,7 @@ static struct old_isa_driver old_drivers[] = { { INTR_TYPE_TTY, &gscdriver }, #endif #if NCY > 0 - { INTR_TYPE_TTY | INTR_TYPE_FAST, &cydriver }, + { INTR_TYPE_TTY | INTR_FAST, &cydriver }, #endif #if NDGB > 0 { INTR_TYPE_TTY, &dgbdriver }, @@ -161,7 +161,7 @@ static struct old_isa_driver old_drivers[] = { { INTR_TYPE_TTY, &stlidriver }, #endif #if NLORAN > 0 - { INTR_TYPE_TTY | INTR_TYPE_FAST, &lorandriver }, + { INTR_TYPE_TTY | INTR_FAST, &lorandriver }, #endif /* BIO */ diff --git a/sys/bus/isa/isavar.h b/sys/bus/isa/isavar.h index 3bdc571ee9..db7242232d 100644 --- a/sys/bus/isa/isavar.h +++ b/sys/bus/isa/isavar.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/isavar.h,v 1.16.2.2 2000/10/29 13:07:56 nyan Exp $ - * $DragonFly: src/sys/bus/isa/isavar.h,v 1.5 2003/11/08 02:55:16 dillon Exp $ + * $DragonFly: src/sys/bus/isa/isavar.h,v 1.6 2004/02/21 06:37:05 dillon Exp $ */ #ifndef _ISA_ISAVAR_H_ @@ -154,6 +154,9 @@ ISA_ACCESSOR(logicalid, LOGICALID, int) ISA_ACCESSOR(compatid, COMPATID, int) ISA_ACCESSOR(configattr, CONFIGATTR, int) +/* Device class for ISA bridges. */ +extern devclass_t isab_devclass; + extern intrmask_t isa_irq_pending(void); extern intrmask_t isa_irq_mask(void); #ifdef __i386__ diff --git a/sys/bus/mca/mca_bus.c b/sys/bus/mca/mca_bus.c index 1492f14c04..4730a9cc9b 100644 --- a/sys/bus/mca/mca_bus.c +++ b/sys/bus/mca/mca_bus.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mca/mca_bus.c,v 1.7.2.1 2000/03/17 23:55:48 peter Exp $ - * $DragonFly: src/sys/bus/mca/Attic/mca_bus.c,v 1.3 2003/08/07 21:16:46 dillon Exp $ + * $DragonFly: src/sys/bus/mca/Attic/mca_bus.c,v 1.4 2004/02/21 06:37:05 dillon Exp $ */ /* @@ -543,6 +543,19 @@ mca_delete_resource(device_t dev, device_t child, int type, int rid) resource_list_delete(rl, type, rid); } +static struct resource_list * +mca_get_resource_list (device_t dev, device_t child) +{ + struct mca_device * m_dev = device_get_ivars(child); + struct resource_list * rl = &m_dev->rl; + + if (!rl) + return (NULL); + + return (rl); +} + + static device_method_t mca_methods[] = { /* Device interface */ DEVMETHOD(device_probe, mca_probe), @@ -557,16 +570,17 @@ static device_method_t mca_methods[] = { DEVMETHOD(bus_read_ivar, mca_read_ivar), DEVMETHOD(bus_write_ivar, mca_write_ivar), DEVMETHOD(bus_driver_added, bus_generic_driver_added), - DEVMETHOD(bus_alloc_resource, mca_alloc_resource), - DEVMETHOD(bus_release_resource, mca_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_get_resource_list,mca_get_resource_list), + DEVMETHOD(bus_alloc_resource, mca_alloc_resource), + DEVMETHOD(bus_release_resource, mca_release_resource), DEVMETHOD(bus_set_resource, mca_set_resource), DEVMETHOD(bus_get_resource, mca_get_resource), DEVMETHOD(bus_delete_resource, mca_delete_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), { 0, 0 } }; diff --git a/sys/bus/pci/i386/pcibus.c b/sys/bus/pci/i386/pcibus.c index e3042e515d..523a6bd4fc 100644 --- a/sys/bus/pci/i386/pcibus.c +++ b/sys/bus/pci/i386/pcibus.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/pcibus.c,v 1.57.2.12 2003/08/07 06:19:26 imp Exp $ - * $DragonFly: src/sys/bus/pci/i386/pcibus.c,v 1.9 2004/02/14 19:54:40 dillon Exp $ + * $DragonFly: src/sys/bus/pci/i386/pcibus.c,v 1.10 2004/02/21 06:37:06 dillon Exp $ * */ @@ -305,7 +305,7 @@ nexus_pcib_identify(driver_t *driver, device_t parent) for (slot = 0; slot <= PCI_SLOTMAX; slot++) { func = 0; hdrtype = nexus_pcib_read_config(0, bus, slot, func, - PCIR_HEADERTYPE, 1); + PCIR_HDRTYPE, 1); if ((hdrtype & ~PCIM_MFDEV) > 2) continue; if (hdrtype & PCIM_MFDEV) diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index dda6f41715..1b983277c1 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pci.c,v 1.141.2.15 2002/04/30 17:48:18 tmm Exp $ - * $DragonFly: src/sys/bus/pci/pci.c,v 1.16 2004/02/16 18:51:01 joerg Exp $ + * $DragonFly: src/sys/bus/pci/pci.c,v 1.17 2004/02/21 06:37:05 dillon Exp $ * */ @@ -73,7 +73,7 @@ #include #endif /* APIC_IO */ -static devclass_t pci_devclass; +devclass_t pci_devclass; static void pci_read_extcap(device_t dev, pcicfgregs *cfg); @@ -360,7 +360,7 @@ pci_read_device(device_t pcib, int b, int s, int f, int width) cfg->subclass = REG(PCIR_SUBCLASS, 1); cfg->progif = REG(PCIR_PROGIF, 1); cfg->revid = REG(PCIR_REVID, 1); - cfg->hdrtype = REG(PCIR_HEADERTYPE, 1); + cfg->hdrtype = REG(PCIR_HDRTYPE, 1); cfg->cachelnsz = REG(PCIR_CACHELNSZ, 1); cfg->lattimer = REG(PCIR_LATTIMER, 1); cfg->intpin = REG(PCIR_INTPIN, 1); @@ -510,7 +510,7 @@ pci_freecfg(struct pci_devinfo *dinfo) /* * PCI power manangement */ -static int +int pci_set_powerstate_method(device_t dev, device_t child, int state) { struct pci_devinfo *dinfo = device_get_ivars(child); @@ -553,7 +553,7 @@ pci_set_powerstate_method(device_t dev, device_t child, int state) return(result); } -static int +int pci_get_powerstate_method(device_t dev, device_t child) { struct pci_devinfo *dinfo = device_get_ivars(child); @@ -611,42 +611,79 @@ pci_clear_command_bit(device_t dev, device_t child, u_int16_t bit) PCI_WRITE_CONFIG(dev, child, PCIR_COMMAND, command, 2); } -static void +int pci_enable_busmaster_method(device_t dev, device_t child) { pci_set_command_bit(dev, child, PCIM_CMD_BUSMASTEREN); + return(0); } -static void +int pci_disable_busmaster_method(device_t dev, device_t child) { pci_clear_command_bit(dev, child, PCIM_CMD_BUSMASTEREN); + return(0); } -static void +int pci_enable_io_method(device_t dev, device_t child, int space) { + uint16_t command; + uint16_t bit; + char *error; + + bit = 0; + error = NULL; + switch(space) { case SYS_RES_IOPORT: - pci_set_command_bit(dev, child, PCIM_CMD_PORTEN); + bit = PCIM_CMD_PORTEN; + error = "port"; break; case SYS_RES_MEMORY: - pci_set_command_bit(dev, child, PCIM_CMD_MEMEN); + bit = PCIM_CMD_MEMEN; + error = "memory"; break; + default: + return(EINVAL); } + pci_set_command_bit(dev, child, bit); + command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2); + if (command & bit) + return(0); + device_printf(child, "failed to enable %s mapping!\n", error); + return(ENXIO); } -static void +int pci_disable_io_method(device_t dev, device_t child, int space) { + uint16_t command; + uint16_t bit; + char *error; + + bit = 0; + error = NULL; + switch(space) { case SYS_RES_IOPORT: - pci_clear_command_bit(dev, child, PCIM_CMD_PORTEN); + bit = PCIM_CMD_PORTEN; + error = "port"; break; case SYS_RES_MEMORY: - pci_clear_command_bit(dev, child, PCIM_CMD_MEMEN); + bit = PCIM_CMD_MEMEN; + error = "memory"; break; + default: + return (EINVAL); } + pci_clear_command_bit(dev, child, bit); + command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2); + if (command & bit) { + device_printf(child, "failed to disable %s mapping!\n", error); + return (ENXIO); + } + return (0); } /* @@ -1247,16 +1284,22 @@ pci_add_map(device_t pcib, int b, int s, int f, int reg, } static void -pci_add_resources(device_t pcib, int b, int s, int f, device_t dev) +pci_add_resources(device_t pcib, device_t bus, device_t dev) { struct pci_devinfo *dinfo = device_get_ivars(dev); pcicfgregs *cfg = &dinfo->cfg; struct resource_list *rl = &dinfo->resources; struct pci_quirk *q; - int i; + int b, i, f, s; +#if 0 /* WILL BE USED WITH ADDITIONAL IMPORT FROM FREEBSD-5 XXX */ + int irq; +#endif + b = cfg->bus; + s = cfg->slot; + f = cfg->func; for (i = 0; i < cfg->nummaps;) { - i += pci_add_map(pcib, b, s, f, PCIR_MAPS + i*4, rl); + i += pci_add_map(pcib, b, s, f, PCIR_BAR(i),rl); } for (q = &pci_quirks[0]; q->devid; q++) { @@ -1270,32 +1313,48 @@ pci_add_resources(device_t pcib, int b, int s, int f, device_t dev) cfg->intline, cfg->intline, 1); } -static void -pci_add_children(device_t dev, int busno) +void +pci_add_children(device_t dev, int busno, size_t dinfo_size) { +#define REG(n, w) PCIB_READ_CONFIG(pcib, busno, s, f, n, w) device_t pcib = device_get_parent(dev); + struct pci_devinfo *dinfo; int maxslots; - int s, f; + int s, f, pcifunchigh; + uint8_t hdrtype; + + KKASSERT(dinfo_size >= sizeof(struct pci_devinfo)); maxslots = PCIB_MAXSLOTS(pcib); for (s = 0; s <= maxslots; s++) { - int pcifunchigh = 0; + pcifunchigh = 0; + f = 0; + hdrtype = REG(PCIR_HDRTYPE, 1); + if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) + continue; + if (hdrtype & PCIM_MFDEV) + pcifunchigh = PCI_FUNCMAX; for (f = 0; f <= pcifunchigh; f++) { - struct pci_devinfo *dinfo = - pci_read_device(pcib, busno, s, f, sizeof *dinfo); + dinfo = pci_read_device(pcib, busno, s, f, dinfo_size); if (dinfo != NULL) { - if (dinfo->cfg.mfdev) - pcifunchigh = 7; - - pci_print_verbose(dinfo); - dinfo->cfg.dev = device_add_child(dev, NULL, -1); - device_set_ivars(dinfo->cfg.dev, dinfo); - pci_add_resources(pcib, busno, s, f, - dinfo->cfg.dev); + pci_add_child(dev, dinfo); } } } +#undef REG +} + +void +pci_add_child(device_t bus, struct pci_devinfo *dinfo) +{ + device_t pcib; + + pcib = device_get_parent(bus); + dinfo->cfg.dev = device_add_child(bus, NULL, -1); + device_set_ivars(dinfo->cfg.dev, dinfo); + pci_add_resources(pcib, bus, dinfo->cfg.dev); + pci_print_verbose(dinfo); } static int @@ -1317,7 +1376,7 @@ pci_probe(device_t dev) busno = pcib_get_bus(dev); if (busno < 0) return ENXIO; - pci_add_children(dev, busno); + pci_add_children(dev, busno, sizeof(struct pci_devinfo)); if (!once) { make_dev(&pcicdev, 0, UID_ROOT, GID_WHEEL, 0644, "pci"); @@ -1327,6 +1386,26 @@ pci_probe(device_t dev) return 0; } +static int +pci_attach(device_t dev) +{ + int busno; + + /* + * Since there can be multiple independantly numbered PCI + * busses on some large alpha systems, we can't use the unit + * number to decide what bus we are probing. We ask the parent + * pcib what our bus number is. + */ + busno = pcib_get_bus(dev); + if (bootverbose) + device_printf(dev, "physical bus=%d\n", busno); + + pci_add_children(dev, busno, sizeof(struct pci_devinfo)); + + return (bus_generic_attach(dev)); +} + static int pci_print_resources(struct resource_list *rl, const char *name, int type, const char *format) @@ -1355,7 +1434,7 @@ pci_print_resources(struct resource_list *rl, const char *name, int type, return retval; } -static int +int pci_print_child(device_t dev, device_t child) { struct pci_devinfo *dinfo; @@ -1383,7 +1462,7 @@ pci_print_child(device_t dev, device_t child) return (retval); } -static void +void pci_probe_nomatch(device_t dev, device_t child) { struct pci_devinfo *dinfo; @@ -1608,13 +1687,25 @@ pci_get_resource(device_t dev, device_t child, int type, int rid, return 0; } -static void +void pci_delete_resource(device_t dev, device_t child, int type, int rid) { printf("pci_delete_resource: PCI resources can not be deleted\n"); } -static u_int32_t +struct resource_list * +pci_get_resource_list (device_t dev, device_t child) +{ + struct pci_devinfo * dinfo = device_get_ivars(child); + struct resource_list * rl = &dinfo->resources; + + if (!rl) + return (NULL); + + return (rl); +} + +u_int32_t pci_read_config_method(device_t dev, device_t child, int reg, int width) { struct pci_devinfo *dinfo = device_get_ivars(child); @@ -1625,7 +1716,7 @@ pci_read_config_method(device_t dev, device_t child, int reg, int width) reg, width); } -static void +void pci_write_config_method(device_t dev, device_t child, int reg, u_int32_t val, int width) { @@ -1637,6 +1728,44 @@ pci_write_config_method(device_t dev, device_t child, int reg, reg, val, width); } +int +pci_child_location_str_method(device_t cbdev, device_t child, char *buf, + size_t buflen) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(child); + snprintf(buf, buflen, "slot=%d function=%d", pci_get_slot(child), + pci_get_function(child)); + return (0); +} + +int +pci_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, + size_t buflen) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + snprintf(buf, buflen, "vendor=0x%04x device=0x%04x subvendor=0x%04x " + "subdevice=0x%04x class=0x%02x%02x%02x", cfg->vendor, cfg->device, + cfg->subvendor, cfg->subdevice, cfg->baseclass, cfg->subclass, + cfg->progif); + return (0); +} + +int +pci_assign_interrupt_method(device_t dev, device_t child) +{ + struct pci_devinfo *dinfo = device_get_ivars(child); + pcicfgregs *cfg = &dinfo->cfg; + + return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child, + cfg->intpin)); +} + static int pci_modevent(module_t mod, int what, void *arg) { @@ -1652,13 +1781,44 @@ pci_modevent(module_t mod, int what, void *arg) return 0; } +int +pci_resume(device_t dev) +{ + int numdevs; + int i; + device_t *children; + device_t child; + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + device_get_children(dev, &children, &numdevs); + + for (i = 0; i < numdevs; i++) { + child = children[i]; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { + cfg->intline = PCI_ASSIGN_INTERRUPT(dev, child); + if (PCI_INTERRUPT_VALID(cfg->intline)) { + pci_write_config(child, PCIR_INTLINE, + cfg->intline, 1); + } + } + } + + free(children, M_TEMP); + + return (bus_generic_resume(dev)); +} + static device_method_t pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pci_probe), - DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_attach, pci_attach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_resume, pci_resume), /* Bus interface */ DEVMETHOD(bus_print_child, pci_print_child), @@ -1666,15 +1826,19 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_read_ivar, pci_read_ivar), DEVMETHOD(bus_write_ivar, pci_write_ivar), DEVMETHOD(bus_driver_added, bus_generic_driver_added), - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + DEVMETHOD(bus_get_resource_list,pci_get_resource_list), DEVMETHOD(bus_set_resource, pci_set_resource), DEVMETHOD(bus_get_resource, pci_get_resource), DEVMETHOD(bus_delete_resource, pci_delete_resource), + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), + DEVMETHOD(bus_child_location_str, pci_child_location_str_method), /* PCI interface */ DEVMETHOD(pci_read_config, pci_read_config_method), @@ -1685,6 +1849,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_disable_io, pci_disable_io_method), DEVMETHOD(pci_get_powerstate, pci_get_powerstate_method), DEVMETHOD(pci_set_powerstate, pci_set_powerstate_method), + DEVMETHOD(pci_assign_interrupt, pci_assign_interrupt_method), { 0, 0 } }; diff --git a/sys/bus/pci/pci_compat.c b/sys/bus/pci/pci_compat.c index 8a32155535..f3066de3f0 100644 --- a/sys/bus/pci/pci_compat.c +++ b/sys/bus/pci/pci_compat.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pci_compat.c,v 1.35.2.1 2001/10/14 21:14:14 luigi Exp $ - * $DragonFly: src/sys/bus/pci/pci_compat.c,v 1.4 2004/01/07 18:13:19 joerg Exp $ + * $DragonFly: src/sys/bus/pci/pci_compat.c,v 1.5 2004/02/21 06:37:05 dillon Exp $ * */ @@ -123,12 +123,10 @@ pci_map_int_right(pcici_t cfg, pci_inthand_t *handler, void *arg, int resflags = RF_SHAREABLE|RF_ACTIVE; void *ih; -#ifdef INTR_FAST if (intflags & INTR_FAST) - flags |= INTR_TYPE_FAST; + flags |= INTR_FAST; if (intflags & INTR_EXCL) resflags &= ~RF_SHAREABLE; -#endif res = bus_alloc_resource(cfg->dev, SYS_RES_IRQ, &rid, irq, irq, 1, resflags); diff --git a/sys/bus/pci/pci_if.m b/sys/bus/pci/pci_if.m index 1c5e92a9b6..07058097da 100644 --- a/sys/bus/pci/pci_if.m +++ b/sys/bus/pci/pci_if.m @@ -24,7 +24,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/sys/pci/pci_if.m,v 1.2.2.1 2001/07/21 22:40:26 imp Exp $ -# $DragonFly: src/sys/bus/pci/pci_if.m,v 1.3 2003/11/17 00:54:39 asmodai Exp $ +# $DragonFly: src/sys/bus/pci/pci_if.m,v 1.4 2004/02/21 06:37:05 dillon Exp $ # #include @@ -57,28 +57,34 @@ METHOD int set_powerstate { int state; }; -METHOD void enable_busmaster { +METHOD int enable_busmaster { device_t dev; device_t child; }; -METHOD void disable_busmaster { +METHOD int disable_busmaster { device_t dev; device_t child; }; -METHOD void enable_io { +METHOD int enable_io { device_t dev; device_t child; int space; }; -METHOD void disable_io { +METHOD int disable_io { device_t dev; device_t child; int space; }; +METHOD int assign_interrupt { + device_t dev; + device_t child; +}; + + # # Route an interrupt. Returns a value suitable for stuffing into # a device's interrupt register. diff --git a/sys/bus/pci/pci_private.h b/sys/bus/pci/pci_private.h index cd9c8ba2a0..db2ef32bac 100644 --- a/sys/bus/pci/pci_private.h +++ b/sys/bus/pci/pci_private.h @@ -23,12 +23,45 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $DragonFly: src/sys/bus/pci/pci_private.h,v 1.1 2004/02/06 23:09:36 joerg Exp $ + * $DragonFly: src/sys/bus/pci/pci_private.h,v 1.2 2004/02/21 06:37:05 dillon Exp $ * */ -void pci_print_verbose(struct pci_devinfo *); +extern devclass_t pci_devclass; + struct pci_devinfo *pci_read_device(device_t, int, int, int, int); -int pci_freecfg(struct pci_devinfo *); -int pci_read_ivar(device_t, device_t, int, uintptr_t *); -int pci_write_ivar(device_t, device_t, int, uintptr_t); +struct resource_list *pci_get_resource_list (device_t dev, device_t child); +static struct resource *pci_alloc_resource(device_t dev, device_t child, + int type, int *rid, u_long start, u_long end, + u_long count, u_int flags); + + +u_int32_t pci_read_config_method(device_t dev, device_t child, + int reg, int width); +void pci_write_config_method(device_t dev, device_t child, + int reg, u_int32_t val, int width); + +void pci_delete_resource(device_t dev, device_t child, int type, int rid); +void pci_print_verbose(struct pci_devinfo *); +void pci_probe_nomatch(device_t dev, device_t child); +void pci_add_children(device_t dev, int busno, size_t dinfo_size); +void pci_add_child(device_t bus, struct pci_devinfo *dinfo); +int pci_freecfg(struct pci_devinfo *); +int pci_read_ivar(device_t, device_t, int, uintptr_t *); +int pci_write_ivar(device_t, device_t, int, uintptr_t); +int pci_resume(device_t dev); +int pci_print_child(device_t dev, device_t child); +int pci_assign_interrupt_method(device_t dev, device_t child); +int pci_set_powerstate_method(device_t dev, device_t child, int state); +int pci_get_powerstate_method(device_t dev, device_t child); +int pci_enable_busmaster_method(device_t dev, device_t child); +int pci_disable_busmaster_method(device_t dev, device_t child); +int pci_enable_io_method(device_t dev, device_t child, int space); +int pci_disable_io_method(device_t dev, device_t child, int space); + +int pci_child_pnpinfo_str_method(device_t cbdev, device_t child, + char *buf, size_t buflen); +int pci_child_location_str_method(device_t cbdev, device_t child, + char *buf, size_t buflen); + + diff --git a/sys/bus/pci/pcireg.h b/sys/bus/pci/pcireg.h index 91e06091fc..629ff5996a 100644 --- a/sys/bus/pci/pcireg.h +++ b/sys/bus/pci/pcireg.h @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pcireg.h,v 1.24.2.5 2002/08/31 10:06:51 gibbs Exp $ - * $DragonFly: src/sys/bus/pci/pcireg.h,v 1.4 2004/02/16 18:49:55 joerg Exp $ + * $DragonFly: src/sys/bus/pci/pcireg.h,v 1.5 2004/02/21 06:37:05 dillon Exp $ * */ @@ -44,6 +44,7 @@ #define PCI_SLOTMAX 31 #define PCI_FUNCMAX 7 #define PCI_REGMAX 255 +#define PCI_MAXHDRTYPE 2 /* PCI config header registers for all devices */ @@ -77,14 +78,37 @@ #define PCIR_CLASS 0x0b #define PCIR_CACHELNSZ 0x0c #define PCIR_LATTIMER 0x0d -#define PCIR_HEADERTYPE 0x0e -#define PCIM_MFDEV 0x80 +#define PCIR_HDRTYPE 0x0e +#define PCIM_HDRTYPE 0x7f +#define PCIM_HDRTYPE_NORMAL 0x00 +#define PCIM_HDRTYPE_BRIDGE 0x01 +#define PCIM_HDRTYPE_CARDBUS 0x02 +#define PCIM_MFDEV 0x80 #define PCIR_BIST 0x0f +/* Capability Identification Numbers */ +#define PCIY_PMG 0x01 /* PCI Power Management */ +#define PCIY_AGP 0x02 /* AGP */ +#define PCIY_VPD 0x03 /* Vital Product Data */ +#define PCIY_SLOTID 0x04 /* Slot Identification */ +#define PCIY_MSI 0x05 /* Message Signaled Interrupts */ +#define PCIY_CHSWP 0x06 /* CompactPCI Hot Swap */ +#define PCIY_PCIX 0x07 /* PCI-X */ +#define PCIY_HT 0x08 /* HyperTransport */ +#define PCIY_VENDOR 0x09 /* Vendor Unique */ +#define PCIY_DEBUG 0x0a /* Debug port */ +#define PCIY_CRES 0x0b /* CompactPCI central resource control */ +#define PCIY_HOTPLUG 0x0c /* PCI Hot-Plug */ +#define PCIY_AGP8X 0x0e /* AGP 8x */ +#define PCIY_SECDEV 0x0f /* Secure Device */ +#define PCIY_EXPRESS 0x10 /* PCI Express */ +#define PCIY_MSIX 0x11 /* MSI-X */ + /* config registers for header type 0 devices */ -#define PCIR_MAPS 0x10 -#define PCIR_BARS PCIR_MAPS +#define PCIR_BARS 0x10 +#define PCIR_BAR(x) (PCIR_BARS + (x) * 4) +#define PCIR_MAPS PCIR_BARS /* DEPRECATED XXX */ #define PCIR_BAR(x) (PCIR_BARS + (x) * 4) #define PCIR_CARDBUSCIS 0x28 #define PCIR_SUBVEND_0 0x2c @@ -99,7 +123,7 @@ /* config registers for header type 1 devices */ -#define PCIR_SECSTAT_1 0 /**/ +#define PCIR_SECSTAT_1 0x1e #define PCIR_PRIBUS_1 0x18 #define PCIR_SECBUS_1 0x19 @@ -108,18 +132,21 @@ #define PCIR_IOBASEL_1 0x1c #define PCIR_IOLIMITL_1 0x1d -#define PCIR_IOBASEH_1 0 /**/ -#define PCIR_IOLIMITH_1 0 /**/ +#define PCIR_IOBASEH_1 0x30 +#define PCIR_IOLIMITH_1 0x32 +#define PCIM_BRIO_16 0x0 +#define PCIM_BRIO_32 0x1 +#define PCIM_BRIO_MASK 0xf #define PCIR_MEMBASE_1 0x20 #define PCIR_MEMLIMIT_1 0x22 #define PCIR_PMBASEL_1 0x24 #define PCIR_PMLIMITL_1 0x26 -#define PCIR_PMBASEH_1 0 /**/ -#define PCIR_PMLIMITH_1 0 /**/ +#define PCIR_PMBASEH_1 0x28 +#define PCIR_PMLIMITH_1 0x2c -#define PCIR_BRIDGECTL_1 0 /**/ +#define PCIR_BRIDGECTL_1 0x3e #define PCIR_SUBVEND_1 0x34 #define PCIR_SUBDEV_1 0x36 @@ -290,6 +317,32 @@ #define PCIR_POWER_DATA 0x7 +/* PCI Message Signalled Interrupts (MSI) */ +#define PCIR_MSI_CTRL 0x2 +#define PCIM_MSICTRL_VECTOR 0x0100 +#define PCIM_MSICTRL_64BIT 0x0080 +#define PCIM_MSICTRL_MME_MASK 0x0070 +#define PCIM_MSICTRL_MME_1 0x0000 +#define PCIM_MSICTRL_MME_2 0x0010 +#define PCIM_MSICTRL_MME_4 0x0020 +#define PCIM_MSICTRL_MME_8 0x0030 +#define PCIM_MSICTRL_MME_16 0x0040 +#define PCIM_MSICTRL_MME_32 0x0050 +#define PCIM_MSICTRL_MMC_MASK 0x000E +#define PCIM_MSICTRL_MMC_1 0x0000 +#define PCIM_MSICTRL_MMC_2 0x0002 +#define PCIM_MSICTRL_MMC_4 0x0004 +#define PCIM_MSICTRL_MMC_8 0x0006 +#define PCIM_MSICTRL_MMC_16 0x0008 +#define PCIM_MSICTRL_MMC_32 0x000A +#define PCIM_MSICTRL_MSI_ENABLE 0x0001 +#define PCIR_MSI_ADDR 0x4 +#define PCIR_MSI_ADDR_HIGH 0x8 +#define PCIR_MSI_DATA 0x8 +#define PCIR_MSI_DATA_64BIT 0xc +#define PCIR_MSI_MASK 0x10 +#define PCIR_MSI_PENDING 0x14 + /* PCI-X definitions */ #define PCIXR_COMMAND 0x96 #define PCIXR_DEVADDR 0x98 diff --git a/sys/bus/pci/pcisupport.c b/sys/bus/pci/pcisupport.c index f6163002a3..9fc1f157a3 100644 --- a/sys/bus/pci/pcisupport.c +++ b/sys/bus/pci/pcisupport.c @@ -1,7 +1,7 @@ /************************************************************************** ** ** $FreeBSD: src/sys/pci/pcisupport.c,v 1.154.2.15 2003/04/29 15:55:06 simokawa Exp $ -** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.9 2004/02/10 07:26:06 dillon Exp $ +** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.10 2004/02/21 06:37:05 dillon Exp $ ** ** Device driver for DEC/INTEL PCI chipsets. ** @@ -59,6 +59,7 @@ #include #include "pcib_if.h" +#include "pcib_private.h" /*--------------------------------------------------------- ** @@ -786,7 +787,7 @@ static int pcib_probe(device_t dev) * the later motherboard bridge bus has already been probed and refuse * to probe it. The result: disappearing busses! */ -static int pcib_attach(device_t dev) +int pcib_attach(device_t dev) { u_int8_t secondary; device_t child; @@ -802,8 +803,8 @@ static int pcib_attach(device_t dev) return 0; } -static int -pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) +int +pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { switch (which) { case PCIB_IVAR_BUS: @@ -813,7 +814,7 @@ pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) return (ENOENT); } -static int +int pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) { switch (which) { @@ -824,13 +825,13 @@ pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) return (ENOENT); } -static int +int pcib_maxslots(device_t dev) { return 31; } -static u_int32_t +u_int32_t pcib_read_config(device_t dev, int b, int s, int f, int reg, int width) { @@ -842,9 +843,9 @@ pcib_read_config(device_t dev, int b, int s, int f, b, s, f, reg, width); } -static void +void pcib_write_config(device_t dev, int b, int s, int f, - int reg, int val, int width) + int reg, uint32_t val, int width) { /* * Pass through to the next ppb up the chain (i.e. our @@ -857,7 +858,7 @@ pcib_write_config(device_t dev, int b, int s, int f, /* * Route an interrupt across a PCI bridge. */ -static int +int pcib_route_interrupt(device_t pcib, device_t dev, int pin) { device_t bus; @@ -891,6 +892,87 @@ pcib_route_interrupt(device_t pcib, device_t dev, int pin) return(intnum); } +/* + * Try to read the bus number of a host-PCI bridge using appropriate config + * registers. + */ +int +host_pcib_get_busno(pci_read_config_fn read_config, int bus, int slot, int func, + uint8_t *busnum) +{ + uint32_t id; + + id = read_config(bus, slot, func, PCIR_DEVVENDOR, 4); + if (id == 0xffffffff) + return (0); + + switch (id) { + case 0x12258086: + /* Intel 824?? */ + /* XXX This is a guess */ + /* *busnum = read_config(bus, slot, func, 0x41, 1); */ + *busnum = bus; + break; + case 0x84c48086: + /* Intel 82454KX/GX (Orion) */ + *busnum = read_config(bus, slot, func, 0x4a, 1); + break; + case 0x84ca8086: + /* + * For the 450nx chipset, there is a whole bundle of + * things pretending to be host bridges. The MIOC will + * be seen first and isn't really a pci bridge (the + * actual busses are attached to the PXB's). We need to + * read the registers of the MIOC to figure out the + * bus numbers for the PXB channels. + * + * Since the MIOC doesn't have a pci bus attached, we + * pretend it wasn't there. + */ + return (0); + case 0x84cb8086: + switch (slot) { + case 0x12: + /* Intel 82454NX PXB#0, Bus#A */ + *busnum = read_config(bus, 0x10, func, 0xd0, 1); + break; + case 0x13: + /* Intel 82454NX PXB#0, Bus#B */ + *busnum = read_config(bus, 0x10, func, 0xd1, 1) + 1; + break; + case 0x14: + /* Intel 82454NX PXB#1, Bus#A */ + *busnum = read_config(bus, 0x10, func, 0xd3, 1); + break; + case 0x15: + /* Intel 82454NX PXB#1, Bus#B */ + *busnum = read_config(bus, 0x10, func, 0xd4, 1) + 1; + break; + } + break; + + /* ServerWorks -- vendor 0x1166 */ + case 0x00051166: + case 0x00061166: + case 0x00081166: + case 0x00091166: + case 0x00101166: + case 0x00111166: + case 0x00171166: + case 0x01011166: + case 0x010f1014: + case 0x02011166: + case 0x03021014: + *busnum = read_config(bus, slot, func, 0x44, 1); + break; + default: + /* Don't know how to read bus number. */ + return 0; + } + + return 1; +} + static device_method_t pcib_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pcib_probe), @@ -927,7 +1009,7 @@ static driver_t pcib_driver = { sizeof(int), }; -static devclass_t pcib_devclass; +devclass_t pcib_devclass; DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0); @@ -1098,7 +1180,7 @@ static driver_t isab_driver = { 1, }; -static devclass_t isab_devclass; +devclass_t isab_devclass; DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0); diff --git a/sys/conf/files b/sys/conf/files index 5baa75b484..4de1be4226 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/files,v 1.340.2.137 2003/06/04 17:10:30 sam Exp $ -# $DragonFly: src/sys/conf/files,v 1.51 2004/02/19 15:05:26 joerg Exp $ +# $DragonFly: src/sys/conf/files,v 1.52 2004/02/21 06:37:06 dillon Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -663,7 +663,7 @@ kern/subr_log.c standard kern/libmchain/subr_mchain.c optional libmchain kern/subr_module.c standard kern/subr_param.c standard -kern/subr_power.c optional acpica +kern/subr_power.c standard # XXX drhodus kern/subr_prf.c standard kern/subr_prof.c standard diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 4665a06822..137bcacdb5 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -2,7 +2,7 @@ # files marked standard are always included. # # $FreeBSD: src/sys/conf/files.i386,v 1.307.2.38 2003/01/02 20:41:33 kan Exp $ -# $DragonFly: src/sys/conf/Attic/files.i386,v 1.18 2004/02/19 15:48:26 joerg Exp $ +# $DragonFly: src/sys/conf/Attic/files.i386,v 1.19 2004/02/21 06:37:06 dillon Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -207,6 +207,9 @@ i386/i386/mem.c standard i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mpapic.c optional smp +# temporarily not in build until we get the 'apic' option working on UP +#i386/i386/io_apic.c optional smp +#i386/i386/local_apic.c optional smp i386/i386/mpboot.s optional smp i386/i386/mplock.s optional smp i386/i386/nexus.c standard @@ -280,7 +283,7 @@ dev/video/pcvt/i386/pcvt_kbd.c optional vt dev/video/pcvt/i386/pcvt_out.c optional vt dev/video/pcvt/i386/pcvt_sup.c optional vt dev/video/pcvt/i386/pcvt_vtf.c optional vt -i386/isa/pmtimer.c optional acpica +i386/isa/pmtimer.c optional acpica acpica5 pmtimer # XXX drhodus i386/isa/prof_machdep.c optional profiling-routine dev/serial/rc/rc.c optional rc diff --git a/sys/cpu/i386/misc/in_cksum2.s b/sys/cpu/i386/misc/in_cksum2.s index 11255060e4..d120ac18f1 100644 --- a/sys/cpu/i386/misc/in_cksum2.s +++ b/sys/cpu/i386/misc/in_cksum2.s @@ -23,11 +23,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/cpu/i386/misc/in_cksum2.s,v 1.1 2004/02/14 02:09:26 dillon Exp $ + * $DragonFly: src/sys/cpu/i386/misc/in_cksum2.s,v 1.2 2004/02/21 06:37:07 dillon Exp $ */ #include /* miscellaneous asm macros */ -#include +#include #include #include "assym.s" diff --git a/sys/dev/acpica/Osd/OsdHardware.c b/sys/dev/acpica/Osd/OsdHardware.c index 824b291adc..ad226008c8 100644 --- a/sys/dev/acpica/Osd/OsdHardware.c +++ b/sys/dev/acpica/Osd/OsdHardware.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.10.2.1 2003/08/22 20:49:21 jhb Exp $ - * $DragonFly: src/sys/dev/acpica/Osd/Attic/OsdHardware.c,v 1.2 2004/02/13 00:25:17 joerg Exp $ + * $DragonFly: src/sys/dev/acpica/Osd/Attic/OsdHardware.c,v 1.3 2004/02/21 06:37:06 dillon Exp $ */ /* @@ -214,7 +214,7 @@ acpi_bus_number(ACPI_HANDLE root, ACPI_HANDLE curr, ACPI_PCI_ID *PciId) return (bus); subclass = pci_cfgregread(bus, slot, func, PCIR_SUBCLASS, 1); /* Find the header type, masking off the multifunction bit */ - header = pci_cfgregread(bus, slot, func, PCIR_HEADERTYPE, 1) & 0x7f; + header = pci_cfgregread(bus, slot, func, PCIR_HDRTYPE, 1) & 0x7f; if (header == 1 && subclass == PCIS_BRIDGE_PCI) bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_1, 1); if (header == 2 && subclass == PCIS_BRIDGE_CARDBUS) diff --git a/sys/dev/misc/puc/puc.c b/sys/dev/misc/puc/puc.c index 11988e44f0..56ed26e515 100644 --- a/sys/dev/misc/puc/puc.c +++ b/sys/dev/misc/puc/puc.c @@ -1,7 +1,7 @@ /* * $NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $ * $FreeBSD: src/sys/dev/puc/puc.c,v 1.3.2.5 2003/04/04 08:42:17 sobomax Exp $ - * $DragonFly: src/sys/dev/misc/puc/puc.c,v 1.4 2003/08/27 10:35:18 rob Exp $ + * $DragonFly: src/sys/dev/misc/puc/puc.c,v 1.5 2004/02/21 06:37:06 dillon Exp $ */ /*- @@ -161,7 +161,7 @@ puc_pci_probe(device_t dev) uint32_t v1, v2, d1, d2; const struct puc_device_description *desc; - if ((pci_read_config(dev, PCIR_HEADERTYPE, 1) & 0x7f) != 0) + if ((pci_read_config(dev, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) != 0) return (ENXIO); v1 = pci_read_config(dev, PCIR_VENDOR, 2); @@ -241,7 +241,7 @@ puc_pci_attach(device_t dev) sc->irqrid = rid; #ifdef PUC_FASTINTR irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, - INTR_TYPE_TTY | INTR_TYPE_FAST, puc_intr, sc, &sc->intr_cookie); + INTR_TYPE_TTY | INTR_FAST, puc_intr, sc, &sc->intr_cookie); #else irq_setup = ENXIO; #endif diff --git a/sys/dev/pccard/cardbus/cardbus.c b/sys/dev/pccard/cardbus/cardbus.c index 2a19fe5480..038baaaadb 100644 --- a/sys/dev/pccard/cardbus/cardbus.c +++ b/sys/dev/pccard/cardbus/cardbus.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.28 2002/11/27 17:30:41 imp Exp $ - * $DragonFly: src/sys/dev/pccard/cardbus/cardbus.c,v 1.1 2004/02/10 07:55:47 joerg Exp $ + * $DragonFly: src/sys/dev/pccard/cardbus/cardbus.c,v 1.2 2004/02/21 06:37:06 dillon Exp $ */ /* @@ -442,7 +442,7 @@ cardbus_read_device(device_t brdev, int b, int s, int f) cfg->subclass = REG(PCIR_SUBCLASS, 1); cfg->progif = REG(PCIR_PROGIF, 1); cfg->revid = REG(PCIR_REVID, 1); - cfg->hdrtype = REG(PCIR_HEADERTYPE, 1); + cfg->hdrtype = REG(PCIR_HDRTYPE, 1); cfg->cachelnsz = REG(PCIR_CACHELNSZ, 1); cfg->lattimer = REG(PCIR_LATTIMER, 1); cfg->intpin = REG(PCIR_INTPIN, 1); diff --git a/sys/dev/raid/aac/aac_pci.c b/sys/dev/raid/aac/aac_pci.c index 3f56efb509..6a48e9b7cf 100644 --- a/sys/dev/raid/aac/aac_pci.c +++ b/sys/dev/raid/aac/aac_pci.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/aac/aac_pci.c,v 1.3.2.18 2003/04/08 13:22:08 scottl Exp $ - * $DragonFly: src/sys/dev/raid/aac/aac_pci.c,v 1.3 2003/08/07 21:17:07 dillon Exp $ + * $DragonFly: src/sys/dev/raid/aac/aac_pci.c,v 1.4 2004/02/21 06:37:06 dillon Exp $ */ /* @@ -221,9 +221,6 @@ aac_pci_attach(device_t dev) device_printf(sc->aac_dev, "can't allocate interrupt\n"); goto out; } -#ifndef INTR_ENTROPY -#define INTR_ENTROPY 0 -#endif if (bus_setup_intr(sc->aac_dev, sc->aac_irq, INTR_TYPE_BIO|INTR_ENTROPY, aac_intr, sc, &sc->aac_intr)) { device_printf(sc->aac_dev, "can't set up interrupt\n"); diff --git a/sys/dev/raid/amr/amr_compat.h b/sys/dev/raid/amr/amr_compat.h index dc63dcf7a8..2b01331388 100644 --- a/sys/dev/raid/amr/amr_compat.h +++ b/sys/dev/raid/amr/amr_compat.h @@ -53,7 +53,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/amr/amr_compat.h,v 1.2.2.4 2002/11/11 13:19:10 emoore Exp $ - * $DragonFly: src/sys/dev/raid/amr/amr_compat.h,v 1.4 2004/02/13 01:33:19 joerg Exp $ + * $DragonFly: src/sys/dev/raid/amr/amr_compat.h,v 1.5 2004/02/21 06:37:06 dillon Exp $ */ /* * Backwards compatibility support. @@ -64,7 +64,6 @@ # include # include # include -# define INTR_ENTROPY 0 # define FREEBSD_4 # define bio buf diff --git a/sys/dev/raid/mlx/mlx_compat.h b/sys/dev/raid/mlx/mlx_compat.h index 99e1b41679..cbd54308cd 100644 --- a/sys/dev/raid/mlx/mlx_compat.h +++ b/sys/dev/raid/mlx/mlx_compat.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx_compat.h,v 1.1.2.1 2001/06/25 04:37:51 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx_compat.h,v 1.4 2004/02/13 01:33:19 joerg Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx_compat.h,v 1.5 2004/02/21 06:37:06 dillon Exp $ */ /* * Portability and compatibility interfaces. @@ -33,7 +33,6 @@ #if defined(__DragonFly__) || __FreeBSD_version < 500003 # include -# define INTR_ENTROPY 0 # include /* old buf style */ # include /* old buf style */ diff --git a/sys/dev/raid/twe/twe_compat.h b/sys/dev/raid/twe/twe_compat.h index 0f85b2a3c7..ba6b5bdb26 100644 --- a/sys/dev/raid/twe/twe_compat.h +++ b/sys/dev/raid/twe/twe_compat.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/twe/twe_compat.h,v 1.1.2.3 2002/03/07 09:57:02 msmith Exp $ - * $DragonFly: src/sys/dev/raid/twe/twe_compat.h,v 1.7 2004/02/13 01:33:19 joerg Exp $ + * $DragonFly: src/sys/dev/raid/twe/twe_compat.h,v 1.8 2004/02/21 06:37:06 dillon Exp $ */ /* * Portability and compatibility interfaces. @@ -136,7 +136,6 @@ #if defined(__DragonFly__) || __FreeBSD_version < 500003 # include -# define INTR_ENTROPY 0 # include /* old buf style */ # include diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c index bef9e06468..43132dcfcb 100644 --- a/sys/dev/serial/sio/sio.c +++ b/sys/dev/serial/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/sio.c,v 1.291.2.35 2003/05/18 08:51:15 murray Exp $ - * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.13 2004/01/30 05:42:15 dillon Exp $ + * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.14 2004/02/21 06:37:07 dillon Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -1203,7 +1203,7 @@ determined_type: ; RF_ACTIVE); if (com->irqres) { ret = BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres, - INTR_TYPE_TTY | INTR_TYPE_FAST, + INTR_TYPE_TTY | INTR_FAST, siointr, com, &com->cookie); if (ret) { ret = BUS_SETUP_INTR(device_get_parent(dev), dev, diff --git a/sys/i386/apic/apic_vector.s b/sys/i386/apic/apic_vector.s index c3b1b6b00c..43b1247779 100644 --- a/sys/i386/apic/apic_vector.s +++ b/sys/i386/apic/apic_vector.s @@ -1,11 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $ - * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.17 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.18 2004/02/21 06:37:08 dillon Exp $ */ -#include +#include #include #include "i386/isa/intr_machdep.h" diff --git a/sys/i386/include/apic.h b/sys/i386/apic/apicreg.h similarity index 99% rename from sys/i386/include/apic.h rename to sys/i386/apic/apicreg.h index 88d65204c1..1d09a61dec 100644 --- a/sys/i386/include/apic.h +++ b/sys/i386/apic/apicreg.h @@ -23,11 +23,11 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/apic.h,v 1.14.2.2 2003/03/21 21:46:15 jhb Exp $ - * $DragonFly: src/sys/i386/include/Attic/apic.h,v 1.4 2003/07/08 06:27:26 dillon Exp $ + * $DragonFly: src/sys/i386/apic/Attic/apicreg.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ */ -#ifndef _MACHINE_APIC_H_ -#define _MACHINE_APIC_H_ +#ifndef _MACHINE_APICREG_H_ +#define _MACHINE_APICREG_H_ /* * Local && I/O APIC definitions for Pentium P54C+ Built-in APIC. diff --git a/sys/i386/apic/apicvar.h b/sys/i386/apic/apicvar.h new file mode 100644 index 0000000000..42634515a6 --- /dev/null +++ b/sys/i386/apic/apicvar.h @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 2003 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.5 2003/11/14 22:21:30 peter Exp $ + * $DragonFly: src/sys/i386/apic/Attic/apicvar.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ + */ + +#ifndef _MACHINE_APICVAR_H_ +#define _MACHINE_APICVAR_H_ + +/* + * Local && I/O APIC variable definitions. + */ + +/* + * Layout of local APIC interrupt vectors: + * + * 0xff (255) +-------------+ + * | | 15 (Spurious / IPIs / Local Interrupts) + * 0xf0 (240) +-------------+ + * | | 14 (I/O Interrupts) + * 0xe0 (224) +-------------+ + * | | 13 (I/O Interrupts) + * 0xd0 (208) +-------------+ + * | | 12 (I/O Interrupts) + * 0xc0 (192) +-------------+ + * | | 11 (I/O Interrupts) + * 0xb0 (176) +-------------+ + * | | 10 (I/O Interrupts) + * 0xa0 (160) +-------------+ + * | | 9 (I/O Interrupts) + * 0x90 (144) +-------------+ + * | | 8 (I/O Interrupts / System Calls) + * 0x80 (128) +-------------+ + * | | 7 (I/O Interrupts) + * 0x70 (112) +-------------+ + * | | 6 (I/O Interrupts) + * 0x60 (96) +-------------+ + * | | 5 (I/O Interrupts) + * 0x50 (80) +-------------+ + * | | 4 (I/O Interrupts) + * 0x40 (64) +-------------+ + * | | 3 (I/O Interrupts) + * 0x30 (48) +-------------+ + * | | 2 (ATPIC Interrupts) + * 0x20 (32) +-------------+ + * | | 1 (Exceptions, traps, faults, etc.) + * 0x10 (16) +-------------+ + * | | 0 (Exceptions, traps, faults, etc.) + * 0x00 (0) +-------------+ + * + * Note: 0x80 needs to be handled specially and not allocated to an + * I/O device! + */ + +#define APIC_ID_ALL 0xff +#define APIC_IO_INTS (IDT_IO_INTS + 16) +#define APIC_NUM_IOINTS 192 + +#define APIC_LOCAL_INTS 240 + +/* XXX put APIC interrupt and IPI assignments here */ + +#define APIC_SPURIOUS_INT 255 + +#define LVT_LINT0 0 +#define LVT_LINT1 1 +#define LVT_TIMER 2 +#define LVT_ERROR 3 +#define LVT_PMC 4 +#define LVT_THERMAL 5 +#define LVT_MAX LVT_THERMAL + +#ifndef LOCORE + +#define APIC_IPI_DEST_SELF -1 +#define APIC_IPI_DEST_ALL -2 +#define APIC_IPI_DEST_OTHERS -3 + +/* + * An APIC enumerator is a psuedo bus driver that enumerates APIC's including + * CPU's and I/O APIC's. + */ +struct apic_enumerator { + const char *apic_name; + int (*apic_probe)(void); + int (*apic_probe_cpus)(void); + int (*apic_setup_local)(void); + int (*apic_setup_io)(void); + SLIST_ENTRY(apic_enumerator) apic_next; +}; + +#if 0 +inthand_t + IDTVEC(apic_isr1), IDTVEC(apic_isr2), IDTVEC(apic_isr3), + IDTVEC(apic_isr4), IDTVEC(apic_isr5), IDTVEC(apic_isr6), + IDTVEC(apic_isr7), IDTVEC(spuriousint); +#endif + +u_int apic_irq_to_idt(u_int irq); +u_int apic_idt_to_irq(u_int vector); +void apic_register_enumerator(struct apic_enumerator *enumerator); +void *ioapic_create(uintptr_t addr, int32_t id, int intbase); +int ioapic_disable_pin(void *cookie, u_int pin); +int ioapic_get_vector(void *cookie, u_int pin); +int ioapic_next_logical_cluster(void); +void ioapic_register(void *cookie); +int ioapic_remap_vector(void *cookie, u_int pin, int vector); +int ioapic_set_extint(void *cookie, u_int pin); +int ioapic_set_nmi(void *cookie, u_int pin); +int ioapic_set_polarity(void *cookie, u_int pin, char activehi); +int ioapic_set_triggermode(void *cookie, u_int pin, char edgetrigger); +int ioapic_set_smi(void *cookie, u_int pin); +void lapic_create(u_int apic_id, int boot_cpu); +void lapic_disable(void); +void lapic_dump(const char *str); +void lapic_enable_intr(u_int vector); +void lapic_eoi(void); +int lapic_id(void); +void lapic_init(uintptr_t addr); +int lapic_intr_pending(u_int vector); +void lapic_ipi_raw(register_t icrlo, u_int dest); +void lapic_ipi_vectored(u_int vector, int dest); +int lapic_ipi_wait(int delay); +void lapic_handle_intr(struct intrframe frame); +void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id); +int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked); +int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode); +int lapic_set_lvt_polarity(u_int apic_id, u_int lvt, u_char activehi); +int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, u_char edgetrigger); +void lapic_setup(void); + +#endif /* !LOCORE */ +#endif /* _MACHINE_APICVAR_H_ */ diff --git a/sys/i386/apic/mpapic.h b/sys/i386/apic/mpapic.h index 913c239496..11a09c2748 100644 --- a/sys/i386/apic/mpapic.h +++ b/sys/i386/apic/mpapic.h @@ -23,13 +23,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/mpapic.h,v 1.14.2.2 2000/09/30 02:49:34 ps Exp $ - * $DragonFly: src/sys/i386/apic/Attic/mpapic.h,v 1.5 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/apic/Attic/mpapic.h,v 1.6 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_MPAPIC_H_ #define _MACHINE_MPAPIC_H_ -#include "apic.h" +#include "apicreg.h" #include @@ -61,6 +61,7 @@ enum busTypes { #define IO_TO_ID(IO) (io_num_to_apic_id[IO]) #define ID_TO_IO(ID) (apic_id_to_logical[ID]) +#ifdef SMP /* * send an IPI INTerrupt containing 'vector' to CPUs in 'targetMap' @@ -85,4 +86,6 @@ all_but_self_ipi(int vector) return apic_ipi(APIC_DEST_ALLESELF, vector, APIC_DELMODE_FIXED); } +#endif + #endif /* _MACHINE_MPAPIC_H */ diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 3b9591c208..ed295665a4 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -24,7 +24,7 @@ * rights to redistribute these changes. * * $FreeBSD: src/sys/i386/i386/db_interface.c,v 1.48.2.1 2000/07/07 00:38:46 obrien Exp $ - * $DragonFly: src/sys/i386/i386/Attic/db_interface.c,v 1.9 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/db_interface.c,v 1.10 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -36,10 +36,8 @@ #include #include -#ifdef SMP #include #include /** CPUSTOP_ON_DDBBREAK */ -#endif #include #include diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s index db84e15a96..08ac86c259 100644 --- a/sys/i386/i386/exception.s +++ b/sys/i386/i386/exception.s @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $ - * $DragonFly: src/sys/i386/i386/Attic/exception.s,v 1.21 2004/01/15 00:03:08 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/exception.s,v 1.22 2004/02/21 06:37:07 dillon Exp $ */ #include "use_npx.h" @@ -41,9 +41,7 @@ #include #include #include -#ifdef SMP #include /** various SMP options */ -#endif #include "assym.s" diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index 048ccdc2a2..df430d6ce6 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.34 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.35 2004/02/21 06:37:07 dillon Exp $ */ #include @@ -64,7 +64,7 @@ #include #include #ifdef SMP -#include +#include #endif #include #include diff --git a/sys/i386/i386/in_cksum2.s b/sys/i386/i386/in_cksum2.s index 6682a055b8..f13ed8d5ed 100644 --- a/sys/i386/i386/in_cksum2.s +++ b/sys/i386/i386/in_cksum2.s @@ -23,11 +23,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/i386/i386/Attic/in_cksum2.s,v 1.1 2004/02/14 02:09:26 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/in_cksum2.s,v 1.2 2004/02/21 06:37:07 dillon Exp $ */ #include /* miscellaneous asm macros */ -#include +#include #include #include "assym.s" diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 1f36e746e2..1fd097df6c 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -23,17 +23,11 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.115.2.15 2003/03/14 21:22:35 jhb Exp $ - * $DragonFly: src/sys/i386/i386/Attic/mp_machdep.c,v 1.22 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/mp_machdep.c,v 1.23 2004/02/21 06:37:07 dillon Exp $ */ #include "opt_cpu.h" -#ifdef SMP -#include -#else -#error -#endif - #include #include #include @@ -55,7 +49,7 @@ #endif #include -#include +#include #include #include #include diff --git a/sys/i386/i386/mpboot.s b/sys/i386/i386/mpboot.s index 89ae8b6811..89a06cd652 100644 --- a/sys/i386/i386/mpboot.s +++ b/sys/i386/i386/mpboot.s @@ -32,11 +32,11 @@ * multiprocessor systems. * * $FreeBSD: src/sys/i386/i386/mpboot.s,v 1.13.2.3 2000/09/07 01:18:26 tegge Exp $ - * $DragonFly: src/sys/i386/i386/Attic/mpboot.s,v 1.6 2003/11/18 05:52:26 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/mpboot.s,v 1.7 2004/02/21 06:37:07 dillon Exp $ */ #include /* miscellaneous asm macros */ -#include +#include #include #include "assym.s" diff --git a/sys/i386/i386/mplock.s b/sys/i386/i386/mplock.s index 6967431398..76e5c583a8 100644 --- a/sys/i386/i386/mplock.s +++ b/sys/i386/i386/mplock.s @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/i386/i386/mplock.s,v 1.29.2.2 2000/05/16 06:58:06 dillon Exp $ - * $DragonFly: src/sys/i386/i386/Attic/mplock.s,v 1.11 2003/12/04 20:09:31 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/mplock.s,v 1.12 2004/02/21 06:37:07 dillon Exp $ * * Copyright (c) 2003 Matthew Dillon * All rights reserved. @@ -56,7 +56,7 @@ #include #include /** GRAB_LOPRIO */ -#include +#include #include "assym.s" diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c index 556678e5ef..56fb5b8926 100644 --- a/sys/i386/i386/nexus.c +++ b/sys/i386/i386/nexus.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/nexus.c,v 1.26.2.10 2003/02/22 13:16:45 imp Exp $ - * $DragonFly: src/sys/i386/i386/Attic/nexus.c,v 1.6 2004/01/14 07:16:37 joerg Exp $ + * $DragonFly: src/sys/i386/i386/Attic/nexus.c,v 1.7 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -533,7 +533,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, icflags = INTR_EXCL; driver = device_get_driver(child); - switch (flags & ~INTR_TYPE_FAST) { + switch (flags & ~INTR_FAST) { case INTR_TYPE_TTY: mask = &tty_imask; break; @@ -552,7 +552,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, default: panic("still using grody create_intr interface"); } - if (flags & INTR_TYPE_FAST) + if (flags & INTR_FAST) icflags |= INTR_FAST; /* diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 0c9f31615d..4341fea575 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -40,7 +40,7 @@ * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 * $FreeBSD: src/sys/i386/i386/pmap.c,v 1.250.2.18 2002/03/06 22:48:53 silby Exp $ - * $DragonFly: src/sys/i386/i386/Attic/pmap.c,v 1.30 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/pmap.c,v 1.31 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -102,7 +102,7 @@ #include #if defined(SMP) || defined(APIC_IO) #include -#include +#include #endif /* SMP || APIC_IO */ #include #include diff --git a/sys/i386/i386/pmap_inval.c b/sys/i386/i386/pmap_inval.c index 20a1006850..8244efa4f0 100644 --- a/sys/i386/i386/pmap_inval.c +++ b/sys/i386/i386/pmap_inval.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/i386/i386/Attic/pmap_inval.c,v 1.1 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/pmap_inval.c,v 1.2 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -53,7 +53,7 @@ #include #if defined(SMP) || defined(APIC_IO) #include -#include +#include #endif /* SMP || APIC_IO */ #include #include diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index 1ad5f23d2e..23330a9666 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/swtch.s,v 1.89.2.10 2003/01/23 03:36:24 ps Exp $ - * $DragonFly: src/sys/i386/i386/Attic/swtch.s,v 1.29 2003/12/20 05:52:26 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/swtch.s,v 1.30 2004/02/21 06:37:07 dillon Exp $ */ #include "use_npx.h" @@ -45,12 +45,10 @@ #include #include -#ifdef SMP #include #include /** GRAB_LOPRIO */ -#include +#include #include -#endif /* SMP */ #include "assym.s" diff --git a/sys/platform/pc32/include/apic.h b/sys/i386/include/apicreg.h similarity index 99% copy from sys/platform/pc32/include/apic.h copy to sys/i386/include/apicreg.h index 9aba13a92c..0bdf8d3d08 100644 --- a/sys/platform/pc32/include/apic.h +++ b/sys/i386/include/apicreg.h @@ -23,11 +23,11 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/apic.h,v 1.14.2.2 2003/03/21 21:46:15 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/include/Attic/apic.h,v 1.4 2003/07/08 06:27:26 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/apicreg.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ */ -#ifndef _MACHINE_APIC_H_ -#define _MACHINE_APIC_H_ +#ifndef _MACHINE_APICREG_H_ +#define _MACHINE_APICREG_H_ /* * Local && I/O APIC definitions for Pentium P54C+ Built-in APIC. diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h new file mode 100644 index 0000000000..231b85be76 --- /dev/null +++ b/sys/i386/include/apicvar.h @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 2003 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.5 2003/11/14 22:21:30 peter Exp $ + * $DragonFly: src/sys/i386/include/Attic/apicvar.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ + */ + +#ifndef _MACHINE_APICVAR_H_ +#define _MACHINE_APICVAR_H_ + +/* + * Local && I/O APIC variable definitions. + */ + +/* + * Layout of local APIC interrupt vectors: + * + * 0xff (255) +-------------+ + * | | 15 (Spurious / IPIs / Local Interrupts) + * 0xf0 (240) +-------------+ + * | | 14 (I/O Interrupts) + * 0xe0 (224) +-------------+ + * | | 13 (I/O Interrupts) + * 0xd0 (208) +-------------+ + * | | 12 (I/O Interrupts) + * 0xc0 (192) +-------------+ + * | | 11 (I/O Interrupts) + * 0xb0 (176) +-------------+ + * | | 10 (I/O Interrupts) + * 0xa0 (160) +-------------+ + * | | 9 (I/O Interrupts) + * 0x90 (144) +-------------+ + * | | 8 (I/O Interrupts / System Calls) + * 0x80 (128) +-------------+ + * | | 7 (I/O Interrupts) + * 0x70 (112) +-------------+ + * | | 6 (I/O Interrupts) + * 0x60 (96) +-------------+ + * | | 5 (I/O Interrupts) + * 0x50 (80) +-------------+ + * | | 4 (I/O Interrupts) + * 0x40 (64) +-------------+ + * | | 3 (I/O Interrupts) + * 0x30 (48) +-------------+ + * | | 2 (ATPIC Interrupts) + * 0x20 (32) +-------------+ + * | | 1 (Exceptions, traps, faults, etc.) + * 0x10 (16) +-------------+ + * | | 0 (Exceptions, traps, faults, etc.) + * 0x00 (0) +-------------+ + * + * Note: 0x80 needs to be handled specially and not allocated to an + * I/O device! + */ + +#define APIC_ID_ALL 0xff +#define APIC_IO_INTS (IDT_IO_INTS + 16) +#define APIC_NUM_IOINTS 192 + +#define APIC_LOCAL_INTS 240 + +/* XXX put APIC interrupt and IPI assignments here */ + +#define APIC_SPURIOUS_INT 255 + +#define LVT_LINT0 0 +#define LVT_LINT1 1 +#define LVT_TIMER 2 +#define LVT_ERROR 3 +#define LVT_PMC 4 +#define LVT_THERMAL 5 +#define LVT_MAX LVT_THERMAL + +#ifndef LOCORE + +#define APIC_IPI_DEST_SELF -1 +#define APIC_IPI_DEST_ALL -2 +#define APIC_IPI_DEST_OTHERS -3 + +/* + * An APIC enumerator is a psuedo bus driver that enumerates APIC's including + * CPU's and I/O APIC's. + */ +struct apic_enumerator { + const char *apic_name; + int (*apic_probe)(void); + int (*apic_probe_cpus)(void); + int (*apic_setup_local)(void); + int (*apic_setup_io)(void); + SLIST_ENTRY(apic_enumerator) apic_next; +}; + +#if 0 +inthand_t + IDTVEC(apic_isr1), IDTVEC(apic_isr2), IDTVEC(apic_isr3), + IDTVEC(apic_isr4), IDTVEC(apic_isr5), IDTVEC(apic_isr6), + IDTVEC(apic_isr7), IDTVEC(spuriousint); +#endif + +u_int apic_irq_to_idt(u_int irq); +u_int apic_idt_to_irq(u_int vector); +void apic_register_enumerator(struct apic_enumerator *enumerator); +void *ioapic_create(uintptr_t addr, int32_t id, int intbase); +int ioapic_disable_pin(void *cookie, u_int pin); +int ioapic_get_vector(void *cookie, u_int pin); +int ioapic_next_logical_cluster(void); +void ioapic_register(void *cookie); +int ioapic_remap_vector(void *cookie, u_int pin, int vector); +int ioapic_set_extint(void *cookie, u_int pin); +int ioapic_set_nmi(void *cookie, u_int pin); +int ioapic_set_polarity(void *cookie, u_int pin, char activehi); +int ioapic_set_triggermode(void *cookie, u_int pin, char edgetrigger); +int ioapic_set_smi(void *cookie, u_int pin); +void lapic_create(u_int apic_id, int boot_cpu); +void lapic_disable(void); +void lapic_dump(const char *str); +void lapic_enable_intr(u_int vector); +void lapic_eoi(void); +int lapic_id(void); +void lapic_init(uintptr_t addr); +int lapic_intr_pending(u_int vector); +void lapic_ipi_raw(register_t icrlo, u_int dest); +void lapic_ipi_vectored(u_int vector, int dest); +int lapic_ipi_wait(int delay); +void lapic_handle_intr(struct intrframe frame); +void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id); +int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked); +int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode); +int lapic_set_lvt_polarity(u_int apic_id, u_int lvt, u_char activehi); +int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, u_char edgetrigger); +void lapic_setup(void); + +#endif /* !LOCORE */ +#endif /* _MACHINE_APICVAR_H_ */ diff --git a/sys/i386/include/globaldata.h b/sys/i386/include/globaldata.h index 02a339d8c3..05360cb187 100644 --- a/sys/i386/include/globaldata.h +++ b/sys/i386/include/globaldata.h @@ -28,7 +28,7 @@ * should not include this file. * * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.22 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.23 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_GLOBALDATA_H_ @@ -83,6 +83,8 @@ struct mdglobaldata { caddr_t gd_CADDR2; caddr_t gd_CADDR3; unsigned *gd_PADDR1; + u_int gd_acpi_id; + u_int gd_apic_id; }; /* diff --git a/sys/i386/include/mpapic.h b/sys/i386/include/mpapic.h index 7f810de9cf..2745c0c271 100644 --- a/sys/i386/include/mpapic.h +++ b/sys/i386/include/mpapic.h @@ -23,13 +23,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/mpapic.h,v 1.14.2.2 2000/09/30 02:49:34 ps Exp $ - * $DragonFly: src/sys/i386/include/Attic/mpapic.h,v 1.5 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/mpapic.h,v 1.6 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_MPAPIC_H_ #define _MACHINE_MPAPIC_H_ -#include "apic.h" +#include "apicreg.h" #include @@ -61,6 +61,7 @@ enum busTypes { #define IO_TO_ID(IO) (io_num_to_apic_id[IO]) #define ID_TO_IO(ID) (apic_id_to_logical[ID]) +#ifdef SMP /* * send an IPI INTerrupt containing 'vector' to CPUs in 'targetMap' @@ -85,4 +86,6 @@ all_but_self_ipi(int vector) return apic_ipi(APIC_DEST_ALLESELF, vector, APIC_DELMODE_FIXED); } +#endif + #endif /* _MACHINE_MPAPIC_H */ diff --git a/sys/i386/include/smp.h b/sys/i386/include/smp.h index 882d4f73e6..e473aa0dbc 100644 --- a/sys/i386/include/smp.h +++ b/sys/i386/include/smp.h @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/i386/include/smp.h,v 1.50.2.5 2001/02/13 22:32:45 tegge Exp $ - * $DragonFly: src/sys/i386/include/Attic/smp.h,v 1.9 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/smp.h,v 1.10 2004/02/21 06:37:07 dillon Exp $ * */ @@ -39,7 +39,7 @@ extern int current_postcode; /** XXX currently in mp_machdep.c */ outb(0x80, current_postcode) -#include "apic.h" +#include "apicreg.h" /* global data in mpboot.s */ extern int bootMP_size; diff --git a/sys/i386/include/smptests.h b/sys/i386/include/smptests.h index 4397a6525f..78786b5da6 100644 --- a/sys/i386/include/smptests.h +++ b/sys/i386/include/smptests.h @@ -23,17 +23,18 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/smptests.h,v 1.33.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/i386/include/Attic/smptests.h,v 1.4 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/smptests.h,v 1.5 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_SMPTESTS_H_ #define _MACHINE_SMPTESTS_H_ - /* * Various 'tests in progress' and configuration parameters. */ +#ifdef SMP + /* * Control the "giant lock" pushdown by logical steps. */ @@ -84,81 +85,41 @@ #ifdef PUSHDOWN_LEVEL_3 #endif - /* - * SPL_DEBUG_POSTCODE/INTR_SPL/SPL_DEBUG - removed + * Send CPUSTOP IPI for stop/restart of other CPUs on DDB break. * - * These functions were too expensive for the standard case but, more - * importantly, we should be able to come up with a much cleaner way - * to handle the cpl. Having to do any locking at all is a mistake - * for something that is modified as often as cpl is. +#define VERBOSE_CPUSTOP_ON_DDBBREAK */ +#define CPUSTOP_ON_DDBBREAK /* - * FAST_WITHOUTCPL - now made the default (define removed). Text below - * contains the current discussion. I am confident we can find a solution - * that does not require us to process softints from a hard int, which can - * kill serial performance due to the lack of true hardware ipl's. - * - **** - * - * Ignore the ipending bits when exiting FAST_INTR() routines. - * - * according to Bruce: - * - * setsoft*() may set ipending. setsofttty() is actually used in the - * FAST_INTR handler in some serial drivers. This is necessary to get - * output completions and other urgent events handled as soon as possible. - * The flag(s) could be set in a variable other than ipending, but they - * needs to be checked against cpl to decide whether the software interrupt - * handler can/should run. - * - * (FAST_INTR used to just return - * in all cases until rev.1.7 of vector.s. This worked OK provided there - * were no user-mode CPU hogs. CPU hogs caused an average latency of 1/2 - * clock tick for output completions...) - *** + * Misc. counters. * - * So I need to restore cpl handling someday, but AFTER - * I finish making spl/cpl MP-safe. - */ -#ifdef PUSHDOWN_LEVEL_1 -#endif - - -/* - * FAST_SIMPLELOCK no longer exists, because it doesn't help us. The cpu - * is likely to already hold the MP lock and recursive MP locks are now - * very cheap, so we do not need this optimization. Eventually *ALL* - * interrupts will run in their own thread, so there is no sense complicating - * matters now. +#define COUNT_XINVLTLB_HITS */ -#ifdef PUSHDOWN_LEVEL_1 -#endif - -/* - * Portions of the old TEST_LOPRIO code, back from the grave! +/** + * Hack to "fake-out" kernel into thinking it is running on a 'default config'. + * + * value == default type +#define TEST_DEFAULT_CONFIG 6 */ -#define GRAB_LOPRIO - /* - * Send CPUSTOP IPI for stop/restart of other CPUs on DDB break. + * Simple test code for IPI interaction, save for future... * -#define VERBOSE_CPUSTOP_ON_DDBBREAK +#define TEST_TEST1 +#define IPI_TARGET_TEST1 1 */ -#define CPUSTOP_ON_DDBBREAK +#endif /* SMP */ + +#ifdef APIC_IO /* - * Bracket code/comments relevant to the current 'giant lock' model. - * Everything is now the 'giant lock' model, but we will use this as - * we start to "push down" the lock. + * Portions of the old TEST_LOPRIO code, back from the grave! */ -#define GIANT_LOCK - -#ifdef APIC_IO +#define GRAB_LOPRIO /* * Don't assume that slow interrupt handler X is called from vector @@ -175,28 +136,7 @@ #endif /* APIC_IO */ -/* - * Misc. counters. - * -#define COUNT_XINVLTLB_HITS - */ - - -/** - * Hack to "fake-out" kernel into thinking it is running on a 'default config'. - * - * value == default type -#define TEST_DEFAULT_CONFIG 6 - */ - - -/* - * Simple test code for IPI interaction, save for future... - * -#define TEST_TEST1 -#define IPI_TARGET_TEST1 1 - */ - +#if 0 /* DEPRECATED */ /* * Address of POST hardware port. @@ -259,7 +199,9 @@ #define ASMPOSTCODE_HI(X) #endif /* POST_ADDR */ +#endif /* DEPRECATED */ +#if 0 /* DEPRECATED */ /* * These are all temps for debugging... * @@ -294,4 +236,6 @@ #define MAYBE_PANIC(irq_num) #endif /* GUARD_INTS */ +#endif /* DEPRECATED */ + #endif /* _MACHINE_SMPTESTS_H_ */ diff --git a/sys/i386/isa/apic_vector.s b/sys/i386/isa/apic_vector.s index 1ae3fe4fee..714ca04ddc 100644 --- a/sys/i386/isa/apic_vector.s +++ b/sys/i386/isa/apic_vector.s @@ -1,11 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $ - * $DragonFly: src/sys/i386/isa/Attic/apic_vector.s,v 1.17 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/i386/isa/Attic/apic_vector.s,v 1.18 2004/02/21 06:37:08 dillon Exp $ */ -#include +#include #include #include "i386/isa/intr_machdep.h" diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 450ae7fff7..731c4f1b0e 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -35,7 +35,7 @@ * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 * $FreeBSD: src/sys/i386/isa/clock.c,v 1.149.2.6 2002/11/02 04:41:50 iwasaki Exp $ - * $DragonFly: src/sys/i386/isa/Attic/clock.c,v 1.12 2004/02/12 06:57:46 dillon Exp $ + * $DragonFly: src/sys/i386/isa/Attic/clock.c,v 1.13 2004/02/21 06:37:08 dillon Exp $ */ /* @@ -57,6 +57,7 @@ #include #include #include +#include #ifndef SMP #include #endif diff --git a/sys/i386/isa/intr_machdep.c b/sys/i386/isa/intr_machdep.c index 80a77f1ec8..88e3eb7245 100644 --- a/sys/i386/isa/intr_machdep.c +++ b/sys/i386/isa/intr_machdep.c @@ -35,7 +35,7 @@ * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/isa/intr_machdep.c,v 1.29.2.5 2001/10/14 06:54:27 luigi Exp $ - * $DragonFly: src/sys/i386/isa/Attic/intr_machdep.c,v 1.18 2004/02/20 22:40:58 drhodus Exp $ + * $DragonFly: src/sys/i386/isa/Attic/intr_machdep.c,v 1.19 2004/02/21 06:37:08 dillon Exp $ */ /* * This file contains an aggregated module marked: @@ -65,10 +65,8 @@ #include #include -#if defined(APIC_IO) #include /** FAST_HI */ #include -#endif /* APIC_IO */ #ifdef PC98 #include #include diff --git a/sys/i386/isa/intr_machdep.h b/sys/i386/isa/intr_machdep.h index 71b487e51b..65481a8df8 100644 --- a/sys/i386/isa/intr_machdep.h +++ b/sys/i386/isa/intr_machdep.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/intr_machdep.h,v 1.19.2.2 2001/10/14 20:05:50 luigi Exp $ - * $DragonFly: src/sys/i386/isa/Attic/intr_machdep.h,v 1.10 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/i386/isa/Attic/intr_machdep.h,v 1.11 2004/02/21 06:37:08 dillon Exp $ */ #ifndef _I386_ISA_INTR_MACHDEP_H_ @@ -217,9 +217,6 @@ int update_intr_masks (void); intrmask_t splq (intrmask_t mask); -#define INTR_FAST 0x00000001 /* fast interrupt handler */ -#define INTR_EXCL 0x00010000 /* excl. intr, default is shared */ - /* * WARNING: These are internal functions and not to be used by device drivers! * They are subject to change without notice. diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index cf532e6827..5d3a1e8fb8 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -24,7 +24,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/sys/kern/bus_if.m,v 1.16 1999/10/12 21:35:50 dfr Exp $ -# $DragonFly: src/sys/kern/bus_if.m,v 1.4 2004/02/06 23:09:36 joerg Exp $ +# $DragonFly: src/sys/kern/bus_if.m,v 1.5 2004/02/21 06:37:08 dillon Exp $ # #include @@ -56,7 +56,7 @@ CODE { METHOD int print_child { device_t dev; device_t child; -}; +} DEFAULT bus_generic_print_child; # # Called for each child device that @@ -238,6 +238,14 @@ METHOD void delete_resource { int rid; }; +# +# Return a struct resource_list. +# +METHOD struct resource_list * get_resource_list { + device_t _dev; + device_t _child; +} DEFAULT bus_generic_get_resource_list; + # # Is the hardware described by _child still attached to the system? # @@ -274,3 +282,15 @@ METHOD int child_location_str { char *_buf; size_t _buflen; }; + +# +# Allow (bus) drivers to specify the trigger mode and polarity of the +# specified interrupt. +# +METHOD int config_intr { + device_t _dev; + int _irq; + enum intr_trigger _trig; + enum intr_polarity _pol; +} DEFAULT bus_generic_config_intr; + diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index a1bd7d59e1..6c7e712c89 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_bus.c,v 1.54.2.9 2002/10/10 15:13:32 jhb Exp $ - * $DragonFly: src/sys/kern/subr_bus.c,v 1.11 2004/02/16 18:48:03 joerg Exp $ + * $DragonFly: src/sys/kern/subr_bus.c,v 1.12 2004/02/21 06:37:08 dillon Exp $ */ #include "opt_bus.h" @@ -1884,6 +1884,12 @@ bus_generic_write_ivar(device_t dev, device_t child, int index, return ENOENT; } +struct resource_list * +bus_generic_get_resource_list(device_t dev, device_t child) +{ + return (NULL); +} + void bus_generic_driver_added(device_t dev, driver_t *driver) { @@ -1920,12 +1926,6 @@ bus_generic_teardown_intr(device_t dev, device_t child, struct resource *irq, return (EINVAL); } -int -bus_generic_child_present(device_t bus, device_t child) -{ - return (BUS_CHILD_PRESENT(device_get_parent(bus), bus)); -} - struct resource * bus_generic_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) @@ -1974,6 +1974,102 @@ bus_generic_deactivate_resource(device_t dev, device_t child, int type, return (EINVAL); } +int +bus_generic_config_intr(device_t dev, int irq, enum intr_trigger trig, + enum intr_polarity pol) +{ + /* Propagate up the bus hierarchy until someone handles it. */ + if (dev->parent) + return (BUS_CONFIG_INTR(dev->parent, irq, trig, pol)); + return (EINVAL); +} + +int +bus_generic_rl_get_resource(device_t dev, device_t child, int type, int rid, + u_long *startp, u_long *countp) +{ + struct resource_list * rl = NULL; + struct resource_list_entry * rle = NULL; + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (!rl) + return (EINVAL); + + rle = resource_list_find(rl, type, rid); + if (!rle) + return (ENOENT); + + if (startp) + *startp = rle->start; + if (countp) + *countp = rle->count; + + return (0); +} + +int +bus_generic_rl_set_resource(device_t dev, device_t child, int type, int rid, + u_long start, u_long count) +{ + struct resource_list * rl = NULL; + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (!rl) + return (EINVAL); + + resource_list_add(rl, type, rid, start, (start + count - 1), count); + + return (0); +} + +void +bus_generic_rl_delete_resource(device_t dev, device_t child, int type, int rid) +{ + struct resource_list * rl = NULL; + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (!rl) + return; + + resource_list_delete(rl, type, rid); + + return; +} + +int +bus_generic_rl_release_resource(device_t dev, device_t child, int type, + int rid, struct resource *r) +{ + struct resource_list * rl = NULL; + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (!rl) + return (EINVAL); + + return (resource_list_release(rl, dev, child, type, rid, r)); +} + +struct resource * +bus_generic_rl_alloc_resource(device_t dev, device_t child, int type, + int *rid, u_long start, u_long end, u_long count, u_int flags) +{ + struct resource_list * rl = NULL; + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (!rl) + return (NULL); + + return (resource_list_alloc(rl, dev, child, type, rid, + start, end, count, flags)); +} + +int +bus_generic_child_present(device_t bus, device_t child) +{ + return (BUS_CHILD_PRESENT(device_get_parent(bus), bus)); +} + + /* * Some convenience functions to make it easier for drivers to use the * resource-management functions. All these really do is hide the @@ -2098,6 +2194,22 @@ root_setup_intr(device_t dev, device_t child, driver_intr_t *intr, void *arg, panic("root_setup_intr"); } +/* + * If we get here, assume that the device is permanant and really is + * present in the system. Removable bus drivers are expected to intercept + * this call long before it gets here. We return -1 so that drivers that + * really care can check vs -1 or some ERRNO returned higher in the food + * chain. + */ +static int +root_child_present(device_t dev, device_t child) +{ + return (-1); +} + +/* + * XXX NOTE! other defaults may be set in bus_if.m + */ static kobj_method_t root_methods[] = { /* Device interface */ KOBJMETHOD(device_shutdown, bus_generic_shutdown), @@ -2109,6 +2221,7 @@ static kobj_method_t root_methods[] = { KOBJMETHOD(bus_read_ivar, bus_generic_read_ivar), KOBJMETHOD(bus_write_ivar, bus_generic_write_ivar), KOBJMETHOD(bus_setup_intr, root_setup_intr), + KOBJMETHOD(bus_child_present, root_child_present), { 0, 0 } }; @@ -2369,3 +2482,18 @@ print_devclass_list(void) } #endif + +/* + * Check to see if a device is disabled via a disabled hint. + */ +int +resource_disabled(const char *name, int unit) +{ + int error, value; + + error = resource_int_value(name, unit, "disabled", &value); + if (error) + return (0); + return (value); +} + diff --git a/sys/platform/pc32/apic/apic_vector.s b/sys/platform/pc32/apic/apic_vector.s index e3050c8632..7230a2fb45 100644 --- a/sys/platform/pc32/apic/apic_vector.s +++ b/sys/platform/pc32/apic/apic_vector.s @@ -1,11 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $ - * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.17 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.18 2004/02/21 06:37:08 dillon Exp $ */ -#include +#include #include #include "i386/isa/intr_machdep.h" diff --git a/sys/platform/pc32/include/apic.h b/sys/platform/pc32/apic/apicreg.h similarity index 99% copy from sys/platform/pc32/include/apic.h copy to sys/platform/pc32/apic/apicreg.h index 9aba13a92c..b0a4d96882 100644 --- a/sys/platform/pc32/include/apic.h +++ b/sys/platform/pc32/apic/apicreg.h @@ -23,11 +23,11 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/apic.h,v 1.14.2.2 2003/03/21 21:46:15 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/include/Attic/apic.h,v 1.4 2003/07/08 06:27:26 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/apic/apicreg.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ */ -#ifndef _MACHINE_APIC_H_ -#define _MACHINE_APIC_H_ +#ifndef _MACHINE_APICREG_H_ +#define _MACHINE_APICREG_H_ /* * Local && I/O APIC definitions for Pentium P54C+ Built-in APIC. diff --git a/sys/platform/pc32/apic/apicvar.h b/sys/platform/pc32/apic/apicvar.h new file mode 100644 index 0000000000..f2ef1b81fe --- /dev/null +++ b/sys/platform/pc32/apic/apicvar.h @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 2003 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.5 2003/11/14 22:21:30 peter Exp $ + * $DragonFly: src/sys/platform/pc32/apic/apicvar.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ + */ + +#ifndef _MACHINE_APICVAR_H_ +#define _MACHINE_APICVAR_H_ + +/* + * Local && I/O APIC variable definitions. + */ + +/* + * Layout of local APIC interrupt vectors: + * + * 0xff (255) +-------------+ + * | | 15 (Spurious / IPIs / Local Interrupts) + * 0xf0 (240) +-------------+ + * | | 14 (I/O Interrupts) + * 0xe0 (224) +-------------+ + * | | 13 (I/O Interrupts) + * 0xd0 (208) +-------------+ + * | | 12 (I/O Interrupts) + * 0xc0 (192) +-------------+ + * | | 11 (I/O Interrupts) + * 0xb0 (176) +-------------+ + * | | 10 (I/O Interrupts) + * 0xa0 (160) +-------------+ + * | | 9 (I/O Interrupts) + * 0x90 (144) +-------------+ + * | | 8 (I/O Interrupts / System Calls) + * 0x80 (128) +-------------+ + * | | 7 (I/O Interrupts) + * 0x70 (112) +-------------+ + * | | 6 (I/O Interrupts) + * 0x60 (96) +-------------+ + * | | 5 (I/O Interrupts) + * 0x50 (80) +-------------+ + * | | 4 (I/O Interrupts) + * 0x40 (64) +-------------+ + * | | 3 (I/O Interrupts) + * 0x30 (48) +-------------+ + * | | 2 (ATPIC Interrupts) + * 0x20 (32) +-------------+ + * | | 1 (Exceptions, traps, faults, etc.) + * 0x10 (16) +-------------+ + * | | 0 (Exceptions, traps, faults, etc.) + * 0x00 (0) +-------------+ + * + * Note: 0x80 needs to be handled specially and not allocated to an + * I/O device! + */ + +#define APIC_ID_ALL 0xff +#define APIC_IO_INTS (IDT_IO_INTS + 16) +#define APIC_NUM_IOINTS 192 + +#define APIC_LOCAL_INTS 240 + +/* XXX put APIC interrupt and IPI assignments here */ + +#define APIC_SPURIOUS_INT 255 + +#define LVT_LINT0 0 +#define LVT_LINT1 1 +#define LVT_TIMER 2 +#define LVT_ERROR 3 +#define LVT_PMC 4 +#define LVT_THERMAL 5 +#define LVT_MAX LVT_THERMAL + +#ifndef LOCORE + +#define APIC_IPI_DEST_SELF -1 +#define APIC_IPI_DEST_ALL -2 +#define APIC_IPI_DEST_OTHERS -3 + +/* + * An APIC enumerator is a psuedo bus driver that enumerates APIC's including + * CPU's and I/O APIC's. + */ +struct apic_enumerator { + const char *apic_name; + int (*apic_probe)(void); + int (*apic_probe_cpus)(void); + int (*apic_setup_local)(void); + int (*apic_setup_io)(void); + SLIST_ENTRY(apic_enumerator) apic_next; +}; + +#if 0 +inthand_t + IDTVEC(apic_isr1), IDTVEC(apic_isr2), IDTVEC(apic_isr3), + IDTVEC(apic_isr4), IDTVEC(apic_isr5), IDTVEC(apic_isr6), + IDTVEC(apic_isr7), IDTVEC(spuriousint); +#endif + +u_int apic_irq_to_idt(u_int irq); +u_int apic_idt_to_irq(u_int vector); +void apic_register_enumerator(struct apic_enumerator *enumerator); +void *ioapic_create(uintptr_t addr, int32_t id, int intbase); +int ioapic_disable_pin(void *cookie, u_int pin); +int ioapic_get_vector(void *cookie, u_int pin); +int ioapic_next_logical_cluster(void); +void ioapic_register(void *cookie); +int ioapic_remap_vector(void *cookie, u_int pin, int vector); +int ioapic_set_extint(void *cookie, u_int pin); +int ioapic_set_nmi(void *cookie, u_int pin); +int ioapic_set_polarity(void *cookie, u_int pin, char activehi); +int ioapic_set_triggermode(void *cookie, u_int pin, char edgetrigger); +int ioapic_set_smi(void *cookie, u_int pin); +void lapic_create(u_int apic_id, int boot_cpu); +void lapic_disable(void); +void lapic_dump(const char *str); +void lapic_enable_intr(u_int vector); +void lapic_eoi(void); +int lapic_id(void); +void lapic_init(uintptr_t addr); +int lapic_intr_pending(u_int vector); +void lapic_ipi_raw(register_t icrlo, u_int dest); +void lapic_ipi_vectored(u_int vector, int dest); +int lapic_ipi_wait(int delay); +void lapic_handle_intr(struct intrframe frame); +void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id); +int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked); +int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode); +int lapic_set_lvt_polarity(u_int apic_id, u_int lvt, u_char activehi); +int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, u_char edgetrigger); +void lapic_setup(void); + +#endif /* !LOCORE */ +#endif /* _MACHINE_APICVAR_H_ */ diff --git a/sys/platform/pc32/apic/mpapic.h b/sys/platform/pc32/apic/mpapic.h index b378def2df..07059400eb 100644 --- a/sys/platform/pc32/apic/mpapic.h +++ b/sys/platform/pc32/apic/mpapic.h @@ -23,13 +23,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/mpapic.h,v 1.14.2.2 2000/09/30 02:49:34 ps Exp $ - * $DragonFly: src/sys/platform/pc32/apic/mpapic.h,v 1.5 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/apic/mpapic.h,v 1.6 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_MPAPIC_H_ #define _MACHINE_MPAPIC_H_ -#include "apic.h" +#include "apicreg.h" #include @@ -61,6 +61,7 @@ enum busTypes { #define IO_TO_ID(IO) (io_num_to_apic_id[IO]) #define ID_TO_IO(ID) (apic_id_to_logical[ID]) +#ifdef SMP /* * send an IPI INTerrupt containing 'vector' to CPUs in 'targetMap' @@ -85,4 +86,6 @@ all_but_self_ipi(int vector) return apic_ipi(APIC_DEST_ALLESELF, vector, APIC_DELMODE_FIXED); } +#endif + #endif /* _MACHINE_MPAPIC_H */ diff --git a/sys/platform/pc32/i386/db_interface.c b/sys/platform/pc32/i386/db_interface.c index 0b2f878bfe..79c40d99ef 100644 --- a/sys/platform/pc32/i386/db_interface.c +++ b/sys/platform/pc32/i386/db_interface.c @@ -24,7 +24,7 @@ * rights to redistribute these changes. * * $FreeBSD: src/sys/i386/i386/db_interface.c,v 1.48.2.1 2000/07/07 00:38:46 obrien Exp $ - * $DragonFly: src/sys/platform/pc32/i386/db_interface.c,v 1.9 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/db_interface.c,v 1.10 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -36,10 +36,8 @@ #include #include -#ifdef SMP #include #include /** CPUSTOP_ON_DDBBREAK */ -#endif #include #include diff --git a/sys/platform/pc32/i386/exception.s b/sys/platform/pc32/i386/exception.s index 6255e659b9..030efa9039 100644 --- a/sys/platform/pc32/i386/exception.s +++ b/sys/platform/pc32/i386/exception.s @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $ - * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.21 2004/01/15 00:03:08 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.22 2004/02/21 06:37:07 dillon Exp $ */ #include "use_npx.h" @@ -41,9 +41,7 @@ #include #include #include -#ifdef SMP #include /** various SMP options */ -#endif #include "assym.s" diff --git a/sys/platform/pc32/i386/genassym.c b/sys/platform/pc32/i386/genassym.c index 47e65b29f7..ecf5e2f36f 100644 --- a/sys/platform/pc32/i386/genassym.c +++ b/sys/platform/pc32/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.34 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.35 2004/02/21 06:37:07 dillon Exp $ */ #include @@ -64,7 +64,7 @@ #include #include #ifdef SMP -#include +#include #endif #include #include diff --git a/sys/platform/pc32/i386/mp_machdep.c b/sys/platform/pc32/i386/mp_machdep.c index 12d6d3719e..ab0c5f2c03 100644 --- a/sys/platform/pc32/i386/mp_machdep.c +++ b/sys/platform/pc32/i386/mp_machdep.c @@ -23,17 +23,11 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.115.2.15 2003/03/14 21:22:35 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/i386/mp_machdep.c,v 1.22 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/mp_machdep.c,v 1.23 2004/02/21 06:37:07 dillon Exp $ */ #include "opt_cpu.h" -#ifdef SMP -#include -#else -#error -#endif - #include #include #include @@ -55,7 +49,7 @@ #endif #include -#include +#include #include #include #include diff --git a/sys/platform/pc32/i386/mpboot.s b/sys/platform/pc32/i386/mpboot.s index 45f65cdddd..0402b2fcdd 100644 --- a/sys/platform/pc32/i386/mpboot.s +++ b/sys/platform/pc32/i386/mpboot.s @@ -32,11 +32,11 @@ * multiprocessor systems. * * $FreeBSD: src/sys/i386/i386/mpboot.s,v 1.13.2.3 2000/09/07 01:18:26 tegge Exp $ - * $DragonFly: src/sys/platform/pc32/i386/mpboot.s,v 1.6 2003/11/18 05:52:26 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/mpboot.s,v 1.7 2004/02/21 06:37:07 dillon Exp $ */ #include /* miscellaneous asm macros */ -#include +#include #include #include "assym.s" diff --git a/sys/platform/pc32/i386/mplock.s b/sys/platform/pc32/i386/mplock.s index 5737b92518..9f27bab5f7 100644 --- a/sys/platform/pc32/i386/mplock.s +++ b/sys/platform/pc32/i386/mplock.s @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/i386/i386/mplock.s,v 1.29.2.2 2000/05/16 06:58:06 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/i386/mplock.s,v 1.11 2003/12/04 20:09:31 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/mplock.s,v 1.12 2004/02/21 06:37:07 dillon Exp $ * * Copyright (c) 2003 Matthew Dillon * All rights reserved. @@ -56,7 +56,7 @@ #include #include /** GRAB_LOPRIO */ -#include +#include #include "assym.s" diff --git a/sys/platform/pc32/i386/nexus.c b/sys/platform/pc32/i386/nexus.c index 6720f3fc41..d0d92b2c22 100644 --- a/sys/platform/pc32/i386/nexus.c +++ b/sys/platform/pc32/i386/nexus.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/nexus.c,v 1.26.2.10 2003/02/22 13:16:45 imp Exp $ - * $DragonFly: src/sys/platform/pc32/i386/nexus.c,v 1.6 2004/01/14 07:16:37 joerg Exp $ + * $DragonFly: src/sys/platform/pc32/i386/nexus.c,v 1.7 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -533,7 +533,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, icflags = INTR_EXCL; driver = device_get_driver(child); - switch (flags & ~INTR_TYPE_FAST) { + switch (flags & ~INTR_FAST) { case INTR_TYPE_TTY: mask = &tty_imask; break; @@ -552,7 +552,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, default: panic("still using grody create_intr interface"); } - if (flags & INTR_TYPE_FAST) + if (flags & INTR_FAST) icflags |= INTR_FAST; /* diff --git a/sys/platform/pc32/i386/pmap.c b/sys/platform/pc32/i386/pmap.c index 1b24e6e729..fb236fb3fb 100644 --- a/sys/platform/pc32/i386/pmap.c +++ b/sys/platform/pc32/i386/pmap.c @@ -40,7 +40,7 @@ * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 * $FreeBSD: src/sys/i386/i386/pmap.c,v 1.250.2.18 2002/03/06 22:48:53 silby Exp $ - * $DragonFly: src/sys/platform/pc32/i386/pmap.c,v 1.30 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/pmap.c,v 1.31 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -102,7 +102,7 @@ #include #if defined(SMP) || defined(APIC_IO) #include -#include +#include #endif /* SMP || APIC_IO */ #include #include diff --git a/sys/platform/pc32/i386/pmap_inval.c b/sys/platform/pc32/i386/pmap_inval.c index 74da0d7c47..5c3c23af95 100644 --- a/sys/platform/pc32/i386/pmap_inval.c +++ b/sys/platform/pc32/i386/pmap_inval.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/pc32/i386/pmap_inval.c,v 1.1 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/pmap_inval.c,v 1.2 2004/02/21 06:37:07 dillon Exp $ */ /* @@ -53,7 +53,7 @@ #include #if defined(SMP) || defined(APIC_IO) #include -#include +#include #endif /* SMP || APIC_IO */ #include #include diff --git a/sys/platform/pc32/i386/swtch.s b/sys/platform/pc32/i386/swtch.s index c3bfe329fc..7e7661bb4c 100644 --- a/sys/platform/pc32/i386/swtch.s +++ b/sys/platform/pc32/i386/swtch.s @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/swtch.s,v 1.89.2.10 2003/01/23 03:36:24 ps Exp $ - * $DragonFly: src/sys/platform/pc32/i386/swtch.s,v 1.29 2003/12/20 05:52:26 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/swtch.s,v 1.30 2004/02/21 06:37:07 dillon Exp $ */ #include "use_npx.h" @@ -45,12 +45,10 @@ #include #include -#ifdef SMP #include #include /** GRAB_LOPRIO */ -#include +#include #include -#endif /* SMP */ #include "assym.s" diff --git a/sys/platform/pc32/include/apic.h b/sys/platform/pc32/include/apicreg.h similarity index 99% rename from sys/platform/pc32/include/apic.h rename to sys/platform/pc32/include/apicreg.h index 9aba13a92c..8e02f3a040 100644 --- a/sys/platform/pc32/include/apic.h +++ b/sys/platform/pc32/include/apicreg.h @@ -23,11 +23,11 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/apic.h,v 1.14.2.2 2003/03/21 21:46:15 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/include/Attic/apic.h,v 1.4 2003/07/08 06:27:26 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/Attic/apicreg.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ */ -#ifndef _MACHINE_APIC_H_ -#define _MACHINE_APIC_H_ +#ifndef _MACHINE_APICREG_H_ +#define _MACHINE_APICREG_H_ /* * Local && I/O APIC definitions for Pentium P54C+ Built-in APIC. diff --git a/sys/platform/pc32/include/apicvar.h b/sys/platform/pc32/include/apicvar.h new file mode 100644 index 0000000000..16ac2ba62f --- /dev/null +++ b/sys/platform/pc32/include/apicvar.h @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 2003 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.5 2003/11/14 22:21:30 peter Exp $ + * $DragonFly: src/sys/platform/pc32/include/Attic/apicvar.h,v 1.1 2004/02/21 06:37:07 dillon Exp $ + */ + +#ifndef _MACHINE_APICVAR_H_ +#define _MACHINE_APICVAR_H_ + +/* + * Local && I/O APIC variable definitions. + */ + +/* + * Layout of local APIC interrupt vectors: + * + * 0xff (255) +-------------+ + * | | 15 (Spurious / IPIs / Local Interrupts) + * 0xf0 (240) +-------------+ + * | | 14 (I/O Interrupts) + * 0xe0 (224) +-------------+ + * | | 13 (I/O Interrupts) + * 0xd0 (208) +-------------+ + * | | 12 (I/O Interrupts) + * 0xc0 (192) +-------------+ + * | | 11 (I/O Interrupts) + * 0xb0 (176) +-------------+ + * | | 10 (I/O Interrupts) + * 0xa0 (160) +-------------+ + * | | 9 (I/O Interrupts) + * 0x90 (144) +-------------+ + * | | 8 (I/O Interrupts / System Calls) + * 0x80 (128) +-------------+ + * | | 7 (I/O Interrupts) + * 0x70 (112) +-------------+ + * | | 6 (I/O Interrupts) + * 0x60 (96) +-------------+ + * | | 5 (I/O Interrupts) + * 0x50 (80) +-------------+ + * | | 4 (I/O Interrupts) + * 0x40 (64) +-------------+ + * | | 3 (I/O Interrupts) + * 0x30 (48) +-------------+ + * | | 2 (ATPIC Interrupts) + * 0x20 (32) +-------------+ + * | | 1 (Exceptions, traps, faults, etc.) + * 0x10 (16) +-------------+ + * | | 0 (Exceptions, traps, faults, etc.) + * 0x00 (0) +-------------+ + * + * Note: 0x80 needs to be handled specially and not allocated to an + * I/O device! + */ + +#define APIC_ID_ALL 0xff +#define APIC_IO_INTS (IDT_IO_INTS + 16) +#define APIC_NUM_IOINTS 192 + +#define APIC_LOCAL_INTS 240 + +/* XXX put APIC interrupt and IPI assignments here */ + +#define APIC_SPURIOUS_INT 255 + +#define LVT_LINT0 0 +#define LVT_LINT1 1 +#define LVT_TIMER 2 +#define LVT_ERROR 3 +#define LVT_PMC 4 +#define LVT_THERMAL 5 +#define LVT_MAX LVT_THERMAL + +#ifndef LOCORE + +#define APIC_IPI_DEST_SELF -1 +#define APIC_IPI_DEST_ALL -2 +#define APIC_IPI_DEST_OTHERS -3 + +/* + * An APIC enumerator is a psuedo bus driver that enumerates APIC's including + * CPU's and I/O APIC's. + */ +struct apic_enumerator { + const char *apic_name; + int (*apic_probe)(void); + int (*apic_probe_cpus)(void); + int (*apic_setup_local)(void); + int (*apic_setup_io)(void); + SLIST_ENTRY(apic_enumerator) apic_next; +}; + +#if 0 +inthand_t + IDTVEC(apic_isr1), IDTVEC(apic_isr2), IDTVEC(apic_isr3), + IDTVEC(apic_isr4), IDTVEC(apic_isr5), IDTVEC(apic_isr6), + IDTVEC(apic_isr7), IDTVEC(spuriousint); +#endif + +u_int apic_irq_to_idt(u_int irq); +u_int apic_idt_to_irq(u_int vector); +void apic_register_enumerator(struct apic_enumerator *enumerator); +void *ioapic_create(uintptr_t addr, int32_t id, int intbase); +int ioapic_disable_pin(void *cookie, u_int pin); +int ioapic_get_vector(void *cookie, u_int pin); +int ioapic_next_logical_cluster(void); +void ioapic_register(void *cookie); +int ioapic_remap_vector(void *cookie, u_int pin, int vector); +int ioapic_set_extint(void *cookie, u_int pin); +int ioapic_set_nmi(void *cookie, u_int pin); +int ioapic_set_polarity(void *cookie, u_int pin, char activehi); +int ioapic_set_triggermode(void *cookie, u_int pin, char edgetrigger); +int ioapic_set_smi(void *cookie, u_int pin); +void lapic_create(u_int apic_id, int boot_cpu); +void lapic_disable(void); +void lapic_dump(const char *str); +void lapic_enable_intr(u_int vector); +void lapic_eoi(void); +int lapic_id(void); +void lapic_init(uintptr_t addr); +int lapic_intr_pending(u_int vector); +void lapic_ipi_raw(register_t icrlo, u_int dest); +void lapic_ipi_vectored(u_int vector, int dest); +int lapic_ipi_wait(int delay); +void lapic_handle_intr(struct intrframe frame); +void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id); +int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked); +int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode); +int lapic_set_lvt_polarity(u_int apic_id, u_int lvt, u_char activehi); +int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, u_char edgetrigger); +void lapic_setup(void); + +#endif /* !LOCORE */ +#endif /* _MACHINE_APICVAR_H_ */ diff --git a/sys/platform/pc32/include/globaldata.h b/sys/platform/pc32/include/globaldata.h index 75db0086b2..744014d338 100644 --- a/sys/platform/pc32/include/globaldata.h +++ b/sys/platform/pc32/include/globaldata.h @@ -28,7 +28,7 @@ * should not include this file. * * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/include/globaldata.h,v 1.22 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/globaldata.h,v 1.23 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_GLOBALDATA_H_ @@ -83,6 +83,8 @@ struct mdglobaldata { caddr_t gd_CADDR2; caddr_t gd_CADDR3; unsigned *gd_PADDR1; + u_int gd_acpi_id; + u_int gd_apic_id; }; /* diff --git a/sys/platform/pc32/include/mpapic.h b/sys/platform/pc32/include/mpapic.h index 2ebeec4548..41d00a630e 100644 --- a/sys/platform/pc32/include/mpapic.h +++ b/sys/platform/pc32/include/mpapic.h @@ -23,13 +23,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/mpapic.h,v 1.14.2.2 2000/09/30 02:49:34 ps Exp $ - * $DragonFly: src/sys/platform/pc32/include/Attic/mpapic.h,v 1.5 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/Attic/mpapic.h,v 1.6 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_MPAPIC_H_ #define _MACHINE_MPAPIC_H_ -#include "apic.h" +#include "apicreg.h" #include @@ -61,6 +61,7 @@ enum busTypes { #define IO_TO_ID(IO) (io_num_to_apic_id[IO]) #define ID_TO_IO(ID) (apic_id_to_logical[ID]) +#ifdef SMP /* * send an IPI INTerrupt containing 'vector' to CPUs in 'targetMap' @@ -85,4 +86,6 @@ all_but_self_ipi(int vector) return apic_ipi(APIC_DEST_ALLESELF, vector, APIC_DELMODE_FIXED); } +#endif + #endif /* _MACHINE_MPAPIC_H */ diff --git a/sys/platform/pc32/include/smp.h b/sys/platform/pc32/include/smp.h index 46d3eb7394..225556d54b 100644 --- a/sys/platform/pc32/include/smp.h +++ b/sys/platform/pc32/include/smp.h @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/i386/include/smp.h,v 1.50.2.5 2001/02/13 22:32:45 tegge Exp $ - * $DragonFly: src/sys/platform/pc32/include/smp.h,v 1.9 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/smp.h,v 1.10 2004/02/21 06:37:07 dillon Exp $ * */ @@ -39,7 +39,7 @@ extern int current_postcode; /** XXX currently in mp_machdep.c */ outb(0x80, current_postcode) -#include "apic.h" +#include "apicreg.h" /* global data in mpboot.s */ extern int bootMP_size; diff --git a/sys/platform/pc32/include/smptests.h b/sys/platform/pc32/include/smptests.h index 6fc8ab49b2..8faba57af7 100644 --- a/sys/platform/pc32/include/smptests.h +++ b/sys/platform/pc32/include/smptests.h @@ -23,17 +23,18 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/smptests.h,v 1.33.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/include/Attic/smptests.h,v 1.4 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/Attic/smptests.h,v 1.5 2004/02/21 06:37:07 dillon Exp $ */ #ifndef _MACHINE_SMPTESTS_H_ #define _MACHINE_SMPTESTS_H_ - /* * Various 'tests in progress' and configuration parameters. */ +#ifdef SMP + /* * Control the "giant lock" pushdown by logical steps. */ @@ -84,81 +85,41 @@ #ifdef PUSHDOWN_LEVEL_3 #endif - /* - * SPL_DEBUG_POSTCODE/INTR_SPL/SPL_DEBUG - removed + * Send CPUSTOP IPI for stop/restart of other CPUs on DDB break. * - * These functions were too expensive for the standard case but, more - * importantly, we should be able to come up with a much cleaner way - * to handle the cpl. Having to do any locking at all is a mistake - * for something that is modified as often as cpl is. +#define VERBOSE_CPUSTOP_ON_DDBBREAK */ +#define CPUSTOP_ON_DDBBREAK /* - * FAST_WITHOUTCPL - now made the default (define removed). Text below - * contains the current discussion. I am confident we can find a solution - * that does not require us to process softints from a hard int, which can - * kill serial performance due to the lack of true hardware ipl's. - * - **** - * - * Ignore the ipending bits when exiting FAST_INTR() routines. - * - * according to Bruce: - * - * setsoft*() may set ipending. setsofttty() is actually used in the - * FAST_INTR handler in some serial drivers. This is necessary to get - * output completions and other urgent events handled as soon as possible. - * The flag(s) could be set in a variable other than ipending, but they - * needs to be checked against cpl to decide whether the software interrupt - * handler can/should run. - * - * (FAST_INTR used to just return - * in all cases until rev.1.7 of vector.s. This worked OK provided there - * were no user-mode CPU hogs. CPU hogs caused an average latency of 1/2 - * clock tick for output completions...) - *** + * Misc. counters. * - * So I need to restore cpl handling someday, but AFTER - * I finish making spl/cpl MP-safe. - */ -#ifdef PUSHDOWN_LEVEL_1 -#endif - - -/* - * FAST_SIMPLELOCK no longer exists, because it doesn't help us. The cpu - * is likely to already hold the MP lock and recursive MP locks are now - * very cheap, so we do not need this optimization. Eventually *ALL* - * interrupts will run in their own thread, so there is no sense complicating - * matters now. +#define COUNT_XINVLTLB_HITS */ -#ifdef PUSHDOWN_LEVEL_1 -#endif - -/* - * Portions of the old TEST_LOPRIO code, back from the grave! +/** + * Hack to "fake-out" kernel into thinking it is running on a 'default config'. + * + * value == default type +#define TEST_DEFAULT_CONFIG 6 */ -#define GRAB_LOPRIO - /* - * Send CPUSTOP IPI for stop/restart of other CPUs on DDB break. + * Simple test code for IPI interaction, save for future... * -#define VERBOSE_CPUSTOP_ON_DDBBREAK +#define TEST_TEST1 +#define IPI_TARGET_TEST1 1 */ -#define CPUSTOP_ON_DDBBREAK +#endif /* SMP */ + +#ifdef APIC_IO /* - * Bracket code/comments relevant to the current 'giant lock' model. - * Everything is now the 'giant lock' model, but we will use this as - * we start to "push down" the lock. + * Portions of the old TEST_LOPRIO code, back from the grave! */ -#define GIANT_LOCK - -#ifdef APIC_IO +#define GRAB_LOPRIO /* * Don't assume that slow interrupt handler X is called from vector @@ -175,28 +136,7 @@ #endif /* APIC_IO */ -/* - * Misc. counters. - * -#define COUNT_XINVLTLB_HITS - */ - - -/** - * Hack to "fake-out" kernel into thinking it is running on a 'default config'. - * - * value == default type -#define TEST_DEFAULT_CONFIG 6 - */ - - -/* - * Simple test code for IPI interaction, save for future... - * -#define TEST_TEST1 -#define IPI_TARGET_TEST1 1 - */ - +#if 0 /* DEPRECATED */ /* * Address of POST hardware port. @@ -259,7 +199,9 @@ #define ASMPOSTCODE_HI(X) #endif /* POST_ADDR */ +#endif /* DEPRECATED */ +#if 0 /* DEPRECATED */ /* * These are all temps for debugging... * @@ -294,4 +236,6 @@ #define MAYBE_PANIC(irq_num) #endif /* GUARD_INTS */ +#endif /* DEPRECATED */ + #endif /* _MACHINE_SMPTESTS_H_ */ diff --git a/sys/platform/pc32/isa/apic_vector.s b/sys/platform/pc32/isa/apic_vector.s index c1cece5da8..7bba24bd54 100644 --- a/sys/platform/pc32/isa/apic_vector.s +++ b/sys/platform/pc32/isa/apic_vector.s @@ -1,11 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $ - * $DragonFly: src/sys/platform/pc32/isa/Attic/apic_vector.s,v 1.17 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/isa/Attic/apic_vector.s,v 1.18 2004/02/21 06:37:08 dillon Exp $ */ -#include +#include #include #include "i386/isa/intr_machdep.h" diff --git a/sys/platform/pc32/isa/clock.c b/sys/platform/pc32/isa/clock.c index 58c50f154a..4ed7fa8661 100644 --- a/sys/platform/pc32/isa/clock.c +++ b/sys/platform/pc32/isa/clock.c @@ -35,7 +35,7 @@ * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 * $FreeBSD: src/sys/i386/isa/clock.c,v 1.149.2.6 2002/11/02 04:41:50 iwasaki Exp $ - * $DragonFly: src/sys/platform/pc32/isa/clock.c,v 1.12 2004/02/12 06:57:46 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/isa/clock.c,v 1.13 2004/02/21 06:37:08 dillon Exp $ */ /* @@ -57,6 +57,7 @@ #include #include #include +#include #ifndef SMP #include #endif diff --git a/sys/platform/pc32/isa/intr_machdep.c b/sys/platform/pc32/isa/intr_machdep.c index b0f85556db..a65b949d3a 100644 --- a/sys/platform/pc32/isa/intr_machdep.c +++ b/sys/platform/pc32/isa/intr_machdep.c @@ -35,7 +35,7 @@ * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/isa/intr_machdep.c,v 1.29.2.5 2001/10/14 06:54:27 luigi Exp $ - * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.c,v 1.18 2004/02/20 22:40:58 drhodus Exp $ + * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.c,v 1.19 2004/02/21 06:37:08 dillon Exp $ */ /* * This file contains an aggregated module marked: @@ -65,10 +65,8 @@ #include #include -#if defined(APIC_IO) #include /** FAST_HI */ #include -#endif /* APIC_IO */ #ifdef PC98 #include #include diff --git a/sys/platform/pc32/isa/intr_machdep.h b/sys/platform/pc32/isa/intr_machdep.h index b96a936b56..97d6a932cc 100644 --- a/sys/platform/pc32/isa/intr_machdep.h +++ b/sys/platform/pc32/isa/intr_machdep.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/intr_machdep.h,v 1.19.2.2 2001/10/14 20:05:50 luigi Exp $ - * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.h,v 1.10 2004/02/17 19:38:54 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.h,v 1.11 2004/02/21 06:37:08 dillon Exp $ */ #ifndef _I386_ISA_INTR_MACHDEP_H_ @@ -217,9 +217,6 @@ int update_intr_masks (void); intrmask_t splq (intrmask_t mask); -#define INTR_FAST 0x00000001 /* fast interrupt handler */ -#define INTR_EXCL 0x00010000 /* excl. intr, default is shared */ - /* * WARNING: These are internal functions and not to be used by device drivers! * They are subject to change without notice. diff --git a/sys/platform/vkernel/i386/genassym.c b/sys/platform/vkernel/i386/genassym.c index 2c1cc0b4f0..6465a42f38 100644 --- a/sys/platform/vkernel/i386/genassym.c +++ b/sys/platform/vkernel/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.34 2004/02/17 19:38:53 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.35 2004/02/21 06:37:07 dillon Exp $ */ #include @@ -64,7 +64,7 @@ #include #include #ifdef SMP -#include +#include #endif #include #include diff --git a/sys/sys/bus.h b/sys/sys/bus.h index c3d55181ca..1c21d92afb 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/bus.h,v 1.30.2.4 2002/10/10 15:13:33 jhb Exp $ - * $DragonFly: src/sys/sys/bus.h,v 1.6 2004/02/16 18:48:03 joerg Exp $ + * $DragonFly: src/sys/sys/bus.h,v 1.7 2004/02/21 06:37:01 dillon Exp $ */ #ifndef _SYS_BUS_H_ @@ -58,9 +58,25 @@ enum intr_type { INTR_TYPE_NET = 4, INTR_TYPE_CAM = 8, INTR_TYPE_MISC = 16, - INTR_TYPE_FAST = 128 + INTR_TYPE_CLK = 32, + INTR_TYPE_AV = 64, + INTR_FAST = 128, + INTR_EXCL = 256, + INTR_MPSAFE = 512, + INTR_ENTROPY = 1024 +}; + +enum intr_trigger { + INTR_TRIGGER_CONFORM = 0, + INTR_TRIGGER_EDGE = 1, + INTR_TRIGGER_LEVEL = 2 +}; + +enum intr_polarity { + INTR_POLARITY_CONFORM = 0, + INTR_POLARITY_HIGH = 1, + INTR_POLARITY_LOW = 2 }; -#define INTR_TYPE_AV INTR_TYPE_TTY /* for source compatibility with 5.x */ typedef int (*devop_t)(void); @@ -168,10 +184,16 @@ void root_bus_configure(void); int bus_generic_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); -struct resource *bus_generic_alloc_resource(device_t bus, device_t child, - int type, int *rid, - u_long start, u_long end, - u_long count, u_int flags); +struct resource * + bus_generic_alloc_resource(device_t bus, device_t child, + int type, int *rid, + u_long start, u_long end, + u_long count, u_int flags); +struct resource_list * + bus_generic_get_resource_list (device_t, device_t); + +int bus_generic_config_intr(device_t, int, enum intr_trigger, + enum intr_polarity); int bus_generic_attach(device_t dev); int bus_generic_child_present(device_t dev, device_t child); int bus_generic_deactivate_resource(device_t dev, device_t child, int type, @@ -197,6 +219,17 @@ int bus_generic_teardown_intr(device_t dev, device_t child, int bus_generic_write_ivar(device_t dev, device_t child, int which, uintptr_t value); +struct resource * + bus_generic_rl_alloc_resource (device_t, device_t, int, int *, + u_long, u_long, u_long, u_int); +void bus_generic_rl_delete_resource (device_t, device_t, int, int); +int bus_generic_rl_get_resource (device_t, device_t, int, int, u_long *, + u_long *); +int bus_generic_rl_set_resource (device_t, device_t, int, int, u_long, + u_long); +int bus_generic_rl_release_resource (device_t, device_t, int, int, + struct resource *); + /* * Wrapper functions for the BUS_*_RESOURCE methods to make client code * a little simpler. @@ -290,6 +323,7 @@ int resource_long_value(const char *name, int unit, const char *resname, long *result); int resource_string_value(const char *name, int unit, const char *resname, char **result); +int resource_disabled(const char *name, int unit); int resource_query_string(int i, const char *resname, const char *value); char *resource_query_name(int i); int resource_query_unit(int i); -- 2.41.0