Date: Sat, 19 Jul 2003 21:58:05 -0700 (PDT) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 34740 for review Message-ID: <200307200458.h6K4w57N088283@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=34740 Change 34740 by marcel@marcel_nfs on 2003/07/19 21:57:17 IFC @34738 Affected files ... .. //depot/projects/uart/cam/scsi/scsi_da.c#2 integrate .. //depot/projects/uart/compat/linprocfs/linprocfs.c#2 integrate .. //depot/projects/uart/compat/linux/linux_misc.c#2 integrate .. //depot/projects/uart/conf/files#9 integrate .. //depot/projects/uart/dev/acpica/acpi.c#4 integrate .. //depot/projects/uart/dev/acpica/acpi_ec.c#4 integrate .. //depot/projects/uart/dev/acpica/acpi_isab.c#3 integrate .. //depot/projects/uart/dev/acpica/acpivar.h#3 integrate .. //depot/projects/uart/dev/ed/if_ed_pccard.c#2 integrate .. //depot/projects/uart/dev/em/if_em.h#3 integrate .. //depot/projects/uart/dev/ep/if_ep.c#2 integrate .. //depot/projects/uart/dev/ep/if_ep_eisa.c#2 integrate .. //depot/projects/uart/dev/ep/if_ep_isa.c#2 integrate .. //depot/projects/uart/dev/ep/if_ep_mca.c#2 integrate .. //depot/projects/uart/dev/ep/if_ep_pccard.c#2 integrate .. //depot/projects/uart/dev/ep/if_epreg.h#2 integrate .. //depot/projects/uart/dev/ep/if_epvar.h#2 integrate .. //depot/projects/uart/dev/firewire/firewire.c#4 integrate .. //depot/projects/uart/dev/firewire/fwdma.c#4 integrate .. //depot/projects/uart/dev/firewire/fwohci.c#4 integrate .. //depot/projects/uart/dev/firewire/fwohci_pci.c#4 integrate .. //depot/projects/uart/dev/firewire/if_fwe.c#2 integrate .. //depot/projects/uart/dev/firewire/sbp.c#4 integrate .. //depot/projects/uart/dev/hatm/if_hatm.c#4 integrate .. //depot/projects/uart/dev/pccard/pccarddevs#4 integrate .. //depot/projects/uart/dev/pccard/pccarddevs.h#4 integrate .. //depot/projects/uart/dev/wi/if_wi_pccard.c#5 integrate .. //depot/projects/uart/dev/wi/if_wi_pci.c#2 integrate .. //depot/projects/uart/i386/i386/busdma_machdep.c#3 integrate .. //depot/projects/uart/i386/isa/vesa.c#2 integrate .. //depot/projects/uart/kern/init_sysent.c#2 integrate .. //depot/projects/uart/kern/kern_proc.c#3 integrate .. //depot/projects/uart/kern/kern_sig.c#4 integrate .. //depot/projects/uart/kern/kern_thread.c#6 integrate .. //depot/projects/uart/kern/kern_umtx.c#3 integrate .. //depot/projects/uart/kern/syscalls.c#2 integrate .. //depot/projects/uart/kern/syscalls.master#2 integrate .. //depot/projects/uart/kern/uipc_mbuf.c#2 integrate .. //depot/projects/uart/kern/uipc_socket.c#3 integrate .. //depot/projects/uart/net/if.c#2 integrate .. //depot/projects/uart/net/if_atm.h#3 integrate .. //depot/projects/uart/net/route.h#2 integrate .. //depot/projects/uart/netatm/atm_subr.c#2 integrate .. //depot/projects/uart/netatm/uni/unisig_msg.c#2 integrate .. //depot/projects/uart/netinet/ip_output.c#2 integrate .. //depot/projects/uart/netinet/raw_ip.c#2 integrate .. //depot/projects/uart/netinet/tcp_syncache.c#2 integrate .. //depot/projects/uart/pci/if_dc.c#6 integrate .. //depot/projects/uart/pci/if_dcreg.h#5 integrate .. //depot/projects/uart/pci/if_rl.c#6 integrate .. //depot/projects/uart/sparc64/include/cache.h#2 integrate .. //depot/projects/uart/sys/kse.h#2 integrate .. //depot/projects/uart/sys/proc.h#3 integrate .. //depot/projects/uart/sys/socketvar.h#2 integrate .. //depot/projects/uart/sys/syscall.h#2 integrate .. //depot/projects/uart/sys/syscall.mk#2 integrate .. //depot/projects/uart/sys/sysproto.h#2 integrate .. //depot/projects/uart/vm/swap_pager.c#2 integrate .. //depot/projects/uart/vm/swap_pager.h#2 integrate .. //depot/projects/uart/vm/uma_core.c#2 integrate .. //depot/projects/uart/vm/vm_map.c#5 integrate .. //depot/projects/uart/vm/vm_swap.c#2 delete Differences ... ==== //depot/projects/uart/cam/scsi/scsi_da.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.144 2003/06/10 18:14:04 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.146 2003/07/18 16:26:36 thomas Exp $"); #ifdef _KERNEL #include "opt_hw_wdog.h" @@ -276,6 +276,14 @@ }, { /* + * Intelligent Stick USB disk-on-key + * PR: kern/53005 + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "USB Card", "IntelligentStick*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE|DA_Q_NO_SYNC_CACHE + }, + { + /* * Sony DSC cameras (DSC-S30, DSC-S50, DSC-S70) */ {T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"}, ==== //depot/projects/uart/compat/linprocfs/linprocfs.c#2 (text+ko) ==== @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.66 2003/06/10 21:23:04 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.67 2003/07/18 10:26:08 phk Exp $"); #include <sys/param.h> #include <sys/queue.h> @@ -121,6 +121,7 @@ unsigned long long swapused; /* used swap space in bytes */ unsigned long long swapfree; /* free swap space in bytes */ vm_object_t object; + int i, j; memtotal = physmem * PAGE_SIZE; /* @@ -135,14 +136,10 @@ */ memused = cnt.v_wire_count * PAGE_SIZE; memfree = memtotal - memused; - if (swapblist == NULL) { - swaptotal = 0; - swapfree = 0; - } else { - swaptotal = (u_quad_t)swapblist->bl_blocks * 1024; /* XXX why 1024? */ - swapfree = (u_quad_t)swapblist->bl_root->u.bmu_avail * PAGE_SIZE; - } - swapused = swaptotal - swapfree; + swap_pager_status(&i, &j); + swaptotal = i * PAGE_SIZE; + swapused = j * PAGE_SIZE; + swapfree = swaptotal - swapused; memshared = 0; TAILQ_FOREACH(object, &vm_object_list, object_list) if (object->shadow_count > 1) ==== //depot/projects/uart/compat/linux/linux_misc.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.144 2003/06/10 21:27:39 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.145 2003/07/18 10:26:09 phk Exp $"); #include "opt_mac.h" @@ -108,7 +108,7 @@ { struct l_sysinfo sysinfo; vm_object_t object; - int i; + int i, j; struct timespec ts; /* Uptime is copied out of print_uptime() in kern_shutdown.c */ @@ -144,13 +144,9 @@ sysinfo.sharedram *= PAGE_SIZE; sysinfo.bufferram = 0; - if (swapblist == NULL) { - sysinfo.totalswap= 0; - sysinfo.freeswap = 0; - } else { - sysinfo.totalswap = swapblist->bl_blocks * 1024; - sysinfo.freeswap = swapblist->bl_root->u.bmu_avail * PAGE_SIZE; - } + swap_pager_status(&i, &j); + sysinfo.totalswap= i * PAGE_SIZE; + sysinfo.freeswap = (i - j) * PAGE_SIZE; sysinfo.procs = 20; /* Hack */ ==== //depot/projects/uart/conf/files#9 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.807 2003/07/15 22:42:36 jmg Exp $ +# $FreeBSD: src/sys/conf/files,v 1.808 2003/07/18 10:02:43 phk Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -1619,7 +1619,6 @@ vm/vm_zeroidle.c standard vm/vm_pageout.c standard vm/vm_pager.c standard -vm/vm_swap.c standard vm/vm_unix.c standard vm/uma_core.c standard vm/uma_dbg.c standard ==== //depot/projects/uart/dev/acpica/acpi.c#4 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.91 2003/07/13 22:57:16 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.93 2003/07/20 00:52:57 njl Exp $ */ #include "opt_acpi.h" @@ -383,6 +383,12 @@ goto out; } + /* + * Call the ECDT probe function to provide EC functionality before + * the namespace has been evaluated. + */ + acpi_ec_ecdt_probe(dev); + if (ACPI_FAILURE(status = AcpiInitializeObjects(flags))) { device_printf(dev, "could not initialize ACPI objects: %s\n", AcpiFormatException(status)); goto out; @@ -923,7 +929,7 @@ ACPI_ASSERTLOCK; if (howto & RB_POWEROFF) { - printf("Power system off using ACPI...\n"); + printf("Powering system off using ACPI\n"); if (ACPI_FAILURE(status = AcpiEnterSleepStatePrep(acpi_off_state))) { printf("AcpiEnterSleepStatePrep failed - %s\n", AcpiFormatException(status)); @@ -936,7 +942,7 @@ printf("ACPI power-off failed - timeout\n"); } } else { - printf("Terminate ACPI\n"); + printf("Shutting down ACPI\n"); AcpiTerminate(); } } ==== //depot/projects/uart/dev/acpica/acpi_ec.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.33 2003/07/15 19:24:36 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.34 2003/07/20 00:48:38 njl Exp $ */ /****************************************************************************** * @@ -221,6 +221,26 @@ #define EC_SET_CSR(sc, v) \ bus_space_write_1((sc)->ec_csr_tag, (sc)->ec_csr_handle, 0, (v)) +/* Embedded Controller Boot Resources Table (ECDT) */ +typedef struct { + ACPI_TABLE_HEADER header; + ACPI_GENERIC_ADDRESS control; + ACPI_GENERIC_ADDRESS data; + UINT32 uid; + UINT8 gpe_bit; + char ec_id[0]; +} ACPI_TABLE_ECDT; + +/* Indicate that this device has already been probed via ECDT. */ +#define DEV_ECDT_FLAG 0x80000000 + +/* Indicate that this device should use the global lock. */ +#define DEV_GLK_FLAG 0x40000000 + +/* Get/set GPE bit value in the magic ivar. */ +#define DEV_GET_GPEBIT(x) ((x) & 0xff) +#define DEV_SET_GPEBIT(x, y) ((x) = ((x) & ~0xff) | ((y) & 0xff)) + /* * Driver softc. */ @@ -307,13 +327,11 @@ UINT8 *Data); static ACPI_STATUS EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data); -static void acpi_ec_identify(driver_t driver, device_t bus); static int acpi_ec_probe(device_t dev); static int acpi_ec_attach(device_t dev); static device_method_t acpi_ec_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, acpi_ec_identify), DEVMETHOD(device_probe, acpi_ec_probe), DEVMETHOD(device_attach, acpi_ec_attach), @@ -330,37 +348,155 @@ DRIVER_MODULE(acpi_ec, acpi, acpi_ec_driver, acpi_ec_devclass, 0, 0); /* - * Look for an ECDT table and if we find one, set up a default EC - * space handler to catch possible attempts to access EC space before + * Look for an ECDT and if we find one, set up default GPE and + * space handlers to catch attempts to access EC space before * we have a real driver instance in place. - * We're not really an identify routine, but because we get called - * before most other things, this works out OK. + * TODO: if people report invalid ECDTs, add a tunable to disable them. */ -static void -acpi_ec_identify(driver_t driver, device_t bus) +void +acpi_ec_ecdt_probe(device_t parent) { + ACPI_TABLE_ECDT *ecdt; + ACPI_STATUS status; + device_t child; + ACPI_HANDLE h; + int magic; + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - /* XXX implement - need an ACPI 2.0 system to test this */ + /* Find and validate the ECDT. */ + status = AcpiGetFirmwareTable("ECDT", 1, ACPI_LOGICAL_ADDRESSING, + (ACPI_TABLE_HEADER **)&ecdt); + if (ACPI_FAILURE(status) || + ecdt->control.RegisterBitWidth != 8 || + ecdt->data.RegisterBitWidth != 8) { + return; + } + + /* Create the child device with the given unit number. */ + child = BUS_ADD_CHILD(parent, 0, "acpi_ec", ecdt->uid); + if (child == NULL) { + printf("acpi_ec_ecdt_probe: can't add child\n"); + return; + } + + /* Find and save the ACPI handle for this device. */ + status = AcpiGetHandle(NULL, ecdt->ec_id, &h); + if (ACPI_FAILURE(status)) { + device_delete_child(parent, child); + printf("acpi_ec_ecdt_probe: can't get handle\n"); + return; + } + acpi_set_handle(child, h); + + /* Set the data and CSR register addresses. */ + bus_set_resource(child, SYS_RES_IOPORT, 0, ecdt->data.Address, + /*count*/1); + bus_set_resource(child, SYS_RES_IOPORT, 1, ecdt->control.Address, + /*count*/1); + + /* + * Store values for the probe/attach routines to use. Store the + * ECDT GPE bit and set the global lock flag (just to be safe). + * We'll determine whether we really want to use the global lock + * in a later call to attach. + */ + magic = DEV_ECDT_FLAG | DEV_GLK_FLAG; + DEV_SET_GPEBIT(magic, ecdt->gpe_bit); + acpi_set_magic(child, magic); + + /* Finish the attach process. */ + if (device_probe_and_attach(child) != 0) + device_delete_child(parent, child); } -/* - * We could setup resources in the probe routine in order to have them printed - * when the device is attached. - */ static int acpi_ec_probe(device_t dev) { - int ret = ENXIO; + ACPI_HANDLE h; + ACPI_STATUS status; + device_t peer; + char desc[64]; + int magic, uid, glk, gpebit, ret = ENXIO; + + /* Check that this is an EC device and it's not disabled. */ + if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec") || + !acpi_MatchHid(dev, "PNP0C09")) { + return (ENXIO); + } + + /* + * If probed via ECDT, set description and continue. Otherwise, + * we can access the namespace and make sure this is not a + * duplicate probe. + */ + magic = acpi_get_magic(dev); + if ((magic & DEV_ECDT_FLAG) != 0) { + snprintf(desc, sizeof(desc), "embedded controller: ECDT, GPE %#x, GLK", + DEV_GET_GPEBIT(magic)); + device_set_desc_copy(dev, desc); + ret = 0; + } else { + h = acpi_get_handle(dev); + + /* + * Read the unit ID to check for duplicate attach and the + * global lock value to see if we should acquire it when + * accessing the EC. + */ + status = acpi_EvaluateInteger(h, "_UID", &uid); + if (ACPI_FAILURE(status)) + uid = 0; + status = acpi_EvaluateInteger(h, "_GLK", &glk); + if (ACPI_FAILURE(status)) + glk = 0; + + /* + * Evaluate the _GPE method to find the GPE bit used by the EC to + * signal status (SCI). Note that we don't handle the case where + * it can return a package instead of an int. + */ + status = acpi_EvaluateInteger(h, "_GPE", &gpebit); + if (ACPI_FAILURE(status)) { + device_printf(dev, "can't evaluate _GPE - %s\n", + AcpiFormatException(status)); + return (ENXIO); + } - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("ec") && - acpi_MatchHid(dev, "PNP0C09")) { + /* Store the values we got from the namespace for attach. */ + magic = glk != 0 ? DEV_GLK_FLAG : 0; + DEV_SET_GPEBIT(magic, gpebit); + acpi_set_magic(dev, magic); /* - * Set device description + * Check for a duplicate probe. This can happen when a probe + * via ECDT succeeded already. If there is a duplicate, override + * its value for GLK in the peer's softc since the ECDT case + * always enables the global lock to be safe. Otherwise, just + * continue on to attach. */ - device_set_desc(dev, "embedded controller"); - ret = 0; + peer = devclass_get_device(acpi_ec_devclass, uid); + if (peer == NULL || !device_is_alive(peer)) { + snprintf(desc, sizeof(desc), "embedded controller: GPE %#x%s", + gpebit, glk != 0 ? ", GLK" : ""); + device_set_desc_copy(dev, desc); + ret = 0; + } else { + struct acpi_ec_softc *sc; + + /* + * Set the peer's sc->ec_glk with locks held so we won't + * override it between another thread's lock/unlock calls. + */ + sc = device_get_softc(peer); + if (sc->ec_glk != glk) { + ACPI_VPRINT(peer, acpi_device_get_parent_softc(peer), + "Changing GLK from %d to %d\n", sc->ec_glk, glk); + mtx_lock(&sc->ec_mtx); + sc->ec_glk = glk != 0 ? 1 : 0; + mtx_unlock(&sc->ec_mtx); + } + } } return (ret); @@ -371,7 +507,7 @@ { struct acpi_ec_softc *sc; ACPI_STATUS Status; - int errval = 0; + int magic, errval = 0; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -382,6 +518,11 @@ sc->ec_polldelay = EC_POLL_DELAY; mtx_init(&sc->ec_mtx, "ACPI embedded controller", NULL, MTX_DEF); + /* Retrieve previously probed values via device ivars. */ + magic = acpi_get_magic(dev); + sc->ec_glk = (magic & DEV_GLK_FLAG) != 0 ? 1 : 0; + sc->ec_gpebit = DEV_GET_GPEBIT(magic); + /* Attach bus resources for data and command/status ports. */ sc->ec_data_rid = 0; sc->ec_data_res = bus_alloc_resource(sc->ec_dev, SYS_RES_IOPORT, @@ -405,24 +546,7 @@ sc->ec_csr_tag = rman_get_bustag(sc->ec_csr_res); sc->ec_csr_handle = rman_get_bushandle(sc->ec_csr_res); - /* Check if global lock should be used. If not, leave flag as 0. */ - acpi_EvaluateInteger(sc->ec_handle, "_GLK", &sc->ec_glk); - /* - * Evaluate the _GPE method to find the GPE bit used by the EC to signal - * status (SCI). Note that we don't handle the case where it can - * return a package instead of an int. - */ - ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "querying GPE\n")); - Status = acpi_EvaluateInteger(sc->ec_handle, "_GPE", &sc->ec_gpebit); - if (ACPI_FAILURE(Status)) { - device_printf(dev, "can't evaluate _GPE - %s\n", - AcpiFormatException(Status)); - errval = ENXIO; - goto out; - } - - /* * Install a handler for this EC's GPE bit. We want edge-triggered * behavior. */ @@ -452,10 +576,6 @@ goto out; } - ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev), - "GPE bit is %#x, %susing global lock\n", sc->ec_gpebit, - sc->ec_glk == 0 ? "not " : ""); - ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "acpi_ec_attach complete\n")); return (0); ==== //depot/projects/uart/dev/acpica/acpi_isab.c#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi_isab.c,v 1.2 2003/07/09 18:28:53 jhb Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi_isab.c,v 1.3 2003/07/17 19:13:41 jhb Exp $ */ /* @@ -94,7 +94,7 @@ if ((acpi_get_type(dev) == ACPI_TYPE_DEVICE) && !acpi_disabled("isa") && - devclass_get_device(isab_devclass, 0) == NULL && + devclass_get_device(isab_devclass, 0) == dev && (acpi_MatchHid(dev, "PNP0A05") || acpi_MatchHid(dev, "PNP0A06"))) { device_set_desc(dev, "ACPI Generic ISA bridge"); return(0); ==== //depot/projects/uart/dev/acpica/acpivar.h#3 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.42 2003/07/15 19:19:54 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.43 2003/07/20 00:48:38 njl Exp $ */ #include "bus_if.h" @@ -133,37 +133,6 @@ #define ACPI_INTR_APIC 1 #define ACPI_INTR_SAPIC 2 -/* XXX this is no longer referenced anywhere, remove? */ -#if 0 -/* - * This is a cheap and nasty way to get around the horrid counted list - * argument format that AcpiEvalateObject uses. - */ -#define ACPI_OBJECTLIST_MAX 16 -struct acpi_object_list { - UINT32 count; - ACPI_OBJECT *pointer[ACPI_OBJECTLIST_MAX]; - ACPI_OBJECT object[ACPI_OBJECTLIST_MAX]; -}; - -static __inline struct acpi_object_list * -acpi_AllocObjectList(int nobj) -{ - struct acpi_object_list *l; - int i; - - if (nobj > ACPI_OBJECTLIST_MAX) - return(NULL); - if ((l = AcpiOsAllocate(sizeof(*l))) == NULL) - return(NULL); - bzero(l, sizeof(*l)); - for (i = 0; i < ACPI_OBJECTLIST_MAX; i++) - l->pointer[i] = &l->object[i]; - l->count = nobj; - return(l); -} -#endif /* unused */ - /* * Note that the low ivar values are reserved to provide * interface compatibility with ISA drivers which can also @@ -376,6 +345,11 @@ extern int acpi_cmbat_get_battinfo(int, struct acpi_battinfo *); /* + * Embedded controller. + */ +extern void acpi_ec_ecdt_probe(device_t); + +/* * AC adapter interface. */ ==== //depot/projects/uart/dev/ed/if_ed_pccard.c#2 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.48 2003/04/15 06:37:23 mdodd Exp $ + * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.49 2003/07/19 05:36:09 imp Exp $ */ #include "opt_ed.h" @@ -127,6 +127,7 @@ { PCMCIA_CARD(BILLIONTON, LNT10TN, 0), 0}, { PCMCIA_CARD(BILLIONTON, CFLT10N, 0), 0}, { PCMCIA_CARD(BUFFALO, LPC3_CLT, 0), 0}, + { PCMCIA_CARD(BUFFALO, LPC3_CLX, 0), NE2000DVF_AX88190}, { PCMCIA_CARD(BUFFALO, LPC_CF_CLT, 0), 0}, { PCMCIA_CARD(CNET, NE2000, 0), 0}, { PCMCIA_CARD(COMPEX, LINKPORT_ENET_B, 0), 0}, ==== //depot/projects/uart/dev/em/if_em.h#3 (text+ko) ==== @@ -31,7 +31,7 @@ ***************************************************************************/ -/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.17 2003/07/04 10:15:16 mux Exp $*/ +/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.18 2003/07/17 19:02:34 jdp Exp $*/ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ @@ -117,7 +117,7 @@ #define EM_TIDV 64 /* - * TxAbsIntDelay (Not valid for 82542 and 82543) + * TxAbsIntDelay (Not valid for 82542/82543/82544) * Valid Range: 0-65535 (0=off) * Default Value: 64 * This value, in units of 1.024 microseconds, limits the delay in which a @@ -151,7 +151,7 @@ #define EM_RDTR 0 /* - * RxAbsIntDelay (Not valid for 82542 and 82543) + * RxAbsIntDelay (Not valid for 82542/82543/82544) * Valid Range: 0-65535 (0=off) * Default Value: 64 * This value, in units of 1.024 microseconds, limits the delay in which a ==== //depot/projects/uart/dev/ep/if_ep.c#2 (text+ko) ==== @@ -26,8 +26,6 @@ * 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. - * - * if_ep.c,v 1.19 1995/01/24 20:53:45 davidg Exp */ /* @@ -38,8 +36,6 @@ */ /* - * $FreeBSD: src/sys/dev/ep/if_ep.c,v 1.117 2003/06/26 17:02:52 mux Exp $ - * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select * logic changed to use value from EEPROM. Autoconfiguration @@ -61,71 +57,67 @@ * <mdodd@FreeBSD.org> */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/dev/ep/if_ep.c,v 1.118 2003/07/17 19:37:56 markm Exp $"); + #include <sys/param.h> #include <sys/systm.h> #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/sockio.h> - #include <sys/bus.h> #include <machine/bus.h> #include <machine/resource.h> -#include <sys/rman.h> +#include <sys/rman.h> #include <net/if.h> #include <net/if_arp.h> -#include <net/if_media.h> +#include <net/if_media.h> #include <net/ethernet.h> #include <net/bpf.h> - #include <dev/ep/if_epreg.h> #include <dev/ep/if_epvar.h> /* Exported variables */ devclass_t ep_devclass; -#if 0 -static char * ep_conn_type[] = {"UTP", "AUI", "???", "BNC"}; -static int if_media2ep_media[] = { 0, 0, 0, UTP, BNC, AUI }; -#endif - -static int ep_media2if_media[] = - { IFM_10_T, IFM_10_5, IFM_NONE, IFM_10_2, IFM_NONE }; +static int ep_media2if_media[] = +{IFM_10_T, IFM_10_5, IFM_NONE, IFM_10_2, IFM_NONE}; /* if functions */ -static void ep_if_init (void *); -static int ep_if_ioctl (struct ifnet *, u_long, caddr_t); -static void ep_if_start (struct ifnet *); -static void ep_if_watchdog (struct ifnet *); +static void ep_if_init(void *); +static int ep_if_ioctl(struct ifnet *, u_long, caddr_t); +static void ep_if_start(struct ifnet *); +static void ep_if_watchdog(struct ifnet *); /* if_media functions */ -static int ep_ifmedia_upd (struct ifnet *); -static void ep_ifmedia_sts (struct ifnet *, struct ifmediareq *); +static int ep_ifmedia_upd(struct ifnet *); +static void ep_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static void epstop (struct ep_softc *); -static void epread (struct ep_softc *); -static int eeprom_rdy (struct ep_softc *); +static void epstop(struct ep_softc *); +static void epread(struct ep_softc *); +static int eeprom_rdy(struct ep_softc *); #define EP_FTST(sc, f) (sc->stat & (f)) #define EP_FSET(sc, f) (sc->stat |= (f)) #define EP_FRST(sc, f) (sc->stat &= ~(f)) static int -eeprom_rdy(sc) - struct ep_softc *sc; +eeprom_rdy(struct ep_softc *sc) { - int i; + int i; + + for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) + DELAY(100); + + if (i >= MAX_EEPROMBUSY) { + printf("ep%d: eeprom failed to come ready.\n", sc->unit); + return (ENXIO); + } - for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) { - DELAY(100); - } - if (i >= MAX_EEPROMBUSY) { - printf("ep%d: eeprom failed to come ready.\n", sc->unit); - return (ENXIO); - } - return (0); + return (0); } /* @@ -133,42 +125,40 @@ * before */ int -get_e(sc, offset, result) - struct ep_softc *sc; - u_int16_t offset; - u_int16_t *result; +get_e(struct ep_softc *sc, u_int16_t offset, u_int16_t *result) { if (eeprom_rdy(sc)) return (ENXIO); + outw(BASE + EP_W0_EEPROM_COMMAND, - (EEPROM_CMD_RD << sc->epb.cmd_off) | offset); + (EEPROM_CMD_RD << sc->epb.cmd_off) | offset); + if (eeprom_rdy(sc)) return (ENXIO); + (*result) = inw(BASE + EP_W0_EEPROM_DATA); return (0); } int -ep_get_macaddr(sc, addr) - struct ep_softc * sc; - u_char * addr; +ep_get_macaddr(struct ep_softc *sc, u_char *addr) { - int i; - u_int16_t result; - int error; - u_int16_t * macaddr; + int i; + u_int16_t result; + int error; + u_int16_t *macaddr; - macaddr = (u_int16_t *)addr; + macaddr = (u_int16_t *) addr; GO_WINDOW(0); - for(i = EEPROM_NODE_ADDR_0; i <= EEPROM_NODE_ADDR_2; i++) { + for (i = EEPROM_NODE_ADDR_0; i <= EEPROM_NODE_ADDR_2; i++) { error = get_e(sc, i, &result); if (error) return (error); macaddr[i] = htons(result); - } + } return (0); } @@ -176,42 +166,40 @@ int ep_alloc(device_t dev) { - struct ep_softc * sc = device_get_softc(dev); - int rid; - int error = 0; - u_int16_t result; + struct ep_softc *sc = device_get_softc(dev); + int rid; + int error = 0; + u_int16_t result; - rid = 0; - sc->iobase = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, 1, RF_ACTIVE); - if (!sc->iobase) { - device_printf(dev, "No I/O space?!\n"); + rid = 0; + sc->iobase = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, + 0, ~0, 1, RF_ACTIVE); + if (!sc->iobase) { + device_printf(dev, "No I/O space?!\n"); error = ENXIO; - goto bad; - } - - rid = 0; - sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, - 0, ~0, 1, RF_ACTIVE); - if (!sc->irq) { - device_printf(dev, "No irq?!\n"); + goto bad; + } + rid = 0; + sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, + 0, ~0, 1, RF_ACTIVE); + if (!sc->irq) { + device_printf(dev, "No irq?!\n"); error = ENXIO; - goto bad; - } + goto bad; + } + sc->dev = dev; + sc->unit = device_get_unit(dev); + sc->stat = 0; /* 16 bit access */ - sc->dev = dev; - sc->unit = device_get_unit(dev); - sc->stat = 0; /* 16 bit access */ + sc->ep_io_addr = rman_get_start(sc->iobase); - sc->ep_io_addr = rman_get_start(sc->iobase); + sc->ep_btag = rman_get_bustag(sc->iobase); + sc->ep_bhandle = rman_get_bushandle(sc->iobase); - sc->ep_btag = rman_get_bustag(sc->iobase); - sc->ep_bhandle = rman_get_bushandle(sc->iobase); - sc->ep_connectors = 0; sc->ep_connector = 0; - GO_WINDOW(0); + GO_WINDOW(0); sc->epb.cmd_off = 0; error = get_e(sc, EEPROM_PROD_ID, &result); @@ -229,24 +217,22 @@ } void -ep_get_media(sc) - struct ep_softc * sc; +ep_get_media(struct ep_softc *sc) { - u_int16_t config; - - GO_WINDOW(0); - config = inw(BASE + EP_W0_CONFIG_CTRL); - if (config & IS_AUI) - sc->ep_connectors |= AUI; - if (config & IS_BNC) - sc->ep_connectors |= BNC; - if (config & IS_UTP) - sc->ep_connectors |= UTP; + u_int16_t config; + + GO_WINDOW(0); + config = inw(BASE + EP_W0_CONFIG_CTRL); + if (config & IS_AUI) + sc->ep_connectors |= AUI; + if (config & IS_BNC) + sc->ep_connectors |= BNC; + if (config & IS_UTP) + sc->ep_connectors |= UTP; - if (!(sc->ep_connectors & 7)) { + if (!(sc->ep_connectors & 7)) if (bootverbose) - device_printf(sc->dev, "no connectors!\n"); - } + device_printf(sc->dev, "no connectors!\n"); /* * This works for most of the cards so we'll do it here. @@ -254,14 +240,12 @@ * this later on. */ sc->ep_connector = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS; - - return; } void ep_free(device_t dev) { - struct ep_softc * sc = device_get_softc(dev); + struct ep_softc *sc = device_get_softc(dev); if (sc->ep_intrhand) bus_teardown_intr(dev, sc->irq, sc->ep_intrhand); @@ -269,20 +253,17 @@ bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->iobase); if (sc->irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); +} - return; -} - int -ep_attach(sc) - struct ep_softc * sc; +ep_attach(struct ep_softc *sc) { - struct ifnet * ifp = NULL; - struct ifmedia * ifm = NULL; - u_short * p; - int i; - int attached; - int error; + struct ifnet *ifp = NULL; + struct ifmedia *ifm = NULL; + u_short *p; + int i; + int attached; + int error; sc->gone = 0; @@ -291,19 +272,17 @@ device_printf(sc->dev, "Unable to retrieve Ethernet address!\n"); return (ENXIO); } - /* * Setup the station address */ p = (u_short *)&sc->arpcom.ac_enaddr; GO_WINDOW(2); - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) outw(BASE + EP_W2_ADDR_0 + (i * 2), ntohs(p[i])); - } device_printf(sc->dev, "Ethernet address %6D\n", - sc->arpcom.ac_enaddr, ":"); - + sc->arpcom.ac_enaddr, ":"); + ifp = &sc->arpcom.ac_if; attached = (ifp->if_softc != 0); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200307200458.h6K4w57N088283>