--- //depot/vendor/freebsd/src/sys/boot/i386/boot2/boot2.c 2005/11/03 07:41:52 +++ //depot/user/jhb/acpipci/boot/i386/boot2/boot2.c 2005/11/08 19:00:58 @@ -277,7 +277,7 @@ for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%u,%c)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, --- //depot/vendor/freebsd/src/sys/boot/i386/loader/Makefile 2006/03/17 18:55:35 +++ //depot/user/jhb/acpipci/boot/i386/loader/Makefile 2006/04/14 17:42:48 @@ -4,7 +4,7 @@ PROG= loader.sym INTERNALPROG= -NEWVERSWHAT= "bootstrap loader" i386 +NEWVERSWHAT= "bootstrap loader" x86 # architecture-specific loader code SRCS= main.c conf.c vers.c --- //depot/vendor/freebsd/src/sys/conf/files 2006/05/12 04:18:05 +++ //depot/user/jhb/acpipci/conf/files 2006/05/13 01:55:00 @@ -838,6 +838,7 @@ dev/si/si.c optional si dev/si/si2_z280.c optional si dev/si/si3_t225.c optional si +dev/si/si4_cf.c optional si dev/si/si_eisa.c optional si eisa dev/si/si_isa.c optional si isa dev/si/si_pci.c optional si pci --- //depot/vendor/freebsd/src/sys/dev/acpica/acpi.c 2006/05/07 03:30:16 +++ //depot/user/jhb/acpipci/dev/acpica/acpi.c 2006/05/13 02:31:54 @@ -30,6 +30,9 @@ #include __FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.223 2006/05/07 03:28:10 njl Exp $"); +#ifdef __i386__ +#include "opt_maxmem.h" +#endif #include "opt_acpi.h" #include #include @@ -285,6 +288,19 @@ return_VALUE (0); started = 1; +#ifdef __i386__ + /* Warn about MAXMEM or hw.physmem use. */ + do { +#ifndef MAXMEM + u_long tmp; + + if (TUNABLE_ULONG_FETCH("hw.physmem", &tmp)) +#endif + printf("WARNING: Usage of MAXMEM or hw.physmem may cause " + "ACPI to panic!\n"); + } while (0); +#endif + /* Initialise the ACPI mutex */ mtx_init(&acpi_mutex, "ACPI global lock", NULL, MTX_DEF); @@ -1508,18 +1524,31 @@ static int acpi_probe_order(ACPI_HANDLE handle, int *order) { + ACPI_OBJECT_TYPE type; + u_int bus; /* * 1. I/O port and memory system resource holders * 2. Embedded controllers (to handle early accesses) - * 3. PCI Link Devices + * 3. CPUs + * 4. PCI Link Devices + * 11 - 266. Host-PCI bridges sorted by _BBN */ + AcpiGetType(handle, &type); if (acpi_MatchHid(handle, "PNP0C01") || acpi_MatchHid(handle, "PNP0C02")) *order = 1; else if (acpi_MatchHid(handle, "PNP0C09")) *order = 2; + else if (type == ACPI_TYPE_PROCESSOR) + *order = 3; else if (acpi_MatchHid(handle, "PNP0C0F")) - *order = 3; + *order = 4; + else if (acpi_MatchHid(handle, "PNP0A03")) { + if (ACPI_SUCCESS(acpi_GetInteger(handle, "_BBN", &bus))) + *order = 11 + bus; + else + *order = 11; + } return (0); } @@ -1566,14 +1595,17 @@ break; /* - * Create a placeholder device for this node. Sort the placeholder - * so that the probe/attach passes will run breadth-first. Orders - * less than 10 are reserved for special objects (i.e., system - * resources). Larger values are used for all other devices. + * Create a placeholder device for this node. Sort the + * placeholder so that the probe/attach passes will run + * breadth-first. Orders less than 10 are reserved for + * special objects (i.e., system resources). Values + * between 10 and 300 are reserved for Host-PCI bridges. + * Larger values are used for all other devices. */ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "scanning '%s'\n", handle_str)); - order = (level + 1) * 10; + order = level * 10 + 300; acpi_probe_order(handle, &order); + printf("ACPI: Adding %s order %d\n", handle_str, order); child = BUS_ADD_CHILD(bus, order, NULL, -1); if (child == NULL) break; --- //depot/vendor/freebsd/src/sys/dev/acpica/acpi_pci.c 2006/05/11 22:16:15 +++ //depot/user/jhb/acpipci/dev/acpica/acpi_pci.c 2006/05/13 01:55:00 @@ -208,8 +208,19 @@ */ child = acpi_get_device(handle); if (child != NULL) { - KASSERT(!device_is_alive(child), ("%s: deleting alive child %s", - __func__, device_get_nameunit(child))); + if (device_is_alive(child)) { + /* + * The TabletPC TC1000 has a second PCI-ISA bridge + * that has a _HID for an acpi_sysresource device. + * In that case, leave ACPI-CA's device data pointing + * at the ACPI-enumerated device. + */ + device_printf(child, + "Conflicts with PCI device %d:%d:%d\n", + pci_get_bus(pci_child), pci_get_slot(pci_child), + pci_get_function(pci_child)); + return; + } KASSERT(device_get_parent(child) == devclass_get_device(devclass_find("acpi"), 0), ("%s: child (%s)'s parent is not acpi0", __func__, --- //depot/vendor/freebsd/src/sys/dev/acpica/acpi_pci_link.c 2006/01/06 16:16:09 +++ //depot/user/jhb/acpipci/dev/acpica/acpi_pci_link.c 2006/01/06 19:54:00 @@ -897,7 +897,18 @@ if (!link->l_routed && PCI_INTERRUPT_VALID(link->l_irq)) { link->l_routed = TRUE; + /* + * Some BIOSen are broken and actually set + * some interrupts to active-high with level + * trigger. Workaround this by hard-coding + * active-low and level-trigger. + */ +#if 0 acpi_config_intr(dev, resource); +#else + BUS_CONFIG_INTR(dev, link->l_irq, + INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); +#endif pci_link_interrupt_weights[link->l_irq] += link->l_references; } --- //depot/vendor/freebsd/src/sys/dev/acpica/acpi_resource.c 2006/05/07 03:30:16 +++ //depot/user/jhb/acpipci/dev/acpica/acpi_resource.c 2006/05/13 01:55:00 @@ -77,6 +77,12 @@ req->counter++; break; } + if (irq != rman_get_start(req->res) && irq == 0) { + if (bootverbose) + printf("IRQ is %u, resource is %lu\n", irq, + rman_get_start(req->res)); + return (AE_CTRL_TERMINATE); + } req->found = 1; KASSERT(irq == rman_get_start(req->res), ("IRQ resources do not match")); --- //depot/vendor/freebsd/src/sys/dev/asr/asr.c 2006/05/12 05:08:03 +++ //depot/user/jhb/acpipci/dev/asr/asr.c 2006/05/13 01:55:00 @@ -152,7 +152,15 @@ #include #include -#define osdSwap4(x) ((u_long)ntohl((u_long)(x))) +/* Alignment macros */ +#define osdSwap2(x) bswap16(x) +#define osdSwap4(x) bswap32(x) +#define osdLocal2(x) htobe16(*(uint16_t *)(x)) +#define osdSlocal2(x) htole16(*(uint16_t *)(x)) +#define osdLocal3(x) htobe32(*(uint32_t *)(x)) +#define osdLocal4(x) osdLocal3(x) +#define osdSlocal4(x) htole32(*(uint32_t *)(x)) + #define KVTOPHYS(x) vtophys(x) #include #include --- //depot/vendor/freebsd/src/sys/dev/fxp/if_fxp.c 2006/04/14 17:32:37 +++ //depot/user/jhb/acpipci/dev/fxp/if_fxp.c 2006/04/27 21:06:54 @@ -1422,6 +1422,7 @@ * This could cause us to overwrite the completion status. * XXX This is probably bogus and we're _not_ looking * for atomicity here. + * XXX: looks like a job for bus_space (jhb) */ atomic_clear_16(&sc->fxp_desc.tx_last->tx_cb->cb_command, htole16(FXP_CB_COMMAND_S)); --- //depot/vendor/freebsd/src/sys/dev/my/if_my.c 2005/12/05 18:57:50 +++ //depot/user/jhb/acpipci/dev/my/if_my.c 2005/12/05 22:00:56 @@ -811,6 +811,7 @@ */ pci_enable_busmaster(dev); + /* XXX: This code doesn't do any good. */ if (my_info_tmp->my_did == MTD800ID) { iobase = pci_read_config(dev, MY_PCI_LOIO, 4); if (iobase & 0x300) --- //depot/vendor/freebsd/src/sys/dev/nve/if_nve.c 2006/04/28 20:10:49 +++ //depot/user/jhb/acpipci/dev/nve/if_nve.c 2006/05/01 19:32:43 @@ -488,7 +488,16 @@ sc->adapterdata.ulMediaIF = sc->media; sc->adapterdata.ulModeRegTxReadCompleteEnable = 1; sc->hwapi->pfnSetCommonData(sc->hwapi->pADCX, &sc->adapterdata); - + + /* From DragonFly: */ + /* Setup Hardware interface and allocate memory structures */ + error = sc->hwapi->pfnInit(sc->hwapi->pADCX, + 0, /* force speed */ + 0, /* force full duplex */ + 0, /* force mode */ + 0, /* force async mode */ + &sc->linkup); + /* MAC is loaded backwards into h/w reg */ sc->hwapi->pfnGetNodeAddress(sc->hwapi->pADCX, sc->original_mac_addr); for (i = 0; i < 6; i++) { @@ -670,6 +679,14 @@ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + /* + * Dragonfly resets these to 0 here, but I think they should already + * always be 0. + */ + if (ifp->if_timer != 0 || sc->pending_txs != 0) + if_printf(ifp, "reinit: timer %d, pending_txs %d", + ifp->if_timer, sc->pending_txs); + callout_reset(&sc->stat_callout, hz, nve_tick, sc); DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_init - exit\n"); @@ -697,6 +714,9 @@ sc->hwapi->pfnDisableInterrupts(sc->hwapi->pADCX); sc->hwapi->pfnStop(sc->hwapi->pADCX, 0); + /* From Dragonfly: */ + sc->hwapi->pfnClearTxDesc(sc->hwapi->pADCX); + DEBUGOUT(NVE_DEBUG_DEINIT, "nve: do pfnDeinit\n"); /* Shutdown interface and deallocate memory buffers */ if (sc->hwapi->pfnDeinit) --- //depot/vendor/freebsd/src/sys/dev/si/si.c 2006/01/06 20:00:50 +++ //depot/user/jhb/acpipci/dev/si/si.c 2006/01/06 20:12:34 @@ -113,10 +113,12 @@ static int si_Nports; static int si_Nmodules; -static int si_debug = 0; /* data, not bss, so it's patchable */ +#ifdef SI_DEBUG +static int si_debug = DBG_ALL & ~DBG_POLL; /* data, not bss, so it's patchable */ SYSCTL_INT(_machdep, OID_AUTO, si_debug, CTLFLAG_RW, &si_debug, 0, ""); TUNABLE_INT("machdep.si_debug", &si_debug); +#endif static int si_numunits; @@ -190,6 +192,7 @@ "SIPCI", "SXPCI", "SXISA", + "SX+", }; /* @@ -271,6 +274,9 @@ sc->sc_ports = NULL; /* mark as uninitialised */ + printf("si%d: maddr offset: %p\n", unit, + (char *)(sc->sc_maddr - sc->sc_baddr)); + maddr = sc->sc_maddr; /* Stop the CPU first so it won't stomp around while we load */ @@ -282,9 +288,23 @@ case SIPCI: *(maddr+SIPCIRESET) = 0; break; + case SIJETCF: case SIJETPCI: /* fall through to JET ISA */ case SIJETISA: *(maddr+SIJETCONFIG) = 0; + *(maddr+SIJETRESET) = 0; + + /* Give the CPU a second to shut down. */ + y = 0; + while (*(maddr+SIJETRESET) & 1) { + y++; + if (y == 10) { + printf("si%d: unable to stop CPU\n", + unit); + return ENXIO; + } + DELAY(100000); + } break; case SIHOST2: *(maddr+SIPLRESET) = 0; @@ -300,7 +320,12 @@ /* OK, now lets download the download code */ - if (SI_ISJET(sc->sc_type)) { + if (sc->sc_type == SIJETCF) { + DPRINT((0, DBG_DOWNLOAD, "si%d: jetcf_download: nbytes %d\n", + unit, si4_cf_dsize)); + si_bcopy(si4_cf_download, sc->sc_baddr + si4_cf_downloadaddr, + si4_cf_dsize); + } else if (SI_ISJET(sc->sc_type)) { DPRINT((0, DBG_DOWNLOAD, "si%d: jet_download: nbytes %d\n", unit, si3_t225_dsize)); si_bcopy(si3_t225_download, maddr + si3_t225_downloadaddr, @@ -332,6 +357,7 @@ *(maddr+SIPCIRESET) = 1; *(maddr+SIPCIINTCL) = 0; break; + case SIJETCF: case SIJETPCI: *(maddr+SIJETRESET) = 0; *(maddr+SIJETCONFIG) = SIJETBUSEN|SIJETIRQEN; @@ -659,6 +685,7 @@ case TCSIMODULES: *ip = si_Nmodules; goto out; +#ifdef SI_DEBUG case TCSISDBG_ALL: SUCHECK; si_debug = *ip; @@ -666,6 +693,12 @@ case TCSIGDBG_ALL: *ip = si_debug; goto out; +#else + case TCSISDBG_ALL: + case TCSIGDBG_ALL: + error = ENOTTY; + goto out; +#endif default: /* * Check that a controller for this port exists @@ -1103,6 +1136,13 @@ if (sc == NULL || sc->sc_type == SIEMPTY) continue; + DPRINT((NULL, arg == NULL ? DBG_POLL:DBG_INTR, + "IRQ_STATUS %#x\n", + (int)sc->sc_maddr[SX_IRQ_STATUS])); + if (SI_ISJET(sc->sc_type) && + (sc->sc_maddr[SX_IRQ_STATUS] & 0x1) != 0) + continue; + /* * First, clear the interrupt */ @@ -1125,6 +1165,7 @@ ((volatile struct si_reg *)maddr)->int_pending = 0; *(maddr+SIPCIINTCL) = 0x0; break; + case SIJETCF: case SIJETPCI: /* fall through to JETISA case */ case SIJETISA: maddr = sc->sc_maddr; @@ -1179,6 +1220,9 @@ if (ccbp->hi_stat == IDLE_CLOSE) { continue; } + DPRINT((pp, arg == NULL ? DBG_POLL:DBG_INTR, + "si_intr hi_stat = 0x%x\n", + ccbp->hi_stat)); /* * Do modem state change if not a local device @@ -1633,6 +1677,7 @@ } break; /* T225 based hosts */ + case SIJETCF: case SIJETPCI: case SIJETISA: switch (uart_type) { --- //depot/vendor/freebsd/src/sys/dev/si/si.h 2005/01/06 01:48:14 +++ //depot/user/jhb/acpipci/dev/si/si.h 2005/11/17 19:19:29 @@ -52,18 +52,30 @@ */ struct si_reg { - BYTE initstat; - BYTE memsize; - WORD int_count; - WORD revision; - BYTE rx_int_count; /* isr_count on Jet */ - BYTE main_count; /* spare on Z-280 */ - WORD int_pending; - WORD int_counter; - BYTE int_scounter; - BYTE res[0x80 - 13]; + BYTE cc_init_status; + BYTE cc_mem_size; + WORD cc_int_count; + WORD cc_revision; + BYTE cc_rx_int_count; /* cc_isr_count on Jet */ + BYTE cc_main_count; /* spare on Z-280 */ + WORD cc_int_pending; + WORD cc_poll_count; + BYTE cc_int_set_count; + BYTE cc_curr_status; + BYTE cc_rfu[0x80 - 0x0e]; }; +/* XXX: Compat for now */ +#define initstat cc_init_status +#define memsize cc_mem_size +#define int_count cc_int_count +#define revision cc_revision +#define rx_int_count cc_rx_int_count +#define main_count cc_main_count +#define int_pending cc_int_pending +#define int_counter cc_poll_count +#define int_scounter cc_int_set_count + /* * Per module control structure, stored in shared memory. */ --- //depot/vendor/freebsd/src/sys/dev/si/si_eisa.c 2005/01/06 01:48:14 +++ //depot/user/jhb/acpipci/dev/si/si_eisa.c 2005/11/15 05:07:15 @@ -90,7 +90,8 @@ goto fail; } sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res); - sc->sc_maddr = rman_get_virtual(sc->sc_mem_res); + sc->sc_baddr = rman_get_virtual(sc->sc_mem_res); + sc->sc_maddr = sc->sc_baddr; sc->sc_irq_rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, --- //depot/vendor/freebsd/src/sys/dev/si/si_isa.c 2005/01/06 01:48:14 +++ //depot/user/jhb/acpipci/dev/si/si_isa.c 2005/11/15 05:07:15 @@ -280,7 +280,8 @@ goto fail; } sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res); - sc->sc_maddr = rman_get_virtual(sc->sc_mem_res); + sc->sc_baddr = rman_get_virtual(sc->sc_mem_res); + sc->sc_maddr = sc->sc_baddr; sc->sc_irq_rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, --- //depot/vendor/freebsd/src/sys/dev/si/si_pci.c 2005/11/08 04:15:30 +++ //depot/user/jhb/acpipci/dev/si/si_pci.c 2005/11/17 19:00:00 @@ -43,11 +43,17 @@ switch (pci_get_devid(dev)) { case 0x400011cb: - desc = "Specialix SI/XIO PCI host card"; + desc = "Specialix z280 SI XIO PCI host card"; break; case 0x200011cb: - if (pci_read_config(dev, SIJETSSIDREG, 4) == 0x020011cb) + switch (pci_get_subdevice(dev)) { + case 0x0200: desc = "Specialix SX PCI host card"; + break; + case 0x0300: + desc = "Specialix SX+ PCI host card"; + break; + } break; } if (desc) { @@ -71,11 +77,20 @@ switch (pci_get_devid(dev)) { case 0x400011cb: sc->sc_type = SIPCI; - sc->sc_mem_rid = SIPCIBADR; + sc->sc_mem_rid = PCIR_BAR(0); break; case 0x200011cb: - sc->sc_type = SIJETPCI; - sc->sc_mem_rid = SIJETBADR; + /* The SX card uses BAR2 whereas the SX+ uses BAR3. */ + switch (pci_get_subdevice(dev)) { + case 0x0200: + sc->sc_type = SIJETPCI; + sc->sc_mem_rid = PCIR_BAR(2); + break; + case 0x0300: + sc->sc_type = SIJETCF; + sc->sc_mem_rid = PCIR_BAR(3); + break; + } break; } @@ -87,7 +102,20 @@ goto fail; } sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res); - sc->sc_maddr = rman_get_virtual(sc->sc_mem_res); + sc->sc_baddr = rman_get_virtual(sc->sc_mem_res); + device_printf(dev, "memory size: %#lx\n", rman_get_size(sc->sc_mem_res)); + if (sc->sc_type == SIJETCF) + /* + * The SX SDK claims that the SX+ BAR3 is 128k in length + * and that the shared memory window starts at 32k from + * the end of the BAR. Howver, in practice it seems that + * at least some SX+ cards have larger BAR3 (e.g. 256k) + * but the offset of the shared memory window is still at + * 0x18000 rather than 32k from the end. + */ + sc->sc_maddr = sc->sc_baddr + 0x18000; + else + sc->sc_maddr = sc->sc_baddr; sc->sc_irq_rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, --- //depot/vendor/freebsd/src/sys/dev/si/sireg.h 2005/11/07 21:55:44 +++ //depot/user/jhb/acpipci/dev/si/sireg.h 2005/11/17 19:19:29 @@ -62,14 +62,24 @@ #define SIEISAIOSIZE 0x100 /* XXX How many ports */ /* SI old PCI */ -#define SIPCIBADR PCIR_BAR(0) /* Which BADR to map in RAM */ #define SIPCI_MEMSIZE 0x100000 /* Mapping size */ #define SIPCIRESET 0xc0001 /* 0 = Reset */ #define SIPCIINTCL 0x40001 /* 0 = clear int */ -/* SI Jet PCI */ -#define SIJETSSIDREG PCIR_SUBVEND_0 /* Is it an SX or RIO? */ -#define SIJETBADR PCIR_BAR(2) /* Which BADR to map in RAM */ +/* SI Jet (SX/SX+) */ +#define SX_EVENT_STATUS 0x7800 /* Read only */ +#define SX_EVENT_STROBE 0x7800 /* Write only */ +#define SX_EVENT_ENABLE 0x7880 /* Write only */ +#define SX_VPD_ROM 0x7c00 /* SX cards only, read only */ +#define SX_VPD_UNIQUEID1 (SX_VPD_ROM + 0x0e) /* & 0xf0 = 0x20 for SX ISA */ +#define SX_VPD_IDENT (SX_VPD_ROM + 0x20) /* ID ROM string */ +#define SX_CONFIG 0x7c00 /* Write only */ +#define SX_IRQ_STATUS 0x7c80 /* Read only */ +#define SX_SET_IRQ 0x7c80 /* Write only */ +#define SX_RESET_STATUS 0x7d00 /* Read only */ +#define SX_RESET 0x7d00 /* Write only */ +#define SX_RESET_IRQ 0x7d80 /* Write only */ + /* SI Jet PCI & ISA */ #define SIJETIDBASE 0x7c00 /* ID ROM base */ #define SISPLXID 0x984d /* Specialix ID */ --- //depot/vendor/freebsd/src/sys/dev/si/sivar.h 2005/01/06 01:48:14 +++ //depot/user/jhb/acpipci/dev/si/sivar.h 2005/11/15 15:33:33 @@ -26,7 +26,7 @@ extern devclass_t si_devclass; -/* where the firmware lives; defined in si2_z280.c and si3_t225.c */ +/* where the firmware lives; defined in si2_z280.c, si3_t225.c, and si4_cf.c */ /* old: si2_z280.c */ extern unsigned char si2_z280_download[]; extern unsigned short si2_z280_downloadaddr; @@ -38,6 +38,10 @@ extern unsigned char si3_t225_bootstrap[]; extern unsigned short si3_t225_bootloadaddr; extern int si3_t225_bsize; +/* even newer: si4_cf.c */ +extern unsigned char si4_cf_download[]; +extern unsigned short si4_cf_downloadaddr; +extern int si4_cf_dsize; struct si_softc { int sc_type; /* adapter type */ @@ -47,6 +51,7 @@ caddr_t sc_paddr; /* physical addr of iomem */ caddr_t sc_maddr; /* kvaddr of iomem */ + caddr_t sc_baddr; /* base kvaddr */ int sc_nport; /* # ports on this card */ int sc_irq; /* copy of attach irq */ int sc_iobase; /* EISA io port address */ @@ -109,5 +114,6 @@ #define SIPCI 5 #define SIJETPCI 6 #define SIJETISA 7 +#define SIJETCF 8 -#define SI_ISJET(x) (((x) == SIJETPCI) || ((x) == SIJETISA)) +#define SI_ISJET(x) (((x) == SIJETPCI) || ((x) == SIJETISA) || ((x) == SIJETCF)) --- //depot/vendor/freebsd/src/sys/dev/ubsec/ubsec.c 2006/04/10 18:40:29 +++ //depot/user/jhb/acpipci/dev/ubsec/ubsec.c 2006/04/25 19:50:52 @@ -1350,57 +1350,46 @@ ubsecstats.hst_unaligned++; totlen = q->q_src_mapsize; - if (q->q_src_m->m_flags & M_PKTHDR) { + if (totlen >= MINCLSIZE) { + m = m_getcl(M_DONTWAIT, MT_DATA, + q->q_src_m->m_flags & M_PKTHDR); + len = MCLBYTES; + } else if (q->q_src_m->m_flags & M_PKTHDR) { + m = m_gethdr(M_DONTWAIT, MT_DATA); len = MHLEN; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m && !m_dup_pkthdr(m, q->q_src_m, M_DONTWAIT)) { - m_free(m); - m = NULL; - } } else { + m = m_get(M_DONTWAIT, MT_DATA); len = MLEN; - MGET(m, M_DONTWAIT, MT_DATA); + } + if (m && q->q_src_m->m_flags & M_PKTHDR && + !m_dup_pkthdr(m, q->q_src_m, M_DONTWAIT)) { + m_free(m); + m = NULL; } if (m == NULL) { ubsecstats.hst_nombuf++; err = sc->sc_nqueue ? ERESTART : ENOMEM; goto errout; } - if (totlen >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_free(m); - ubsecstats.hst_nomcl++; - err = sc->sc_nqueue ? ERESTART : ENOMEM; - goto errout; - } - len = MCLBYTES; - } - m->m_len = len; - top = NULL; + m->m_len = len = min(totlen, len); + totlen -= len; + top = m; mp = ⊤ - + while (totlen > 0) { - if (top) { - MGET(m, M_DONTWAIT, MT_DATA); - if (m == NULL) { - m_freem(top); - ubsecstats.hst_nombuf++; - err = sc->sc_nqueue ? ERESTART : ENOMEM; - goto errout; - } + if (totlen >= MINCLSIZE) { + m = m_getcl(M_DONTWAIT, + MT_DATA, 0); + len = MCLBYTES; + } else { + m = m_get(M_DONTWAIT, MT_DATA); len = MLEN; } - if (top && totlen >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - *mp = m; - m_freem(top); - ubsecstats.hst_nomcl++; - err = sc->sc_nqueue ? ERESTART : ENOMEM; - goto errout; - } - len = MCLBYTES; + if (m == NULL) { + m_freem(top); + ubsecstats.hst_nombuf++; + err = sc->sc_nqueue ? ERESTART : ENOMEM; + goto errout; } m->m_len = len = min(totlen, len); totlen -= len; --- //depot/vendor/freebsd/src/sys/kern/subr_prof.c 2005/12/16 22:10:20 +++ //depot/user/jhb/acpipci/kern/subr_prof.c 2005/12/19 19:05:58 @@ -442,10 +442,12 @@ * Scale is a fixed-point number with the binary point 16 bits * into the value, and is <= 1.0. pc is at most 32 bits, so the * intermediate result is at most 48 bits. + * + * XXX: pc is 64 bits on LP64 archs. */ #define PC_TO_INDEX(pc, prof) \ - ((int)(((u_quad_t)((pc) - (prof)->pr_off) * \ - (u_quad_t)((prof)->pr_scale)) >> 16) & ~1) + ((((uintmax_t)((pc) - (prof)->pr_off) * \ + (uintmax_t)((prof)->pr_scale)) >> 16) & ~(uintmax_t)1) /* * Collect user-level profiling statistics; called on a profiling tick, @@ -465,7 +467,7 @@ { struct uprof *prof; caddr_t addr; - u_int i; + uintfptr_t i; int v; if (ticks == 0) @@ -500,7 +502,7 @@ struct proc *p = td->td_proc; struct uprof *prof; caddr_t addr; - u_int i; + uintfptr_t i; u_short v; int stop = 0; --- //depot/vendor/freebsd/src/sys/modules/acpi/acpi/Makefile 2005/11/01 22:45:32 +++ //depot/user/jhb/acpipci/modules/acpi/acpi/Makefile 2006/04/25 19:56:35 @@ -49,7 +49,7 @@ SRCS+= OsdDebug.c SRCS+= OsdHardware.c OsdInterrupt.c OsdMemory.c OsdSchedule.c SRCS+= OsdStream.c OsdSynch.c OsdTable.c OsdEnvironment.c -SRCS+= opt_acpi.h opt_bus.h opt_ddb.h +SRCS+= opt_acpi.h opt_bus.h opt_ddb.h opt_maxmem.h SRCS+= acpi_if.h acpi_quirks.h bus_if.h cpufreq_if.h device_if.h SRCS+= isa_if.h pci_if.h pcib_if.h