Date: Fri, 19 Mar 2004 17:34:58 -0800 (PST) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 49325 for review Message-ID: <200403200134.i2K1YwZN042937@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49325 Change 49325 by peter@peter_overcee on 2004/03/19 17:34:33 IFC @49308 Affected files ... .. //depot/projects/hammer/Makefile.inc1#46 integrate .. //depot/projects/hammer/lib/libc/stdio/fgetc.c#3 integrate .. //depot/projects/hammer/lib/libc/stdio/fputc.c#4 integrate .. //depot/projects/hammer/lib/libc/stdio/getc.c#4 integrate .. //depot/projects/hammer/lib/libc/stdio/getchar.c#4 integrate .. //depot/projects/hammer/lib/libc/stdio/putc.c#4 integrate .. //depot/projects/hammer/lib/libc/stdio/putchar.c#4 integrate .. //depot/projects/hammer/lib/libc/sys/select.2#7 integrate .. //depot/projects/hammer/sys/amd64/conf/GENERIC.hints#9 integrate .. //depot/projects/hammer/sys/conf/files#50 integrate .. //depot/projects/hammer/sys/conf/kern.pre.mk#21 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi.c#27 integrate .. //depot/projects/hammer/sys/dev/ips/ips.h#7 integrate .. //depot/projects/hammer/sys/dev/ips/ips_pci.c#9 integrate .. //depot/projects/hammer/sys/dev/md/md.c#27 integrate .. //depot/projects/hammer/sys/dev/usb/ehci.c#5 integrate .. //depot/projects/hammer/sys/dev/usb/ehcireg.h#2 integrate .. //depot/projects/hammer/sys/dev/usb/usb_subr.c#7 integrate .. //depot/projects/hammer/sys/dev/vinum/vinumobj.h#4 integrate .. //depot/projects/hammer/sys/dev/vinum/vinumrequest.c#12 integrate .. //depot/projects/hammer/sys/dev/vinum/vinumvar.h#6 integrate .. //depot/projects/hammer/sys/netatalk/ddp_pcb.c#1 branch .. //depot/projects/hammer/sys/netatalk/ddp_pcb.h#1 branch .. //depot/projects/hammer/sys/netatalk/ddp_usrreq.c#8 integrate .. //depot/projects/hammer/sys/pci/if_xl.c#33 integrate .. //depot/projects/hammer/sys/sys/tree.h#2 integrate Differences ... ==== //depot/projects/hammer/Makefile.inc1#46 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: src/Makefile.inc1,v 1.418 2004/03/18 10:17:03 ru Exp $ +# $FreeBSD: src/Makefile.inc1,v 1.420 2004/03/19 17:57:07 ru Exp $ # # Make command line options: # -DNO_DYNAMICROOT do not link /bin and /sbin dynamically @@ -257,7 +257,8 @@ .endfor .for _dir in \ lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ - usr/libexec usr/share/misc usr/share/bsnmp/defs usr/share/bsnmp/mibs + usr/libexec usr/sbin usr/share/misc \ + usr/share/bsnmp/defs usr/share/bsnmp/mibs mkdir -p ${WORLDTMP}/${_dir} .endfor mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ @@ -324,7 +325,7 @@ everything: @echo @echo "--------------------------------------------------------------" - @echo ">>> stage 4.4: building everything.." + @echo ">>> stage 4.4: building everything" @echo "--------------------------------------------------------------" cd ${.CURDIR}; ${WMAKE} par-all @@ -465,13 +466,13 @@ cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy @echo @echo "--------------------------------------------------------------" - @echo ">>> Installing everything.." + @echo ">>> Installing everything" @echo "--------------------------------------------------------------" cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install redistribute: @echo "--------------------------------------------------------------" - @echo ">>> Distributing everything.." + @echo ">>> Distributing everything" @echo "--------------------------------------------------------------" cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute ==== //depot/projects/hammer/lib/libc/stdio/fgetc.c#3 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)fgetc.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetc.c,v 1.11 2002/08/13 09:30:41 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetc.c,v 1.12 2004/03/19 09:04:56 tjr Exp $"); #include "namespace.h" #include <stdio.h> @@ -52,7 +52,8 @@ { int retval; FLOCKFILE(fp); - ORIENT(fp, -1); + /* Orientation set by __sgetc() when buffer is empty. */ + /* ORIENT(fp, -1); */ retval = __sgetc(fp); FUNLOCKFILE(fp); return (retval); ==== //depot/projects/hammer/lib/libc/stdio/fputc.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)fputc.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/fputc.c,v 1.12 2004/03/10 10:49:45 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/fputc.c,v 1.13 2004/03/19 09:04:56 tjr Exp $"); #include "namespace.h" #include <stdio.h> @@ -53,7 +53,8 @@ { int retval; FLOCKFILE(fp); - ORIENT(fp, -1); + /* Orientation set by __sputc() when buffer is full. */ + /* ORIENT(fp, -1); */ retval = __sputc(c, fp); FUNLOCKFILE(fp); return (retval); ==== //depot/projects/hammer/lib/libc/stdio/getc.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)getc.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/getc.c,v 1.12 2004/03/17 01:43:07 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/getc.c,v 1.13 2004/03/19 09:04:56 tjr Exp $"); #include "namespace.h" #include <stdio.h> @@ -53,7 +53,8 @@ { int retval; FLOCKFILE(fp); - ORIENT(fp, -1); + /* Orientation set by __sgetc() when buffer is empty. */ + /* ORIENT(fp, -1); */ retval = __sgetc(fp); FUNLOCKFILE(fp); return (retval); ==== //depot/projects/hammer/lib/libc/stdio/getchar.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)getchar.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/getchar.c,v 1.11 2004/03/10 10:24:15 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/getchar.c,v 1.12 2004/03/19 09:04:56 tjr Exp $"); /* * A subroutine version of the macro getchar. @@ -56,7 +56,8 @@ { int retval; FLOCKFILE(stdin); - ORIENT(stdin, -1); + /* Orientation set by __sgetc() when buffer is empty. */ + /* ORIENT(stdin, -1); */ retval = __sgetc(stdin); FUNLOCKFILE(stdin); return (retval); ==== //depot/projects/hammer/lib/libc/stdio/putc.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)putc.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/putc.c,v 1.12 2004/03/17 01:43:07 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/putc.c,v 1.13 2004/03/19 09:04:56 tjr Exp $"); #include "namespace.h" #include <stdio.h> @@ -55,7 +55,8 @@ { int retval; FLOCKFILE(fp); - ORIENT(fp, -1); + /* Orientation set by __sputc() when buffer is full. */ + /* ORIENT(fp, -1); */ retval = __sputc(c, fp); FUNLOCKFILE(fp); return (retval); ==== //depot/projects/hammer/lib/libc/stdio/putchar.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)putchar.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/putchar.c,v 1.12 2004/03/17 01:43:08 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/putchar.c,v 1.13 2004/03/19 09:04:56 tjr Exp $"); #include "namespace.h" #include <stdio.h> @@ -59,7 +59,8 @@ FILE *so = stdout; FLOCKFILE(so); - ORIENT(so, -1); + /* Orientation set by __sputc() when buffer is full. */ + /* ORIENT(so, -1); */ retval = __sputc(c, so); FUNLOCKFILE(so); return (retval); ==== //depot/projects/hammer/lib/libc/sys/select.2#7 (text+ko) ==== @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)select.2 8.2 (Berkeley) 3/25/94 -.\" $FreeBSD: src/lib/libc/sys/select.2,v 1.27 2004/03/03 14:51:11 dds Exp $ +.\" $FreeBSD: src/lib/libc/sys/select.2,v 1.28 2004/03/19 16:04:11 dds Exp $ .\" .Dd November 17, 2002 .Dt SELECT 2 @@ -150,9 +150,7 @@ One of the descriptor sets specified an invalid descriptor. .It Bq Er EFAULT One of the arguments -.Fa readfds , -.Fa writefds , -.Fa exceptfds , +.Fa readfds , writefds , exceptfds , or .Fa timeout points to an invalid address. ==== //depot/projects/hammer/sys/amd64/conf/GENERIC.hints#9 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/amd64/conf/GENERIC.hints,v 1.13 2004/03/18 00:18:45 obrien Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC.hints,v 1.14 2004/03/19 03:28:38 obrien Exp $ hint.fdc.0.at="isa" hint.fdc.0.port="0x3F0" hint.fdc.0.irq="6" ==== //depot/projects/hammer/sys/conf/files#50 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.875 2004/03/16 12:23:38 scottl Exp $ +# $FreeBSD: src/sys/conf/files,v 1.876 2004/03/19 07:21:22 rwatson Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -1237,6 +1237,7 @@ netatalk/at_rmx.c optional netatalkdebug netatalk/ddp_input.c optional netatalk netatalk/ddp_output.c optional netatalk +netatalk/ddp_pcb.c optional netatalk netatalk/ddp_usrreq.c optional netatalk netatm/atm_aal5.c optional atm_core netatm/atm_cm.c optional atm_core ==== //depot/projects/hammer/sys/conf/kern.pre.mk#21 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.45 2004/03/18 18:05:08 obrien Exp $ +# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.47 2004/03/19 17:40:45 obrien Exp $ # Part of a unified Makefile for building kernels. This part contains all # of the definitions that need to be before %BEFORE_DEPEND. @@ -18,10 +18,12 @@ .if ${CC} == "icc" COPTFLAGS?=-O -.elif ${MACHINE_ARCH} == "amd64" -COPTFLAGS?=-O2 -fno-strict-aliasing -frename-registers -pipe .else +. if ${MACHINE_ARCH} == "amd64" +COPTFLAGS?=-O2 -frename-registers -pipe +. else COPTFLAGS?=-O -pipe +. endif . if ${COPTFLAGS:M-O[23s]} != "" COPTFLAGS+= -fno-strict-aliasing . endif ==== //depot/projects/hammer/sys/dev/acpica/acpi.c#27 (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.127 2004/03/18 18:42:22 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.128 2004/03/19 07:05:01 njl Exp $ */ #include "opt_acpi.h" @@ -44,6 +44,7 @@ #include <sys/linker.h> #include <sys/power.h> #include <sys/sbuf.h> +#include <sys/smp.h> #include <machine/clock.h> #include <machine/resource.h> @@ -132,6 +133,7 @@ void *context, void **status); static void acpi_shutdown_pre_sync(void *arg, int howto); static void acpi_shutdown_final(void *arg, int howto); +static void acpi_shutdown_poweroff(void *arg); static void acpi_enable_fixed_events(struct acpi_softc *sc); static void acpi_system_eventhandler_sleep(void *arg, int state); static void acpi_system_eventhandler_wakeup(void *arg, int state); @@ -1177,26 +1179,17 @@ static void acpi_shutdown_final(void *arg, int howto) { - ACPI_STATUS status; ACPI_ASSERTLOCK; + /* + * If powering off, run the actual shutdown code on each processor. + * It will only perform the shutdown on the BSP. Some chipsets do + * not power off the system correctly if called from an AP. + */ if ((howto & RB_POWEROFF) != 0) { printf("Powering system off using ACPI\n"); - status = AcpiEnterSleepStatePrep(acpi_off_state); - if (ACPI_FAILURE(status)) { - printf("AcpiEnterSleepStatePrep failed - %s\n", - AcpiFormatException(status)); - return; - } - ACPI_DISABLE_IRQS(); - status = AcpiEnterSleepState(acpi_off_state); - if (ACPI_FAILURE(status)) { - printf("ACPI power-off failed - %s\n", AcpiFormatException(status)); - } else { - DELAY(1000000); - printf("ACPI power-off failed - timeout\n"); - } + smp_rendezvous(NULL, acpi_shutdown_poweroff, NULL, NULL); } else { printf("Shutting down ACPI\n"); AcpiTerminate(); @@ -1204,6 +1197,33 @@ } static void +acpi_shutdown_poweroff(void *arg) +{ + ACPI_STATUS status; + + ACPI_ASSERTLOCK; + + /* Only attempt to power off if this is the BSP (cpuid 0). */ + if (PCPU_GET(cpuid) != 0) + return; + + status = AcpiEnterSleepStatePrep(acpi_off_state); + if (ACPI_FAILURE(status)) { + printf("AcpiEnterSleepStatePrep failed - %s\n", + AcpiFormatException(status)); + return; + } + ACPI_DISABLE_IRQS(); + status = AcpiEnterSleepState(acpi_off_state); + if (ACPI_FAILURE(status)) { + printf("ACPI power-off failed - %s\n", AcpiFormatException(status)); + } else { + DELAY(1000000); + printf("ACPI power-off failed - timeout\n"); + } +} + +static void acpi_enable_fixed_events(struct acpi_softc *sc) { static int first_time = 1; ==== //depot/projects/hammer/sys/dev/ips/ips.h#7 (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/ips/ips.h,v 1.6 2004/02/28 19:14:41 scottl Exp $ + * $FreeBSD: src/sys/dev/ips/ips.h,v 1.7 2004/03/19 17:36:47 scottl Exp $ */ @@ -54,8 +54,10 @@ * IPS CONSTANTS */ #define IPS_VENDOR_ID 0x1014 +#define IPS_VENDOR_ID_ADAPTEC 0x9005 #define IPS_MORPHEUS_DEVICE_ID 0x01BD #define IPS_COPPERHEAD_DEVICE_ID 0x002E +#define IPS_MARCO_DEVICE_ID 0x0950 #define IPS_CSL 0xff #define IPS_POCL 0x30 ==== //depot/projects/hammer/sys/dev/ips/ips_pci.c#9 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ips/ips_pci.c,v 1.9 2004/03/17 17:50:35 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ips/ips_pci.c,v 1.10 2004/03/19 17:36:47 scottl Exp $"); #include <dev/ips/ips.h> @@ -45,7 +45,11 @@ (pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID)) { device_set_desc(dev, "IBM ServeRAID Adapter"); return (0); - } + } else if ((pci_get_vendor(dev) == IPS_VENDOR_ID_ADAPTEC) && + (pci_get_device(dev) == IPS_MARCO_DEVICE_ID)) { + device_set_desc(dev, "Adaptec ServeRAID Adapter"); + return (0); + } return(ENXIO); } @@ -77,6 +81,10 @@ sc->ips_adapter_reinit = ips_copperhead_reinit; sc->ips_adapter_intr = ips_copperhead_intr; sc->ips_issue_cmd = ips_issue_copperhead_cmd; + } else if (pci_get_device(dev) == IPS_MARCO_DEVICE_ID){ + sc->ips_adapter_reinit = ips_morpheus_reinit; + sc->ips_adapter_intr = ips_morpheus_intr; + sc->ips_issue_cmd = ips_issue_morpheus_cmd; } else goto error; /* make sure busmastering is on */ @@ -87,10 +95,10 @@ sc->iores = NULL; if(command & PCIM_CMD_MEMEN){ PRINTF(10, "trying MEMIO\n"); - if(pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID) - sc->rid = PCIR_BAR(0); + if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID) + sc->rid = PCIR_BAR(1); else - sc->rid = PCIR_BAR(1); + sc->rid = PCIR_BAR(0); sc->iotype = SYS_RES_MEMORY; sc->iores = bus_alloc_resource_any(dev, sc->iotype, &sc->rid, RF_ACTIVE); ==== //depot/projects/hammer/sys/dev/md/md.c#27 (text+ko) ==== @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $FreeBSD: src/sys/dev/md/md.c,v 1.117 2004/03/18 18:23:37 alc Exp $ + * $FreeBSD: src/sys/dev/md/md.c,v 1.118 2004/03/19 21:19:15 alc Exp $ * */ @@ -517,92 +517,78 @@ return (error); } -#include <vm/vm_extern.h> -#include <vm/vm_kern.h> - static int mdstart_swap(struct md_s *sc, struct bio *bp) { - { - struct sf_buf *sf; - int i, rv; - int offs, len, lastp, lastend; - vm_page_t m; - u_char *p; + struct sf_buf *sf; + int i, rv; + int offs, len, lastp, lastend; + vm_page_t m; + u_char *p; + + p = bp->bio_data; - p = bp->bio_data; + /* + * offs is the ofset at whih to start operating on the + * next (ie, first) page. lastp is the last page on + * which we're going to operate. lastend is the ending + * position within that last page (ie, PAGE_SIZE if + * we're operating on complete aligned pages). + */ + offs = bp->bio_offset % PAGE_SIZE; + lastp = (bp->bio_offset + bp->bio_length - 1) / PAGE_SIZE; + lastend = (bp->bio_offset + bp->bio_length - 1) % PAGE_SIZE + 1; - /* - * offs is the ofset at whih to start operating on the - * next (ie, first) page. lastp is the last page on - * which we're going to operate. lastend is the ending - * position within that last page (ie, PAGE_SIZE if - * we're operating on complete aligned pages). - */ - offs = bp->bio_offset % PAGE_SIZE; - lastp = (bp->bio_offset + bp->bio_length - 1) / PAGE_SIZE; - lastend = (bp->bio_offset + bp->bio_length - 1) % PAGE_SIZE + 1; + VM_OBJECT_LOCK(sc->object); + vm_object_pip_add(sc->object, 1); + for (i = bp->bio_offset / PAGE_SIZE; i <= lastp; i++) { + len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; + m = vm_page_grab(sc->object, i, + VM_ALLOC_NORMAL|VM_ALLOC_RETRY); + VM_OBJECT_UNLOCK(sc->object); + sf = sf_buf_alloc(m); VM_OBJECT_LOCK(sc->object); - vm_object_pip_add(sc->object, 1); - for (i = bp->bio_offset / PAGE_SIZE; i <= lastp; i++) { - len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; - - m = vm_page_grab(sc->object, i, - VM_ALLOC_NORMAL|VM_ALLOC_RETRY); - VM_OBJECT_UNLOCK(sc->object); - sf = sf_buf_alloc(m); - VM_OBJECT_LOCK(sc->object); - if (bp->bio_cmd == BIO_READ) { - if (m->valid != VM_PAGE_BITS_ALL) { - rv = vm_pager_get_pages(sc->object, - &m, 1, 0); - } - bcopy((void *)(sf_buf_kva(sf) + offs), p, len); - } else if (bp->bio_cmd == BIO_WRITE) { - if (len != PAGE_SIZE && m->valid != - VM_PAGE_BITS_ALL) { - rv = vm_pager_get_pages(sc->object, - &m, 1, 0); - } - bcopy(p, (void *)(sf_buf_kva(sf) + offs), len); - m->valid = VM_PAGE_BITS_ALL; + if (bp->bio_cmd == BIO_READ) { + if (m->valid != VM_PAGE_BITS_ALL) + rv = vm_pager_get_pages(sc->object, &m, 1, 0); + bcopy((void *)(sf_buf_kva(sf) + offs), p, len); + } else if (bp->bio_cmd == BIO_WRITE) { + if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL) + rv = vm_pager_get_pages(sc->object, &m, 1, 0); + bcopy(p, (void *)(sf_buf_kva(sf) + offs), len); + m->valid = VM_PAGE_BITS_ALL; #if 0 - } else if (bp->bio_cmd == BIO_DELETE) { - if (len != PAGE_SIZE && m->valid != - VM_PAGE_BITS_ALL) { - rv = vm_pager_get_pages(sc->object, - &m, 1, 0); - } - bzero((void *)(sf_buf_kva(sf) + offs), len); - vm_page_dirty(m); - m->valid = VM_PAGE_BITS_ALL; + } else if (bp->bio_cmd == BIO_DELETE) { + if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL) + rv = vm_pager_get_pages(sc->object, &m, 1, 0); + bzero((void *)(sf_buf_kva(sf) + offs), len); + vm_page_dirty(m); + m->valid = VM_PAGE_BITS_ALL; #endif - } - sf_buf_free(sf); - vm_page_lock_queues(); - vm_page_wakeup(m); - vm_page_activate(m); - if (bp->bio_cmd == BIO_WRITE) { - vm_page_dirty(m); - } - vm_page_unlock_queues(); + } + sf_buf_free(sf); + vm_page_lock_queues(); + vm_page_wakeup(m); + vm_page_activate(m); + if (bp->bio_cmd == BIO_WRITE) + vm_page_dirty(m); + vm_page_unlock_queues(); - /* Actions on further pages start at offset 0 */ - p += PAGE_SIZE - offs; - offs = 0; + /* Actions on further pages start at offset 0 */ + p += PAGE_SIZE - offs; + offs = 0; #if 0 if (bootverbose || bp->bio_offset / PAGE_SIZE < 17) printf("wire_count %d busy %d flags %x hold_count %d act_count %d queue %d valid %d dirty %d @ %d\n", m->wire_count, m->busy, m->flags, m->hold_count, m->act_count, m->queue, m->valid, m->dirty, i); #endif - } - vm_object_pip_subtract(sc->object, 1); - vm_object_set_writeable_dirty(sc->object); - VM_OBJECT_UNLOCK(sc->object); - return (0); } + vm_object_pip_subtract(sc->object, 1); + vm_object_set_writeable_dirty(sc->object); + VM_OBJECT_UNLOCK(sc->object); + return (0); } static void ==== //depot/projects/hammer/sys/dev/usb/ehci.c#5 (text+ko) ==== @@ -2,6 +2,7 @@ /* Also ported from NetBSD: * $NetBSD: ehci.c,v 1.50 2003/10/18 04:50:35 simonb Exp $ + * $NetBSD: ehci.c,v 1.54 2004/01/17 13:15:05 jdolecek Exp $ */ /* @@ -10,7 +11,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/usb/ehci.c,v 1.5 2003/11/10 00:20:52 joe Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/ehci.c,v 1.6 2004/03/19 07:14:23 julian Exp $"); /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -58,6 +59,28 @@ * */ +/* + * TODO: + * 1) hold off explorations by companion controllers until ehci has started. + * + * 2) The EHCI driver lacks support for interrupt isochronous transfers, so + * devices using them don't work. + * Interrupt transfers are not difficult, it's just not done. + * + * 3) There might also be some issues with the data toggle, it was not + * completely tested to work properly under all condistions. If wrong + * toggle would be sent/recvd, bulk data transfers would stop working. + * + * 4) The meaty part to implement is the support for USB 2.0 hubs. + * They are quite compolicated since the need to be able to do + * "transaction translation", i.e., converting to/from USB 2 and USB 1. + * So the hub driver needs to handle and schedule these things, to + * assign place in frame where different devices get to go. See chapter + * on hubs in USB 2.0 for details. + * + * 5) command failures are not recovered correctly +*/ + #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -99,6 +122,7 @@ #endif #ifdef USB_DEBUG +#define EHCI_DEBUG USB_DEBUG #define DPRINTF(x) if (ehcidebug) logprintf x #define DPRINTFN(n,x) if (ehcidebug>(n)) logprintf x int ehcidebug = 0; @@ -226,7 +250,7 @@ Static void ehci_close_pipe(usbd_pipe_handle, ehci_soft_qh_t *); Static void ehci_abort_xfer(usbd_xfer_handle, usbd_status); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG Static void ehci_dump_regs(ehci_softc_t *); void ehci_dump(void); Static ehci_softc_t *theehci; @@ -326,7 +350,7 @@ ehci_soft_qh_t *sqh; DPRINTF(("ehci_init: start\n")); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG theehci = sc; #endif @@ -424,7 +448,7 @@ sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL; sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED); sqh->sqtd = NULL; -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug) { ehci_dump_sqh(sqh); } @@ -617,7 +641,7 @@ ehci_softintr(void *v) { ehci_softc_t *sc = v; - struct ehci_xfer *ex; + struct ehci_xfer *ex, *nextex; DPRINTFN(10,("%s: ehci_softintr (%d)\n", USBDEVNAME(sc->sc_bus.bdev), sc->sc_bus.intr_context)); @@ -630,8 +654,10 @@ * An interrupt just tells us that something is done, we have no * clue what, so we need to scan through all active transfers. :-( */ - for (ex = LIST_FIRST(&sc->sc_intrhead); ex; ex = LIST_NEXT(ex, inext)) + for (ex = LIST_FIRST(&sc->sc_intrhead); ex; ex = nextex) { + nextex = LIST_NEXT(ex, inext); ehci_check_intr(sc, ex); + } #ifdef USB_USE_SOFTINTR if (sc->sc_softwake) { @@ -696,7 +722,7 @@ ehci_idone(struct ehci_xfer *ex) { usbd_xfer_handle xfer = &ex->xfer; -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe; #endif ehci_soft_qtd_t *sqtd; @@ -709,7 +735,7 @@ int s = splhigh(); if (ex->isdone) { splx(s); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG printf("ehci_idone: ex is done!\n "); ehci_dump_exfer(ex); #else @@ -728,7 +754,7 @@ return; } -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG DPRINTFN(/*10*/2, ("ehci_idone: xfer=%p, pipe=%p ready\n", xfer, epipe)); if (ehcidebug > 10) ehci_dump_sqtds(ex->sqtdstart); @@ -742,6 +768,10 @@ break; status = nstatus; + /* halt is ok if descriptor is last, and complete */ + if (sqtd->qtd.qtd_next == EHCI_NULL && + EHCI_QTD_GET_BYTES(status) == 0) + status &= ~EHCI_QTD_HALTED; if (EHCI_QTD_GET_PID(status) != EHCI_QTD_PID_SETUP) actlen += sqtd->len - EHCI_QTD_GET_BYTES(status); } @@ -760,7 +790,7 @@ xfer->length, actlen, status)); xfer->actlen = actlen; if (status != 0) { -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG char sbuf[128]; bitmask_snprintf((u_int32_t)status, @@ -811,7 +841,7 @@ intrs = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS)) & sc->sc_eintrs; DPRINTFN(15,("ehci_waitintr: 0x%04x\n", intrs)); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug > 15) ehci_dump_regs(sc); #endif @@ -833,7 +863,7 @@ ehci_poll(struct usbd_bus *bus) { ehci_softc_t *sc = (ehci_softc_t *)bus; -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG static int last; int new; new = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS)); @@ -910,7 +940,7 @@ //u_int32_t ctl; int s; -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG DPRINTF(("ehci_power: sc=%p, why=%d\n", sc, why)); ehci_dump_regs(sc); #endif @@ -992,7 +1022,7 @@ usbd_status err; err = usb_allocmem(bus, size, 0, dma); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (err) printf("ehci_allocm: usb_allocmem()=%d\n", err); #endif @@ -1072,7 +1102,7 @@ { } -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG void ehci_dump_regs(ehci_softc_t *sc) { @@ -1276,7 +1306,7 @@ case UE_CONTROL: err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t), 0, &epipe->u.ctl.reqdma); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (err) printf("ehci_open: usb_allocmem()=%d\n", err); #endif @@ -1323,7 +1353,7 @@ head->next = sqh; head->qh.qh_link = htole32(sqh->physaddr | EHCI_LINK_QH); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug > 5) { printf("ehci_add_qh:\n"); ehci_dump_sqh(sqh); @@ -1739,7 +1769,7 @@ #endif break; case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE): - if (value != 0) { + if ((value & 0xff) != 0) { err = USBD_IOERROR; goto ret; } @@ -2020,7 +2050,7 @@ DPRINTFN(2, ("ehci_alloc_sqh: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, EHCI_SQH_SIZE * EHCI_SQH_CHUNK, EHCI_PAGE_SIZE, &dma); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (err) printf("ehci_alloc_sqh: usb_allocmem()=%d\n", err); #endif @@ -2061,7 +2091,7 @@ DPRINTFN(2, ("ehci_alloc_sqtd: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, EHCI_SQTD_SIZE*EHCI_SQTD_CHUNK, EHCI_PAGE_SIZE, &dma); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (err) printf("ehci_alloc_sqtd: usb_allocmem()=%d\n", err); #endif @@ -2202,6 +2232,7 @@ if (i != 0) /* use offset only in first buffer */ a = EHCI_PAGE(a); cur->qtd.qtd_buffer[i] = htole32(a); + cur->qtd.qtd_buffer_hi[i] = 0; #ifdef DIAGNOSTIC if (i >= EHCI_QTD_NBUFFERS) { printf("ehci_alloc_sqtd_chain: i=%d\n", i); @@ -2587,6 +2618,7 @@ EHCI_QTD_SET_BYTES(sizeof *req) ); setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->u.ctl.reqdma, 0)); + setup->qtd.qtd_buffer_hi[0] = 0; setup->nextqtd = next; setup->qtd.qtd_next = setup->qtd.qtd_altnext = htole32(next->physaddr); setup->xfer = xfer; @@ -2599,12 +2631,13 @@ EHCI_QTD_IOC ); stat->qtd.qtd_buffer[0] = 0; /* XXX not needed? */ + stat->qtd.qtd_buffer_hi[0] = 0; /* XXX not needed? */ stat->nextqtd = NULL; stat->qtd.qtd_next = stat->qtd.qtd_altnext = EHCI_NULL; stat->xfer = xfer; stat->len = 0; -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug > 5) { DPRINTF(("ehci_device_request:\n")); ehci_dump_sqh(sqh); @@ -2632,7 +2665,7 @@ xfer->status = USBD_IN_PROGRESS; splx(s); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug > 10) { DPRINTF(("ehci_device_request: status=%x\n", EOREAD4(sc, EHCI_USBSTS))); @@ -2714,7 +2747,7 @@ return (err); } -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug > 5) { DPRINTF(("ehci_device_bulk_transfer: data(1)\n")); ehci_dump_sqh(sqh); @@ -2742,7 +2775,7 @@ xfer->status = USBD_IN_PROGRESS; splx(s); -#ifdef USB_DEBUG +#ifdef EHCI_DEBUG if (ehcidebug > 10) { DPRINTF(("ehci_device_bulk_transfer: data(2)\n")); delay(10000); ==== //depot/projects/hammer/sys/dev/usb/ehcireg.h#2 (text+ko) ==== @@ -1,5 +1,5 @@ /* $NetBSD: ehcireg.h,v 1.13 2001/11/23 01:16:27 augustss Exp $ */ -/* $FreeBSD: src/sys/dev/usb/ehcireg.h,v 1.1 2003/04/14 14:04:07 ticso Exp $ */ +/* $FreeBSD: src/sys/dev/usb/ehcireg.h,v 1.2 2004/03/19 07:14:23 julian Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -235,6 +235,7 @@ #define EHCI_QTD_GET_TOGGLE(x) (((x) >> 31) & 0x1) #define EHCI_QTD_TOGGLE 0x80000000 ehci_physaddr_t qtd_buffer[EHCI_QTD_NBUFFERS]; + ehci_physaddr_t qtd_buffer_hi[EHCI_QTD_NBUFFERS]; } ehci_qtd_t; #define EHCI_QTD_ALIGN 32 ==== //depot/projects/hammer/sys/dev/usb/usb_subr.c#7 (text+ko) ==== @@ -3,10 +3,11 @@ /* Also already have from NetBSD: * $NetBSD: usb_subr.c,v 1.102 2003/01/01 16:21:50 augustss Exp $ * $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ + * $NetBSD: usb_subr.c,v 1.111 2004/03/15 10:35:04 augustss Exp $ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.59 2004/01/18 12:46:19 sanpei Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.61 2004/03/19 08:19:52 julian Exp $"); /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -587,7 +588,7 @@ usb_status_t ds; usb_config_descriptor_t cd, *cdp; usbd_status err; - int ifcidx, nifc, len, selfpowered, power; + int i, ifcidx, nifc, len, selfpowered, power; DPRINTFN(5,("usbd_set_config_index: dev=%p index=%d\n", dev, index)); @@ -623,8 +624,14 @@ cdp = malloc(len, M_USB, M_NOWAIT); if (cdp == NULL) return (USBD_NOMEM); - /* Get the full descriptor. */ - err = usbd_get_desc(dev, UDESC_CONFIG, index, len, cdp); + + /* Get the full descriptor. Try a few times for slow devices. */ + for (i = 0; i < 3; i++) { + err = usbd_get_desc(dev, UDESC_CONFIG, index, len, cdp); + if (!err) + break; + usbd_delay_ms(dev, 200); + } if (err) goto bad; if (cdp->bDescriptorType != UDESC_CONFIG) { @@ -775,8 +782,14 @@ return (err); } /* Clear any stall and make sure DATA0 toggle will be used next. */ - if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) - usbd_clear_endpoint_stall(p); + if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) { + err = usbd_clear_endpoint_stall(p); + /* Some devices reject this command, so ignore a STALL. */ + if (err && err != USBD_STALLED) { + printf("usbd_setup_pipe: failed to start endpoint, %s\n", usbd_errstr(err)); + return (err); + } + } *pipe = p; return (USBD_NORMAL_COMPLETION); } @@ -1030,6 +1043,21 @@ } up->device = dev; + + /* Set the address. Do this early; some devices need that. */ + err = usbd_set_address(dev, addr); + DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr)); + if (err) { + DPRINTFN(-1,("usb_new_device: set address %d failed\n", addr)); + err = USBD_SET_ADDR_FAILED; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403200134.i2K1YwZN042937>