diff options
Diffstat (limited to 'sys/dev')
33 files changed, 780 insertions, 1000 deletions
diff --git a/sys/dev/acpi_support/acpi_aiboost.c b/sys/dev/acpi_support/acpi_aiboost.c index 8fff872..a8fe9cc 100644 --- a/sys/dev/acpi_support/acpi_aiboost.c +++ b/sys/dev/acpi_support/acpi_aiboost.c @@ -46,7 +46,6 @@ ACPI_MODULE_NAME("AIBOOST") #define DESCSTRLEN 32 struct acpi_aiboost_element{ - ACPI_HANDLE h; uint32_t id; char desc[DESCSTRLEN]; }; @@ -127,22 +126,23 @@ static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct a for(i = 1 ; i < o->Package.Count; i++){ elem = &o->Package.Elements[i]; - if(elem->Type != ACPI_TYPE_ANY){ - printf("NOREF\n"); - goto error; - } - c->elem[ i - 1].h = elem->Reference.Handle; - - buf2.Pointer = NULL; - buf2.Length = ACPI_ALLOCATE_BUFFER; - - status = AcpiEvaluateObject(c->elem[i - 1].h, NULL, NULL, - &buf2); - if(ACPI_FAILURE(status)){ - printf("FETCH OBJECT\n"); + if (elem->Type == ACPI_TYPE_ANY) { + buf2.Pointer = NULL; + buf2.Length = ACPI_ALLOCATE_BUFFER; + + status = AcpiEvaluateObject(elem->Reference.Handle, + NULL, NULL, &buf2); + if (ACPI_FAILURE(status)){ + printf("FETCH OBJECT\n"); + goto error; + } + subobj = buf2.Pointer; + } else if (elem->Type == ACPI_TYPE_PACKAGE) + subobj = elem; + else { + printf("NO PACKAGE\n"); goto error; } - subobj = buf2.Pointer; if(ACPI_FAILURE(acpi_PkgInt32(subobj,0, &c->elem[i -1].id))){ printf("ID FAILED\n"); goto error; @@ -151,15 +151,17 @@ static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct a sizeof(c->elem[i - 1].desc)); if(ACPI_FAILURE(status)){ if(status == E2BIG){ - c->elem[i-1].desc[DESCSTRLEN-1] = 0; + c->elem[i - 1].desc[DESCSTRLEN-1] = 0; }else{ printf("DESC FAILED %d\n", i-1); goto error; } } - if(buf2.Pointer) - AcpiOsFree(buf2.Pointer); + if (buf2.Pointer) { + AcpiOsFree(buf2.Pointer); + buf2.Pointer = NULL; + } } if(buf.Pointer) diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 0bf340d..25db9b0 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -288,7 +288,7 @@ static devclass_t acpi_ibm_devclass; DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass, 0, 0); MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1); -static char *ibm_ids[] = {"IBM0057", "IBM0068", NULL}; +static char *ibm_ids[] = {"IBM0068", NULL}; static void ibm_led(void *softc, int onoff) @@ -356,8 +356,6 @@ acpi_ibm_attach(device_t dev) } sc->ec_handle = acpi_get_handle(sc->ec_dev); - ACPI_SERIAL_BEGIN(ibm); - /* Get the sysctl tree */ sc->sysctl_ctx = device_get_sysctl_ctx(dev); sc->sysctl_tree = device_get_sysctl_tree(dev); @@ -404,8 +402,6 @@ acpi_ibm_attach(device_t dev) "Thermal zones"); } - ACPI_SERIAL_END(ibm); - /* Handle notifies */ AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, acpi_ibm_notify, dev); diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index d402274..b31f1e7 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2244,6 +2244,28 @@ acpi_SetIntrModel(int model) } /* + * Walk subtables of a table and call a callback routine for each + * subtable. The caller should provide the first subtable and a + * pointer to the end of the table. This can be used to walk tables + * such as MADT and SRAT that use subtable entries. + */ +void +acpi_walk_subtables(void *first, void *end, acpi_subtable_handler *handler, + void *arg) +{ + ACPI_SUBTABLE_HEADER *entry; + + for (entry = first; (void *)entry < end; ) { + /* Avoid an infinite loop if we hit a bogus entry. */ + if (entry->Length < sizeof(ACPI_SUBTABLE_HEADER)) + return; + + handler(entry, arg); + entry = ACPI_ADD_PTR(ACPI_SUBTABLE_HEADER, entry, entry->Length); + } +} + +/* * DEPRECATED. This interface has serious deficiencies and will be * removed. * diff --git a/sys/dev/acpica/acpi_video.c b/sys/dev/acpica/acpi_video.c index c095a40..e7e7d66 100644 --- a/sys/dev/acpica/acpi_video.c +++ b/sys/dev/acpica/acpi_video.c @@ -282,8 +282,7 @@ acpi_video_detach(device_t dev) acpi_video_notify_handler); ACPI_SERIAL_BEGIN(video); - for (vo = STAILQ_FIRST(&sc->vid_outputs); vo != NULL; vo = vn) { - vn = STAILQ_NEXT(vo, vo_next); + STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) { acpi_video_vo_destroy(vo); } ACPI_SERIAL_END(video); diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 63eadea..f4d27e4 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -307,6 +307,9 @@ void acpi_EnterDebugger(void); ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL | \ ACPI_STA_BATT_PRESENT) +/* Callback function type for walking subtables within a table. */ +typedef void acpi_subtable_handler(ACPI_SUBTABLE_HEADER *, void *); + BOOLEAN acpi_DeviceIsPresent(device_t dev); BOOLEAN acpi_BatteryIsPresent(device_t dev); ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, @@ -340,6 +343,8 @@ void acpi_UserNotify(const char *subsystem, ACPI_HANDLE h, int acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas, struct resource **res, u_int flags); +void acpi_walk_subtables(void *first, void *end, + acpi_subtable_handler *handler, void *arg); struct acpi_parse_resource_set { void (*set_init)(device_t dev, void *arg, void **context); diff --git a/sys/dev/ata/chipsets/ata-marvell.c b/sys/dev/ata/chipsets/ata-marvell.c index 0544e19..dd6b96f 100644 --- a/sys/dev/ata/chipsets/ata-marvell.c +++ b/sys/dev/ata/chipsets/ata-marvell.c @@ -227,6 +227,8 @@ ata_marvell_edma_ch_attach(device_t dev) work = ch->dma.work_bus; /* clear work area */ bzero(ch->dma.work, 1024+256); + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* set legacy ATA resources */ for (i = ATA_DATA; i <= ATA_COMMAND; i++) { @@ -310,7 +312,11 @@ ata_marvell_edma_ch_attach(device_t dev) static int ata_marvell_edma_ch_detach(device_t dev) { + struct ata_channel *ch = device_get_softc(dev); + if (ch->dma.work_tag && ch->dma.work_map) + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); ata_dmafini(dev); return (0); } @@ -344,8 +350,6 @@ ata_marvell_edma_begin_transaction(struct ata_request *request) struct ata_channel *ch = device_get_softc(request->parent); u_int32_t req_in; u_int8_t *bytep; - u_int16_t *wordp; - u_int32_t *quadp; int i; int error, slot; @@ -374,13 +378,14 @@ ata_marvell_edma_begin_transaction(struct ata_request *request) slot = (((req_in & ~0xfffffc00) >> 5) + 0) & 0x1f; bytep = (u_int8_t *)(ch->dma.work); bytep += (slot << 5); - wordp = (u_int16_t *)bytep; - quadp = (u_int32_t *)bytep; /* fill in this request */ - quadp[0] = (long)request->dma->sg_bus & 0xffffffff; - quadp[1] = (u_int64_t)request->dma->sg_bus >> 32; - wordp[4] = (request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag<<1); + le32enc(bytep + 0 * sizeof(u_int32_t), + request->dma->sg_bus & 0xffffffff); + le32enc(bytep + 1 * sizeof(u_int32_t), + (u_int64_t)request->dma->sg_bus >> 32); + le16enc(bytep + 4 * sizeof(u_int16_t), + (request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag << 1)); i = 10; bytep[i++] = (request->u.ata.count >> 8) & 0xff; @@ -409,6 +414,9 @@ ata_marvell_edma_begin_transaction(struct ata_request *request) bytep[i++] = request->u.ata.command; bytep[i++] = 0x90 | ATA_COMMAND; + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* enable EDMA machinery if needed */ if (!(ATA_INL(ctlr->r_res1, 0x02028 + ATA_MV_EDMA_BASE(ch)) & 0x00000001)) { ATA_OUTL(ctlr->r_res1, 0x02028 + ATA_MV_EDMA_BASE(ch), 0x00000001); @@ -451,6 +459,8 @@ ata_marvell_edma_end_transaction(struct ata_request *request) slot = (((rsp_in & ~0xffffff00) >> 3)) & 0x1f; rsp_out &= 0xffffff00; rsp_out += (slot << 3); + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); response = (struct ata_marvell_response *) (ch->dma.work + 1024 + (slot << 3)); @@ -525,6 +535,7 @@ ata_marvell_edma_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, prd[i].addrlo = htole32(segs[i].ds_addr); prd[i].count = htole32(segs[i].ds_len); prd[i].addrhi = htole32((u_int64_t)segs[i].ds_addr >> 32); + prd[i].reserved = 0; } prd[i - 1].count |= htole32(ATA_DMA_EOT); KASSERT(nsegs <= ATA_DMA_ENTRIES, ("too many DMA segment entries\n")); diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c index 0aae153..59d9632 100644 --- a/sys/dev/atkbdc/atkbd.c +++ b/sys/dev/atkbdc/atkbd.c @@ -44,10 +44,10 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/resource.h> -#ifdef __i386__ +#if defined(__i386__) || defined(__amd64__) #include <machine/md_var.h> #include <machine/psl.h> -#include <machine/vm86.h> +#include <compat/x86bios/x86bios.h> #include <machine/pc/bios.h> #include <vm/vm.h> @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_param.h> #include <isa/isareg.h> -#endif /* __i386__ */ +#endif /* __i386__ || __amd64__ */ #include <sys/kbio.h> #include <dev/kbd/kbdreg.h> @@ -1089,34 +1089,42 @@ atkbd_shutdown_final(void *v) static int get_typematic(keyboard_t *kbd) { -#ifdef __i386__ +#if defined(__i386__) || defined(__amd64__) /* * Only some systems allow us to retrieve the keyboard repeat * rate previously set via the BIOS... */ - struct vm86frame vmf; - u_int32_t p; - - bzero(&vmf, sizeof(vmf)); - vmf.vmf_ax = 0xc000; - vm86_intcall(0x15, &vmf); - if ((vmf.vmf_eflags & PSL_C) || vmf.vmf_ah) - return ENODEV; - p = BIOS_PADDRTOVADDR(((u_int32_t)vmf.vmf_es << 4) + vmf.vmf_bx); - if ((readb(p + 6) & 0x40) == 0) /* int 16, function 0x09 supported? */ - return ENODEV; - vmf.vmf_ax = 0x0900; - vm86_intcall(0x16, &vmf); - if ((vmf.vmf_al & 0x08) == 0) /* int 16, function 0x0306 supported? */ - return ENODEV; - vmf.vmf_ax = 0x0306; - vm86_intcall(0x16, &vmf); - kbd->kb_delay1 = typematic_delay(vmf.vmf_bh << 5); - kbd->kb_delay2 = typematic_rate(vmf.vmf_bl); - return 0; + x86regs_t regs; + uint8_t *p; + + /* Is BIOS system configuration table supported? */ + bzero(®s, sizeof(regs)); + regs.R_AH = 0xc0; + x86bios_intr(®s, 0x15); + if ((regs.R_FLG & PSL_C) != 0 || regs.R_AH != 0) + return (ENODEV); + + /* Is int 16, function 0x09 supported? */ + p = x86bios_offset((regs.R_ES << 4) + regs.R_BX); + if (readw(p) < 5 || (readb(p + 6) & 0x40) == 0) + return (ENODEV); + + /* Is int 16, function 0x0306 supported? */ + bzero(®s, sizeof(regs)); + regs.R_AH = 0x09; + x86bios_intr(®s, 0x16); + if ((regs.R_AL & 0x08) == 0) + return (ENODEV); + + bzero(®s, sizeof(regs)); + regs.R_AX = 0x0306; + x86bios_intr(®s, 0x16); + kbd->kb_delay1 = typematic_delay(regs.R_BH << 5); + kbd->kb_delay2 = typematic_rate(regs.R_BL); + return (0); #else - return ENODEV; -#endif /* __i386__ */ + return (ENODEV); +#endif /* __i386__ || __amd64__ */ } static int diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 2acf1a8..c3d2839 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -160,7 +160,7 @@ static void tulip_dma_map_rxbuf(void *, bus_dma_segment_t *, int, static void tulip_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - u_int32_t *paddr; + bus_addr_t *paddr; if (error) return; @@ -182,7 +182,7 @@ tulip_dma_map_rxbuf(void *arg, bus_dma_segment_t *segs, int nseg, KASSERT(nseg == 1, ("too many DMA segments")); KASSERT(segs[0].ds_len >= TULIP_RX_BUFLEN, ("receive buffer too small")); - desc->d_addr1 = segs[0].ds_addr; + desc->d_addr1 = segs[0].ds_addr & 0xffffffff; desc->d_length1 = TULIP_RX_BUFLEN; #ifdef not_needed /* These should already always be zero. */ @@ -3171,8 +3171,8 @@ tulip_reset(tulip_softc_t * const sc) sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } - TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr); - TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr); + TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr & 0xffffffff); + TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr & 0xffffffff); TULIP_CSR_WRITE(sc, csr_busmode, (1 << (3 /*pci_max_burst_len*/ + 8)) |TULIP_BUSMODE_CACHE_ALIGN8 @@ -3488,7 +3488,7 @@ tulip_rx_intr(tulip_softc_t * const sc) struct mbuf *m0; KASSERT(ms != NULL, ("no packet to accept")); -#if defined(TULIP_COPY_RXDATA) +#ifndef __NO_STRICT_ALIGNMENT /* * Copy the data into a new mbuf that is properly aligned. If * we fail to allocate a new mbuf, then drop the packet. We will @@ -3527,7 +3527,7 @@ tulip_rx_intr(tulip_softc_t * const sc) */ ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); -#if defined(TULIP_COPY_RXDATA) +#ifndef __NO_STRICT_ALIGNMENT skip_input: #endif if (ms == NULL) { @@ -4016,9 +4016,9 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m) eop = nextout; eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; eop->di_desc->d_status = d_status; - eop->di_desc->d_addr1 = segs[segcnt].ds_addr; + eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff; eop->di_desc->d_length1 = segs[segcnt].ds_len; - eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr; + eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr & 0xffffffff; eop->di_desc->d_length2 = segs[segcnt+1].ds_len; d_status = TULIP_DSTS_OWNER; if (++nextout == ri->ri_last) @@ -4028,7 +4028,7 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m) eop = nextout; eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; eop->di_desc->d_status = d_status; - eop->di_desc->d_addr1 = segs[segcnt].ds_addr; + eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff; eop->di_desc->d_length1 = segs[segcnt].ds_len; eop->di_desc->d_addr2 = 0; eop->di_desc->d_length2 = 0; @@ -4194,7 +4194,7 @@ tulip_txput_setup(tulip_softc_t * const sc) nextout->d_length2 = 0; nextout->d_addr2 = 0; nextout->d_length1 = sizeof(sc->tulip_setupdata); - nextout->d_addr1 = sc->tulip_setup_dma_addr; + nextout->d_addr1 = sc->tulip_setup_dma_addr & 0xffffffff; bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); TULIP_TXDESC_PRESYNC(ri); @@ -4491,7 +4491,7 @@ tulip_busdma_freering(tulip_ringinfo_t *ri) /* Allocate memory for a single descriptor ring. */ static int tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, - bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri, const char *name) + bus_size_t align, int nsegs, tulip_ringinfo_t *ri, const char *name) { size_t size; int error, i; @@ -4499,7 +4499,7 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, /* First, setup a tag. */ ri->ri_max = count; size = count * sizeof(tulip_desc_t); - error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL, &ri->ri_ring_tag); if (error) { @@ -4527,9 +4527,9 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, } /* Allocate a tag for the data buffers. */ - error = bus_dma_tag_create(NULL, 4, 0, + error = bus_dma_tag_create(NULL, align, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - maxsize, nsegs, TULIP_DATA_PER_DESC, 0, NULL, NULL, &ri->ri_data_tag); + MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag); if (error) { device_printf(dev, "failed to allocate %s buffer dma tag\n", name); return (error); @@ -4563,6 +4563,7 @@ tulip_busdma_cleanup(tulip_softc_t * const sc) if (sc->tulip_setupbuf != NULL) { bus_dmamem_free(sc->tulip_setup_tag, sc->tulip_setupbuf, sc->tulip_setup_map); + bus_dmamap_destroy(sc->tulip_setup_tag, sc->tulip_setup_map); sc->tulip_setup_map = NULL; sc->tulip_setupbuf = NULL; } @@ -4586,8 +4587,8 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc) /* * Allocate space and dmamap for transmit ring. */ - error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, TULIP_DATA_PER_DESC, - TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit"); + error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, 1, TULIP_MAX_TXSEG, + &sc->tulip_txinfo, "transmit"); if (error) return (error); @@ -4598,7 +4599,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc) * a waste in practice though as an ethernet frame can easily fit * in TULIP_RX_BUFLEN bytes. */ - error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, MCLBYTES, 1, + error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, 4, 1, &sc->tulip_rxinfo, "receive"); if (error) return (error); @@ -4606,7 +4607,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc) /* * Allocate a DMA tag, memory, and map for setup descriptor */ - error = bus_dma_tag_create(NULL, 4, 0, + error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0, NULL, NULL, &sc->tulip_setup_tag); diff --git a/sys/dev/de/if_devar.h b/sys/dev/de/if_devar.h index 3fd3410..b4feebc 100644 --- a/sys/dev/de/if_devar.h +++ b/sys/dev/de/if_devar.h @@ -104,7 +104,7 @@ typedef struct { tulip_descinfo_t *ri_descinfo; bus_dma_tag_t ri_ring_tag; bus_dmamap_t ri_ring_map; - uint32_t ri_dma_addr; + bus_addr_t ri_dma_addr; bus_dma_tag_t ri_data_tag; bus_dmamap_t *ri_data_maps; } tulip_ringinfo_t; @@ -134,11 +134,7 @@ typedef struct { * architecture which can't handle unaligned accesses) because with * 100Mb/s cards the copying is just too much of a hit. */ -#if !defined(__i386__) -#define TULIP_COPY_RXDATA 1 -#endif -#define TULIP_DATA_PER_DESC 2032 #define TULIP_TXTIMER 4 #define TULIP_RXDESCS 48 #define TULIP_TXDESCS 128 @@ -560,7 +556,7 @@ struct tulip_softc { */ bus_dma_tag_t tulip_setup_tag; bus_dmamap_t tulip_setup_map; - uint32_t tulip_setup_dma_addr; + bus_addr_t tulip_setup_dma_addr; u_int32_t *tulip_setupbuf; u_int32_t tulip_setupdata[192 / sizeof(u_int32_t)]; char tulip_boardid[24]; diff --git a/sys/dev/dpms/dpms.c b/sys/dev/dpms/dpms.c index ac729f9..c0476c5 100644 --- a/sys/dev/dpms/dpms.c +++ b/sys/dev/dpms/dpms.c @@ -67,11 +67,7 @@ __FBSDID("$FreeBSD$"); #include <sys/libkern.h> #include <sys/module.h> -#include <vm/vm.h> -#include <vm/pmap.h> - -#include <contrib/x86emu/x86emu.h> -#include <contrib/x86emu/x86emu_regs.h> +#include <compat/x86bios/x86bios.h> /* * VESA DPMS States @@ -94,9 +90,6 @@ struct dpms_softc { int dpms_initial_state; }; -static struct x86emu vesa_emu; -static unsigned char *emumem = NULL; - static int dpms_attach(device_t); static int dpms_detach(device_t); static int dpms_get_supported_states(int *); @@ -126,59 +119,7 @@ static driver_t dpms_driver = { static devclass_t dpms_devclass; DRIVER_MODULE(dpms, vgapci, dpms_driver, dpms_devclass, NULL, NULL); -MODULE_DEPEND(dpms, x86emu, 1, 1, 1); - -static uint8_t -vm86_emu_inb(struct x86emu *emu, uint16_t port) -{ - if (port == 0xb2) /* APM scratch register */ - return 0; - if (port >= 0x80 && port < 0x88) /* POST status register */ - return 0; - return inb(port); -} - -static uint16_t -vm86_emu_inw(struct x86emu *emu, uint16_t port) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return 0; - return inw(port); -} - -static uint32_t -vm86_emu_inl(struct x86emu *emu, uint16_t port) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return 0; - return inl(port); -} - -static void -vm86_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val) -{ - if (port == 0xb2) /* APM scratch register */ - return; - if (port >= 0x80 && port < 0x88) /* POST status register */ - return; - outb(port, val); -} - -static void -vm86_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return; - outw(port, val); -} - -static void -vm86_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return; - outl(port, val); -} +MODULE_DEPEND(dpms, x86bios, 1, 1, 1); static void dpms_identify(driver_t *driver, device_t parent) @@ -192,7 +133,6 @@ dpms_identify(driver_t *driver, device_t parent) */ if (devclass_get_device(dpms_devclass, 0) == NULL) device_add_child(parent, "dpms", 0); - } static int @@ -200,21 +140,6 @@ dpms_probe(device_t dev) { int error, states; - emumem = pmap_mapbios(0x0, 0xc00000); - - memset(&vesa_emu, 0, sizeof(vesa_emu)); - x86emu_init_default(&vesa_emu); - - vesa_emu.emu_inb = vm86_emu_inb; - vesa_emu.emu_inw = vm86_emu_inw; - vesa_emu.emu_inl = vm86_emu_inl; - vesa_emu.emu_outb = vm86_emu_outb; - vesa_emu.emu_outw = vm86_emu_outw; - vesa_emu.emu_outl = vm86_emu_outl; - - vesa_emu.mem_base = (char *)emumem; - vesa_emu.mem_size = 1024 * 1024; - error = dpms_get_supported_states(&states); if (error) return (error); @@ -240,8 +165,6 @@ dpms_attach(device_t dev) static int dpms_detach(device_t dev) { - if (emumem) - pmap_unmapdev((vm_offset_t)emumem, 0xc00000); return (0); } @@ -267,17 +190,20 @@ dpms_resume(device_t dev) static int dpms_call_bios(int subfunction, int *bh) { - vesa_emu.x86.R_AX = VBE_DPMS_FUNCTION; - vesa_emu.x86.R_BL = subfunction; - vesa_emu.x86.R_BH = *bh; - vesa_emu.x86.R_ES = 0; - vesa_emu.x86.R_DI = 0; - x86emu_exec_intr(&vesa_emu, 0x10); - - if ((vesa_emu.x86.R_EAX & 0xffff) != 0x004f) + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_AX = VBE_DPMS_FUNCTION; + regs.R_BL = subfunction; + regs.R_BH = *bh; + regs.R_ES = 0; + regs.R_DI = 0; + x86bios_intr(®s, 0x10); + + if ((regs.R_EAX & 0xffff) != 0x004f) return (ENXIO); - *bh = vesa_emu.x86.R_BH; + *bh = regs.R_BH; return (0); } diff --git a/sys/dev/fb/s3_pci.c b/sys/dev/fb/s3_pci.c index 45facc9..cfddf30 100644 --- a/sys/dev/fb/s3_pci.c +++ b/sys/dev/fb/s3_pci.c @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <machine/md_var.h> -#include <machine/vm86.h> #include <machine/pc/bios.h> #include <dev/fb/vesa.h> diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index 5a766dc..8a61368 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -45,16 +45,15 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_param.h> #include <vm/pmap.h> +#include <machine/pc/bios.h> #include <dev/fb/vesa.h> #include <dev/fb/fbreg.h> #include <dev/fb/vgareg.h> #include <isa/isareg.h> -#include <machine/cpufunc.h> -#include <contrib/x86emu/x86emu.h> -#include <contrib/x86emu/x86emu_regs.h> +#include <compat/x86bios/x86bios.h> #define VESA_VIA_CLE266 "VIA CLE266\r\n" @@ -73,7 +72,7 @@ typedef struct adp_state adp_state_t; /* VESA video adapter */ static video_adapter_t *vesa_adp = NULL; static int vesa_state_buf_size = 0; -#define VESA_X86EMU_BUFSIZE (3 * PAGE_SIZE) +#define VESA_BIOS_BUFSIZE (3 * PAGE_SIZE) /* VESA functions */ #if 0 @@ -106,8 +105,6 @@ static vi_bitblt_t vesa_bitblt; static vi_diag_t vesa_diag; static int vesa_bios_info(int level); -static struct x86emu vesa_emu; - static video_switch_t vesavidsw = { vesa_probe, vesa_init, @@ -197,6 +194,7 @@ static int vesa_bios_set_start(int x, int y); static int vesa_map_gen_mode_num(int type, int color, int mode); static int vesa_translate_flags(u_int16_t vflags); static int vesa_translate_mmodel(u_int8_t vmodel); +static int vesa_get_line_width(video_info_t *info); static int vesa_bios_init(void); static void vesa_clear_modes(video_info_t *info, int color); static vm_offset_t vesa_map_buffer(u_int paddr, size_t size); @@ -206,77 +204,6 @@ static void vesa_unmap_buffer(vm_offset_t vaddr, size_t size); static int vesa_get_origin(video_adapter_t *adp, off_t *offset); #endif -#define SEG_ADDR(x) (((x) >> 4) & 0x00F000) -#define SEG_OFF(x) ((x) & 0x0FFFF) - -#if _BYTE_ORDER == _LITTLE_ENDIAN -#define B_O16(x) (x) -#define B_O32(x) (x) -#else -#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) -#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ - | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) -#endif - -#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) -#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) - -#define REALOFF(x) (x*4096) - -static unsigned char *emumem = NULL; - -static uint8_t -vm86_emu_inb(struct x86emu *emu, uint16_t port) -{ - if (port == 0xb2) /* APM scratch register */ - return 0; - if (port >= 0x80 && port < 0x88) /* POST status register */ - return 0; - return inb(port); -} - -static uint16_t -vm86_emu_inw(struct x86emu *emu, uint16_t port) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return 0; - return inw(port); -} - -static uint32_t -vm86_emu_inl(struct x86emu *emu, uint16_t port) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return 0; - return inl(port); -} - -static void -vm86_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val) -{ - if (port == 0xb2) /* APM scratch register */ - return; - if (port >= 0x80 && port < 0x88) /* POST status register */ - return; - outb(port, val); -} - -static void -vm86_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return; - outw(port, val); -} - -static void -vm86_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val) -{ - if (port >= 0x80 && port < 0x88) /* POST status register */ - return; - outl(port, val); -} - static void dump_buffer(u_char *buf, size_t len) { @@ -293,8 +220,12 @@ dump_buffer(u_char *buf, size_t len) static int int10_set_mode(int mode) { - vesa_emu.x86.R_EAX = 0x0000 | mode; - x86emu_exec_intr(&vesa_emu, 0x10); + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x0000 | mode; + + x86bios_intr(®s, 0x10); return 0; } @@ -303,21 +234,29 @@ int10_set_mode(int mode) static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode) { + x86regs_t regs; + int offs; u_char *buf; - vesa_emu.x86.R_EAX = 0x4f01; - vesa_emu.x86.R_ECX = mode; + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f01; + regs.R_ECX = mode; + + buf = (u_char *)x86bios_alloc(1, &offs); - buf = (emumem + REALOFF(3)); - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(3)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(3)); + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) + { + x86bios_free(buf, 1); return 1; + } bcopy(buf, vmode, sizeof(*vmode)); + x86bios_free(buf, 1); return 0; } @@ -325,62 +264,77 @@ vesa_bios_get_mode(int mode, struct vesa_mode *vmode) static int vesa_bios_set_mode(int mode) { - vesa_emu.x86.R_EAX = 0x4f02; - vesa_emu.x86.R_EBX = mode; + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f02; + regs.R_EBX = mode; - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - return ((vesa_emu.x86.R_AX & 0xff) != 0x4f); + return ((regs.R_AX & 0xff) != 0x4f); } static int vesa_bios_get_dac(void) { - vesa_emu.x86.R_EAX = 0x4f08; - vesa_emu.x86.R_EBX = 1; + x86regs_t regs; - x86emu_exec_intr(&vesa_emu, 0x10); + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f08; + regs.R_EBX = 1; - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + x86bios_intr(®s, 0x10); + + if ((regs.R_AX & 0xff) != 0x4f) return 6; - return ((vesa_emu.x86.R_EBX >> 8) & 0x00ff); + return ((regs.R_EBX >> 8) & 0x00ff); } static int vesa_bios_set_dac(int bits) { - vesa_emu.x86.R_EAX = 0x4f08; - vesa_emu.x86.R_EBX = (bits << 8); + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f08; + regs.R_EBX = (bits << 8); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) return 6; - return ((vesa_emu.x86.R_EBX >> 8) & 0x00ff); + return ((regs.R_EBX >> 8) & 0x00ff); } static int vesa_bios_save_palette(int start, int colors, u_char *palette, int bits) { + x86regs_t regs; + int offs; u_char *p; int i; - vesa_emu.x86.R_EAX = 0x4f09; - vesa_emu.x86.R_EBX = 1; - vesa_emu.x86.R_ECX = colors; - vesa_emu.x86.R_EDX = start; + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f09; + regs.R_EBX = 1; + regs.R_ECX = colors; + regs.R_EDX = start; - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2)); + p = (u_char *)x86bios_alloc(1, &offs); - p = emumem + REALOFF(2); + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) + { + x86bios_free(p, 1); return 1; + } bits = 8 - bits; for (i = 0; i < colors; ++i) { @@ -388,6 +342,8 @@ vesa_bios_save_palette(int start, int colors, u_char *palette, int bits) palette[i*3 + 1] = p[i*4 + 1] << bits; palette[i*3 + 2] = p[i*4] << bits; } + + x86bios_free(p, 1); return 0; } @@ -395,23 +351,29 @@ static int vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, int bits) { + x86regs_t regs; + int offs; u_char *p; int i; - vesa_emu.x86.R_EAX = 0x4f09; - vesa_emu.x86.R_EBX = 1; - vesa_emu.x86.R_ECX = colors; - vesa_emu.x86.R_EDX = start; + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f09; + regs.R_EBX = 1; + regs.R_ECX = colors; + regs.R_EDX = start; - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2)); + p = (u_char *)x86bios_alloc(1, &offs); - p = emumem + REALOFF(2); + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) + { + x86bios_free(p, 1); return 1; + } bits = 8 - bits; for (i = 0; i < colors; ++i) { @@ -419,16 +381,20 @@ vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, g[i] = p[i*4 + 1] << bits; b[i] = p[i*4] << bits; } + + x86bios_free(p, 1); return 0; } static int vesa_bios_load_palette(int start, int colors, u_char *palette, int bits) { + x86regs_t regs; + int offs; u_char *p; int i; - p = (emumem + REALOFF(2)); + p = (u_char *)x86bios_alloc(1, &offs); bits = 8 - bits; for (i = 0; i < colors; ++i) { @@ -438,17 +404,20 @@ vesa_bios_load_palette(int start, int colors, u_char *palette, int bits) p[i*4 + 3] = 0; } - vesa_emu.x86.R_EAX = 0x4f09; - vesa_emu.x86.R_EBX = 0; - vesa_emu.x86.R_ECX = colors; - vesa_emu.x86.R_EDX = start; + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f09; + regs.R_EBX = 0; + regs.R_ECX = colors; + regs.R_EDX = start; + + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2)); + x86bios_intr(®s, 0x10); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_free(p, 1); - return ((vesa_emu.x86.R_AX & 0xff) != 0x4f); + return ((regs.R_AX & 0xff) != 0x4f); } #ifdef notyet @@ -456,10 +425,12 @@ static int vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, int bits) { + x86regs_t regs; + int offs; u_char *p; int i; - p = (emumem + REALOFF(2)); + p = (u_char *)x86bios_alloc(1, &offs); bits = 8 - bits; for (i = 0; i < colors; ++i) { @@ -469,93 +440,111 @@ vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, p[i*4 + 3] = 0; } - vesa_emu.x86.R_EAX = 0x4f09; - vesa_emu.x86.R_EBX = 0; - vesa_emu.x86.R_ECX = colors; - vesa_emu.x86.R_EDX = start; + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f09; + regs.R_EBX = 0; + regs.R_ECX = colors; + regs.R_EDX = start; - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2)); + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - return ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + x86bios_free(p, 1); + + return ((regs.R_AX & 0xff) != 0x4f); } #endif static int vesa_bios_state_buf_size(void) { - vesa_emu.x86.R_EAX = 0x4f04; - vesa_emu.x86.R_ECX = STATE_ALL; - vesa_emu.x86.R_EDX = STATE_SIZE; + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f04; + regs.R_ECX = STATE_ALL; + regs.R_EDX = STATE_SIZE; - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) return 0; - return vesa_emu.x86.R_BX*64; + return regs.R_BX * 64; } static int vesa_bios_save_restore(int code, void *p, size_t size) { + x86regs_t regs; + int offs; u_char *buf; - if (size > VESA_X86EMU_BUFSIZE) + if (size > VESA_BIOS_BUFSIZE) return (1); - vesa_emu.x86.R_EAX = 0x4f04; - vesa_emu.x86.R_ECX = STATE_ALL; - vesa_emu.x86.R_EDX = code; + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f04; + regs.R_ECX = STATE_ALL; + regs.R_EDX = code; - buf = emumem + REALOFF(2); + buf = (u_char *)x86bios_alloc(1, &offs); - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2)); + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); bcopy(p, buf, size); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); bcopy(buf, p, size); - return ((vesa_emu.x86.R_AX & 0xff) != 0x4f); + x86bios_free(p, 1); + + return ((regs.R_AX & 0xff) != 0x4f); } static int vesa_bios_get_line_length(void) { - vesa_emu.x86.R_EAX = 0x4f06; - vesa_emu.x86.R_EBX = 1; + x86regs_t regs; - x86emu_exec_intr(&vesa_emu, 0x10); + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f06; + regs.R_EBX = 1; - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + x86bios_intr(®s, 0x10); + + if ((regs.R_AX & 0xff) != 0x4f) return -1; - return vesa_emu.x86.R_BX; + + return regs.R_BX; } static int vesa_bios_set_line_length(int pixel, int *bytes, int *lines) { - vesa_emu.x86.R_EAX = 0x4f06; - vesa_emu.x86.R_EBX = 0; - vesa_emu.x86.R_ECX = pixel; + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f06; + regs.R_EBX = 0; + regs.R_ECX = pixel; - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); #if VESA_DEBUG > 1 - printf("bx:%d, cx:%d, dx:%d\n", vesa_emu.x86.R_BX, vesa_emu.x86.R_CX, vesa_emu.x86.R_DX); + printf("bx:%d, cx:%d, dx:%d\n", regs.R_BX, regs.R_CX, regs.R_DX); #endif - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) return -1; if (bytes) - *bytes = vesa_emu.x86.R_BX; + *bytes = regs.R_BX; if (lines) - *lines = vesa_emu.x86.R_DX; + *lines = regs.R_DX; return 0; } @@ -564,16 +553,19 @@ vesa_bios_set_line_length(int pixel, int *bytes, int *lines) static int vesa_bios_get_start(int *x, int *y) { - vesa_emu.x86.R_EAX = 0x4f07; - vesa_emu.x86.R_EBX = 1; + x86regs_t regs; - x86emu_exec_intr(&vesa_emu, 0x10); + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f07; + regs.R_EBX = 1; - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + x86bios_intr(®s, 0x10); + + if ((regs.R_AX & 0xff) != 0x4f) return -1; - *x = vesa_emu.x86.R_CX; - *y = vesa_emu.x86.R_DX; + *x = regs.R_CX; + *y = regs.R_DX; return 0; } @@ -582,14 +574,17 @@ vesa_bios_get_start(int *x, int *y) static int vesa_bios_set_start(int x, int y) { - vesa_emu.x86.R_EAX = 0x4f07; - vesa_emu.x86.R_EBX = 0x80; - vesa_emu.x86.R_EDX = y; - vesa_emu.x86.R_ECX = x; + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f07; + regs.R_EBX = 0x80; + regs.R_EDX = y; + regs.R_ECX = x; - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - return ((vesa_emu.x86.R_AX & 0xff) != 0x4f); + return ((regs.R_AX & 0xff) != 0x4f); } /* map a generic video mode to a known mode */ @@ -660,11 +655,45 @@ vesa_translate_mmodel(u_int8_t vmodel) } static int +vesa_get_line_width(video_info_t *info) +{ + int len; + int width; + + width = info->vi_width; + + if (info->vi_flags & V_INFO_GRAPHICS) + switch (info->vi_depth / info->vi_planes) { + case 1: + return (width / 8); + case 2: + return (width / 4); + case 4: + return (width / 2); + case 8: + return (width); + case 15: + case 16: + return (width * 2); + case 24: + case 32: + return (width * 4); + } + + len = vesa_bios_get_line_length(); + + return (len > 0 ? len : width); +} + +static int vesa_bios_init(void) { static struct vesa_info buf; struct vesa_mode vmode; video_info_t *p; + x86regs_t regs; + size_t bsize; + int offs; u_char *vmbuf; int is_via_cle266; int modes; @@ -678,16 +707,17 @@ vesa_bios_init(void) vesa_vmode_max = 0; vesa_vmode[0].vi_mode = EOT; - vmbuf = (emumem + REALOFF(2)); + vmbuf = (u_char *)x86bios_alloc(1, &offs); bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */ - vesa_emu.x86.R_EAX = 0x4f00; - vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2)); - vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2)); + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f00; + regs.R_ES = SEG_ADDR(offs); + regs.R_DI = SEG_OFF(offs); - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if (((vesa_emu.x86.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4)) + if (((regs.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4)) return 1; bcopy(vmbuf, &buf, sizeof(buf)); @@ -707,17 +737,17 @@ vesa_bios_init(void) return 1; } - vesa_oemstr = (char *)(emumem + L_ADD(vesa_adp_info->v_oemstr)); + vesa_oemstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_oemstr)); is_via_cle266 = strcmp(vesa_oemstr, VESA_VIA_CLE266) == 0; if (vesa_adp_info->v_version >= 0x0200) { - vesa_venderstr = (char *)(emumem+L_ADD(vesa_adp_info->v_venderstr)); - vesa_prodstr = (char *)(emumem+L_ADD(vesa_adp_info->v_prodstr)); - vesa_revstr = (char *)(emumem+L_ADD(vesa_adp_info->v_revstr)); + vesa_venderstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_venderstr)); + vesa_prodstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_prodstr)); + vesa_revstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_revstr)); } - vesa_vmodetab = (u_int16_t *)(emumem+L_ADD(vesa_adp_info->v_modetable)); + vesa_vmodetab = (uint16_t *)x86bios_offset(FARP(vesa_adp_info->v_modetable)); if (vesa_vmodetab == NULL) return 1; @@ -802,7 +832,7 @@ vesa_bios_init(void) - vmode.v_lfb; else vesa_vmode[modes].vi_buffer_size - = vmode.v_offscreen + vmode.v_offscreensize*1024 + = vmode.v_offscreen + vmode.v_offscreensize * 1024; #endif vesa_vmode[modes].vi_mem_model = vesa_translate_mmodel(vmode.v_memmodel); @@ -840,9 +870,26 @@ vesa_bios_init(void) vesa_vmode[modes].vi_flags = vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA; + + /* Does it have enough memory to support this mode? */ + bsize = vesa_get_line_width(&vesa_vmode[modes]); + bsize *= vesa_vmode[modes].vi_height; + if (bsize > vesa_vmode[modes].vi_buffer_size) { +#if VESA_DEBUG > 1 + printf( + "Rejecting VESA %s mode: %d x %d x %d bpp attr = %x, not enough memory\n", + (vmode.v_modeattr & V_MODEGRAPHICS) != 0 ? "graphics" : "text", + vmode.v_width, vmode.v_height, vmode.v_bpp, vmode.v_modeattr); +#endif + continue; + } + ++modes; } vesa_vmode[modes].vi_mode = EOT; + + x86bios_free(vmbuf, 1); + if (bootverbose) printf("VESA: %d mode(s) found\n", modes); @@ -870,7 +917,8 @@ vesa_map_buffer(u_int paddr, size_t size) u_int off; off = paddr - trunc_page(paddr); - vaddr = (vm_offset_t)pmap_mapdev(paddr - off, size + off); + vaddr = (vm_offset_t)pmap_mapdev_attr(paddr - off, size + off, + PAT_WRITE_COMBINING); #if VESA_DEBUG > 1 printf("vesa_map_buffer: paddr:%x vaddr:%tx size:%zx off:%x\n", paddr, vaddr, size, off); @@ -1048,7 +1096,6 @@ static int vesa_set_mode(video_adapter_t *adp, int mode) { video_info_t info; - int len; if (adp != vesa_adp) return (*prevvidsw->set_mode)(adp, mode); @@ -1126,46 +1173,17 @@ vesa_set_mode(video_adapter_t *adp, int mode) } else { vesa_adp->va_buffer = 0; vesa_adp->va_buffer_size = info.vi_buffer_size; - vesa_adp->va_window = (vm_offset_t)(emumem+L_ADD(info.vi_window)); + vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window); vesa_adp->va_window_size = info.vi_window_size; vesa_adp->va_window_gran = info.vi_window_gran; } vesa_adp->va_window_orig = 0; - len = vesa_bios_get_line_length(); - if (len > 0) { - vesa_adp->va_line_width = len; - } else if (info.vi_flags & V_INFO_GRAPHICS) { - switch (info.vi_depth/info.vi_planes) { - case 1: - vesa_adp->va_line_width = info.vi_width/8; - break; - case 2: - vesa_adp->va_line_width = info.vi_width/4; - break; - case 4: - vesa_adp->va_line_width = info.vi_width/2; - break; - case 8: - default: /* shouldn't happen */ - vesa_adp->va_line_width = info.vi_width; - break; - case 15: - case 16: - vesa_adp->va_line_width = info.vi_width*2; - break; - case 24: - case 32: - vesa_adp->va_line_width = info.vi_width*4; - break; - } - } else { - vesa_adp->va_line_width = info.vi_width; - } + vesa_adp->va_line_width = vesa_get_line_width(&info); vesa_adp->va_disp_start.x = 0; vesa_adp->va_disp_start.y = 0; #if VESA_DEBUG > 0 - printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d\n", - info.vi_width, len, vesa_adp->va_line_width); + printf("vesa_set_mode(): vi_width:%d, line_width:%d\n", + info.vi_width, vesa_adp->va_line_width); #endif bcopy(&info, &vesa_adp->va_info, sizeof(vesa_adp->va_info)); @@ -1275,14 +1293,17 @@ vesa_load_state(video_adapter_t *adp, void *p) static int vesa_get_origin(video_adapter_t *adp, off_t *offset) { - vesa_emu.x86.R_EAX = 0x4f05; - vesa_emu.x86.R_EBX = 0x10; + x86regs_t regs; + + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f05; + regs.R_EBX = 0x10; - x86emu_exec_intr(&vesa_emu, 0x10); + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) return 1; - *offset = vesa_emu.x86.DX*adp->va_window_gran; + *offset = regs.DX * adp->va_window_gran; return 0; } @@ -1291,6 +1312,8 @@ vesa_get_origin(video_adapter_t *adp, off_t *offset) static int vesa_set_origin(video_adapter_t *adp, off_t offset) { + x86regs_t regs; + /* * This function should return as quickly as possible to * maintain good performance of the system. For this reason, @@ -1307,18 +1330,20 @@ vesa_set_origin(video_adapter_t *adp, off_t offset) if (adp->va_window_gran == 0) return 1; - vesa_emu.x86.R_EAX = 0x4f05; - vesa_emu.x86.R_EBX = 0; - vesa_emu.x86.R_EDX = offset/adp->va_window_gran; - x86emu_exec_intr(&vesa_emu, 0x10); + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f05; + regs.R_EBX = 0; + regs.R_EDX = offset / adp->va_window_gran; + x86bios_intr(®s, 0x10); - if ((vesa_emu.x86.R_AX & 0xff) != 0x4f) + if ((regs.R_AX & 0xff) != 0x4f) return 1; - vesa_emu.x86.R_EAX = 0x4f05; - vesa_emu.x86.R_EBX = 1; - vesa_emu.x86.R_EDX = offset/adp->va_window_gran; - x86emu_exec_intr(&vesa_emu, 0x10); + bzero(®s, sizeof(regs)); + regs.R_EAX = 0x4f05; + regs.R_EBX = 1; + regs.R_EDX = offset / adp->va_window_gran; + x86bios_intr(®s, 0x10); adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran; return 0; /* XXX */ @@ -1653,22 +1678,6 @@ vesa_load(void) if (vesa_init_done) return 0; - /* Can `emumem' be NULL here? */ - emumem = pmap_mapbios(0x0, 0xc00000); - - memset(&vesa_emu, 0, sizeof(vesa_emu)); - x86emu_init_default(&vesa_emu); - - vesa_emu.emu_inb = vm86_emu_inb; - vesa_emu.emu_inw = vm86_emu_inw; - vesa_emu.emu_inl = vm86_emu_inl; - vesa_emu.emu_outb = vm86_emu_outb; - vesa_emu.emu_outw = vm86_emu_outw; - vesa_emu.emu_outl = vm86_emu_outl; - - vesa_emu.mem_base = (char *)emumem; - vesa_emu.mem_size = 1024 * 1024; - /* locate a VGA adapter */ s = spltty(); vesa_adp = NULL; @@ -1716,9 +1725,6 @@ vesa_unload(void) } splx(s); - if (emumem) - pmap_unmapdev((vm_offset_t)emumem, 0xc00000); - return error; } @@ -1743,6 +1749,6 @@ static moduledata_t vesa_mod = { }; DECLARE_MODULE(vesa, vesa_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); -MODULE_DEPEND(vesa, x86emu, 1, 1, 1); +MODULE_DEPEND(vesa, x86bios, 1, 1, 1); #endif /* VGA_NO_MODE_CHANGE */ diff --git a/sys/dev/hwpmc/pmc_events.h b/sys/dev/hwpmc/pmc_events.h index e7bc349..45ebc21 100644 --- a/sys/dev/hwpmc/pmc_events.h +++ b/sys/dev/hwpmc/pmc_events.h @@ -1979,6 +1979,30 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE", IAP_EVENT_FDH_40H) #define PMC_EV_TSC_FIRST PMC_EV_TSC_TSC #define PMC_EV_TSC_LAST PMC_EV_TSC_TSC + +/* + * Intel XScale events from "Intel XScale Core Developer's Manual", + * January 2004, #27347302 + */ +#define __PMC_EV_XSCALE() \ + __PMC_EV(XSCALE, IC_FETCH) \ + __PMC_EV(XSCALE, IC_MISS) \ + __PMC_EV(XSCALE, DATA_DEPENDENCY_STALL) \ + __PMC_EV(XSCALE, ITLB_MISS) \ + __PMC_EV(XSCALE, DTLB_MISS) \ + __PMC_EV(XSCALE, BRANCH_EXECUTED) \ + __PMC_EV(XSCALE, BRANCH_MISPRED) \ + __PMC_EV(XSCALE, INSTR_EXECUTED) \ + __PMC_EV(XSCALE, DC_FULL_CYCLE) \ + __PMC_EV(XSCALE, DC_FULL_CONTIG) \ + __PMC_EV(XSCALE, DC_ACCESS) \ + __PMC_EV(XSCALE, DC_MISS) \ + __PMC_EV(XSCALE, DC_WRITEBACK) \ + __PMC_EV(XSCALE, PC_CHANGE) + +#define PMC_EV_XSCALE_FIRST PMC_EV_XSCALE_IC_FETCH +#define PMC_EV_XSCALE_LAST PMC_EV_XSCALE_PC_CHANGE + /* * All known PMC events. * @@ -1996,6 +2020,7 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE", IAP_EVENT_FDH_40H) * 0x11000 0x0080 INTEL Pentium 4 events * 0x11080 0x0080 INTEL Pentium MMX events * 0x11100 0x0100 INTEL Pentium Pro/P-II/P-III/Pentium-M events + * 0x11200 0x00FF INTEL XScale events */ #define __PMC_EVENTS() \ __PMC_EV_BLOCK(TSC, 0x01000) \ @@ -2013,9 +2038,11 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE", IAP_EVENT_FDH_40H) __PMC_EV_BLOCK(P5, 0x11080) \ __PMC_EV_P5() \ __PMC_EV_BLOCK(P6, 0x11100) \ - __PMC_EV_P6() + __PMC_EV_P6() \ + __PMC_EV_BLOCK(XSCALE, 0x11200) \ + __PMC_EV_XSCALE() #define PMC_EVENT_FIRST PMC_EV_TSC_TSC -#define PMC_EVENT_LAST PMC_EV_P6_LAST +#define PMC_EVENT_LAST PMC_EV_XSCALE_LAST #endif /* _DEV_HWPMC_PMC_EVENTS_H_ */ diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index cd23972..b153e65 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -1012,7 +1012,12 @@ static void ndis_vap_delete(struct ieee80211vap *vap) { struct ndis_vap *nvp = NDIS_VAP(vap); + struct ieee80211com *ic = vap->iv_ic; + struct ifnet *ifp = ic->ic_ifp; + struct ndis_softc *sc = ifp->if_softc; + ndis_stop(sc); + callout_drain(&sc->ndis_scan_callout); ieee80211_vap_detach(vap); free(nvp, M_80211_VAP); } diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index 50c1249..d13e208 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); /* * General defines */ - #define MBOX_DELAY_COUNT 1000000 / 100 #define ISP_MARK_PORTDB(a, b, c) \ isp_prt(isp, ISP_LOGSANCFG, \ @@ -1547,24 +1546,18 @@ isp_fibre_init(ispsoftc_t *isp) } icbp->icb_maxfrmlen = DEFAULT_FRAMESIZE(isp); - if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || - icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) { - isp_prt(isp, ISP_LOGERR, - "bad frame length (%d) from NVRAM- using %d", - DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN); + if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) { + isp_prt(isp, ISP_LOGERR, "bad frame length (%d) from NVRAM- using %d", DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN); icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN; } icbp->icb_maxalloc = fcp->isp_maxalloc; if (icbp->icb_maxalloc < 1) { - isp_prt(isp, ISP_LOGERR, - "bad maximum allocation (%d)- using 16", fcp->isp_maxalloc); + isp_prt(isp, ISP_LOGERR, "bad maximum allocation (%d)- using 16", fcp->isp_maxalloc); icbp->icb_maxalloc = 16; } icbp->icb_execthrottle = DEFAULT_EXEC_THROTTLE(isp); if (icbp->icb_execthrottle < 1) { - isp_prt(isp, ISP_LOGERR, - "bad execution throttle of %d- using %d", - DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE); + isp_prt(isp, ISP_LOGERR, "bad execution throttle of %d- using %d", DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE); icbp->icb_execthrottle = ICB_DFLT_THROTTLE; } icbp->icb_retry_delay = fcp->isp_retry_delay; @@ -1658,18 +1651,18 @@ isp_fibre_init(ispsoftc_t *isp) /* * For 22XX > 2.1.26 && 23XX, set some options. - * XXX: Probably okay for newer 2100 f/w too. */ if (ISP_FW_NEWER_THAN(isp, 2, 26, 0)) { - /* - * Turn on LIP F8 async event (1) - * Turn on generate AE 8013 on all LIP Resets (2) - * Disable LIP F7 switching (8) - */ MBSINIT(&mbs, MBOX_SET_FIRMWARE_OPTIONS, MBLOGALL, 0); - mbs.param[1] = 0xb; + mbs.param[1] = IFCOPT1_DISF7SWTCH|IFCOPT1_LIPASYNC|IFCOPT1_LIPF8; mbs.param[2] = 0; mbs.param[3] = 0; + if (ISP_FW_NEWER_THAN(isp, 3, 16, 0)) { + mbs.param[1] |= IFCOPT1_EQFQASYNC|IFCOPT1_CTIO_RETRY; + if (fcp->role & ISP_ROLE_TARGET) { + mbs.param[3] = IFCOPT3_NOPRLI; + } + } isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; @@ -2093,8 +2086,7 @@ isp_mark_portdb(ispsoftc_t *isp, int chan, int disposition) * or via FABRIC LOGIN/FABRIC LOGOUT for other cards. */ static int -isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, - int flags, int gs) +isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags, int gs) { mbreg_t mbs; uint8_t q[QENTRY_LEN]; @@ -2771,15 +2763,21 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) /* * Make sure we're okay for doing this right now. */ - if (fcp->isp_loopstate != LOOP_PDB_RCVD && fcp->isp_loopstate != LOOP_FSCAN_DONE && fcp->isp_loopstate != LOOP_LSCAN_DONE) { - isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d", fcp->isp_loopstate); + if (fcp->isp_loopstate != LOOP_PDB_RCVD && + fcp->isp_loopstate != LOOP_FSCAN_DONE && + fcp->isp_loopstate != LOOP_LSCAN_DONE) { + isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d", + fcp->isp_loopstate); return (-1); } - if (fcp->isp_topo == TOPO_FL_PORT || fcp->isp_topo == TOPO_NL_PORT || fcp->isp_topo == TOPO_N_PORT) { + if (fcp->isp_topo == TOPO_FL_PORT || + fcp->isp_topo == TOPO_NL_PORT || + fcp->isp_topo == TOPO_N_PORT) { if (fcp->isp_loopstate < LOOP_LSCAN_DONE) { if (isp_scan_loop(isp, chan) != 0) { - isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: isp_scan_loop failed"); + isp_prt(isp, ISP_LOGWARN, + "isp_pdb_sync: isp_scan_loop failed"); return (-1); } } @@ -2788,13 +2786,15 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) { if (fcp->isp_loopstate < LOOP_FSCAN_DONE) { if (isp_scan_fabric(isp, chan) != 0) { - isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: isp_scan_fabric failed"); + isp_prt(isp, ISP_LOGWARN, + "isp_pdb_sync: isp_scan_fabric failed"); return (-1); } } } - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Synchronizing PDBs", chan); + isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, + "Chan %d Synchronizing PDBs", chan); fcp->isp_loopstate = LOOP_SYNCING_PDB; @@ -2823,7 +2823,11 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) lp->state = FC_PORTDB_STATE_NIL; isp_async(isp, ISPASYNC_DEV_GONE, chan, lp); if (lp->autologin == 0) { - (void) isp_plogx(isp, chan, lp->handle, lp->portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | PLOGX_FLG_FREE_NPHDL, 0); + (void) isp_plogx(isp, chan, lp->handle, + lp->portid, + PLOGX_FLG_CMD_LOGO | + PLOGX_FLG_IMPLICIT | + PLOGX_FLG_FREE_NPHDL, 0); } else { lp->autologin = 0; } @@ -3069,7 +3073,8 @@ isp_scan_loop(ispsoftc_t *isp, int chan) for (i = 0; i < MAX_FC_TARG; i++) { lp = &fcp->portdb[i]; - if (lp->state == FC_PORTDB_STATE_NIL || lp->target_mode) { + if (lp->state == FC_PORTDB_STATE_NIL || + lp->target_mode) { continue; } if (lp->node_wwn != tmp.node_wwn) { @@ -3587,7 +3592,8 @@ isp_scan_fabric(ispsoftc_t *isp, int chan) for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) { lp = &fcp->portdb[dbidx]; - if (lp->state != FC_PORTDB_STATE_PROBATIONAL || lp->target_mode) { + if (lp->state != FC_PORTDB_STATE_PROBATIONAL || + lp->target_mode) { continue; } if (lp->portid == portid) { @@ -3824,7 +3830,8 @@ isp_scan_fabric(ispsoftc_t *isp, int chan) if (fcp->portdb[dbidx].target_mode) { continue; } - if (fcp->portdb[dbidx].node_wwn == wwnn && fcp->portdb[dbidx].port_wwn == wwpn) { + if (fcp->portdb[dbidx].node_wwn == wwnn && + fcp->portdb[dbidx].port_wwn == wwpn) { break; } } diff --git a/sys/dev/isp/isp_stds.h b/sys/dev/isp/isp_stds.h index d0a9812..2ed66cb 100644 --- a/sys/dev/isp/isp_stds.h +++ b/sys/dev/isp/isp_stds.h @@ -31,7 +31,6 @@ */ #ifndef _ISP_STDS_H #define _ISP_STDS_H - /* * FC Frame Header * @@ -147,6 +146,7 @@ typedef struct { #define FCP_SNSLEN_VALID 0x02 #define FCP_RSPLEN_VALID 0x01 +#define FCP_MAX_RSPLEN 0x08 /* * FCP Response Code Definitions * Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08) @@ -159,6 +159,8 @@ typedef struct { #define FCP_RSPNS_EROFS 3 #define FCP_RSPNS_TMF_REJECT 4 #define FCP_RSPNS_TMF_FAILED 5 +#define FCP_RSPNS_TMF_SUCCEEDED 8 +#define FCP_RSPNS_TMF_INCORRECT_LUN 9 /* unconverted miscellany */ diff --git a/sys/dev/isp/isp_tpublic.h b/sys/dev/isp/isp_tpublic.h deleted file mode 100644 index b16440b..0000000 --- a/sys/dev/isp/isp_tpublic.h +++ /dev/null @@ -1,428 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright (c) 1997-2007 by Matthew Jacob - * 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. - * - * THIS SOFTWARE IS PROVIDED BY 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 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. - */ -/* - * Host Adapter Public Target Interface Structures && Routines - */ - -#ifndef _ISP_TPUBLIC_H -#define _ISP_TPUBLIC_H 1 - -/* - * Action codes set by the MD target driver for - * the external layer to figure out what to do with. - */ -typedef enum { - QOUT_HBA_REG=0, /* the argument is a pointer to a hba_register_t */ - QOUT_ENABLE, /* the argument is a pointer to a enadis_t */ - QOUT_DISABLE, /* the argument is a pointer to a enadis_t */ - QOUT_TMD_START, /* the argument is a pointer to a tmd_cmd_t */ - QOUT_TMD_DONE, /* the argument is a pointer to a tmd_cmd_t */ - QOUT_NOTIFY, /* the argument is a pointer to a tmd_notify_t */ - QOUT_HBA_UNREG /* the argument is a pointer to a hba_register_t */ -} tact_e; - -/* - * Action codes set by the external layer for the - * MD driver to figure out what to do with. - */ -typedef enum { - QIN_HBA_REG=99, /* the argument is a pointer to a hba_register_t */ - QIN_GETINFO, /* the argument is a pointer to a info_t */ - QIN_SETINFO, /* the argument is a pointer to a info_t */ - QIN_GETDLIST, /* the argument is a pointer to a fc_dlist_t */ - QIN_ENABLE, /* the argument is a pointer to a enadis_t */ - QIN_DISABLE, /* the argument is a pointer to a enadis_t */ - QIN_TMD_CONT, /* the argument is a pointer to a tmd_cmd_t */ - QIN_TMD_FIN, /* the argument is a pointer to a tmd_cmd_t */ - QIN_NOTIFY_ACK, /* the argument is a pointer to a tmd_notify_t */ - QIN_HBA_UNREG, /* the argument is a pointer to a hba_register_t */ -} qact_e; - -/* - * This structure is used to register to other software modules the - * binding of an HBA identifier, driver name and instance and the - * lun width capapbilities of this target driver. It's up to each - * platform to figure out how it wants to do this, but a typical - * sequence would be for the MD layer to find some external module's - * entry point and start by sending a QOUT_HBA_REG with info filled - * in, and the external module to call back with a QIN_HBA_REG that - * passes back the corresponding information. - */ -#define QR_VERSION 16 -typedef struct { - /* NB: tags from here to r_version must never change */ - void * r_identity; - void (*r_action)(qact_e, void *); - char r_name[8]; - int r_inst; - int r_version; - uint32_t r_locator; - uint32_t r_nchannels; - enum { R_FC, R_SPI } r_type; - void * r_private; -} hba_register_t; - -/* - * An information structure that is used to get or set per-channel transport layer parameters. - */ -typedef struct { - void * i_identity; - enum { I_FC, I_SPI } i_type; - int i_channel; - int i_error; - union { - struct { - uint64_t wwnn_nvram; - uint64_t wwpn_nvram; - uint64_t wwnn; - uint64_t wwpn; - } fc; - struct { - int iid; - } spi; - } i_id; -} info_t; - -/* - * An information structure to return a list of logged in WWPNs. FC specific. - */ -typedef struct { - void * d_identity; - int d_channel; - int d_error; - int d_count; - uint64_t * d_wwpns; -} fc_dlist_t; -/* - * Notify structure - */ -typedef enum { - NT_ABORT_TASK=0x1000, - NT_ABORT_TASK_SET, - NT_CLEAR_ACA, - NT_CLEAR_TASK_SET, - NT_LUN_RESET, - NT_TARGET_RESET, - NT_BUS_RESET, - NT_LIP_RESET, - NT_LINK_UP, - NT_LINK_DOWN, - NT_LOGOUT, - NT_HBA_RESET -} tmd_ncode_t; - -typedef struct tmd_notify { - void * nt_hba; /* HBA tag */ - uint64_t nt_iid; /* inititator id */ - uint64_t nt_tgt; /* target id */ - uint16_t nt_lun; /* logical unit */ - uint16_t : 15, - nt_need_ack : 1; /* this notify needs an ACK */ - uint64_t nt_tagval; /* tag value */ - uint32_t nt_channel; /* channel id */ - tmd_ncode_t nt_ncode; /* action */ - void * nt_lreserved; - void * nt_hreserved; -} tmd_notify_t; -#define LUN_ANY 0xffff -#define TGT_ANY ((uint64_t) -1) -#define INI_ANY ((uint64_t) -1) -#define TAG_ANY ((uint64_t) 0) -#define MATCH_TMD(tmd, iid, lun, tag) \ - ( \ - (tmd) && \ - (iid == INI_ANY || iid == tmd->cd_iid) && \ - (lun == LUN_ANY || lun == tmd->cd_lun) && \ - (tag == TAG_ANY || tag == tmd->cd_tagval) \ - ) - -/* - * A word about ENABLE/DISABLE: the argument is a pointer to a enadis_t - * with en_hba, en_iid, en_chan, en_tgt and en_lun filled out. - * - * If an error occurs in either enabling or disabling the described lun - * cd_error is set with an appropriate non-zero value. - */ -typedef struct { - void * en_private; /* for outer layer usage */ - void * en_hba; /* HBA tag */ - uint64_t en_iid; /* initiator ID */ - uint64_t en_tgt; /* target id */ - uint16_t en_lun; /* logical unit */ - uint16_t en_chan; /* channel on card */ - int en_error; -} enadis_t; - -/* - * Suggested Software Target Mode Command Handling structure. - * - * A note about terminology: - * - * MD stands for "Machine Dependent". - * - * This driver is structured in three layers: Outer MD, core, and inner MD. - * The latter also is bus dependent (i.e., is cognizant of PCI bus issues - * as well as platform issues). - * - * - * "Outer Layer" means "Other Module" - * - * Some additional module that actually implements SCSI target command - * policy is the recipient of incoming commands and the source of the - * disposition for them. - * - * The command structure below is one suggested possible MD command structure, - * but since the handling of thbis is entirely in the MD layer, there is - * no explicit or implicit requirement that it be used. - * - * The cd_private tag should be used by the MD layer to keep a free list - * of these structures. Code outside of this driver can then use this - * to identify it's own unit structures. That is, when not on the MD - * layer's freelist, the MD layer should shove into it the identifier - * that the outer layer has for it- passed in on an initial QIN_HBA_REG - * call (see below). - * - * The cd_hba tag is a tag that uniquely identifies the HBA this target - * mode command is coming from. The outer layer has to pass this back - * unchanged to avoid chaos. - * - * The cd_iid, cd_tgt, cd_lun and cd_port tags are used to identify the - * id of the initiator who sent us a command, the target claim to be, the - * lun on the target we claim to be, and the port instance (for multiple - * port host adapters) that this applies to (consider it an extra port - * parameter). The iid, tgt and lun values are deliberately chosen to be - * fat so that, for example, World Wide Names can be used instead of - * the units that the firmware uses (in the case where the MD - * layer maintains a port database, for example). - * - * The cd_tagtype field specifies what kind of command tag type, if - * any, has been sent with the command. Note that the Outer Layer - * still needs to pass the tag handle through unchanged even - * if the tag type is CD_UNTAGGED. - * - * The cd_cdb contains storage for the passed in command descriptor block. - * There is no need to define length as the callee should be able to - * figure this out. - * - * The tag cd_lflags are the flags set by the MD driver when it gets - * command incoming or when it needs to inform any outside entities - * that the last requested action failed. - * - * The tag cd_hflags should be set by any outside software to indicate - * the validity of sense and status fields (defined below) and to indicate - * the direction data is expected to move. It is an error to have both - * CDFH_DATA_IN and CDFH_DATA_OUT set. - * - * If the CDFH_STSVALID flag is set, the command should be completed (after - * sending any data and/or status). If CDFH_SNSVALID is set and the MD layer - * can also handle sending the associated sense data (either back with an - * FCP RESPONSE IU for Fibre Channel or otherwise automatically handling a - * REQUEST SENSE from the initator for this target/lun), the MD layer will - * set the CDFL_SENTSENSE flag on successful transmission of the sense data. - * It is an error for the CDFH_SNSVALID bit to be set and CDFH_STSVALID not - * to be set. It is an error for the CDFH_SNSVALID be set and the associated - * SCSI status (cd_scsi_status) not be set to CHECK CONDITON. - * - * The tag cd_data points to a data segment to either be filled or - * read from depending on the direction of data movement. The tag - * is undefined if no data direction is set. The MD layer and outer - * layers must agree on the meaning of cd_data and it is specifically - * not defined here. - * - * The tag cd_totlen is the total data amount expected to be moved - * over the life of the command. It may be set by the MD layer, possibly - * from the datalen field of an FCP CMND IU unit. If it shows up in the outer - * layers set to zero and the CDB indicates data should be moved, the outer - * layer should set it to the amount expected to be moved. - * - * The tag cd_resid should be the total residual of data not transferred. - * The outer layers need to set this at the begining of command processing - * to equal cd_totlen. As data is successfully moved, this value is decreased. - * At the end of a command, any nonzero residual indicates the number of bytes - * requested by the command but not moved. - * - * The tag cd_xfrlen is the length of the currently active data transfer. - * This allows several interations between any outside software and the - * MD layer to move data. - * - * The reason that total length and total residual have to be tracked - * is to keep track of relative offset. - * - * The tags cd_sense and cd_scsi_status are pretty obvious. - * - * The tag cd_error is to communicate between the MD layer and outer software - * the current error conditions. - * - * The tag cd_lreserved, cd_hreserved are scratch areas for use for the MD - * and outer layers respectively. - * - */ - -#ifndef TMD_CDBLEN -#define TMD_CDBLEN 16 -#endif -#ifndef TMD_SENSELEN -#define TMD_SENSELEN 18 -#endif -#ifndef QCDS -#define QCDS (sizeof (void *)) -#endif - -typedef struct tmd_cmd { - void * cd_private; /* private data pointer */ - void * cd_hba; /* HBA tag */ - void * cd_data; /* 'pointer' to data */ - uint64_t cd_iid; /* initiator ID */ - uint64_t cd_tgt; /* target id */ - uint8_t cd_lun[8]; /* logical unit */ - uint64_t cd_tagval; /* tag value */ - uint32_t cd_channel; /* channel index */ - uint32_t cd_lflags; /* flags lower level sets */ - uint32_t cd_hflags; /* flags higher level sets */ - uint32_t cd_totlen; /* total data load */ - uint32_t cd_resid; /* total data residual */ - uint32_t cd_xfrlen; /* current data load */ - int32_t cd_error; /* current error */ - uint8_t cd_tagtype; /* tag type */ - uint8_t cd_scsi_status; - uint8_t cd_sense[TMD_SENSELEN]; - uint8_t cd_cdb[TMD_CDBLEN]; - union { - void * ptrs[QCDS / sizeof (void *)]; - uint64_t llongs[QCDS / sizeof (uint64_t)]; - uint32_t longs[QCDS / sizeof (uint32_t)]; - uint16_t shorts[QCDS / sizeof (uint16_t)]; - uint8_t bytes[QCDS]; - } cd_lreserved[4], cd_hreserved[4]; -} tmd_cmd_t; - -/* defined tags */ -#define CD_UNTAGGED 0 -#define CD_SIMPLE_TAG 1 -#define CD_ORDERED_TAG 2 -#define CD_HEAD_TAG 3 -#define CD_ACA_TAG 4 - -#ifndef TMD_SIZE -#define TMD_SIZE (sizeof (tmd_cmd_t)) -#endif - -#define L0LUN_TO_FLATLUN(lptr) ((((lptr)[0] & 0x3f) << 8) | ((lptr)[1])) -#define FLATLUN_TO_L0LUN(lptr, lun) \ - (lptr)[1] = lun & 0xff; \ - if (sizeof (lun) == 1) { \ - (lptr)[0] = 0; \ - } else { \ - uint16_t nl = lun; \ - if (nl == LUN_ANY) { \ - (lptr)[0] = (nl >> 8) & 0xff; \ - } else if (nl < 256) { \ - (lptr)[0] = 0; \ - } else { \ - (lptr)[0] = 0x40 | ((nl >> 8) & 0x3f); \ - } \ - } \ - memset(&(lptr)[2], 0, 6) - -/* - * Note that NODISC (obviously) doesn't apply to non-SPI transport. - * - * Note that knowing the data direction and lengh at the time of receipt of - * a command from the initiator is a feature only of Fibre Channel. - * - * The CDFL_BIDIR is in anticipation of the adoption of some newer - * features required by OSD. - * - * The principle selector for MD layer to know whether data is to - * be transferred in any QOUT_TMD_CONT call is cd_xfrlen- the - * flags CDFH_DATA_IN and CDFH_DATA_OUT define which direction. - */ -#define CDFL_SNSVALID 0x01 /* sense data (from f/w) good */ -#define CDFL_SENTSTATUS 0x02 /* last action sent status */ -#define CDFL_DATA_IN 0x04 /* target (us) -> initiator (them) */ -#define CDFL_DATA_OUT 0x08 /* initiator (them) -> target (us) */ -#define CDFL_BIDIR 0x0C /* bidirectional data */ -#define CDFL_ERROR 0x10 /* last action ended in error */ -#define CDFL_NODISC 0x20 /* disconnects disabled */ -#define CDFL_SENTSENSE 0x40 /* last action sent sense data */ -#define CDFL_BUSY 0x80 /* this command is not on a free list */ -#define CDFL_PRIVATE 0xFF000000 /* private layer flags */ - -#define CDFH_SNSVALID 0x01 /* sense data (from outer layer) good */ -#define CDFH_STSVALID 0x02 /* status valid */ -#define CDFH_DATA_IN 0x04 /* target (us) -> initiator (them) */ -#define CDFH_DATA_OUT 0x08 /* initiator (them) -> target (us) */ -#define CDFH_DATA_MASK 0x0C /* mask to cover data direction */ -#define CDFH_PRIVATE 0xFF000000 /* private layer flags */ - - -/* - * A word about the START/CONT/DONE/FIN dance: - * - * When the HBA is enabled for receiving commands, one may show up - * without notice. When that happens, the MD target mode driver - * gets a tmd_cmd_t, fills it with the info that just arrived, and - * calls the outer layer with a QOUT_TMD_START code and pointer to - * the tmd_cmd_t. - * - * The outer layer decodes the command, fetches data, prepares stuff, - * whatever, and starts by passing back the pointer with a QIN_TMD_CONT - * code which causes the MD target mode driver to generate CTIOs to - * satisfy whatever action needs to be taken. When those CTIOs complete, - * the MD target driver sends the pointer to the cmd_tmd_t back with - * a QOUT_TMD_DONE code. This repeats for as long as necessary. These - * may not be done in parallel- they are sequential operations. - * - * The outer layer signals it wants to end the command by settings within - * the tmd_cmd_t itself. When the final QIN_TMD_CONT is reported completed, - * the outer layer frees the tmd_cmd_t by sending the pointer to it - * back with a QIN_TMD_FIN code. - * - * The graph looks like: - * - * QOUT_TMD_START -> [ QIN_TMD_CONT -> QOUT_TMD_DONE ] * -> QIN_TMD_FIN. - * - */ - -/* - * Target handler functions. - * - * The MD target handler function (the outer layer calls this) - * should be be prototyped like: - * - * void target_action(qact_e, void *arg) - * - * The outer layer target handler function (the MD layer calls this) - * should be be prototyped like: - * - * void scsi_target_handler(tact_e, void *arg) - */ -#endif /* _ISP_TPUBLIC_H */ -/* - * vim:ts=4:sw=4:expandtab - */ diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h index 8f68937..2f9d152 100644 --- a/sys/dev/isp/ispmbox.h +++ b/sys/dev/isp/ispmbox.h @@ -26,6 +26,7 @@ * SUCH DAMAGE. * */ + /* * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters. */ @@ -245,12 +246,38 @@ #define ASYNC_RCV_ERR 0x8048 /* + * Firmware Options. There are a lot of them. + * + * IFCOPTN - ISP Fibre Channel Option Word N + */ +#define IFCOPT1_EQFQASYNC (1 << 13) /* enable QFULL notification */ +#define IFCOPT1_EAABSRCVD (1 << 12) +#define IFCOPT1_RJTASYNC (1 << 11) /* enable 8018 notification */ +#define IFCOPT1_ENAPURE (1 << 10) +#define IFCOPT1_ENA8017 (1 << 7) +#define IFCOPT1_DISGPIO67 (1 << 6) +#define IFCOPT1_LIPLOSSIMM (1 << 5) +#define IFCOPT1_DISF7SWTCH (1 << 4) +#define IFCOPT1_CTIO_RETRY (1 << 3) +#define IFCOPT1_LIPASYNC (1 << 1) +#define IFCOPT1_LIPF8 (1 << 0) + +#define IFCOPT2_LOOPBACK (1 << 1) +#define IFCOPT2_ATIO3_ONLY (1 << 0) + +#define IFCOPT3_NOPRLI (1 << 4) /* disable automatic sending of PRLI on local loops */ +#define IFCOPT3_RNDASYNC (1 << 1) +/* * 2.01.31 2200 Only. Need Bit 13 in Mailbox 1 for Set Firmware Options * mailbox command to enable this. */ #define ASYNC_QFULL_SENT 0x8049 /* + * Needs to be enabled + */ +#define ASYNC_AUTO_PLOGI_RJT 0x8018 +/* * 24XX only */ #define ASYNC_RJT_SENT 0x8049 diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 851f677..0813676 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -728,7 +728,7 @@ genkbd_event(keyboard_t *kbd, int event, void *arg) size_t len; u_char *cp; int mode; - int c; + u_int c; /* assert(KBD_IS_VALID(kbd)) */ sc = (genkbd_softc_t *)arg; @@ -837,13 +837,14 @@ static int fkey_change_ok(fkeytab_t *, fkeyarg_t *, struct thread *); int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) { +#ifndef KBD_DISABLE_KEYMAP_LOAD + keymap_t *mapp; +#endif keyarg_t *keyp; fkeyarg_t *fkeyp; int s; int i; -#ifndef KBD_DISABLE_KEYMAP_LOAD int error; -#endif s = spltty(); switch (cmd) { @@ -869,18 +870,29 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) break; case GIO_KEYMAP: /* get keyboard translation table */ - bcopy(kbd->kb_keymap, arg, sizeof(*kbd->kb_keymap)); - break; + error = copyout(kbd->kb_keymap, *(void **)arg, + sizeof(keymap_t)); + splx(s); + return (error); case PIO_KEYMAP: /* set keyboard translation table */ #ifndef KBD_DISABLE_KEYMAP_LOAD - error = keymap_change_ok(kbd->kb_keymap, (keymap_t *)arg, - curthread); + mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT); + error = copyin(*(void **)arg, mapp, sizeof *mapp); + if (error != 0) { + splx(s); + free(mapp, M_TEMP); + return (error); + } + + error = keymap_change_ok(kbd->kb_keymap, mapp, curthread); if (error != 0) { splx(s); + free(mapp, M_TEMP); return (error); } bzero(kbd->kb_accentmap, sizeof(*kbd->kb_accentmap)); - bcopy(arg, kbd->kb_keymap, sizeof(*kbd->kb_keymap)); + bcopy(mapp, kbd->kb_keymap, sizeof(*kbd->kb_keymap)); + free(mapp, M_TEMP); break; #else splx(s); diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c index 991bc79..4a1dc8a 100644 --- a/sys/dev/mwl/if_mwl.c +++ b/sys/dev/mwl/if_mwl.c @@ -304,7 +304,7 @@ mwl_attach(uint16_t devid, struct mwl_softc *sc) ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { - device_printf(sc->sc_dev, "can not if_alloc()\n"); + device_printf(sc->sc_dev, "cannot if_alloc()\n"); return ENOSPC; } ic = ifp->if_l2com; @@ -2303,8 +2303,10 @@ mwl_dma_setup(struct mwl_softc *sc) int error, i; error = mwl_rxdma_setup(sc); - if (error != 0) + if (error != 0) { + mwl_rxdma_cleanup(sc); return error; + } for (i = 0; i < MWL_NUM_TX_QUEUES; i++) { error = mwl_txdma_setup(sc, &sc->sc_txq[i]); diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c index 88c3489..6e8ca67 100644 --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -106,6 +106,7 @@ static int mxge_max_slices = 1; static int mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT; static int mxge_always_promisc = 0; static int mxge_initial_mtu = ETHERMTU_JUMBO; +static int mxge_throttle = 0; static char *mxge_fw_unaligned = "mxge_ethp_z8e"; static char *mxge_fw_aligned = "mxge_eth_z8e"; static char *mxge_fw_rss_aligned = "mxge_rss_eth_z8e"; @@ -143,7 +144,7 @@ MODULE_DEPEND(mxge, zlib, 1, 1, 1); static int mxge_load_firmware(mxge_softc_t *sc, int adopt); static int mxge_send_cmd(mxge_softc_t *sc, uint32_t cmd, mxge_cmd_t *data); -static int mxge_close(mxge_softc_t *sc); +static int mxge_close(mxge_softc_t *sc, int down); static int mxge_open(mxge_softc_t *sc); static void mxge_tick(void *arg); @@ -596,10 +597,13 @@ static int mxge_select_firmware(mxge_softc_t *sc) { int aligned = 0; + int force_firmware = mxge_force_firmware; + if (sc->throttle) + force_firmware = sc->throttle; - if (mxge_force_firmware != 0) { - if (mxge_force_firmware == 1) + if (force_firmware != 0) { + if (force_firmware == 1) aligned = 1; else aligned = 0; @@ -1305,8 +1309,7 @@ mxge_reset(mxge_softc_t *sc, int interrupts_setup) ss->lro_queued = 0; ss->lro_flushed = 0; if (ss->fw_stats != NULL) { - ss->fw_stats->valid = 0; - ss->fw_stats->send_done_count = 0; + bzero(ss->fw_stats, sizeof *ss->fw_stats); } } sc->rdma_tags_available = 15; @@ -1314,10 +1317,48 @@ mxge_reset(mxge_softc_t *sc, int interrupts_setup) mxge_change_promisc(sc, sc->ifp->if_flags & IFF_PROMISC); mxge_change_pause(sc, sc->pause); mxge_set_multicast_list(sc); + if (sc->throttle) { + cmd.data0 = sc->throttle; + if (mxge_send_cmd(sc, MXGEFW_CMD_SET_THROTTLE_FACTOR, + &cmd)) { + device_printf(sc->dev, + "can't enable throttle\n"); + } + } return status; } static int +mxge_change_throttle(SYSCTL_HANDLER_ARGS) +{ + mxge_cmd_t cmd; + mxge_softc_t *sc; + int err; + unsigned int throttle; + + sc = arg1; + throttle = sc->throttle; + err = sysctl_handle_int(oidp, &throttle, arg2, req); + if (err != 0) { + return err; + } + + if (throttle == sc->throttle) + return 0; + + if (throttle < MXGE_MIN_THROTTLE || throttle > MXGE_MAX_THROTTLE) + return EINVAL; + + mtx_lock(&sc->driver_mtx); + cmd.data0 = throttle; + err = mxge_send_cmd(sc, MXGEFW_CMD_SET_THROTTLE_FACTOR, &cmd); + if (err == 0) + sc->throttle = throttle; + mtx_unlock(&sc->driver_mtx); + return err; +} + +static int mxge_change_intr_coal(SYSCTL_HANDLER_ARGS) { mxge_softc_t *sc; @@ -1379,7 +1420,7 @@ mxge_change_lro_locked(mxge_softc_t *sc, int lro_cnt) ifp->if_capenable |= IFCAP_LRO; sc->lro_cnt = lro_cnt; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - mxge_close(sc); + mxge_close(sc, 0); err = mxge_open(sc); } return err; @@ -1495,6 +1536,10 @@ mxge_add_sysctls(mxge_softc_t *sc) "read_write_dma_MBs", CTLFLAG_RD, &sc->read_write_dma, 0, "DMA concurrent Read/Write speed in MB/s"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "watchdog_resets", + CTLFLAG_RD, &sc->watchdog_resets, + 0, "Number of times NIC was reset"); /* performance related tunables */ @@ -1505,6 +1550,12 @@ mxge_add_sysctls(mxge_softc_t *sc) "I", "interrupt coalescing delay in usecs"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, + "throttle", + CTLTYPE_INT|CTLFLAG_RW, sc, + 0, mxge_change_throttle, + "I", "transmit throttling"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "flow_control_enabled", CTLTYPE_INT|CTLFLAG_RW, sc, 0, mxge_change_flow_control, @@ -3600,7 +3651,7 @@ abort: } static int -mxge_close(mxge_softc_t *sc) +mxge_close(mxge_softc_t *sc, int down) { mxge_cmd_t cmd; int err, old_down_cnt; @@ -3617,21 +3668,23 @@ mxge_close(mxge_softc_t *sc) } #endif sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - old_down_cnt = sc->down_cnt; - wmb(); - err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd); - if (err) { - device_printf(sc->dev, "Couldn't bring down link\n"); - } - if (old_down_cnt == sc->down_cnt) { - /* wait for down irq */ - DELAY(10 * sc->intr_coal_delay); - } - wmb(); - if (old_down_cnt == sc->down_cnt) { - device_printf(sc->dev, "never got down irq\n"); + if (!down) { + old_down_cnt = sc->down_cnt; + wmb(); + err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd); + if (err) { + device_printf(sc->dev, + "Couldn't bring down link\n"); + } + if (old_down_cnt == sc->down_cnt) { + /* wait for down irq */ + DELAY(10 * sc->intr_coal_delay); + } + wmb(); + if (old_down_cnt == sc->down_cnt) { + device_printf(sc->dev, "never got down irq\n"); + } } - mxge_free_mbufs(sc); return 0; @@ -3684,8 +3737,9 @@ static int mxge_watchdog_reset(mxge_softc_t *sc, int slice) { struct pci_devinfo *dinfo; + struct mxge_slice_state *ss; mxge_tx_ring_t *tx; - int err; + int err, running, s, num_tx_slices = 1; uint32_t reboot; uint16_t cmd; @@ -3719,6 +3773,30 @@ mxge_watchdog_reset(mxge_softc_t *sc, int slice) reboot = mxge_read_reboot(sc); device_printf(sc->dev, "NIC rebooted, status = 0x%x\n", reboot); + running = sc->ifp->if_drv_flags & IFF_DRV_RUNNING; + if (running) { + + /* + * quiesce NIC so that TX routines will not try to + * xmit after restoration of BAR + */ + + /* Mark the link as down */ + if (sc->link_state) { + sc->link_state = 0; + if_link_state_change(sc->ifp, + LINK_STATE_DOWN); + } +#ifdef IFNET_BUF_RING + num_tx_slices = sc->num_slices; +#endif + /* grab all TX locks to ensure no tx */ + for (s = 0; s < num_tx_slices; s++) { + ss = &sc->ss[s]; + mtx_lock(&ss->tx.mtx); + } + mxge_close(sc, 1); + } /* restore PCI configuration space */ dinfo = device_get_ivars(sc->dev); pci_cfg_restore(sc->dev, dinfo); @@ -3726,10 +3804,22 @@ mxge_watchdog_reset(mxge_softc_t *sc, int slice) /* and redo any changes we made to our config space */ mxge_setup_cfg_space(sc); - if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) { - mxge_close(sc); - err = mxge_open(sc); + /* reload f/w */ + err = mxge_load_firmware(sc, 0); + if (err) { + device_printf(sc->dev, + "Unable to re-load f/w\n"); } + if (running) { + if (!err) + err = mxge_open(sc); + /* release all TX locks */ + for (s = 0; s < num_tx_slices; s++) { + ss = &sc->ss[s]; + mtx_unlock(&ss->tx.mtx); + } + } + sc->watchdog_resets++; } else { tx = &sc->ss[slice].tx; device_printf(sc->dev, @@ -3745,6 +3835,9 @@ mxge_watchdog_reset(mxge_softc_t *sc, int slice) be32toh(sc->ss->fw_stats->send_done_count)); device_printf(sc->dev, "not resetting\n"); } + if (err) + device_printf(sc->dev, "watchdog reset failed\n"); + return (err); } @@ -3860,11 +3953,11 @@ mxge_change_mtu(mxge_softc_t *sc, int mtu) old_mtu = ifp->if_mtu; ifp->if_mtu = mtu; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - mxge_close(sc); + mxge_close(sc, 0); err = mxge_open(sc); if (err != 0) { ifp->if_mtu = old_mtu; - mxge_close(sc); + mxge_close(sc, 0); (void) mxge_open(sc); } } @@ -3922,7 +4015,7 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - mxge_close(sc); + mxge_close(sc, 0); } } mtx_unlock(&sc->driver_mtx); @@ -4016,6 +4109,7 @@ mxge_fetch_tunables(mxge_softc_t *sc) TUNABLE_INT_FETCH("hw.mxge.rss_hash_type", &mxge_rss_hash_type); TUNABLE_INT_FETCH("hw.mxge.rss_hashtype", &mxge_rss_hash_type); TUNABLE_INT_FETCH("hw.mxge.initial_mtu", &mxge_initial_mtu); + TUNABLE_INT_FETCH("hw.mxge.throttle", &mxge_throttle); if (sc->lro_cnt != 0) mxge_lro_cnt = sc->lro_cnt; @@ -4033,6 +4127,12 @@ mxge_fetch_tunables(mxge_softc_t *sc) if (mxge_initial_mtu > ETHERMTU_JUMBO || mxge_initial_mtu < ETHER_MIN_LEN) mxge_initial_mtu = ETHERMTU_JUMBO; + + if (mxge_throttle && mxge_throttle > MXGE_MAX_THROTTLE) + mxge_throttle = MXGE_MAX_THROTTLE; + if (mxge_throttle && mxge_throttle < MXGE_MIN_THROTTLE) + mxge_throttle = MXGE_MIN_THROTTLE; + sc->throttle = mxge_throttle; } @@ -4645,7 +4745,7 @@ mxge_detach(device_t dev) mtx_lock(&sc->driver_mtx); sc->dying = 1; if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) - mxge_close(sc); + mxge_close(sc, 0); mtx_unlock(&sc->driver_mtx); ether_ifdetach(sc->ifp); callout_drain(&sc->co_hdl); diff --git a/sys/dev/mxge/if_mxge_var.h b/sys/dev/mxge/if_mxge_var.h index 47c39b5..b25adb4 100644 --- a/sys/dev/mxge/if_mxge_var.h +++ b/sys/dev/mxge/if_mxge_var.h @@ -261,6 +261,7 @@ struct mxge_softc { int fw_multicast_support; int link_width; int max_mtu; + int throttle; int tx_defrag; int media_flags; int need_media_probe; @@ -286,6 +287,8 @@ struct mxge_softc { #define MXGE_PCI_REV_Z8ES 1 #define MXGE_XFP_COMPLIANCE_BYTE 131 #define MXGE_SFP_COMPLIANCE_BYTE 3 +#define MXGE_MIN_THROTTLE 416 +#define MXGE_MAX_THROTTLE 4096 #define MXGE_HIGHPART_TO_U32(X) \ (sizeof (X) == 8) ? ((uint32_t)((uint64_t)(X) >> 32)) : (0) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 0b7b267..47aedbd 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -2149,62 +2149,38 @@ pci_disable_busmaster_method(device_t dev, device_t child) 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: bit = PCIM_CMD_PORTEN; - error = "port"; break; case SYS_RES_MEMORY: bit = PCIM_CMD_MEMEN; - error = "memory"; break; default: return (EINVAL); } pci_set_command_bit(dev, child, bit); - /* Some devices seem to need a brief stall here, what do to? */ - 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); + return (0); } 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: bit = PCIM_CMD_PORTEN; - error = "port"; break; case SYS_RES_MEMORY: 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); } diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h index c7a7245..981d1e0 100644 --- a/sys/dev/pci/pcireg.h +++ b/sys/dev/pci/pcireg.h @@ -44,6 +44,7 @@ #define PCI_SLOTMAX 31 /* highest supported slot number */ #define PCI_FUNCMAX 7 /* highest supported function number */ #define PCI_REGMAX 255 /* highest supported config register addr. */ +#define PCIE_REGMAX 4095 /* highest supported config register addr. */ #define PCI_MAXHDRTYPE 2 /* PCI config header registers for all devices */ diff --git a/sys/dev/ppbus/vpo.c b/sys/dev/ppbus/vpo.c index 4009178..673a785 100644 --- a/sys/dev/ppbus/vpo.c +++ b/sys/dev/ppbus/vpo.c @@ -176,9 +176,6 @@ vpo_attach(device_t dev) return (ENXIO); } ppb_unlock(ppbus); - - /* all went ok */ - vpo_cam_rescan(vpo); /* have CAM rescan the bus */ return (0); @@ -194,12 +191,15 @@ vpo_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) static void vpo_cam_rescan(struct vpo_data *vpo) { + device_t ppbus = device_get_parent(vpo->vpo_dev); struct cam_path *path; union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO); + ppb_lock(ppbus); if (xpt_create_path(&path, xpt_periph, cam_sim_path(vpo->sim), 0, 0) != CAM_REQ_CMP) { /* A failure is benign as the user can do a manual rescan */ + ppb_unlock(ppbus); free(ccb, M_TEMP); return; } @@ -209,6 +209,7 @@ vpo_cam_rescan(struct vpo_data *vpo) ccb->ccb_h.cbfcnp = vpo_cam_rescan_callback; ccb->crcn.flags = CAM_FLAG_NONE; xpt_action(ccb); + ppb_unlock(ppbus); /* The scan is in progress now. */ } diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index 3a62724..8d04f70 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -1,10 +1,33 @@ /*- - * Support the ENSONIQ AudioPCI board and Creative Labs SoundBlaster PCI - * boards based on the ES1370, ES1371 and ES1373 chips. - * * Copyright (c) 1999 Russell Cattelan <cattelan@thebarn.com> + * Copyright (c) 1998 Joachim Kuebart <joachim.kuebart@gmx.net> + * 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. + * + * 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. + */ + +/*- * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> - * Copyright (c) 1998 by Joachim Kuebart. All rights reserved. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,12 +63,14 @@ */ /* + * Support the ENSONIQ AudioPCI board and Creative Labs SoundBlaster PCI + * boards based on the ES1370, ES1371 and ES1373 chips. + * * Part of this code was heavily inspired by the linux driver from * Thomas Sailer (sailer@ife.ee.ethz.ch) * Just about everything has been touched and reworked in some way but * the all the underlying sequences/timing/register values are from * Thomas' code. - * */ #ifdef HAVE_KERNEL_OPTION_HEADERS diff --git a/sys/dev/sound/pci/es137x.h b/sys/dev/sound/pci/es137x.h index 7e0225f..fb86a94 100644 --- a/sys/dev/sound/pci/es137x.h +++ b/sys/dev/sound/pci/es137x.h @@ -1,26 +1,21 @@ /*- - * This supports the ENSONIQ AudioPCI board based on the ES1370. - * - * Copyright (c) 1998 Joachim Kuebart <joki@kuebart.stuttgart.netsurf.de> + * Copyright (c) 1998 Joachim Kuebart <joachim.kuebart@gmx.net> * 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 immediately at the beginning of the file, without modification, - * this list of conditions, and the following disclaimer. + * 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. Absolutely no warranty of function or purpose is made by the author - * Joachim Kuebart. - * 4. Modifications may be freely made to this file if the above conditions - * are met. * * $FreeBSD$ */ +/* This supports the ENSONIQ AudioPCI board based on the ES1370. */ + #ifndef _ES1370_REG_H #define _ES1370_REG_H diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index 086c4fe..8d9c4c6 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -45,18 +45,22 @@ SND_DECLARE_FILE("$FreeBSD$"); #define SPA_PCI_ID 0x70181039 #define TR_DEFAULT_BUFSZ 0x1000 +/* For ALi M5451 the DMA transfer size appears to be fixed to 64k. */ +#define ALI_BUFSZ 0x10000 +#define TR_BUFALGN 0x8 #define TR_TIMEOUT_CDC 0xffff +#define TR_MAXHWCH 64 +#define ALI_MAXHWCH 32 #define TR_MAXPLAYCH 4 +#define ALI_MAXPLAYCH 1 /* - * Though, it's not clearly documented in trident datasheet, trident - * audio cards can't handle DMA addresses located above 1GB. The LBA - * (loop begin address) register which holds DMA base address is 32bits - * register. - * But the MSB 2bits are used for other purposes(I guess it is really - * bad idea). This effectivly limits the DMA address space up to 1GB. + * Though, it's not clearly documented in the 4DWAVE datasheet, the + * DX and NX chips can't handle DMA addresses located above 1GB as the + * LBA (loop begin address) register which holds the DMA base address + * is 32-bit, but the two MSBs are used for other purposes. */ -#define TR_MAXADDR ((1 << 30) - 1) - +#define TR_MAXADDR ((1U << 30) - 1) +#define ALI_MAXADDR ((1U << 31) - 1) struct tr_info; @@ -97,6 +101,7 @@ struct tr_info { struct mtx *lock; + u_int32_t hwchns; u_int32_t playchns; unsigned int bufsz; @@ -398,7 +403,10 @@ tr_wrch(struct tr_chinfo *ch) ch->ec &= 0x00000fff; ch->alpha &= 0x00000fff; ch->delta &= 0x0000ffff; - ch->lba &= 0x3fffffff; + if (tr->type == ALI_PCI_ID) + ch->lba &= ALI_MAXADDR; + else + ch->lba &= TR_MAXADDR; cr[1]=ch->lba; cr[3]=(ch->fmc<<14) | (ch->rvol<<7) | (ch->cvol); @@ -441,7 +449,10 @@ tr_rdch(struct tr_chinfo *ch) snd_mtxunlock(tr->lock); - ch->lba= (cr[1] & 0x3fffffff); + if (tr->type == ALI_PCI_ID) + ch->lba=(cr[1] & ALI_MAXADDR); + else + ch->lba=(cr[1] & TR_MAXADDR); ch->fmc= (cr[3] & 0x0000c000) >> 14; ch->rvol= (cr[3] & 0x00003f80) >> 7; ch->cvol= (cr[3] & 0x0000007f); @@ -628,7 +639,6 @@ trrchan_setformat(kobj_t obj, void *data, u_int32_t format) tr_wr(tr, TR_REG_SBCTRL, i, 1); return 0; - } static u_int32_t @@ -729,7 +739,7 @@ tr_intr(void *p) intsrc = tr_rd(tr, TR_REG_MISCINT, 4); if (intsrc & TR_INT_ADDR) { chnum = 0; - while (chnum < 64) { + while (chnum < tr->hwchns) { mask = 0x00000001; active = tr_rd(tr, (chnum < 32)? TR_REG_ADDRINTA : TR_REG_ADDRINTB, 4); bufhalf = tr_rd(tr, (chnum < 32)? TR_REG_CSPF_A : TR_REG_CSPF_B, 4); @@ -815,8 +825,13 @@ tr_pci_attach(device_t dev) u_int32_t data; struct tr_info *tr; struct ac97_info *codec = 0; + bus_addr_t lowaddr; int i, dacn; char status[SND_STATUSLEN]; +#ifdef __sparc64__ + device_t *children; + int nchildren; +#endif tr = malloc(sizeof(*tr), M_DEVBUF, M_WAITOK | M_ZERO); tr->type = pci_get_devid(dev); @@ -834,7 +849,7 @@ tr_pci_attach(device_t dev) } else { switch (tr->type) { case ALI_PCI_ID: - dacn = 1; + dacn = ALI_MAXPLAYCH; break; default: dacn = TR_MAXPLAYCH; @@ -859,8 +874,6 @@ tr_pci_attach(device_t dev) goto bad; } - tr->bufsz = pcm_getbuffersize(dev, 4096, TR_DEFAULT_BUFSZ, 65536); - if (tr_init(tr) == -1) { device_printf(dev, "unable to initialize the card\n"); goto bad; @@ -879,12 +892,59 @@ tr_pci_attach(device_t dev) goto bad; } - if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(dev), /*alignment*/2, + if (tr->type == ALI_PCI_ID) { + /* + * The M5451 generates 31 bit of DMA and in order to do + * 32-bit DMA, the 31st bit can be set via its accompanying + * ISA bridge. Note that we can't predict whether bus_dma(9) + * will actually supply us with a 32-bit buffer and even when + * using a low address of BUS_SPACE_MAXADDR_32BIT for both + * we might end up with the play buffer being in the 32-bit + * range while the record buffer isn't or vice versa. So we + * limit enabling the 31st bit to sparc64, where the IOMMU + * guarantees that we're using a 32-bit address (and in turn + * requires it). + */ + lowaddr = ALI_MAXADDR; +#ifdef __sparc64__ + if (device_get_children(device_get_parent(dev), &children, + &nchildren) == 0) { + for (i = 0; i < nchildren; i++) { + if (pci_get_devid(children[i]) == 0x153310b9) { + lowaddr = BUS_SPACE_MAXADDR_32BIT; + data = pci_read_config(children[i], + 0x7e, 1); + if (bootverbose) + device_printf(dev, + "M1533 0x7e: 0x%x -> ", + data); + data |= 0x1; + if (bootverbose) + printf("0x%x\n", data); + pci_write_config(children[i], 0x7e, + data, 1); + break; + } + } + } + free(children, M_TEMP); +#endif + tr->hwchns = ALI_MAXHWCH; + tr->bufsz = ALI_BUFSZ; + } else { + lowaddr = TR_MAXADDR; + tr->hwchns = TR_MAXHWCH; + tr->bufsz = pcm_getbuffersize(dev, 4096, TR_DEFAULT_BUFSZ, + 65536); + } + + if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(dev), + /*alignment*/TR_BUFALGN, /*boundary*/0, - /*lowaddr*/TR_MAXADDR, + /*lowaddr*/lowaddr, /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, - /*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff, + /*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/tr->bufsz, /*flags*/0, /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, &tr->parent_dmat) != 0) { device_printf(dev, "unable to create dma tag\n"); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index e75db9d..c980958 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -634,14 +634,8 @@ sckbdevent(keyboard_t *thiskbd, int event, void *arg) break; case FKEY: /* function key, return string */ cp = kbdd_get_fkeystr(thiskbd, KEYCHAR(c), &len); - if (cp != NULL) { - if (ttydisc_can_bypass(cur_tty)) { - ttydisc_rint_bypass(cur_tty, cp, len); - } else { - while (len-- > 0) - ttydisc_rint(cur_tty, *cp++, 0); - } - } + if (cp != NULL) + ttydisc_rint_simple(cur_tty, cp, len); break; case MKEY: /* meta is active, prepend ESC */ ttydisc_rint(cur_tty, 0x1b, 0); diff --git a/sys/dev/twa/tw_cl_io.c b/sys/dev/twa/tw_cl_io.c index 162b1ea..6fea175 100644 --- a/sys/dev/twa/tw_cl_io.c +++ b/sys/dev/twa/tw_cl_io.c @@ -396,7 +396,7 @@ tw_cl_fw_passthru(struct tw_cl_ctlr_handle *ctlr_handle, * non-zero-- failure */ TW_INT32 -tw_cl_ioctl(struct tw_cl_ctlr_handle *ctlr_handle, TW_INT32 cmd, TW_VOID *buf) +tw_cl_ioctl(struct tw_cl_ctlr_handle *ctlr_handle, u_long cmd, TW_VOID *buf) { struct tw_cli_ctlr_context *ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); diff --git a/sys/dev/twa/tw_cl_share.h b/sys/dev/twa/tw_cl_share.h index 265ff77..e583818 100644 --- a/sys/dev/twa/tw_cl_share.h +++ b/sys/dev/twa/tw_cl_share.h @@ -565,7 +565,7 @@ extern TW_INT32 tw_cl_interrupt(struct tw_cl_ctlr_handle *ctlr_handle); /* CL's ioctl handler. */ extern TW_INT32 tw_cl_ioctl(struct tw_cl_ctlr_handle *ctlr_handle, - TW_INT32 cmd, TW_VOID *buf); + u_long cmd, TW_VOID *buf); #ifdef TW_OSL_DEBUG diff --git a/sys/dev/twe/twe.c b/sys/dev/twe/twe.c index 59b5027..90dfa2e 100644 --- a/sys/dev/twe/twe.c +++ b/sys/dev/twe/twe.c @@ -487,7 +487,7 @@ twe_dump_blocks(struct twe_softc *sc, int unit, u_int32_t lba, void *data, int n * Handle controller-specific control operations. */ int -twe_ioctl(struct twe_softc *sc, int ioctlcmd, void *addr) +twe_ioctl(struct twe_softc *sc, u_long ioctlcmd, void *addr) { struct twe_usercommand *tu = (struct twe_usercommand *)addr; struct twe_paramcommand *tp = (struct twe_paramcommand *)addr; diff --git a/sys/dev/twe/twevar.h b/sys/dev/twe/twevar.h index 90391ad..2711ccc 100644 --- a/sys/dev/twe/twevar.h +++ b/sys/dev/twe/twevar.h @@ -150,7 +150,7 @@ extern void twe_startio(struct twe_softc *sc); extern int twe_start(struct twe_request *tr); extern int twe_dump_blocks(struct twe_softc *sc, int unit, /* crashdump block write */ u_int32_t lba, void *data, int nblks); -extern int twe_ioctl(struct twe_softc *sc, int cmd, +extern int twe_ioctl(struct twe_softc *sc, u_long cmd, void *addr); /* handle user request */ extern void twe_describe_controller(struct twe_softc *sc); /* print controller info */ extern void twe_print_controller(struct twe_softc *sc); |