Date: Thu, 9 Sep 2010 13:38:36 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r212361 - in user/nwhitehorn/ps3: arm/conf boot/fdt/dts boot/forth cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys dev/acpica dev/ata dev/ata/chipsets... Message-ID: <201009091338.o89DcaZt088137@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Thu Sep 9 13:38:36 2010 New Revision: 212361 URL: http://svn.freebsd.org/changeset/base/212361 Log: IFC @ r212360 to pick up recent PowerPC-related memory management and VM fixes. Added: user/nwhitehorn/ps3/arm/conf/DOCKSTAR - copied unchanged from r212360, head/sys/arm/conf/DOCKSTAR user/nwhitehorn/ps3/boot/fdt/dts/dockstar.dts - copied unchanged from r212360, head/sys/boot/fdt/dts/dockstar.dts Modified: user/nwhitehorn/ps3/boot/forth/beastie.4th user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c user/nwhitehorn/ps3/dev/ata/ata-all.h user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c user/nwhitehorn/ps3/dev/atkbdc/psm.c user/nwhitehorn/ps3/dev/bge/if_bge.c user/nwhitehorn/ps3/dev/e1000/if_em.c user/nwhitehorn/ps3/dev/e1000/if_em.h user/nwhitehorn/ps3/dev/mii/brgphy.c user/nwhitehorn/ps3/dev/mii/brgphyreg.h user/nwhitehorn/ps3/dev/pci/pcireg.h user/nwhitehorn/ps3/fs/nfsclient/nfs_clrpcops.c user/nwhitehorn/ps3/fs/nfsclient/nfs_clvnops.c user/nwhitehorn/ps3/fs/nfsclient/nfsnode.h user/nwhitehorn/ps3/fs/tmpfs/tmpfs_vnops.c user/nwhitehorn/ps3/kern/kern_fork.c user/nwhitehorn/ps3/kern/subr_bus.c user/nwhitehorn/ps3/kern/vfs_mount.c user/nwhitehorn/ps3/mips/mips/busdma_machdep.c user/nwhitehorn/ps3/mips/rmi/dev/nlge/if_nlge.c user/nwhitehorn/ps3/mips/rmi/dev/xlr/rge.c user/nwhitehorn/ps3/mips/rmi/fmn.c user/nwhitehorn/ps3/mips/rmi/msgring.h user/nwhitehorn/ps3/mips/rmi/xlr_pci.c user/nwhitehorn/ps3/nfsclient/nfs_vnops.c user/nwhitehorn/ps3/nfsclient/nfsnode.h user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c user/nwhitehorn/ps3/sys/time.h user/nwhitehorn/ps3/vm/vm_mmap.c user/nwhitehorn/ps3/vm/vm_pageout.c user/nwhitehorn/ps3/x86/pci/qpi.c Directory Properties: user/nwhitehorn/ps3/ (props changed) user/nwhitehorn/ps3/amd64/include/xen/ (props changed) user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed) user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed) user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed) user/nwhitehorn/ps3/contrib/pf/ (props changed) user/nwhitehorn/ps3/contrib/x86emu/ (props changed) user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed) user/nwhitehorn/ps3/powerpc/ps3/ (props changed) Copied: user/nwhitehorn/ps3/arm/conf/DOCKSTAR (from r212360, head/sys/arm/conf/DOCKSTAR) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/arm/conf/DOCKSTAR Thu Sep 9 13:38:36 2010 (r212361, copy of r212360, head/sys/arm/conf/DOCKSTAR) @@ -0,0 +1,76 @@ +# +# Custom kernel for Seagate DockStar (Marvell SheevaPlug based) devices. +# +# $FreeBSD$ +# + +ident DOCKSTAR +include "../mv/kirkwood/std.sheevaplug" + +options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_COMPAT +options BOOTP_WIRED_TO=mge0 + +# Root fs on USB device +#options ROOTDEVNAME=\"ufs:/dev/da0a\" + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB + +# Pseudo devices +device md +device random +device pty +device loop + +# Serial ports +device uart + +# Networking +device ether +device mge # Marvell Gigabit Ethernet controller +device mii +device bpf +options HZ=1000 +options DEVICE_POLLING +device vlan + +# USB +options USB_DEBUG # enable debug msgs +device usb +device ehci +device umass +device scbus +device pass +device da + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=dockstar.dts Copied: user/nwhitehorn/ps3/boot/fdt/dts/dockstar.dts (from r212360, head/sys/boot/fdt/dts/dockstar.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/boot/fdt/dts/dockstar.dts Thu Sep 9 13:38:36 2010 (r212361, copy of r212360, head/sys/boot/fdt/dts/dockstar.dts) @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * 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. + * + * Seagate DockStar (Marvell SheevaPlug based) Device Tree Source. + * + * $FreeBSD$ + */ + +/dts-v1/; + +/ { + model = "seagate,DockStar"; + compatible = "DockStar"; + #address-cells = <1>; + #size-cells = <1>; + + aliases { + ethernet0 = &enet0; + mpp = &MPP; + serial0 = &serial0; + serial1 = &serial1; + soc = &SOC; + sram = &SRAM; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "ARM,88FR131"; + reg = <0x0>; + d-cache-line-size = <32>; // 32 bytes + i-cache-line-size = <32>; // 32 bytes + d-cache-size = <0x4000>; // L1, 16K + i-cache-size = <0x4000>; // L1, 16K + timebase-frequency = <0>; + bus-frequency = <0>; + clock-frequency = <0>; + }; + }; + + memory { + device_type = "memory"; + reg = <0x0 0x8000000>; // 128M at 0x0 + }; + + localbus@f1000000 { + #address-cells = <2>; + #size-cells = <1>; + compatible = "mrvl,lbc"; + + /* This reflects CPU decode windows setup. */ + ranges = <0x0 0x0f 0xf9300000 0x00100000 + 0x1 0x1e 0xfa000000 0x00100000 + 0x2 0x1d 0xfa100000 0x02000000 + 0x3 0x1b 0xfc100000 0x00000400>; + + nor@0,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x0 0x0 0x00100000>; + bank-width = <2>; + device-width = <1>; + }; + + led@1,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "led"; + reg = <0x1 0x0 0x00100000>; + }; + + nor@2,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x2 0x0 0x02000000>; + bank-width = <2>; + device-width = <1>; + }; + + nand@3,0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0x3 0x0 0x00100000>; + bank-width = <2>; + device-width = <1>; + }; + }; + + SOC: soc88f6281@f1000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges = <0x0 0xf1000000 0x00100000>; + bus-frequency = <0>; + + PIC: pic@20200 { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x20200 0x3c>; + compatible = "mrvl,pic"; + }; + + timer@20300 { + compatible = "mrvl,timer"; + reg = <0x20300 0x30>; + interrupts = <1>; + interrupt-parent = <&PIC>; + mrvl,has-wdt; + }; + + MPP: mpp@10000 { + #pin-cells = <2>; + compatible = "mrvl,mpp"; + reg = <0x10000 0x34>; + pin-count = <50>; + pin-map = < + 0 1 /* MPP[0]: NF_IO[2] */ + 1 1 /* MPP[1]: NF_IO[3] */ + 2 1 /* MPP[2]: NF_IO[4] */ + 3 1 /* MPP[3]: NF_IO[5] */ + 4 1 /* MPP[4]: NF_IO[6] */ + 5 1 /* MPP[5]: NF_IO[7] */ + 6 1 /* MPP[6]: SYSRST_OUTn */ + 8 2 /* MPP[8]: UA0_RTS */ + 9 2 /* MPP[9]: UA0_CTS */ + 10 3 /* MPP[10]: UA0_TXD */ + 11 3 /* MPP[11]: UA0_RXD */ + 12 1 /* MPP[12]: SD_CLK */ + 13 1 /* MPP[13]: SD_CMD */ + 14 1 /* MPP[14]: SD_D[0] */ + 15 1 /* MPP[15]: SD_D[1] */ + 16 1 /* MPP[16]: SD_D[2] */ + 17 1 /* MPP[17]: SD_D[3] */ + 18 1 /* MPP[18]: NF_IO[0] */ + 19 1 /* MPP[19]: NF_IO[1] */ + 29 1 >; /* MPP[29]: TSMP[9] */ + }; + + GPIO: gpio@10100 { + #gpio-cells = <3>; + compatible = "mrvl,gpio"; + reg = <0x10100 0x20>; + gpio-controller; + interrupts = <35 36 37 38 39 40 41>; + interrupt-parent = <&PIC>; + }; + + rtc@10300 { + compatible = "mrvl,rtc"; + reg = <0x10300 0x08>; + }; + + twsi@11000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mrvl,twsi"; + reg = <0x11000 0x20>; + interrupts = <43>; + interrupt-parent = <&PIC>; + }; + + enet0: ethernet@72000 { + #address-cells = <1>; + #size-cells = <1>; + model = "V2"; + compatible = "mrvl,ge"; + reg = <0x72000 0x2000>; + ranges = <0x0 0x72000 0x2000>; + local-mac-address = [ 00 00 00 00 00 00 ]; + interrupts = <12 13 14 11 46>; + interrupt-parent = <&PIC>; + phy-handle = <&phy0>; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mrvl,mdio"; + + phy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; + }; + + serial0: serial@12000 { + compatible = "ns16550"; + reg = <0x12000 0x20>; + reg-shift = <2>; + clock-frequency = <0>; + interrupts = <33>; + interrupt-parent = <&PIC>; + }; + + serial1: serial@12100 { + compatible = "ns16550"; + reg = <0x12100 0x20>; + reg-shift = <2>; + clock-frequency = <0>; + interrupts = <34>; + interrupt-parent = <&PIC>; + }; + + crypto@30000 { + compatible = "mrvl,cesa"; + reg = <0x30000 0x10000>; + interrupts = <22>; + interrupt-parent = <&PIC>; + }; + + usb@50000 { + compatible = "mrvl,usb-ehci", "usb-ehci"; + reg = <0x50000 0x1000>; + interrupts = <48 19>; + interrupt-parent = <&PIC>; + }; + + xor@60000 { + compatible = "mrvl,xor"; + reg = <0x60000 0x1000>; + interrupts = <5 6 7 8>; + interrupt-parent = <&PIC>; + }; + }; + + SRAM: sram@fd000000 { + compatible = "mrvl,cesa-sram"; + reg = <0xfd000000 0x00100000>; + }; + + chosen { + stdin = "serial0"; + stdout = "serial0"; + }; +}; Modified: user/nwhitehorn/ps3/boot/forth/beastie.4th ============================================================================== --- user/nwhitehorn/ps3/boot/forth/beastie.4th Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/boot/forth/beastie.4th Thu Sep 9 13:38:36 2010 (r212361) @@ -240,7 +240,10 @@ set-current drop 10 else - 0 0 2swap >number drop drop drop + 2dup s" -1" compare 0= if + 0 boot + then + 0 s>d 2swap >number 2drop drop then begin dup tkey Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Sep 9 13:38:36 2010 (r212361) @@ -9218,7 +9218,6 @@ dtrace_difo_init(dtrace_difo_t *dp, dtra dtrace_difo_hold(dp); } -#if defined(sun) static dtrace_difo_t * dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate) { @@ -9262,7 +9261,6 @@ dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_difo_init(new, vstate); return (new); } -#endif static void dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate) @@ -14615,12 +14613,16 @@ dtrace_helpers_create(proc_t *p) } #if defined(sun) -static void -dtrace_helpers_destroy(void) +static +#endif +void +dtrace_helpers_destroy(proc_t *p) { dtrace_helpers_t *help; dtrace_vstate_t *vstate; +#if defined(sun) proc_t *p = curproc; +#endif int i; mutex_enter(&dtrace_lock); @@ -14707,7 +14709,10 @@ dtrace_helpers_destroy(void) mutex_exit(&dtrace_lock); } -static void +#if defined(sun) +static +#endif +void dtrace_helpers_duplicate(proc_t *from, proc_t *to) { dtrace_helpers_t *help, *newhelp; @@ -14788,7 +14793,6 @@ dtrace_helpers_duplicate(proc_t *from, p if (hasprovs) dtrace_helper_provider_register(to, newhelp, NULL); } -#endif #if defined(sun) /* Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 9 13:38:36 2010 (r212361) @@ -456,6 +456,16 @@ fasttrap_fork(proc_t *p, proc_t *cp) #if defined(sun) ASSERT(p->p_dtrace_count > 0); #else + if (p->p_dtrace_helpers) { + /* + * dtrace_helpers_duplicate() allocates memory. + */ + PROC_UNLOCK(p); + PROC_UNLOCK(cp); + dtrace_helpers_duplicate(p, cp); + PROC_LOCK(cp); + PROC_LOCK(p); + } /* * This check is purposely here instead of in kern_fork.c because, * for legal resons, we cannot include the dtrace_cddl.h header @@ -539,6 +549,10 @@ fasttrap_exec_exit(proc_t *p) * static probes are handled by the meta-provider remove entry point. */ fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0); +#if !defined(sun) + if (p->p_dtrace_helpers) + dtrace_helpers_destroy(p); +#endif PROC_LOCK(p); } Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Thu Sep 9 13:38:36 2010 (r212361) @@ -2289,6 +2289,11 @@ extern int dtrace_blksuword32(uintptr_t, extern void dtrace_getfsr(uint64_t *); #endif +#if !defined(sun) +extern void dtrace_helpers_duplicate(proc_t *, proc_t *); +extern void dtrace_helpers_destroy(proc_t *); +#endif + #define DTRACE_CPUFLAG_ISSET(flag) \ (cpu_core[curcpu].cpuc_dtrace_flags & (flag)) Modified: user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c ============================================================================== --- user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c Thu Sep 9 13:38:36 2010 (r212361) @@ -89,6 +89,8 @@ struct hpet_softc { int mode; int intr_rid; int irq; + int pcpu_cpu; + int pcpu_misrouted; int pcpu_master; int pcpu_slaves[MAXCPU]; struct resource *intr_res; @@ -185,7 +187,7 @@ restart: if (fdiv < 5000) { bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); - if ((int32_t)(t->last - cmp) < 0) { + if ((int32_t)(t->last - cmp) >= 0) { fdiv *= 2; goto restart; } @@ -215,6 +217,26 @@ hpet_intr_single(void *arg) struct hpet_softc *sc = t->sc; uint32_t now; + /* Check that per-CPU timer interrupt reached right CPU. */ + if (t->pcpu_cpu >= 0 && t->pcpu_cpu != curcpu) { + if ((++t->pcpu_misrouted) % 32 == 0) { + printf("HPET interrupt routed to the wrong CPU" + " (timer %d CPU %d -> %d)!\n", + t->num, t->pcpu_cpu, curcpu); + } + + /* + * Reload timer, hoping that next time may be more lucky + * (system will manage proper interrupt binding). + */ + if ((t->mode == 1 && (t->caps & HPET_TCAP_PER_INT) == 0) || + t->mode == 2) { + t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), + t->last + sc->freq / 8); + } + return (FILTER_HANDLED); + } if (t->mode == 1 && (t->caps & HPET_TCAP_PER_INT) == 0) { t->last += t->div; @@ -394,6 +416,8 @@ hpet_attach(device_t dev) t->mode = 0; t->intr_rid = -1; t->irq = -1; + t->pcpu_cpu = -1; + t->pcpu_misrouted = 0; t->pcpu_master = -1; t->caps = bus_read_4(sc->mem_res, HPET_TIMER_CAP_CNF(i)); t->vectors = bus_read_4(sc->mem_res, HPET_TIMER_CAP_CNF(i) + 4); @@ -534,6 +558,7 @@ hpet_attach(device_t dev) if (t->irq >= 0 && num_percpu_t > 0) { if (cur_cpu == CPU_FIRST()) pcpu_master = i; + t->pcpu_cpu = cur_cpu; t->pcpu_master = pcpu_master; sc->t[pcpu_master]. pcpu_slaves[cur_cpu] = i; Modified: user/nwhitehorn/ps3/dev/ata/ata-all.h ============================================================================== --- user/nwhitehorn/ps3/dev/ata/ata-all.h Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/ata/ata-all.h Thu Sep 9 13:38:36 2010 (r212361) @@ -566,6 +566,7 @@ struct ata_channel { #define ATA_SATA 0x80 #define ATA_DMA_BEFORE_CMD 0x100 #define ATA_KNOWN_PRESENCE 0x200 +#define ATA_STATUS_IS_LONG 0x400 int pm_level; /* power management level */ int devices; /* what is present */ Modified: user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c Thu Sep 9 13:38:36 2010 (r212361) @@ -516,10 +516,13 @@ ata_generic_reset(device_t dev) if ((mask & 0x01) && (stat0 & ATA_S_BUSY)) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_MASTER)); DELAY(10); + if (ch->flags & ATA_STATUS_IS_LONG) + stat0 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; + else + stat0 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - stat0 = ATA_IDX_INB(ch, ATA_STATUS); if (bootverbose) device_printf(dev, "stat0=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", @@ -546,10 +549,13 @@ ata_generic_reset(device_t dev) !((mask & 0x01) && (stat0 & ATA_S_BUSY))) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_SLAVE)); DELAY(10); + if (ch->flags & ATA_STATUS_IS_LONG) + stat1 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; + else + stat1 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - stat1 = ATA_IDX_INB(ch, ATA_STATUS); if (bootverbose) device_printf(dev, "stat1=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", Modified: user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c Thu Sep 9 13:38:36 2010 (r212361) @@ -58,9 +58,8 @@ static int ata_serverworks_ch_detach(dev static void ata_serverworks_tf_read(struct ata_request *request); static void ata_serverworks_tf_write(struct ata_request *request); static int ata_serverworks_setmode(device_t dev, int target, int mode); -#ifdef __powerpc__ +static void ata_serverworks_sata_reset(device_t dev); static int ata_serverworks_status(device_t dev); -#endif /* misc defines */ #define SWKS_33 0 @@ -101,7 +100,6 @@ ata_serverworks_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -#ifdef __powerpc__ static int ata_serverworks_status(device_t dev) { @@ -123,7 +121,6 @@ ata_serverworks_status(device_t dev) return ata_pci_status(dev); } -#endif static int ata_serverworks_chipinit(device_t dev) @@ -145,6 +142,7 @@ ata_serverworks_chipinit(device_t dev) ctlr->ch_detach = ata_serverworks_ch_detach; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; + ctlr->reset = ata_serverworks_sata_reset; return 0; } else if (ctlr->chip->cfg1 == SWKS_33) { @@ -210,30 +208,20 @@ ata_serverworks_ch_attach(device_t dev) ch->r_io[ATA_SERROR].offset = ch_offset + 0x44; ch->r_io[ATA_SCONTROL].offset = ch_offset + 0x48; - ch->flags |= ATA_NO_SLAVE; - ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE | ATA_SATA | ATA_KNOWN_PRESENCE; ata_pci_hw(dev); ch->hw.tf_read = ata_serverworks_tf_read; ch->hw.tf_write = ata_serverworks_tf_write; -#ifdef __powerpc__ - ch->hw.status = ata_serverworks_status; -#endif if (ctlr->chip->chipid == ATA_K2) { /* - * The revision 1 K2 SATA controller has interesting bugs. Patch them. - * These magic numbers regulate interrupt delivery in the first few - * cases and are pure magic in the last case. - * - * Values obtained from the Darwin driver. + * Set SICR registers to turn off waiting for a status message + * before sending FIS. Values obtained from the Darwin driver. */ - ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, 0x04); - ATA_IDX_OUTL(ch, ATA_SERROR, 0xffffffff); - ATA_IDX_OUTL(ch, ATA_SCONTROL, 0x00000300); - ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); ATA_OUTL(ctlr->r_res2, ch_offset + 0x80, ATA_INL(ctlr->r_res2, ch_offset + 0x80) & ~0x00040000); + ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); /* * Some controllers have a bug where they will send the command @@ -244,6 +232,14 @@ ata_serverworks_ch_attach(device_t dev) */ ch->flags |= ATA_DMA_BEFORE_CMD; + + /* + * The status register must be read as a long to fill the other + * registers. + */ + + ch->hw.status = ata_serverworks_status; + ch->flags |= ATA_STATUS_IS_LONG; } /* chip does not reliably do 64K DMA transfers */ @@ -404,4 +400,15 @@ ata_serverworks_setmode(device_t dev, in return (mode); } +static void +ata_serverworks_sata_reset(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_sata_phy_reset(dev, -1, 1)) + ata_generic_reset(dev); + else + ch->devices = 0; +} + ATA_DECLARE_DRIVER(ata_serverworks); Modified: user/nwhitehorn/ps3/dev/atkbdc/psm.c ============================================================================== --- user/nwhitehorn/ps3/dev/atkbdc/psm.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/atkbdc/psm.c Thu Sep 9 13:38:36 2010 (r212361) @@ -143,11 +143,6 @@ __FBSDID("$FreeBSD$"); #define MOUSE_PS2PLUS_PACKET_TYPE(b) \ (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4)) -/* some macros */ -#define PSM_UNIT(dev) (dev2unit(dev) >> 1) -#define PSM_NBLOCKIO(dev) (dev2unit(dev) & 1) -#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1)) - /* ring buffer */ typedef struct ringbuf { int count; /* # of valid elements in the buffer */ @@ -305,8 +300,6 @@ struct psm_softc { /* Driver status inf struct sigio *async; /* Processes waiting for SIGIO */ }; static devclass_t psm_devclass; -#define PSM_SOFTC(unit) \ - ((struct psm_softc*)devclass_get_softc(psm_devclass, unit)) /* driver state flags (state) */ #define PSM_VALID 0x80 @@ -1457,10 +1450,10 @@ psmattach(device_t dev) } /* Done */ - sc->dev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, - "psm%d", unit); - sc->bdev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, - "bpsm%d", unit); + sc->dev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "psm%d", unit); + sc->dev->si_drv1 = sc; + sc->bdev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "bpsm%d", unit); + sc->bdev->si_drv1 = sc; if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1504,14 +1497,13 @@ psmdetach(device_t dev) static int psmopen(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit = PSM_UNIT(dev); struct psm_softc *sc; int command_byte; int err; int s; /* Get device data */ - sc = PSM_SOFTC(unit); + sc = dev->si_drv1; if ((sc == NULL) || (sc->state & PSM_VALID) == 0) { /* the device is no longer valid/functioning */ return (ENXIO); @@ -1521,7 +1513,7 @@ psmopen(struct cdev *dev, int flag, int if (sc->state & PSM_OPEN) return (EBUSY); - device_busy(devclass_get_device(psm_devclass, unit)); + device_busy(devclass_get_device(psm_devclass, sc->unit)); /* Initialize state */ sc->mode.level = sc->dflt_mode.level; @@ -1565,7 +1557,8 @@ psmopen(struct cdev *dev, int flag, int kbdc_lock(sc->kbdc, FALSE); splx(s); log(LOG_ERR, - "psm%d: unable to set the command byte (psmopen).\n", unit); + "psm%d: unable to set the command byte (psmopen).\n", + sc->unit); return (EIO); } /* @@ -1590,8 +1583,7 @@ psmopen(struct cdev *dev, int flag, int static int psmclose(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit = PSM_UNIT(dev); - struct psm_softc *sc = PSM_SOFTC(unit); + struct psm_softc *sc = dev->si_drv1; int stat[3]; int command_byte; int s; @@ -1615,7 +1607,8 @@ psmclose(struct cdev *dev, int flag, int KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_ENABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { log(LOG_ERR, - "psm%d: failed to disable the aux int (psmclose).\n", unit); + "psm%d: failed to disable the aux int (psmclose).\n", + sc->unit); /* CONTROLLER ERROR; * NOTE: we shall force our way through. Because the only * ill effect we shall see is that we may not be able @@ -1643,12 +1636,13 @@ psmclose(struct cdev *dev, int flag, int */ log(LOG_ERR, "psm%d: failed to disable the device (psmclose).\n", - unit); + sc->unit); } if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) log(LOG_DEBUG, - "psm%d: failed to get status (psmclose).\n", unit); + "psm%d: failed to get status (psmclose).\n", + sc->unit); } if (!set_controller_command_byte(sc->kbdc, @@ -1661,7 +1655,7 @@ psmclose(struct cdev *dev, int flag, int */ log(LOG_ERR, "psm%d: failed to disable the aux port (psmclose).\n", - unit); + sc->unit); } /* remove anything left in the output buffer */ @@ -1676,7 +1670,7 @@ psmclose(struct cdev *dev, int flag, int /* close is almost always successful */ sc->state &= ~PSM_OPEN; kbdc_lock(sc->kbdc, FALSE); - device_unbusy(devclass_get_device(psm_devclass, unit)); + device_unbusy(devclass_get_device(psm_devclass, sc->unit)); return (0); } @@ -1745,7 +1739,7 @@ tame_mouse(struct psm_softc *sc, packetb static int psmread(struct cdev *dev, struct uio *uio, int flag) { - register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; u_char buf[PSM_SMALLBUFSIZE]; int error = 0; int s; @@ -1757,7 +1751,7 @@ psmread(struct cdev *dev, struct uio *ui /* block until mouse activity occured */ s = spltty(); while (sc->queue.count <= 0) { - if (PSM_NBLOCKIO(dev)) { + if (dev != sc->bdev) { splx(s); return (EWOULDBLOCK); } @@ -1892,7 +1886,7 @@ unblock_mouse_data(struct psm_softc *sc, static int psmwrite(struct cdev *dev, struct uio *uio, int flag) { - register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; u_char buf[PSM_SMALLBUFSIZE]; int error = 0, i, l; @@ -1925,7 +1919,7 @@ static int psmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { - struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; mousemode_t mode; mousestatus_t status; #if (defined(MOUSE_GETVARS)) @@ -3270,7 +3264,7 @@ psmsoftintr(void *arg) MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN, MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN }; - register struct psm_softc *sc = arg; + struct psm_softc *sc = arg; mousestatus_t ms; packetbuf_t *pb; int x, y, z, c, l, s; @@ -3519,7 +3513,7 @@ next: static int psmpoll(struct cdev *dev, int events, struct thread *td) { - struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; int s; int revents = 0; Modified: user/nwhitehorn/ps3/dev/bge/if_bge.c ============================================================================== --- user/nwhitehorn/ps3/dev/bge/if_bge.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/bge/if_bge.c Thu Sep 9 13:38:36 2010 (r212361) @@ -2258,6 +2258,15 @@ bge_dma_alloc(struct bge_softc *sc) if (error) return (error); + /* Create tag for statistics block. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_STATS_SZ, + &sc->bge_cdata.bge_stats_tag, + (uint8_t **)&sc->bge_ldata.bge_stats, + &sc->bge_cdata.bge_stats_map, + &sc->bge_ldata.bge_stats_paddr, "statistics block"); + if (error) + return (error); + /* Create tag for jumbo RX ring. */ if (BGE_IS_JUMBO_CAPABLE(sc)) { error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_JUMBO_RX_RING_SZ, Modified: user/nwhitehorn/ps3/dev/e1000/if_em.c ============================================================================== --- user/nwhitehorn/ps3/dev/e1000/if_em.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/e1000/if_em.c Thu Sep 9 13:38:36 2010 (r212361) @@ -93,7 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.0.5"; +char em_driver_version[] = "7.0.6"; /********************************************************************* @@ -281,6 +281,8 @@ static void em_handle_link(void *context static void em_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); +static __inline void em_rx_discard(struct rx_ring *, int); + #ifdef DEVICE_POLLING static poll_handler_t em_poll; #endif /* POLLING */ @@ -2563,11 +2565,11 @@ msi: val = pci_msi_count(dev); if (val == 1 && pci_alloc_msi(dev, &val) == 0) { adapter->msix = 1; - device_printf(adapter->dev,"Using MSI interrupt\n"); + device_printf(adapter->dev,"Using an MSI interrupt\n"); return (val); } - /* Should only happen due to manual invention */ - device_printf(adapter->dev,"Setup MSIX failure\n"); + /* Should only happen due to manual configuration */ + device_printf(adapter->dev,"No MSI/MSIX using a Legacy IRQ\n"); return (0); } @@ -3681,14 +3683,27 @@ em_refresh_mbufs(struct rx_ring *rxr, in struct adapter *adapter = rxr->adapter; struct mbuf *m; bus_dma_segment_t segs[1]; - bus_dmamap_t map; struct em_buffer *rxbuf; int i, error, nsegs, cleaned; i = rxr->next_to_refresh; cleaned = -1; while (i != limit) { + rxbuf = &rxr->rx_buffers[i]; + /* + ** Just skip entries with a buffer, + ** they can only be due to an error + ** and are to be reused. + */ + if (rxbuf->m_head != NULL) + goto reuse; m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + /* + ** If we have a temporary resource shortage + ** that causes a failure, just abort refresh + ** for now, we will return to this point when + ** reinvoked from em_rxeof. + */ if (m == NULL) goto update; m->m_len = m->m_pkthdr.len = MCLBYTES; @@ -3696,11 +3711,8 @@ em_refresh_mbufs(struct rx_ring *rxr, in if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) m_adj(m, ETHER_ALIGN); - /* - * Using memory from the mbuf cluster pool, invoke the - * bus_dma machinery to arrange the memory mapping. - */ - error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxr->rx_sparemap, + /* Use bus_dma machinery to setup the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { m_free(m); @@ -3710,18 +3722,11 @@ em_refresh_mbufs(struct rx_ring *rxr, in /* If nsegs is wrong then the stack is corrupt. */ KASSERT(nsegs == 1, ("Too many segments returned!")); - rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) - bus_dmamap_unload(rxr->rxtag, rxbuf->map); - - map = rxbuf->map; - rxbuf->map = rxr->rx_sparemap; - rxr->rx_sparemap = map; bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); rxbuf->m_head = m; rxr->rx_base[i].buffer_addr = htole64(segs[0].ds_addr); - +reuse: cleaned = i; /* Calculate next index */ if (++i == adapter->num_rx_desc) @@ -3730,8 +3735,10 @@ em_refresh_mbufs(struct rx_ring *rxr, in rxr->next_to_refresh = i; } update: - bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* + ** Update the tail pointer only if, + ** and as far as we have refreshed. + */ if (cleaned != -1) /* Update tail index */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), cleaned); @@ -3781,15 +3788,6 @@ em_allocate_receive_buffers(struct rx_ri goto fail; } - /* Create the spare map (used by getbuf) */ - error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT, - &rxr->rx_sparemap); - if (error) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, error); - goto fail; - } - rxbuf = rxr->rx_buffers; for (int i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; @@ -3956,11 +3954,6 @@ em_free_receive_buffers(struct rx_ring * INIT_DEBUGOUT("free_receive_buffers: begin"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009091338.o89DcaZt088137>