From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 04:22:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3036B1065674; Sun, 16 Nov 2008 04:22:00 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C75C8FC13; Sun, 16 Nov 2008 04:22:00 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAG4LxCG042720; Sun, 16 Nov 2008 04:21:59 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAG4Lx4m042719; Sun, 16 Nov 2008 04:21:59 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811160421.mAG4Lx4m042719@svn.freebsd.org> From: Joseph Koshy Date: Sun, 16 Nov 2008 04:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184997 - head/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 04:22:00 -0000 Author: jkoshy Date: Sun Nov 16 04:21:59 2008 New Revision: 184997 URL: http://svn.freebsd.org/changeset/base/184997 Log: Print PMC widths in the initialization announcement. Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 15 22:23:07 2008 (r184996) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sun Nov 16 04:21:59 2008 (r184997) @@ -4539,9 +4539,10 @@ pmc_initialize(void) printf(PMC_MODULE_NAME ":"); for (n = 0; n < (int) md->pmd_nclass; n++) { pcd = &md->pmd_classdep[n]; - printf(" %s/%d/0x%b", + printf(" %s/%d/%d/0x%b", pmc_name_of_pmcclass[pcd->pcd_class], pcd->pcd_num, + pcd->pcd_width, pcd->pcd_caps, "\20" "\1INT\2USR\3SYS\4EDG\5THR" From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 04:26:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C6411065677; Sun, 16 Nov 2008 04:26:38 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68E6F8FC08; Sun, 16 Nov 2008 04:26:38 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAG4QchK042844; Sun, 16 Nov 2008 04:26:38 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAG4QcL1042843; Sun, 16 Nov 2008 04:26:38 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811160426.mAG4QcL1042843@svn.freebsd.org> From: Joseph Koshy Date: Sun, 16 Nov 2008 04:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184998 - head/usr.sbin/pmccontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 04:26:38 -0000 Author: jkoshy Date: Sun Nov 16 04:26:38 2008 New Revision: 184998 URL: http://svn.freebsd.org/changeset/base/184998 Log: Ignore absent CPUs when listing the current state of PMC hardware. Modified: head/usr.sbin/pmccontrol/pmccontrol.c Modified: head/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- head/usr.sbin/pmccontrol/pmccontrol.c Sun Nov 16 04:21:59 2008 (r184997) +++ head/usr.sbin/pmccontrol/pmccontrol.c Sun Nov 16 04:26:38 2008 (r184998) @@ -256,9 +256,12 @@ pmcc_do_list_state(void) (logical_cpus_mask & (1 << cpu))) continue; /* skip P4-style 'logical' cpus */ #endif - if (pmc_pmcinfo(cpu, &pi) < 0) + if (pmc_pmcinfo(cpu, &pi) < 0) { + if (errno == ENXIO) + continue; err(EX_OSERR, "Unable to get PMC status for CPU %d", cpu); + } printf("#CPU %d:\n", c++); npmc = pmc_npmc(cpu); From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 11:51:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2ED7106564A; Sun, 16 Nov 2008 11:51:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 512578FC1A; Sun, 16 Nov 2008 11:51:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L1gA0-000PGw-6l; Sun, 16 Nov 2008 13:51:24 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAGBpLLd024248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 16 Nov 2008 13:51:21 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAGBpKd8004111; Sun, 16 Nov 2008 13:51:20 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAGBpKhL004109; Sun, 16 Nov 2008 13:51:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 16 Nov 2008 13:51:20 +0200 From: Kostik Belousov To: Doug Ambrisko Message-ID: <20081116115120.GC2037@deviant.kiev.zoral.com.ua> References: <200811142105.mAEL5jsL001886@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GPJrCs/72TxItFYR" Content-Disposition: inline In-Reply-To: <200811142105.mAEL5jsL001886@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L1gA0-000PGw-6l da89b4840acbf8c58fcec5f045c34f73 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 11:51:25 -0000 --GPJrCs/72TxItFYR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > Author: ambrisko > Date: Fri Nov 14 21:05:45 2008 > New Revision: 184974 > URL: http://svn.freebsd.org/changeset/base/184974 >=20 > Log: > When running a 32bit app. on amd64, ensure the bits above 32bit > are zero for the copyout. Confirmed by LSI. >=20 > Modified: > head/sys/dev/mfi/mfi.c >=20 > Modified: head/sys/dev/mfi/mfi.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd,=20 > ->mfi_frame.raw[ioc->mfi_sense_off], > &sense_ptr.sense_ptr_data[0], > sizeof(sense_ptr.sense_ptr_data)); > +#ifdef __amd64__ > + if (cmd !=3D MFI_CMD) { > + /* > + * not 64bit native so zero out any address > + * over 32bit */ > + sense_ptr.high =3D 0; > + } > +#endif > error =3D copyout(cm->cm_sense, sense_ptr.user_space, > ioc->mfi_sense_len); > if (error !=3D 0) { > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > ->lioc_frame.raw[l_ioc.lioc_sense_off], > &sense_ptr.sense_ptr_data[0], > sizeof(sense_ptr.sense_ptr_data)); > +#ifdef __amd64__ > + /* > + * only 32bit Linux support so zero out any > + * address over 32bit > + */ > + sense_ptr.high =3D 0; > +#endif > error =3D copyout(cm->cm_sense, sense_ptr.user_space, > l_ioc.lioc_sense_len); > if (error !=3D 0) { Would it make sense to perform this cut slightly more generically, by checking whether the current process is 32bit ? We still have not grew the easy to check flag or attribute of the image, but usual practice is to compare p_sysent with corresponding sysvec, like if (td->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) or if (td->td_proc->p_sysent =3D=3D &elf_linux_sysvec) --GPJrCs/72TxItFYR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkgCTgACgkQC3+MBN1Mb4ilSgCcC7rlFS2UrHNAP3Cxwitk5+/0 qc4AoPIXURK4hD+H2KXYnYSdVyvLNqEt =dnux -----END PGP SIGNATURE----- --GPJrCs/72TxItFYR-- From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 13:19:47 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3E4A1065679; Sun, 16 Nov 2008 13:19:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B43678FC19; Sun, 16 Nov 2008 13:19:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGDJlZ7053575; Sun, 16 Nov 2008 13:19:47 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGDJlQd053573; Sun, 16 Nov 2008 13:19:47 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811161319.mAGDJlQd053573@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Nov 2008 13:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184999 - in stable/7/sys: . dev/esp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 13:19:47 -0000 Author: marius Date: Sun Nov 16 13:19:47 2008 New Revision: 184999 URL: http://svn.freebsd.org/changeset/base/184999 Log: MFC: r180692 o Fix style(9) bugs and similar nits. o Merge ncr53c9x.c from NetBSD: 1.115: fix variable shadowing 1.118: __inline -> inline 1.121: fix empty if Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/esp/esp_sbus.c stable/7/sys/dev/esp/ncr53c9x.c stable/7/sys/dev/esp/ncr53c9xvar.h Modified: stable/7/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/7/sys/dev/esp/esp_sbus.c Sun Nov 16 04:26:38 2008 (r184998) +++ stable/7/sys/dev/esp/esp_sbus.c Sun Nov 16 13:19:47 2008 (r184999) @@ -158,19 +158,19 @@ MODULE_DEPEND(esp, sbus, 1, 1, 1); MODULE_DEPEND(esp, cam, 1, 1, 1); /* - * Functions and the switch for the MI code. + * Functions and the switch for the MI code */ -static u_char esp_read_reg(struct ncr53c9x_softc *, int); -static void esp_write_reg(struct ncr53c9x_softc *, int, u_char); -static int esp_dma_isintr(struct ncr53c9x_softc *); -static void esp_dma_reset(struct ncr53c9x_softc *); -static int esp_dma_intr(struct ncr53c9x_softc *); -static int esp_dma_setup(struct ncr53c9x_softc *, caddr_t *, size_t *, - int, size_t *); -static void esp_dma_go(struct ncr53c9x_softc *); -static void esp_dma_stop(struct ncr53c9x_softc *); -static int esp_dma_isactive(struct ncr53c9x_softc *); -static int espattach(struct esp_softc *, struct ncr53c9x_glue *); +static u_char esp_read_reg(struct ncr53c9x_softc *sc, int reg); +static void esp_write_reg(struct ncr53c9x_softc *sc, int reg, u_char v); +static int esp_dma_isintr(struct ncr53c9x_softc *sc); +static void esp_dma_reset(struct ncr53c9x_softc *sc); +static int esp_dma_intr(struct ncr53c9x_softc *sc); +static int esp_dma_setup(struct ncr53c9x_softc *sc, caddr_t *addr, + size_t *len, int datain, size_t *dmasize); +static void esp_dma_go(struct ncr53c9x_softc *sc); +static void esp_dma_stop(struct ncr53c9x_softc *sc); +static int esp_dma_isactive(struct ncr53c9x_softc *sc); +static int espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep); static struct ncr53c9x_glue esp_sbus_glue = { esp_read_reg, @@ -311,7 +311,7 @@ esp_sbus_attach(device_t dev) esc->sc_regh = rman_get_bushandle(esc->sc_res); } else { /* - * Search accompanying DMA engine. It should have been + * Search accompanying DMA engine. It should have been * already attached otherwise there isn't much we can do. */ if (device_get_children(device_get_parent(dev), &children, @@ -498,9 +498,6 @@ esp_resume(device_t dev) return (ENXIO); } -/* - * Attach this instance, and then all the sub-devices - */ static int espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep) { @@ -530,7 +527,7 @@ espattach(struct esp_softc *esc, struct */ /* - * Read the part-unique ID code of the SCSI chip. The contained + * Read the part-unique ID code of the SCSI chip. The contained * value is only valid if all of the following conditions are met: * - After power-up or chip reset. * - Before any value is written to this register. @@ -570,7 +567,7 @@ espattach(struct esp_softc *esc, struct (NCRCFG3_CDB | NCRCFG3_FCLK)) { sc->sc_rev = NCR_VARIANT_ESP100A; } else { - /* NCRCFG2_FE enables > 64K transfers */ + /* NCRCFG2_FE enables > 64K transfers. */ sc->sc_cfg2 |= NCRCFG2_FE; sc->sc_cfg3 = 0; NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); @@ -581,15 +578,18 @@ espattach(struct esp_softc *esc, struct case 0x00: sc->sc_rev = NCR_VARIANT_FAS100A; break; + case 0x02: if ((uid & 0x07) == 0x02) sc->sc_rev = NCR_VARIANT_FAS216; else sc->sc_rev = NCR_VARIANT_FAS236; break; + case 0x0a: sc->sc_rev = NCR_VARIANT_FAS366; break; + default: /* * We could just treat unknown chips @@ -660,10 +660,10 @@ espattach(struct esp_softc *esc, struct /* * The onboard SCSI chips in Sun Ultra 1 are actually * documented to be NCR53C9X which use NCRCFG3_FCLK and - * NCRCFG3_FSCSI. BSD/OS however probes these chips as + * NCRCFG3_FSCSI. BSD/OS however probes these chips as * FAS100A and uses NCRF9XCFG3_FCLK and NCRF9XCFG3_FSCSI * instead which seems to be correct as otherwise sync - * negotiation just doesn't work. Using NCRF9XCFG3_FCLK + * negotiation just doesn't work. Using NCRF9XCFG3_FCLK * and NCRF9XCFG3_FSCSI with these chips in fact also * yields Fast-SCSI speed. */ @@ -683,7 +683,7 @@ espattach(struct esp_softc *esc, struct /* Limit minsync due to unsolved performance issues. */ sc->sc_maxsync = sc->sc_minsync; - /* Establish interrupt channel */ + /* Establish interrupt channel. */ esc->sc_irqrid = 0; if ((esc->sc_irqres = bus_alloc_resource_any(esc->sc_dev, SYS_RES_IRQ, &esc->sc_irqrid, RF_SHAREABLE|RF_ACTIVE)) == NULL) { @@ -697,7 +697,7 @@ espattach(struct esp_softc *esc, struct goto fail_ires; } - /* Turn on target selection using the `DMA' method */ + /* Turn on target selection using the `DMA' method. */ if (sc->sc_rev != NCR_VARIANT_FAS366) sc->sc_features |= NCR_F_DMASELECT; @@ -720,7 +720,7 @@ espattach(struct esp_softc *esc, struct } /* - * Glue functions. + * Glue functions */ #ifdef ESP_SBUS_DEBUG @@ -844,11 +844,8 @@ static void esp_dma_stop(struct ncr53c9x_softc *sc) { struct esp_softc *esc = (struct esp_softc *)sc; - uint32_t csr; - csr = L64854_GCSR(esc->sc_dma); - csr &= ~D_EN_DMA; - L64854_SCSR(esc->sc_dma, csr); + L64854_SCSR(esc->sc_dma, L64854_GCSR(esc->sc_dma) & ~D_EN_DMA); } static int Modified: stable/7/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/7/sys/dev/esp/ncr53c9x.c Sun Nov 16 04:26:38 2008 (r184998) +++ stable/7/sys/dev/esp/ncr53c9x.c Sun Nov 16 13:19:47 2008 (r184999) @@ -129,46 +129,54 @@ __FBSDID("$FreeBSD$"); #include #include -int ncr53c9x_debug = NCR_SHOWMISC /*|NCR_SHOWPHASE|NCR_SHOWTRAC|NCR_SHOWCMDS*/; +int ncr53c9x_debug = + NCR_SHOWMISC /* | NCR_SHOWPHASE | NCR_SHOWTRAC | NCR_SHOWCMDS */; #ifdef DEBUG int ncr53c9x_notag = 0; #endif -static void ncr53c9x_select(struct ncr53c9x_softc *, struct ncr53c9x_ecb *); -static int ncr53c9x_reselect(struct ncr53c9x_softc *, int, int, int); -static void ncr53c9x_scsi_reset(struct ncr53c9x_softc *); -static void ncr53c9x_poll(struct cam_sim *); -static void ncr53c9x_sched(struct ncr53c9x_softc *); -static void ncr53c9x_done(struct ncr53c9x_softc *, struct ncr53c9x_ecb *); -static void ncr53c9x_msgin(struct ncr53c9x_softc *); -static void ncr53c9x_msgout(struct ncr53c9x_softc *); +static void ncr53c9x_abort(struct ncr53c9x_softc *sc, + struct ncr53c9x_ecb *ecb); +static void ncr53c9x_dequeue(struct ncr53c9x_softc *sc, + struct ncr53c9x_ecb *ecb); +static void ncr53c9x_done(struct ncr53c9x_softc *sc, + struct ncr53c9x_ecb *ecb); +static void ncr53c9x_free_ecb(struct ncr53c9x_softc *sc, + struct ncr53c9x_ecb *ecb); +static void ncr53c9x_msgin(struct ncr53c9x_softc *sc); +static void ncr53c9x_msgout(struct ncr53c9x_softc *sc); +static void ncr53c9x_poll(struct cam_sim *sim); +static int ncr53c9x_rdfifo(struct ncr53c9x_softc *sc, int how); +static int ncr53c9x_reselect(struct ncr53c9x_softc *sc, int message, + int tagtype, int tagid); +static void ncr53c9x_sense(struct ncr53c9x_softc *sc, + struct ncr53c9x_ecb *ecb); +static void ncr53c9x_scsi_reset(struct ncr53c9x_softc *sc); +static void ncr53c9x_sched(struct ncr53c9x_softc *sc); +static void ncr53c9x_select(struct ncr53c9x_softc *sc, + struct ncr53c9x_ecb *ecb); static void ncr53c9x_timeout(void *arg); static void ncr53c9x_watch(void *arg); -static void ncr53c9x_abort(struct ncr53c9x_softc *, struct ncr53c9x_ecb *); -static void ncr53c9x_dequeue(struct ncr53c9x_softc *, - struct ncr53c9x_ecb *); -static void ncr53c9x_sense(struct ncr53c9x_softc *, struct ncr53c9x_ecb *); -static void ncr53c9x_free_ecb(struct ncr53c9x_softc *, - struct ncr53c9x_ecb *); -static void ncr53c9x_wrfifo(struct ncr53c9x_softc *, u_char *, int); -static int ncr53c9x_rdfifo(struct ncr53c9x_softc *, int); - -static struct ncr53c9x_ecb *ncr53c9x_get_ecb(struct ncr53c9x_softc *); -static struct ncr53c9x_linfo *ncr53c9x_lunsearch(struct ncr53c9x_tinfo *, - int64_t lun); - -static __inline void ncr53c9x_readregs(struct ncr53c9x_softc *); -static __inline int ncr53c9x_stp2cpb(struct ncr53c9x_softc *, int); -static __inline void ncr53c9x_setsync(struct ncr53c9x_softc *, - struct ncr53c9x_tinfo *); +static void ncr53c9x_wrfifo(struct ncr53c9x_softc *sc, u_char *p, + int len); -#define NCR_RDFIFO_START 0 -#define NCR_RDFIFO_CONTINUE 1 +static struct ncr53c9x_ecb *ncr53c9x_get_ecb(struct ncr53c9x_softc *sc); +static struct ncr53c9x_linfo *ncr53c9x_lunsearch(struct ncr53c9x_tinfo *sc, + int64_t lun); + +static inline void ncr53c9x_readregs(struct ncr53c9x_softc *sc); +static inline void ncr53c9x_setsync(struct ncr53c9x_softc *sc, + struct ncr53c9x_tinfo *ti); +static inline int ncr53c9x_stp2cpb(struct ncr53c9x_softc *sc, + int period); -#define NCR_SET_COUNT(sc, size) do { \ - NCR_WRITE_REG((sc), NCR_TCL, (size)); \ +#define NCR_RDFIFO_START 0 +#define NCR_RDFIFO_CONTINUE 1 + +#define NCR_SET_COUNT(sc, size) do { \ + NCR_WRITE_REG((sc), NCR_TCL, (size)); \ NCR_WRITE_REG((sc), NCR_TCM, (size) >> 8); \ - if ((sc->sc_cfg2 & NCRCFG2_FE) || \ + if ((sc->sc_cfg2 & NCRCFG2_FE) || \ (sc->sc_rev == NCR_VARIANT_FAS366)) { \ NCR_WRITE_REG((sc), NCR_TCH, (size) >> 16); \ } \ @@ -178,8 +186,8 @@ static __inline void ncr53c9x_setsync(st } while (0) #ifndef mstohz -#define mstohz(ms) \ - (((ms) < 0x20000) ? \ +#define mstohz(ms) \ + (((ms) < 0x20000) ? \ ((ms +0u) / 1000u) * hz : \ ((ms +0u) * hz) /1000u) #endif @@ -211,6 +219,7 @@ static struct ncr53c9x_linfo * ncr53c9x_lunsearch(struct ncr53c9x_tinfo *ti, int64_t lun) { struct ncr53c9x_linfo *li; + LIST_FOREACH(li, &ti->luns, link) if (li->lun == lun) return (li); @@ -248,7 +257,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s /* * Allocate SCSI message buffers. * Front-ends can override allocation to avoid alignment - * handling in the DMA engines. Note that that ncr53c9x_msgout() + * handling in the DMA engines. Note that ncr53c9x_msgout() * can request a 1 byte DMA transfer. */ if (sc->sc_omess == NULL) { @@ -294,12 +303,12 @@ ncr53c9x_attach(struct ncr53c9x_softc *s sc->sc_ccf = FREQTOCCF(sc->sc_freq); - /* The value *must not* be == 1. Make it 2 */ + /* The value *must not* be == 1. Make it 2. */ if (sc->sc_ccf == 1) sc->sc_ccf = 2; /* - * The recommended timeout is 250ms. This register is loaded + * The recommended timeout is 250ms. This register is loaded * with a value calculated as follows, from the docs: * * (timout period) x (CLK frequency) @@ -311,11 +320,11 @@ ncr53c9x_attach(struct ncr53c9x_softc *s */ sc->sc_timeout = ((250 * 1000) * sc->sc_freq) / (8192 * sc->sc_ccf); - /* CCF register only has 3 bits; 0 is actually 8 */ + /* The CCF register only has 3 bits; 0 is actually 8. */ sc->sc_ccf &= 7; /* - * Register with CAM + * Register with CAM. */ devq = cam_simq_alloc(sc->sc_ntarg); if (devq == NULL) { @@ -325,8 +334,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s } sim = cam_sim_alloc(ncr53c9x_action, ncr53c9x_poll, "esp", sc, - device_get_unit(sc->sc_dev), &Giant, 1, - NCR_TAG_DEPTH, devq); + device_get_unit(sc->sc_dev), &Giant, 1, NCR_TAG_DEPTH, devq); if (sim == NULL) { device_printf(sc->sc_dev, "cannot allocate SIM entry\n"); error = ENOMEM; @@ -339,8 +347,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s } if (xpt_create_path(&path, NULL, cam_sim_path(sim), - CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) - != CAM_REQ_CMP) { + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { device_printf(sc->sc_dev, "cannot create path\n"); error = EIO; goto fail_bus; @@ -349,16 +356,19 @@ ncr53c9x_attach(struct ncr53c9x_softc *s sc->sc_sim = sim; sc->sc_path = path; - /* Reset state & bus */ + /* Reset state and bus. */ #if 0 sc->sc_cfflags = sc->sc_dev.dv_cfdata->cf_flags; +#else + sc->sc_cfflags = 0; #endif sc->sc_state = 0; ncr53c9x_init(sc, 1); TAILQ_INIT(&sc->free_list); - if ((sc->ecb_array = malloc(sizeof(struct ncr53c9x_ecb) * NCR_TAG_DEPTH, - M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) { + if ((sc->ecb_array = + malloc(sizeof(struct ncr53c9x_ecb) * NCR_TAG_DEPTH, M_DEVBUF, + M_NOWAIT | M_ZERO)) == NULL) { device_printf(sc->sc_dev, "cannot allocate ECB array\n"); error = ENOMEM; goto fail_path; @@ -416,8 +426,8 @@ ncr53c9x_detach(struct ncr53c9x_softc *s } /* - * This is the generic ncr53c9x reset function. It does not reset the SCSI bus, - * only this controller, but kills any on-going commands, and also stops + * This is the generic ncr53c9x reset function. It does not reset the SCSI + * bus, only this controller, but kills any on-going commands, and also stops * and resets the DMA. * * After reset, registers are loaded with the defaults from the attach @@ -427,20 +437,21 @@ void ncr53c9x_reset(struct ncr53c9x_softc *sc) { - /* reset DMA first */ + /* Reset DMA first. */ NCRDMA_RESET(sc); - /* reset SCSI chip */ + /* Reset SCSI chip. */ NCRCMD(sc, NCRCMD_RSTCHIP); NCRCMD(sc, NCRCMD_NOP); DELAY(500); - /* do these backwards, and fall through */ + /* Do these backwards, and fall through. */ switch (sc->sc_rev) { case NCR_VARIANT_ESP406: case NCR_VARIANT_FAS408: NCR_WRITE_REG(sc, NCR_CFG5, sc->sc_cfg5 | NCRCFG5_SINT); NCR_WRITE_REG(sc, NCR_CFG4, sc->sc_cfg4); + /* FALLTHROUGH */ case NCR_VARIANT_AM53C974: case NCR_VARIANT_FAS100A: case NCR_VARIANT_FAS216: @@ -450,9 +461,11 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc case NCR_VARIANT_ESP200: sc->sc_features |= NCR_F_HASCFG3; NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); + /* FALLTHROUGH */ case NCR_VARIANT_ESP100A: sc->sc_features |= NCR_F_SELATN3; NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); + /* FALLTHROUGH */ case NCR_VARIANT_ESP100: NCR_WRITE_REG(sc, NCR_CFG1, sc->sc_cfg1); NCR_WRITE_REG(sc, NCR_CCF, sc->sc_ccf); @@ -466,7 +479,7 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc sc->sc_cfg3 = NCRFASCFG3_FASTCLK | NCRFASCFG3_OBAUTO; sc->sc_cfg3_fscsi = NCRFASCFG3_FASTSCSI; NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); - sc->sc_cfg2 = 0; /* NCRCFG2_HMEFE| NCRCFG2_HME32 */ + sc->sc_cfg2 = 0; /* NCRCFG2_HMEFE | NCRCFG2_HME32 */ NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); NCR_WRITE_REG(sc, NCR_CFG1, sc->sc_cfg1); NCR_WRITE_REG(sc, NCR_CCF, sc->sc_ccf); @@ -475,8 +488,8 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc break; default: - device_printf(sc->sc_dev, "unknown revision code, " - "assuming ESP100\n"); + device_printf(sc->sc_dev, + "unknown revision code, assuming ESP100\n"); NCR_WRITE_REG(sc, NCR_CFG1, sc->sc_cfg1); NCR_WRITE_REG(sc, NCR_CCF, sc->sc_ccf); NCR_WRITE_REG(sc, NCR_SYNCOFF, 0); @@ -488,7 +501,7 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc #if 0 device_printf(sc->sc_dev, "ncr53c9x_reset: revision %d\n", - sc->sc_rev); + sc->sc_rev); device_printf(sc->sc_dev, "ncr53c9x_reset: cfg1 0x%x, cfg2 0x%x, " "cfg3 0x%x, ccf 0x%x, timeout 0x%x\n", sc->sc_cfg1, sc->sc_cfg2, sc->sc_cfg3, sc->sc_ccf, sc->sc_timeout); @@ -496,7 +509,7 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc } /* - * Reset the SCSI bus, but not the chip + * Reset the SCSI bus, but not the chip. */ static void ncr53c9x_scsi_reset(struct ncr53c9x_softc *sc) @@ -510,13 +523,14 @@ ncr53c9x_scsi_reset(struct ncr53c9x_soft } /* - * Initialize ncr53c9x state machine + * Initialize ncr53c9x state machine. */ void ncr53c9x_init(struct ncr53c9x_softc *sc, int doreset) { struct ncr53c9x_ecb *ecb; struct ncr53c9x_linfo *li; + struct ncr53c9x_tinfo *ti; int i, r; NCR_MISC(("[NCR_INIT(%d) %d] ", doreset, sc->sc_state)); @@ -538,13 +552,13 @@ ncr53c9x_init(struct ncr53c9x_softc *sc, ecb->ccb->ccb_h.status = CAM_CMD_TIMEOUT; ncr53c9x_done(sc, ecb); } - /* Cancel outstanding disconnected commands on each LUN */ + /* Cancel outstanding disconnected commands on each LUN. */ for (r = 0; r < sc->sc_ntarg; r++) { LIST_FOREACH(li, &sc->sc_tinfo[r].luns, link) { if ((ecb = li->untagged) != NULL) { li->untagged = NULL; /* - * XXXXXXX + * XXX * * Should we terminate a command * that never reached the disk? @@ -567,7 +581,7 @@ ncr53c9x_init(struct ncr53c9x_softc *sc, } /* - * reset the chip to a known state + * Reset the chip to a known state. */ ncr53c9x_reset(sc); @@ -576,12 +590,14 @@ ncr53c9x_init(struct ncr53c9x_softc *sc, sc->sc_phase = sc->sc_prevphase = INVALID_PHASE; for (r = 0; r < sc->sc_ntarg; r++) { - struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[r]; + ti = &sc->sc_tinfo[r]; /* XXX - config flags per target: low bits: no reselect; high bits: no synch */ + ti->flags = ((sc->sc_minsync != 0 && + (sc->sc_cfflags & (1 << ((r & 7) + 8))) == 0) ? + 0 : T_SYNCHOFF) | + ((sc->sc_cfflags & (1 << (r & 7))) == 0 ? + 0 : T_RSELECTOFF); - ti->flags = ((sc->sc_minsync && !(sc->sc_cfflags & (1<<((r&7)+8)))) - ? 0 : T_SYNCHOFF) | - ((sc->sc_cfflags & (1<<(r&7))) ? T_RSELECTOFF : 0); #ifdef DEBUG if (ncr53c9x_notag) ti->flags &= ~T_TAG; @@ -606,15 +622,15 @@ ncr53c9x_init(struct ncr53c9x_softc *sc, * NCR_INTR - so make sure it is the last read. * * I think that (from reading the docs) most bits in these registers - * only make sense when he DMA CSR has an interrupt showing. Call only + * only make sense when the DMA CSR has an interrupt showing. Call only * if an interrupt is pending. */ -static __inline void +static inline void ncr53c9x_readregs(struct ncr53c9x_softc *sc) { sc->sc_espstat = NCR_READ_REG(sc, NCR_STAT); - /* Only the stepo bits are of interest */ + /* Only the step bits are of interest. */ sc->sc_espstep = NCR_READ_REG(sc, NCR_STEP) & NCRSTEP_MASK; if (sc->sc_rev == NCR_VARIANT_FAS366) @@ -629,9 +645,8 @@ ncr53c9x_readregs(struct ncr53c9x_softc * Determine the SCSI bus phase, return either a real SCSI bus phase * or some pseudo phase we use to detect certain exceptions. */ - sc->sc_phase = (sc->sc_espintr & NCRINTR_DIS) ? - /* Disconnected */ BUSFREE_PHASE : sc->sc_espstat & NCRSTAT_PHASE; + BUSFREE_PHASE : sc->sc_espstat & NCRSTAT_PHASE; NCR_INTS(("regs[intr=%02x,stat=%02x,step=%02x,stat2=%02x] ", sc->sc_espintr, sc->sc_espstat, sc->sc_espstep, sc->sc_espstat2)); @@ -640,18 +655,18 @@ ncr53c9x_readregs(struct ncr53c9x_softc /* * Convert Synchronous Transfer Period to chip register Clock Per Byte value. */ -static __inline int +static inline int ncr53c9x_stp2cpb(struct ncr53c9x_softc *sc, int period) { int v; v = (sc->sc_freq * period) / 250; if (ncr53c9x_cpb2stp(sc, v) < period) - /* Correct round-down error */ + /* Correct round-down error. */ v++; return (v); } -static __inline void +static inline void ncr53c9x_setsync(struct ncr53c9x_softc *sc, struct ncr53c9x_tinfo *ti) { u_char syncoff, synctp; @@ -705,20 +720,17 @@ ncr53c9x_setsync(struct ncr53c9x_softc * static void ncr53c9x_select(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb) { - int target = ecb->ccb->ccb_h.target_id; - int lun = ecb->ccb->ccb_h.target_lun; struct ncr53c9x_tinfo *ti; - int tiflags; u_char *cmd; - int clen; - int selatn3, selatns; size_t dmasize; + int clen, selatn3, selatns; + int lun = ecb->ccb->ccb_h.target_lun; + int target = ecb->ccb->ccb_h.target_id; NCR_TRACE(("[ncr53c9x_select(t%d,l%d,cmd:%x,tag:%x,%x)] ", target, lun, ecb->cmd.cmd.opcode, ecb->tag[0], ecb->tag[1])); ti = &sc->sc_tinfo[target]; - tiflags = ti->flags; sc->sc_state = NCR_SELECTING; /* * Schedule the timeout now, the first time we will go away @@ -730,7 +742,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s /* * The docs say the target register is never reset, and I - * can't think of a better place to set it + * can't think of a better place to set it. */ if (sc->sc_rev == NCR_VARIANT_FAS366) { NCRCMD(sc, NCRCMD_FLUSH); @@ -756,9 +768,9 @@ ncr53c9x_select(struct ncr53c9x_softc *s NCR_SET_COUNT(sc, dmasize); if (sc->sc_rev != NCR_VARIANT_FAS366) - NCRCMD(sc, NCRCMD_NOP|NCRCMD_DMA); + NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); - /* And get the targets attention */ + /* And get the target's attention */ NCRCMD(sc, NCRCMD_SELNATN | NCRCMD_DMA); NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &dmasize); @@ -773,15 +785,15 @@ ncr53c9x_select(struct ncr53c9x_softc *s selatn3 = selatns = 0; if (ecb->tag[0] != 0) { if (sc->sc_features & NCR_F_SELATN3) - /* use SELATN3 to send tag messages */ + /* Use SELATN3 to send tag messages. */ selatn3 = 1; else - /* We don't have SELATN3; use SELATNS to send tags */ + /* We don't have SELATN3; use SELATNS to send tags. */ selatns = 1; } if (ti->flags & T_NEGOTIATE) { - /* We have to use SELATNS to send sync/wide messages */ + /* We have to use SELATNS to send sync/wide messages. */ selatn3 = 0; selatns = 1; } @@ -789,34 +801,33 @@ ncr53c9x_select(struct ncr53c9x_softc *s cmd = (u_char *)&ecb->cmd.cmd; if (selatn3) { - /* We'll use tags with SELATN3 */ + /* We'll use tags with SELATN3. */ clen = ecb->clen + 3; cmd -= 3; cmd[0] = MSG_IDENTIFY(lun, 1); /* msg[0] */ cmd[1] = ecb->tag[0]; /* msg[1] */ cmd[2] = ecb->tag[1]; /* msg[2] */ } else { - /* We don't have tags, or will send messages with SELATNS */ + /* We don't have tags, or will send messages with SELATNS. */ clen = ecb->clen + 1; cmd -= 1; - cmd[0] = MSG_IDENTIFY(lun, (tiflags & T_RSELECTOFF) == 0); + cmd[0] = MSG_IDENTIFY(lun, (ti->flags & T_RSELECTOFF) == 0); } if ((sc->sc_features & NCR_F_DMASELECT) && !selatns) { - - /* setup DMA transfer for command */ + /* Setup DMA transfer for command. */ dmasize = clen; sc->sc_cmdlen = clen; sc->sc_cmdp = cmd; - /* Program the SCSI counter */ + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, dmasize); - /* load the count in */ + /* Load the count in. */ /* if (sc->sc_rev != NCR_VARIANT_FAS366) */ - NCRCMD(sc, NCRCMD_NOP|NCRCMD_DMA); + NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); - /* And get the targets attention */ + /* And get the target's attention. */ if (selatn3) { sc->sc_msgout = SEND_TAG; sc->sc_flags |= NCR_ATN; @@ -833,13 +844,13 @@ ncr53c9x_select(struct ncr53c9x_softc *s * happy for it to disconnect etc. */ - /* Now get the command into the FIFO */ + /* Now get the command into the FIFO. */ ncr53c9x_wrfifo(sc, cmd, clen); - /* And get the targets attention */ + /* And get the target's attention. */ if (selatns) { NCR_MSGS(("SELATNS \n")); - /* Arbitrate, select and stop after IDENTIFY message */ + /* Arbitrate, select and stop after IDENTIFY message. */ NCRCMD(sc, NCRCMD_SELATNS); } else if (selatn3) { sc->sc_msgout = SEND_TAG; @@ -855,7 +866,6 @@ ncr53c9x_free_ecb(struct ncr53c9x_softc ecb->flags = 0; TAILQ_INSERT_TAIL(&sc->free_list, ecb, free_links); - return; } static struct ncr53c9x_ecb * @@ -870,7 +880,7 @@ ncr53c9x_get_ecb(struct ncr53c9x_softc * TAILQ_REMOVE(&sc->free_list, ecb, free_links); ecb->flags = ECB_ALLOC; bzero(&ecb->ccb, sizeof(struct ncr53c9x_ecb) - - offsetof(struct ncr53c9x_ecb, ccb)); + offsetof(struct ncr53c9x_ecb, ccb)); } return (ecb); } @@ -880,7 +890,7 @@ ncr53c9x_get_ecb(struct ncr53c9x_softc * */ /* - * Start a SCSI-command + * Start a SCSI-command. * This function is called by the higher level SCSI-driver to queue/run * SCSI-commands. */ @@ -888,8 +898,15 @@ ncr53c9x_get_ecb(struct ncr53c9x_softc * void ncr53c9x_action(struct cam_sim *sim, union ccb *ccb) { - struct ncr53c9x_softc *sc; + struct ccb_pathinq *cpi; + struct ccb_scsiio *csio; + struct ccb_trans_settings *cts; + struct ccb_trans_settings_scsi *scsi; + struct ccb_trans_settings_spi *spi; struct ncr53c9x_ecb *ecb; + struct ncr53c9x_softc *sc; + struct ncr53c9x_tinfo *ti; + int target; NCR_TRACE(("[ncr53c9x_action %d]", ccb->ccb_h.func_code)); @@ -903,17 +920,17 @@ ncr53c9x_action(struct cam_sim *sim, uni mtx_unlock(&sc->sc_lock); xpt_done(ccb); return; + case XPT_CALC_GEOMETRY: mtx_unlock(&sc->sc_lock); cam_calc_geometry(&ccb->ccg, sc->sc_extended_geom); xpt_done(ccb); return; - case XPT_PATH_INQ: - { - struct ccb_pathinq *cpi = &ccb->cpi; + case XPT_PATH_INQ: + cpi = &ccb->cpi; cpi->version_num = 1; - cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE; + cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE; cpi->hba_inquiry |= (sc->sc_rev == NCR_VARIANT_FAS366) ? PI_WIDE_16 : 0; cpi->target_sprt = 0; @@ -936,15 +953,12 @@ ncr53c9x_action(struct cam_sim *sim, uni mtx_unlock(&sc->sc_lock); xpt_done(ccb); return; - } + case XPT_GET_TRAN_SETTINGS: - { - struct ccb_trans_settings *cts = &ccb->cts; - struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[ccb->ccb_h.target_id]; - struct ccb_trans_settings_scsi *scsi = - &cts->proto_specific.scsi; - struct ccb_trans_settings_spi *spi = - &cts->xport_specific.spi; + cts = &ccb->cts; + ti = &sc->sc_tinfo[ccb->ccb_h.target_id]; + scsi = &cts->proto_specific.scsi; + spi = &cts->xport_specific.spi; cts->protocol = PROTO_SCSI; cts->protocol_version = SCSI_REV_2; @@ -979,25 +993,24 @@ ncr53c9x_action(struct cam_sim *sim, uni mtx_unlock(&sc->sc_lock); xpt_done(ccb); return; - } + case XPT_ABORT: printf("XPT_ABORT called\n"); ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; mtx_unlock(&sc->sc_lock); xpt_done(ccb); return; + case XPT_TERM_IO: printf("XPT_TERM_IO called\n"); ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; mtx_unlock(&sc->sc_lock); xpt_done(ccb); return; + case XPT_RESET_DEV: printf("XPT_RESET_DEV called\n"); case XPT_SCSI_IO: - { - struct ccb_scsiio *csio; - if (ccb->ccb_h.target_id < 0 || ccb->ccb_h.target_id >= sc->sc_ntarg) { ccb->ccb_h.status = CAM_PATH_INVALID; @@ -1020,7 +1033,7 @@ ncr53c9x_action(struct cam_sim *sim, uni return; } - /* Initialize ecb */ + /* Initialize ecb. */ ecb->ccb = ccb; ecb->timeout = ccb->ccb_h.timeout; @@ -1032,10 +1045,10 @@ ncr53c9x_action(struct cam_sim *sim, uni csio = &ccb->csio; if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) bcopy(csio->cdb_io.cdb_ptr, &ecb->cmd.cmd, - csio->cdb_len); + csio->cdb_len); else bcopy(csio->cdb_io.cdb_bytes, &ecb->cmd.cmd, - csio->cdb_len); + csio->cdb_len); ecb->clen = csio->cdb_len; ecb->daddr = csio->data_ptr; ecb->dleft = csio->dxfer_len; @@ -1046,19 +1059,14 @@ ncr53c9x_action(struct cam_sim *sim, uni ecb->flags |= ECB_READY; if (sc->sc_state == NCR_IDLE) ncr53c9x_sched(sc); - break; - } case XPT_SET_TRAN_SETTINGS: - { - struct ccb_trans_settings *cts = &ccb->cts; - int target = ccb->ccb_h.target_id; - struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[target]; - struct ccb_trans_settings_scsi *scsi = - &cts->proto_specific.scsi; - struct ccb_trans_settings_spi *spi = - &cts->xport_specific.spi; + cts = &ccb->cts; + target = ccb->ccb_h.target_id; + ti = &sc->sc_tinfo[target]; + scsi = &cts->proto_specific.scsi; + spi = &cts->xport_specific.spi; if ((scsi->valid & CTS_SCSI_VALID_TQ) != 0) { if ((sc->sc_cfflags & (1<<((target & 7) + 16))) == 0 && @@ -1103,11 +1111,10 @@ ncr53c9x_action(struct cam_sim *sim, uni ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); return; - } default: device_printf(sc->sc_dev, "Unhandled function code %d\n", - ccb->ccb_h.func_code); + ccb->ccb_h.func_code); ccb->ccb_h.status = CAM_PROVIDE_FAIL; mtx_unlock(&sc->sc_lock); xpt_done(ccb); @@ -1137,7 +1144,7 @@ ncr53c9x_poll(struct cam_sim *sim) */ /* - * Schedule a scsi operation. This has now been pulled out of the interrupt + * Schedule a SCSI operation. This has now been pulled out of the interrupt * handler so that we may call it from ncr53c9x_scsipi_request and * ncr53c9x_done. This may save us an unnecessary interrupt just to get * things going. Should only be called when state == NCR_IDLE and at bio pl. @@ -1146,12 +1153,12 @@ static void ncr53c9x_sched(struct ncr53c9x_softc *sc) { struct ncr53c9x_ecb *ecb; - struct ncr53c9x_tinfo *ti; struct ncr53c9x_linfo *li; - int lun; - int tag; + struct ncr53c9x_tinfo *ti; + int lun, tag; NCR_TRACE(("[ncr53c9x_sched] ")); + if (sc->sc_state != NCR_IDLE) panic("ncr53c9x_sched: not IDLE (state=%d)", sc->sc_state); @@ -1182,7 +1189,7 @@ ncr53c9x_sched(struct ncr53c9x_softc *sc if (li == NULL) { /* Initialize LUN info and add to list. */ if ((li = malloc(sizeof(*li), - M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) { + M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { continue; } li->lun = lun; @@ -1193,17 +1200,20 @@ ncr53c9x_sched(struct ncr53c9x_softc *sc } li->last_used = time_second; if (tag == 0) { - /* Try to issue this as an un-tagged command */ + /* Try to issue this as an untagged command. */ if (li->untagged == NULL) li->untagged = ecb; } if (li->untagged != NULL) { tag = 0; if ((li->busy != 1) && li->used == 0) { - /* We need to issue this untagged command now */ + /* + * We need to issue this untagged command + * now. + */ ecb = li->untagged; } else { - /* Not ready yet */ + /* not ready, yet */ continue; } } @@ -1227,10 +1237,11 @@ ncr53c9x_sched(struct ncr53c9x_softc *sc sc->sc_nexus = ecb; ncr53c9x_select(sc, ecb); break; - } else + } else { NCR_TRACE(("%d:%d busy\n", ecb->ccb->ccb_h.target_id, ecb->ccb->ccb_h.target_lun)); + } } } @@ -1238,9 +1249,9 @@ static void ncr53c9x_sense(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb) { union ccb *ccb = ecb->ccb; + struct ncr53c9x_linfo *li; struct ncr53c9x_tinfo *ti; struct scsi_request_sense *ss = (void *)&ecb->cmd.cmd; - struct ncr53c9x_linfo *li; int lun; NCR_TRACE(("requesting sense ")); @@ -1248,7 +1259,7 @@ ncr53c9x_sense(struct ncr53c9x_softc *sc lun = ccb->ccb_h.target_lun; ti = &sc->sc_tinfo[ccb->ccb_h.target_id]; - /* Next, setup a request sense command block */ + /* Next, setup a REQUEST SENSE command block. */ memset(ss, 0, sizeof(*ss)); ss->opcode = REQUEST_SENSE; ss->byte2 = ccb->ccb_h.target_lun << SCSI_CMD_LUN_SHIFT; @@ -1263,7 +1274,7 @@ ncr53c9x_sense(struct ncr53c9x_softc *sc if (li->busy) li->busy = 0; ncr53c9x_dequeue(sc, ecb); - li->untagged = ecb; /* must be executed first to fix C/A */ + li->untagged = ecb; /* Must be executed first to fix C/A. */ li->busy = 2; if (ecb == sc->sc_nexus) { ncr53c9x_select(sc, ecb); @@ -1282,15 +1293,15 @@ static void ncr53c9x_done(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb) { union ccb *ccb = ecb->ccb; - struct ncr53c9x_tinfo *ti; struct ncr53c9x_linfo *li; + struct ncr53c9x_tinfo *ti; int lun; NCR_TRACE(("[ncr53c9x_done(status:%x)] ", ccb->ccb_h.status)); ti = &sc->sc_tinfo[ccb->ccb_h.target_id]; lun = ccb->ccb_h.target_lun; - li = TINFO_LUN(ti, lun); + li = TINFO_LUN(ti, lun); untimeout(ncr53c9x_timeout, ecb, ccb->ccb_h.timeout_ch); @@ -1312,7 +1323,7 @@ ncr53c9x_done(struct ncr53c9x_softc *sc, if ((ecb->flags & ECB_SENSE) != 0) ccb->ccb_h.status = CAM_AUTOSENSE_FAIL; else { - /* First, save the return values */ + /* First, save the return values. */ ccb->csio.resid = ecb->dleft; ncr53c9x_sense(sc, ecb); return; @@ -1353,7 +1364,7 @@ ncr53c9x_done(struct ncr53c9x_softc *sc, } if (ccb->ccb_h.status == CAM_SEL_TIMEOUT) { - /* Selection timeout -- discard this LUN if empty */ + /* Selection timeout -- discard this LUN if empty. */ if (li->untagged == NULL && li->used == 0) { if (lun < NCR_NLUN) ti->lun[lun] = NULL; @@ -1370,8 +1381,8 @@ ncr53c9x_done(struct ncr53c9x_softc *sc, static void ncr53c9x_dequeue(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb) { - struct ncr53c9x_tinfo *ti; struct ncr53c9x_linfo *li; + struct ncr53c9x_tinfo *ti; int64_t lun; ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id]; @@ -1380,7 +1391,7 @@ ncr53c9x_dequeue(struct ncr53c9x_softc * #ifdef DIAGNOSTIC if (li == NULL || li->lun != lun) panic("ncr53c9x_dequeue: lun %qx for ecb %p does not exist", - (long long) lun, ecb); + (long long)lun, ecb); #endif if (li->untagged == ecb) { li->busy = 0; @@ -1392,8 +1403,7 @@ ncr53c9x_dequeue(struct ncr53c9x_softc * (li->queued[ecb->tag[1]] != ecb)) panic("ncr53c9x_dequeue: slot %d for lun %qx has %p " "instead of ecb %p\n", ecb->tag[1], - (long long) lun, - li->queued[ecb->tag[1]], ecb); + (long long)lun, li->queued[ecb->tag[1]], ecb); #endif li->queued[ecb->tag[1]] = NULL; li->used--; @@ -1411,16 +1421,15 @@ ncr53c9x_dequeue(struct ncr53c9x_softc * /* * Schedule an outgoing message by prioritizing it, and asserting - * attention on the bus. We can only do this when we are the initiator + * attention on the bus. We can only do this when we are the initiator * else there will be an illegal command interrupt. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 14:43:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62DD8106564A; Sun, 16 Nov 2008 14:43:33 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 577118FC18; Sun, 16 Nov 2008 14:43:33 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGEhXaO055869; Sun, 16 Nov 2008 14:43:33 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGEhXFO055868; Sun, 16 Nov 2008 14:43:33 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200811161443.mAGEhXFO055868@svn.freebsd.org> From: Ed Schouten Date: Sun, 16 Nov 2008 14:43:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185000 - head/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 14:43:33 -0000 Author: ed Date: Sun Nov 16 14:43:33 2008 New Revision: 185000 URL: http://svn.freebsd.org/changeset/base/185000 Log: Add a comment to utmp.h about the sizes of UT_HOSTSIZE and UT_LINESIZE. UT_HOSTSIZE and UT_LINESIZE are too small right now. If we ever bump UT_HOSTSIZE, we must not forget to increase UT_LINESIZE as well. If we add a comment, we're pretty sure we increase both values at the same time. PR: bin/108743 (maybe others) Modified: head/include/utmp.h Modified: head/include/utmp.h ============================================================================== --- head/include/utmp.h Sun Nov 16 13:19:47 2008 (r184999) +++ head/include/utmp.h Sun Nov 16 14:43:33 2008 (r185000) @@ -46,6 +46,13 @@ #define _PATH_WTMP "/var/log/wtmp" #define _PATH_LASTLOG "/var/log/lastlog" +/* + * XXX: These values are too low, but cannot be changed without breaking + * the file format. Right now pts(4) is limited to 1000 instances, + * because /dev/pts/1000 would require UT_LINESIZE to be bigger. + * UT_HOSTSIZE is also too small to hold most common hostnames or IPv6 + * addresses. + */ #define UT_NAMESIZE 16 /* see MAXLOGNAME in */ #define UT_LINESIZE 8 #define UT_HOSTSIZE 16 From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 14:55:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8074C1065670; Sun, 16 Nov 2008 14:55:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 713AF8FC19; Sun, 16 Nov 2008 14:55:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGEtxQB056643; Sun, 16 Nov 2008 14:55:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGEtxSt056640; Sun, 16 Nov 2008 14:55:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811161455.mAGEtxSt056640@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Nov 2008 14:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185001 - in stable/7/sys: . dev/esp dev/le modules/cxgb sparc64/sbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 14:55:59 -0000 Author: marius Date: Sun Nov 16 14:55:58 2008 New Revision: 185001 URL: http://svn.freebsd.org/changeset/base/185001 Log: MFC: r182876 Adapt the locking of esp(4) to MPSAFE cam(4) (so that ncr53c9x_intr() actually is INTR_MPSAFE now) and fix a couple of bugs which lead to panics, amongst other improvements. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/esp/esp_sbus.c stable/7/sys/dev/esp/ncr53c9x.c stable/7/sys/dev/esp/ncr53c9xreg.h stable/7/sys/dev/esp/ncr53c9xvar.h stable/7/sys/dev/le/if_le_ledma.c stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/sparc64/sbus/dma_sbus.c stable/7/sys/sparc64/sbus/lsi64854.c stable/7/sys/sparc64/sbus/lsi64854var.h Modified: stable/7/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/7/sys/dev/esp/esp_sbus.c Sun Nov 16 14:43:33 2008 (r185000) +++ stable/7/sys/dev/esp/esp_sbus.c Sun Nov 16 14:55:58 2008 (r185001) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004 Scott Long + * Copyright (c) 2005 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,8 +72,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include -#include +#include #include #include @@ -83,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -97,12 +100,8 @@ struct esp_softc { struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */ struct device *sc_dev; - int sc_rid; struct resource *sc_res; - bus_space_handle_t sc_regh; - bus_space_tag_t sc_regt; - int sc_irqrid; struct resource *sc_irqres; void *sc_irq; @@ -155,8 +154,6 @@ static driver_t esp_sbus_driver = { DRIVER_MODULE(esp, sbus, esp_sbus_driver, esp_devclass, 0, 0); MODULE_DEPEND(esp, sbus, 1, 1, 1); -MODULE_DEPEND(esp, cam, 1, 1, 1); - /* * Functions and the switch for the MI code */ @@ -170,9 +167,11 @@ static int esp_dma_setup(struct ncr53c9x static void esp_dma_go(struct ncr53c9x_softc *sc); static void esp_dma_stop(struct ncr53c9x_softc *sc); static int esp_dma_isactive(struct ncr53c9x_softc *sc); -static int espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep); +static int espattach(struct esp_softc *esc, + const struct ncr53c9x_glue *gluep); +static int espdetach(struct esp_softc *esc); -static struct ncr53c9x_glue esp_sbus_glue = { +static const struct ncr53c9x_glue esp_sbus_glue = { esp_read_reg, esp_write_reg, esp_dma_isintr, @@ -209,29 +208,16 @@ esp_sbus_attach(device_t dev) struct ncr53c9x_softc *sc; struct lsi64854_softc *lsc; device_t *children; - const char *name; - phandle_t node; - int burst, error, i, nchildren, slot; + int error, i, nchildren; esc = device_get_softc(dev); - bzero(esc, sizeof(struct esp_softc)); sc = &esc->sc_ncr53c9x; lsc = NULL; esc->sc_dev = dev; - name = ofw_bus_get_name(dev); - node = ofw_bus_get_node(dev); - if (OF_getprop(node, "initiator-id", &sc->sc_id, - sizeof(sc->sc_id)) == -1) - sc->sc_id = 7; sc->sc_freq = sbus_get_clockfreq(dev); -#ifdef ESP_SBUS_DEBUG - device_printf(dev, "%s: sc_id %d, freq %d\n", __func__, sc->sc_id, - sc->sc_freq); -#endif - - if (strcmp(name, "SUNW,fas") == 0) { + if (strcmp(ofw_bus_get_name(dev), "SUNW,fas") == 0) { /* * Allocate space for DMA, in SUNW,fas there are no * separate DMA devices. @@ -250,20 +236,18 @@ esp_sbus_attach(device_t dev) */ /* Allocate DMA registers. */ - lsc->sc_rid = 0; + i = 0; if ((lsc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &lsc->sc_rid, RF_ACTIVE)) == NULL) { + &i, RF_ACTIVE)) == NULL) { device_printf(dev, "cannot allocate DMA registers\n"); error = ENXIO; goto fail_sbus_lsc; } - lsc->sc_regt = rman_get_bustag(lsc->sc_res); - lsc->sc_regh = rman_get_bushandle(lsc->sc_res); /* Create a parent DMA tag based on this bus. */ error = bus_dma_tag_create( bus_get_dma_tag(dev), /* parent */ - PAGE_SIZE, 0, /* alignment, boundary */ + 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -277,38 +261,31 @@ esp_sbus_attach(device_t dev) device_printf(dev, "cannot allocate parent DMA tag\n"); goto fail_sbus_lres; } - burst = sbus_get_burstsz(dev); + + i = sbus_get_burstsz(dev); #ifdef ESP_SBUS_DEBUG - printf("%s: burst 0x%x\n", __func__, burst); + printf("%s: burst 0x%x\n", __func__, i); #endif - lsc->sc_burst = (burst & SBUS_BURST_32) ? 32 : - (burst & SBUS_BURST_16) ? 16 : 0; + lsc->sc_burst = (i & SBUS_BURST_32) ? 32 : + (i & SBUS_BURST_16) ? 16 : 0; lsc->sc_channel = L64854_CHANNEL_SCSI; lsc->sc_client = sc; lsc->sc_dev = dev; - error = lsi64854_attach(lsc); - if (error != 0) { - device_printf(dev, "lsi64854_attach failed\n"); - goto fail_sbus_lpdma; - } - /* * Allocate SCSI core registers. */ - esc->sc_rid = 1; + i = 1; if ((esc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &esc->sc_rid, RF_ACTIVE)) == NULL) { + &i, RF_ACTIVE)) == NULL) { device_printf(dev, "cannot allocate SCSI core registers\n"); error = ENXIO; - goto fail_sbus_lsi; + goto fail_sbus_lpdma; } - esc->sc_regt = rman_get_bustag(esc->sc_res); - esc->sc_regh = rman_get_bushandle(esc->sc_res); } else { /* * Search accompanying DMA engine. It should have been @@ -319,10 +296,9 @@ esp_sbus_attach(device_t dev) device_printf(dev, "cannot determine siblings\n"); return (ENXIO); } - slot = sbus_get_slot(dev); for (i = 0; i < nchildren; i++) { if (device_is_attached(children[i]) && - sbus_get_slot(children[i]) == slot && + sbus_get_slot(children[i]) == sbus_get_slot(dev) && strcmp(ofw_bus_get_name(children[i]), "dma") == 0) { /* XXX hackery */ esc->sc_dma = (struct lsi64854_softc *) @@ -340,15 +316,13 @@ esp_sbus_attach(device_t dev) /* * Allocate SCSI core registers. */ - esc->sc_rid = 0; + i = 0; if ((esc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &esc->sc_rid, RF_ACTIVE)) == NULL) { + &i, RF_ACTIVE)) == NULL) { device_printf(dev, "cannot allocate SCSI core registers\n"); return (ENXIO); } - esc->sc_regt = rman_get_bustag(esc->sc_res); - esc->sc_regh = rman_get_bushandle(esc->sc_res); } error = espattach(esc, &esp_sbus_glue); @@ -360,15 +334,15 @@ esp_sbus_attach(device_t dev) return (0); fail_sbus_eres: - bus_release_resource(dev, SYS_RES_MEMORY, esc->sc_rid, esc->sc_res); - if (strcmp(name, "SUNW,fas") != 0) + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), + esc->sc_res); + if (strcmp(ofw_bus_get_name(dev), "SUNW,fas") != 0) return (error); - fail_sbus_lsi: - lsi64854_detach(lsc); fail_sbus_lpdma: bus_dma_tag_destroy(lsc->sc_parent_dmat); fail_sbus_lres: - bus_release_resource(dev, SYS_RES_MEMORY, lsc->sc_rid, lsc->sc_res); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lsc->sc_res), + lsc->sc_res); fail_sbus_lsc: free(lsc, M_DEVBUF); return (error); @@ -378,28 +352,22 @@ static int esp_sbus_detach(device_t dev) { struct esp_softc *esc; - struct ncr53c9x_softc *sc; struct lsi64854_softc *lsc; int error; esc = device_get_softc(dev); - sc = &esc->sc_ncr53c9x; lsc = esc->sc_dma; - bus_teardown_intr(esc->sc_dev, esc->sc_irqres, esc->sc_irq); - error = ncr53c9x_detach(sc); + error = espdetach(esc); if (error != 0) return (error); - bus_release_resource(esc->sc_dev, SYS_RES_IRQ, esc->sc_irqrid, - esc->sc_irqres); - bus_release_resource(dev, SYS_RES_MEMORY, esc->sc_rid, esc->sc_res); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), + esc->sc_res); if (strcmp(ofw_bus_get_name(dev), "SUNW,fas") != 0) return (0); - error = lsi64854_detach(lsc); - if (error != 0) - return (error); bus_dma_tag_destroy(lsc->sc_parent_dmat); - bus_release_resource(dev, SYS_RES_MEMORY, lsc->sc_rid, lsc->sc_res); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lsc->sc_res), + lsc->sc_res); free(lsc, M_DEVBUF); return (0); @@ -410,29 +378,18 @@ esp_dma_attach(device_t dev) { struct esp_softc *esc; struct ncr53c9x_softc *sc; - phandle_t node; - int error; + int error, i; esc = device_get_softc(dev); - bzero(esc, sizeof(struct esp_softc)); sc = &esc->sc_ncr53c9x; esc->sc_dev = dev; - node = ofw_bus_get_node(dev); - if (OF_getprop(node, "initiator-id", &sc->sc_id, - sizeof(sc->sc_id)) == -1) - sc->sc_id = 7; - if (OF_getprop(node, "clock-frequency", &sc->sc_freq, - sizeof(sc->sc_freq)) == -1) { + if (OF_getprop(ofw_bus_get_node(dev), "clock-frequency", + &sc->sc_freq, sizeof(sc->sc_freq)) == -1) { printf("failed to query OFW for clock-frequency\n"); return (ENXIO); } -#ifdef ESP_SBUS_DEBUG - device_printf(dev, "%s: sc_id %d, freq %d\n", __func__, sc->sc_id, - sc->sc_freq); -#endif - /* XXX hackery */ esc->sc_dma = (struct lsi64854_softc *) device_get_softc(device_get_parent(dev)); @@ -441,14 +398,12 @@ esp_dma_attach(device_t dev) /* * Allocate SCSI core registers. */ - esc->sc_rid = 0; + i = 0; if ((esc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &esc->sc_rid, RF_ACTIVE)) == NULL) { + &i, RF_ACTIVE)) == NULL) { device_printf(dev, "cannot allocate SCSI core registers\n"); return (ENXIO); } - esc->sc_regt = rman_get_bustag(esc->sc_res); - esc->sc_regh = rman_get_bushandle(esc->sc_res); error = espattach(esc, &esp_sbus_glue); if (error != 0) { @@ -459,7 +414,8 @@ esp_dma_attach(device_t dev) return (0); fail_dma_eres: - bus_release_resource(dev, SYS_RES_MEMORY, esc->sc_rid, esc->sc_res); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), + esc->sc_res); return (error); } @@ -467,19 +423,15 @@ static int esp_dma_detach(device_t dev) { struct esp_softc *esc; - struct ncr53c9x_softc *sc; int error; esc = device_get_softc(dev); - sc = &esc->sc_ncr53c9x; - bus_teardown_intr(esc->sc_dev, esc->sc_irqres, esc->sc_irq); - error = ncr53c9x_detach(sc); + error = espdetach(esc); if (error != 0) return (error); - bus_release_resource(esc->sc_dev, SYS_RES_IRQ, esc->sc_irqrid, - esc->sc_irqres); - bus_release_resource(dev, SYS_RES_MEMORY, esc->sc_rid, esc->sc_res); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), + esc->sc_res); return (0); } @@ -499,11 +451,29 @@ esp_resume(device_t dev) } static int -espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep) +espattach(struct esp_softc *esc, const struct ncr53c9x_glue *gluep) { struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; unsigned int uid = 0; - int error; + int error, i; + + NCR_LOCK_INIT(sc); + + /* Attach the DMA engine. */ + error = lsi64854_attach(esc->sc_dma); + if (error != 0) { + device_printf(esc->sc_dev, "lsi64854_attach failed\n"); + goto fail_lock; + } + + if (OF_getprop(ofw_bus_get_node(esc->sc_dev), "scsi-initiator-id", + &sc->sc_id, sizeof(sc->sc_id)) == -1) + sc->sc_id = 7; + +#ifdef ESP_SBUS_DEBUG + device_printf(esc->sc_dev, "%s: sc_id %d, freq %d\n", + __func__, sc->sc_id, sc->sc_freq); +#endif /* * The `ESC' DMA chip must be reset before we can access @@ -598,7 +568,7 @@ espattach(struct esp_softc *esc, struct */ device_printf(esc->sc_dev, "Unknown chip\n"); - return (ENXIO); + goto fail_lsi; } } } @@ -635,20 +605,20 @@ espattach(struct esp_softc *esc, struct */ switch (sc->sc_rev) { case NCR_VARIANT_ESP100: - sc->sc_maxwidth = 0; + sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; sc->sc_maxxfer = 64 * 1024; sc->sc_minsync = 0; /* No synch on old chip? */ break; case NCR_VARIANT_ESP100A: - sc->sc_maxwidth = 0; + sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; sc->sc_maxxfer = 64 * 1024; /* Min clocks/byte is 5 */ sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); break; case NCR_VARIANT_ESP200: - sc->sc_maxwidth = 0; + sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; sc->sc_maxxfer = 16 * 1024 * 1024; /* Min clocks/byte is 5 */ sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); @@ -670,28 +640,26 @@ espattach(struct esp_softc *esc, struct sc->sc_features = NCR_F_FASTSCSI; sc->sc_cfg3 = NCRF9XCFG3_FCLK; sc->sc_cfg3_fscsi = NCRF9XCFG3_FSCSI; - sc->sc_maxwidth = 0; + sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; sc->sc_maxxfer = 16 * 1024 * 1024; break; case NCR_VARIANT_FAS366: - sc->sc_maxwidth = 1; + sc->sc_maxwidth = MSG_EXT_WDTR_BUS_16_BIT; sc->sc_maxxfer = 16 * 1024 * 1024; break; } - /* Limit minsync due to unsolved performance issues. */ - sc->sc_maxsync = sc->sc_minsync; - /* Establish interrupt channel. */ - esc->sc_irqrid = 0; + i = 0; if ((esc->sc_irqres = bus_alloc_resource_any(esc->sc_dev, SYS_RES_IRQ, - &esc->sc_irqrid, RF_SHAREABLE|RF_ACTIVE)) == NULL) { + &i, RF_SHAREABLE|RF_ACTIVE)) == NULL) { device_printf(esc->sc_dev, "cannot allocate interrupt\n"); - return (ENXIO); + goto fail_lsi; } if (bus_setup_intr(esc->sc_dev, esc->sc_irqres, - INTR_TYPE_BIO|INTR_MPSAFE, NULL, ncr53c9x_intr, sc, &esc->sc_irq)) { + INTR_MPSAFE | INTR_TYPE_CAM, NULL, ncr53c9x_intr, sc, + &esc->sc_irq)) { device_printf(esc->sc_dev, "cannot set up interrupt\n"); error = ENXIO; goto fail_ires; @@ -714,19 +682,43 @@ espattach(struct esp_softc *esc, struct fail_intr: bus_teardown_intr(esc->sc_dev, esc->sc_irqres, esc->sc_irq); fail_ires: - bus_release_resource(esc->sc_dev, SYS_RES_IRQ, esc->sc_irqrid, - esc->sc_irqres); + bus_release_resource(esc->sc_dev, SYS_RES_IRQ, + rman_get_rid(esc->sc_irqres), esc->sc_irqres); + fail_lsi: + lsi64854_detach(esc->sc_dma); + fail_lock: + NCR_LOCK_DESTROY(sc); return (error); } +static int +espdetach(struct esp_softc *esc) +{ + struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; + int error; + + bus_teardown_intr(esc->sc_dev, esc->sc_irqres, esc->sc_irq); + error = ncr53c9x_detach(sc); + if (error != 0) + return (error); + error = lsi64854_detach(esc->sc_dma); + if (error != 0) + return (error); + NCR_LOCK_DESTROY(sc); + bus_release_resource(esc->sc_dev, SYS_RES_IRQ, + rman_get_rid(esc->sc_irqres), esc->sc_irqres); + + return (0); +} + /* * Glue functions */ #ifdef ESP_SBUS_DEBUG -int esp_sbus_debug = 0; +static int esp_sbus_debug = 0; -static struct { +static const struct { char *r_name; int r_flag; } esp__read_regnames [] = { @@ -748,7 +740,7 @@ static struct { { "TCX", 1}, /* f/3c */ }; -static struct { +static const struct { char *r_name; int r_flag; } esp__write_regnames[] = { @@ -777,13 +769,15 @@ esp_read_reg(struct ncr53c9x_softc *sc, struct esp_softc *esc = (struct esp_softc *)sc; u_char v; - v = bus_space_read_1(esc->sc_regt, esc->sc_regh, reg * 4); + v = bus_read_1(esc->sc_res, reg * 4); + #ifdef ESP_SBUS_DEBUG if (esp_sbus_debug && (reg < 0x10) && esp__read_regnames[reg].r_flag) - printf("RD:%x <%s> %x\n", reg * 4, - ((unsigned)reg < 0x10) ? esp__read_regnames[reg].r_name : "<***>", v); + printf("RD:%x <%s> %x\n", reg * 4, ((unsigned)reg < 0x10) ? + esp__read_regnames[reg].r_name : "<***>", v); #endif - return v; + + return (v); } static void @@ -793,10 +787,11 @@ esp_write_reg(struct ncr53c9x_softc *sc, #ifdef ESP_SBUS_DEBUG if (esp_sbus_debug && (reg < 0x10) && esp__write_regnames[reg].r_flag) - printf("WR:%x <%s> %x\n", reg * 4, - ((unsigned)reg < 0x10) ? esp__write_regnames[reg].r_name : "<***>", v); + printf("WR:%x <%s> %x\n", reg * 4, ((unsigned)reg < 0x10) ? + esp__write_regnames[reg].r_name : "<***>", v); #endif - bus_space_write_1(esc->sc_regt, esc->sc_regh, reg * 4, v); + + bus_write_1(esc->sc_res, reg * 4, v); } static int Modified: stable/7/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/7/sys/dev/esp/ncr53c9x.c Sun Nov 16 14:43:33 2008 (r185000) +++ stable/7/sys/dev/esp/ncr53c9x.c Sun Nov 16 14:55:58 2008 (r185001) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004 Scott Long + * Copyright (c) 2005, 2008 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,7 +26,7 @@ * */ -/* $NetBSD: ncr53c9x.c,v 1.114 2005/02/27 00:27:02 perry Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.125 2007/01/09 12:53:12 itohy Exp $ */ /*- * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -111,8 +112,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include #include #include @@ -129,14 +130,22 @@ __FBSDID("$FreeBSD$"); #include #include -int ncr53c9x_debug = +MODULE_DEPEND(esp, cam, 1, 1, 1); + +#ifdef NCR53C9X_DEBUG +static int ncr53c9x_debug = NCR_SHOWMISC /* | NCR_SHOWPHASE | NCR_SHOWTRAC | NCR_SHOWCMDS */; -#ifdef DEBUG -int ncr53c9x_notag = 0; #endif static void ncr53c9x_abort(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb); +static void ncr53c9x_action(struct cam_sim *sim, union ccb *ccb); +static void ncr53c9x_async(void *cbarg, uint32_t code, + struct cam_path *path, void *arg); +static void ncr53c9x_callout(void *arg); +static void ncr53c9x_clear(struct ncr53c9x_softc *sc, cam_status result); +static void ncr53c9x_clear_target(struct ncr53c9x_softc *sc, int target, + cam_status result); static void ncr53c9x_dequeue(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb); static void ncr53c9x_done(struct ncr53c9x_softc *sc, @@ -145,17 +154,18 @@ static void ncr53c9x_free_ecb(struct ncr struct ncr53c9x_ecb *ecb); static void ncr53c9x_msgin(struct ncr53c9x_softc *sc); static void ncr53c9x_msgout(struct ncr53c9x_softc *sc); +static void ncr53c9x_init(struct ncr53c9x_softc *sc, int doreset); +static void ncr53c9x_intr1(struct ncr53c9x_softc *sc); static void ncr53c9x_poll(struct cam_sim *sim); static int ncr53c9x_rdfifo(struct ncr53c9x_softc *sc, int how); static int ncr53c9x_reselect(struct ncr53c9x_softc *sc, int message, int tagtype, int tagid); +static void ncr53c9x_reset(struct ncr53c9x_softc *sc); static void ncr53c9x_sense(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb); -static void ncr53c9x_scsi_reset(struct ncr53c9x_softc *sc); static void ncr53c9x_sched(struct ncr53c9x_softc *sc); static void ncr53c9x_select(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb); -static void ncr53c9x_timeout(void *arg); static void ncr53c9x_watch(void *arg); static void ncr53c9x_wrfifo(struct ncr53c9x_softc *sc, u_char *p, int len); @@ -238,7 +248,12 @@ ncr53c9x_attach(struct ncr53c9x_softc *s struct ncr53c9x_ecb *ecb; int error, i; - mtx_init(&sc->sc_lock, "ncr", "ncr53c9x lock", MTX_DEF); + if (NCR_LOCK_INITIALIZED(sc) == 0) { + device_printf(sc->sc_dev, "mutex not initialized\n"); + return (ENXIO); + } + + callout_init_mtx(&sc->sc_watchdog, &sc->sc_lock, 0); /* * Note, the front-end has set us up to print the chip variation. @@ -292,8 +307,6 @@ ncr53c9x_attach(struct ncr53c9x_softc *s goto fail_imess; } - callout_init(&sc->sc_watchdog, 0); - /* * Treat NCR53C90 with the 86C01 DMA chip exactly as ESP100 * from now on. @@ -334,16 +347,19 @@ ncr53c9x_attach(struct ncr53c9x_softc *s } sim = cam_sim_alloc(ncr53c9x_action, ncr53c9x_poll, "esp", sc, - device_get_unit(sc->sc_dev), &Giant, 1, NCR_TAG_DEPTH, devq); + device_get_unit(sc->sc_dev), &sc->sc_lock, 1, NCR_TAG_DEPTH, devq); if (sim == NULL) { device_printf(sc->sc_dev, "cannot allocate SIM entry\n"); error = ENOMEM; goto fail_devq; } + + NCR_LOCK(sc); + if (xpt_bus_register(sim, sc->sc_dev, 0) != CAM_SUCCESS) { device_printf(sc->sc_dev, "cannot register bus\n"); error = EIO; - goto fail_sim; + goto fail_lock; } if (xpt_create_path(&path, NULL, cam_sim_path(sim), @@ -353,6 +369,13 @@ ncr53c9x_attach(struct ncr53c9x_softc *s goto fail_bus; } + if (xpt_register_async(AC_LOST_DEVICE, ncr53c9x_async, sim, path) != + CAM_REQ_CMP) { + device_printf(sc->sc_dev, "cannot register async handler\n"); + error = EIO; + goto fail_path; + } + sc->sc_sim = sim; sc->sc_path = path; @@ -371,7 +394,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s M_NOWAIT | M_ZERO)) == NULL) { device_printf(sc->sc_dev, "cannot allocate ECB array\n"); error = ENOMEM; - goto fail_path; + goto fail_async; } for (i = 0; i < NCR_TAG_DEPTH; i++) { ecb = &sc->ecb_array[i]; @@ -380,15 +403,20 @@ ncr53c9x_attach(struct ncr53c9x_softc *s TAILQ_INSERT_HEAD(&sc->free_list, ecb, free_links); } - callout_reset(&sc->sc_watchdog, 60*hz, ncr53c9x_watch, sc); + callout_reset(&sc->sc_watchdog, 60 * hz, ncr53c9x_watch, sc); + + NCR_UNLOCK(sc); return (0); +fail_async: + xpt_register_async(0, ncr53c9x_async, sim, path); fail_path: xpt_free_path(path); fail_bus: xpt_bus_deregister(cam_sim_path(sim)); -fail_sim: +fail_lock: + NCR_UNLOCK(sc); cam_sim_free(sim, TRUE); fail_devq: cam_simq_free(devq); @@ -406,13 +434,33 @@ fail_omess: int ncr53c9x_detach(struct ncr53c9x_softc *sc) { + struct ncr53c9x_linfo *li, *nextli; + int t; callout_drain(&sc->sc_watchdog); - mtx_lock(&sc->sc_lock); - ncr53c9x_init(sc, 1); - mtx_unlock(&sc->sc_lock); + + NCR_LOCK(sc); + + if (sc->sc_tinfo) { + /* Cancel all commands. */ + ncr53c9x_clear(sc, CAM_REQ_ABORTED); + + /* Free logical units. */ + for (t = 0; t < sc->sc_ntarg; t++) { + for (li = LIST_FIRST(&sc->sc_tinfo[t].luns); li; + li = nextli) { + nextli = LIST_NEXT(li, link); + free(li, M_DEVBUF); + } + } + } + + xpt_register_async(0, ncr53c9x_async, sc->sc_sim, sc->sc_path); xpt_free_path(sc->sc_path); xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + + NCR_UNLOCK(sc); + cam_sim_free(sc->sc_sim, TRUE); free(sc->ecb_array, M_DEVBUF); free(sc->sc_tinfo, M_DEVBUF); @@ -420,7 +468,6 @@ ncr53c9x_detach(struct ncr53c9x_softc *s free(sc->sc_imess, M_DEVBUF); if (sc->sc_omess_self) free(sc->sc_omess, M_DEVBUF); - mtx_destroy(&sc->sc_lock); return (0); } @@ -433,10 +480,12 @@ ncr53c9x_detach(struct ncr53c9x_softc *s * After reset, registers are loaded with the defaults from the attach * routine above. */ -void +static void ncr53c9x_reset(struct ncr53c9x_softc *sc) { + NCR_LOCK_ASSERT(sc, MA_OWNED); + /* Reset DMA first. */ NCRDMA_RESET(sc); @@ -477,9 +526,11 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc sc->sc_features |= NCR_F_HASCFG3 | NCR_F_FASTSCSI | NCR_F_SELATN3; sc->sc_cfg3 = NCRFASCFG3_FASTCLK | NCRFASCFG3_OBAUTO; + if (sc->sc_id > 7) + sc->sc_cfg3 |= NCRFASCFG3_IDBIT3; sc->sc_cfg3_fscsi = NCRFASCFG3_FASTSCSI; NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); - sc->sc_cfg2 = 0; /* NCRCFG2_HMEFE | NCRCFG2_HME32 */ + sc->sc_cfg2 = NCRCFG2_HMEFE | NCRCFG2_HME32; NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); NCR_WRITE_REG(sc, NCR_CFG1, sc->sc_cfg1); NCR_WRITE_REG(sc, NCR_CCF, sc->sc_ccf); @@ -509,29 +560,73 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc } /* - * Reset the SCSI bus, but not the chip. + * Clear all commands. */ static void -ncr53c9x_scsi_reset(struct ncr53c9x_softc *sc) +ncr53c9x_clear(struct ncr53c9x_softc *sc, cam_status result) { + struct ncr53c9x_ecb *ecb; + int r; - (*sc->sc_glue->gl_dma_stop)(sc); + NCR_LOCK_ASSERT(sc, MA_OWNED); - NCR_MISC(("%s: resetting SCSI bus\n", device_get_nameunit(sc->sc_dev))); - NCRCMD(sc, NCRCMD_RSTSCSI); - DELAY(250000); /* Give the bus a fighting chance to settle */ + /* Cancel any active commands. */ + sc->sc_state = NCR_CLEANING; + sc->sc_msgify = 0; + if ((ecb = sc->sc_nexus) != NULL) { + ecb->ccb->ccb_h.status = result; + ncr53c9x_done(sc, ecb); + } + /* Cancel outstanding disconnected commands. */ + for (r = 0; r < sc->sc_ntarg; r++) + ncr53c9x_clear_target(sc, r, result); } /* - * Initialize ncr53c9x state machine. + * Clear all commands for a specific target. */ -void -ncr53c9x_init(struct ncr53c9x_softc *sc, int doreset) +static void +ncr53c9x_clear_target(struct ncr53c9x_softc *sc, int target, + cam_status result) { struct ncr53c9x_ecb *ecb; struct ncr53c9x_linfo *li; + int i; + + NCR_LOCK_ASSERT(sc, MA_OWNED); + + /* Cancel outstanding disconnected commands on each LUN. */ + LIST_FOREACH(li, &sc->sc_tinfo[target].luns, link) { + if ((ecb = li->untagged) != NULL) { + li->untagged = NULL; + /* + * XXX should we terminate a command + * that never reached the disk? + */ + li->busy = 0; + ecb->ccb->ccb_h.status = result; + ncr53c9x_done(sc, ecb); + } + for (i = 0; i < NCR_TAG_DEPTH; i++) + if ((ecb = li->queued[i])) { + li->queued[i] = NULL; + ecb->ccb->ccb_h.status = result; + ncr53c9x_done(sc, ecb); + } + li->used = 0; + } +} + +/* + * Initialize ncr53c9x state machine. + */ +static void +ncr53c9x_init(struct ncr53c9x_softc *sc, int doreset) +{ struct ncr53c9x_tinfo *ti; - int i, r; + int r; + + NCR_LOCK_ASSERT(sc, MA_OWNED); NCR_MISC(("[NCR_INIT(%d) %d] ", doreset, sc->sc_state)); @@ -544,41 +639,8 @@ ncr53c9x_init(struct ncr53c9x_softc *sc, for (r = 0; r < sc->sc_ntarg; r++) { LIST_INIT(&sc->sc_tinfo[r].luns); } - } else { - /* Cancel any active commands. */ - sc->sc_state = NCR_CLEANING; - sc->sc_msgify = 0; - if ((ecb = sc->sc_nexus) != NULL) { - ecb->ccb->ccb_h.status = CAM_CMD_TIMEOUT; - ncr53c9x_done(sc, ecb); - } - /* Cancel outstanding disconnected commands on each LUN. */ - for (r = 0; r < sc->sc_ntarg; r++) { - LIST_FOREACH(li, &sc->sc_tinfo[r].luns, link) { - if ((ecb = li->untagged) != NULL) { - li->untagged = NULL; - /* - * XXX - * - * Should we terminate a command - * that never reached the disk? - */ - li->busy = 0; - ecb->ccb->ccb_h.status = - CAM_CMD_TIMEOUT; - ncr53c9x_done(sc, ecb); - } - for (i = 0; i < 256; i++) - if ((ecb = li->queued[i])) { - li->queued[i] = NULL; - ecb->ccb->ccb_h.status = - CAM_CMD_TIMEOUT; - ncr53c9x_done(sc, ecb); - } - li->used = 0; - } - } - } + } else + ncr53c9x_clear(sc, CAM_CMD_TIMEOUT); /* * Reset the chip to a known state. @@ -589,27 +651,42 @@ ncr53c9x_init(struct ncr53c9x_softc *sc, sc->sc_msgpriq = sc->sc_msgout = sc->sc_msgoutq = 0; sc->sc_phase = sc->sc_prevphase = INVALID_PHASE; - for (r = 0; r < sc->sc_ntarg; r++) { - ti = &sc->sc_tinfo[r]; + /* + * If we're the first time through, set the default parameters + * for all targets. Otherwise we only clear their current transfer + * settings so we'll renegotiate their goal settings with the next + * command. + */ + if (sc->sc_state == 0) { + for (r = 0; r < sc->sc_ntarg; r++) { + ti = &sc->sc_tinfo[r]; /* XXX - config flags per target: low bits: no reselect; high bits: no synch */ - ti->flags = ((sc->sc_minsync != 0 && - (sc->sc_cfflags & (1 << ((r & 7) + 8))) == 0) ? - 0 : T_SYNCHOFF) | - ((sc->sc_cfflags & (1 << (r & 7))) == 0 ? - 0 : T_RSELECTOFF); -#ifdef DEBUG - if (ncr53c9x_notag) - ti->flags &= ~T_TAG; -#endif - ti->period = sc->sc_minsync; - ti->offset = 0; - ti->cfg3 = 0; + ti->flags = ((sc->sc_minsync != 0 && + (sc->sc_cfflags & (1 << ((r & 7) + 8))) == 0) ? + 0 : T_SYNCHOFF) | + ((sc->sc_cfflags & (1 << (r & 7))) == 0 ? + 0 : T_RSELECTOFF); + ti->curr.period = ti->goal.period = 0; + ti->curr.offset = ti->goal.offset = 0; + ti->curr.width = ti->goal.width = + MSG_EXT_WDTR_BUS_8_BIT; + } + } else { + for (r = 0; r < sc->sc_ntarg; r++) { + ti = &sc->sc_tinfo[r]; + ti->flags &= ~(T_SDTRSENT | T_WDTRSENT); + ti->curr.period = 0; + ti->curr.offset = 0; + ti->curr.width = MSG_EXT_WDTR_BUS_8_BIT; + } } if (doreset) { sc->sc_state = NCR_SBR; NCRCMD(sc, NCRCMD_RSTSCSI); + /* Give the bus a fighting chance to settle. */ + DELAY(250000); } else { sc->sc_state = NCR_IDLE; ncr53c9x_sched(sc); @@ -629,6 +706,8 @@ static inline void ncr53c9x_readregs(struct ncr53c9x_softc *sc) { + NCR_LOCK_ASSERT(sc, MA_OWNED); + sc->sc_espstat = NCR_READ_REG(sc, NCR_STAT); /* Only the step bits are of interest. */ sc->sc_espstep = NCR_READ_REG(sc, NCR_STEP) & NCRSTEP_MASK; @@ -659,6 +738,9 @@ static inline int ncr53c9x_stp2cpb(struct ncr53c9x_softc *sc, int period) { int v; + + NCR_LOCK_ASSERT(sc, MA_OWNED); + v = (sc->sc_freq * period) / 250; if (ncr53c9x_cpb2stp(sc, v) < period) /* Correct round-down error. */ @@ -669,18 +751,20 @@ ncr53c9x_stp2cpb(struct ncr53c9x_softc * static inline void ncr53c9x_setsync(struct ncr53c9x_softc *sc, struct ncr53c9x_tinfo *ti) { - u_char syncoff, synctp; - u_char cfg3 = sc->sc_cfg3 | ti->cfg3; + u_char cfg3, syncoff, synctp; - if (ti->flags & T_SYNCMODE) { - syncoff = ti->offset; - synctp = ncr53c9x_stp2cpb(sc, ti->period); + NCR_LOCK_ASSERT(sc, MA_OWNED); + + cfg3 = sc->sc_cfg3; + if (ti->curr.offset != 0) { + syncoff = ti->curr.offset; + synctp = ncr53c9x_stp2cpb(sc, ti->curr.period); if (sc->sc_features & NCR_F_FASTSCSI) { /* * If the period is 200ns or less (ti->period <= 50), * put the chip in Fast SCSI mode. */ - if (ti->period <= 50) + if (ti->curr.period <= 50) /* * There are (at least) 4 variations of the * configuration 3 register. The drive attach @@ -703,6 +787,11 @@ ncr53c9x_setsync(struct ncr53c9x_softc * synctp = 0; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 15:45:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 357EC1065674; Sun, 16 Nov 2008 15:45:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28A178FC1A; Sun, 16 Nov 2008 15:45:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGFjfG4057852; Sun, 16 Nov 2008 15:45:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGFjfkH057849; Sun, 16 Nov 2008 15:45:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811161545.mAGFjfkH057849@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 16 Nov 2008 15:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185002 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 15:45:42 -0000 Author: kib Date: Sun Nov 16 15:45:41 2008 New Revision: 185002 URL: http://svn.freebsd.org/changeset/base/185002 Log: In the robust futexes list head, futex_offset shall be signed, and glibc actually supplies negative offsets. Change l_ulong to l_long. Submitted by: dchagin Modified: head/sys/amd64/linux32/linux.h head/sys/compat/linux/linux_futex.c head/sys/i386/linux/linux.h Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sun Nov 16 14:55:58 2008 (r185001) +++ head/sys/amd64/linux32/linux.h Sun Nov 16 15:45:41 2008 (r185002) @@ -892,7 +892,7 @@ struct linux_robust_list { struct linux_robust_list_head { struct linux_robust_list list; - l_ulong futex_offset; + l_long futex_offset; l_uintptr_t pending_list; }; Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Sun Nov 16 14:55:58 2008 (r185001) +++ head/sys/compat/linux/linux_futex.c Sun Nov 16 15:45:41 2008 (r185002) @@ -652,7 +652,7 @@ release_futexes(struct proc *p) struct linux_robust_list *entry, *next_entry, *pending; unsigned int limit = 2048, pi, next_pi, pip; struct linux_emuldata *em; - l_ulong futex_offset; + l_long futex_offset; int rc; em = em_find(p, EMUL_DONTLOCK); @@ -664,7 +664,7 @@ release_futexes(struct proc *p) if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi)) return; - if (copyin(&head->futex_offset, &futex_offset, sizeof(l_ulong))) + if (copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset))) return; if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Sun Nov 16 14:55:58 2008 (r185001) +++ head/sys/i386/linux/linux.h Sun Nov 16 15:45:41 2008 (r185002) @@ -862,7 +862,7 @@ struct linux_robust_list { struct linux_robust_list_head { struct linux_robust_list list; - l_ulong futex_offset; + l_long futex_offset; struct linux_robust_list *pending_list; }; From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 17:42:03 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38020106567D; Sun, 16 Nov 2008 17:42:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B4968FC1C; Sun, 16 Nov 2008 17:42:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGHg3ZO060800; Sun, 16 Nov 2008 17:42:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGHg2ln060788; Sun, 16 Nov 2008 17:42:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811161742.mAGHg2ln060788@svn.freebsd.org> From: John Baldwin Date: Sun, 16 Nov 2008 17:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185003 - in head/sys/dev: ppbus ppc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 17:42:03 -0000 Author: jhb Date: Sun Nov 16 17:42:02 2008 New Revision: 185003 URL: http://svn.freebsd.org/changeset/base/185003 Log: Various whitespace and style fixes. Modified: head/sys/dev/ppbus/if_plip.c head/sys/dev/ppbus/immio.c head/sys/dev/ppbus/lpbb.c head/sys/dev/ppbus/lpt.c head/sys/dev/ppbus/lpt.h head/sys/dev/ppbus/pcfclock.c head/sys/dev/ppbus/ppb_1284.c head/sys/dev/ppbus/ppb_base.c head/sys/dev/ppbus/ppb_msq.c head/sys/dev/ppbus/ppbconf.c head/sys/dev/ppbus/ppbconf.h head/sys/dev/ppbus/ppi.c head/sys/dev/ppbus/ppi.h head/sys/dev/ppbus/pps.c head/sys/dev/ppbus/vpo.c head/sys/dev/ppbus/vpoio.c head/sys/dev/ppbus/vpoio.h head/sys/dev/ppc/ppc.c head/sys/dev/ppc/ppc_acpi.c Modified: head/sys/dev/ppbus/if_plip.c ============================================================================== --- head/sys/dev/ppbus/if_plip.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/if_plip.c Sun Nov 16 17:42:02 2008 (r185003) @@ -125,19 +125,19 @@ __FBSDID("$FreeBSD$"); #define LPMAXERRS 100 #endif -#define CLPIPHDRLEN 14 /* We send dummy ethernet addresses (two) + packet type in front of packet */ +#define CLPIPHDRLEN 14 /* We send dummy ethernet addresses (two) + packet type in front of packet */ #define CLPIP_SHAKE 0x80 /* This bit toggles between nibble reception */ -#define MLPIPHDRLEN CLPIPHDRLEN +#define MLPIPHDRLEN CLPIPHDRLEN -#define LPIPHDRLEN 2 /* We send 0x08, 0x00 in front of packet */ +#define LPIPHDRLEN 2 /* We send 0x08, 0x00 in front of packet */ #define LPIP_SHAKE 0x40 /* This bit toggles between nibble reception */ #if !defined(MLPIPHDRLEN) || LPIPHDRLEN > MLPIPHDRLEN -#define MLPIPHDRLEN LPIPHDRLEN +#define MLPIPHDRLEN LPIPHDRLEN #endif #define LPIPTBLSIZE 256 /* Size of octet translation table */ -#define lprintf if (lptflag) printf +#define lprintf if (lptflag) printf #ifdef PLIP_DEBUG static int volatile lptflag = 1; @@ -156,14 +156,14 @@ struct lp_data { /* Tables for the lp# interface */ static u_char *txmith; -#define txmitl (txmith + (1 * LPIPTBLSIZE)) -#define trecvh (txmith + (2 * LPIPTBLSIZE)) -#define trecvl (txmith + (3 * LPIPTBLSIZE)) +#define txmitl (txmith + (1 * LPIPTBLSIZE)) +#define trecvh (txmith + (2 * LPIPTBLSIZE)) +#define trecvl (txmith + (3 * LPIPTBLSIZE)) static u_char *ctxmith; -#define ctxmitl (ctxmith + (1 * LPIPTBLSIZE)) -#define ctrecvh (ctxmith + (2 * LPIPTBLSIZE)) -#define ctrecvl (ctxmith + (3 * LPIPTBLSIZE)) +#define ctxmitl (ctxmith + (1 * LPIPTBLSIZE)) +#define ctrecvh (ctxmith + (2 * LPIPTBLSIZE)) +#define ctrecvl (ctxmith + (3 * LPIPTBLSIZE)) /* Functions for the lp# interface */ static int lpinittables(void); @@ -172,7 +172,7 @@ static int lpoutput(struct ifnet *, stru struct rtentry *); static void lp_intr(void *); -#define DEVTOSOFTC(dev) \ +#define DEVTOSOFTC(dev) \ ((struct lp_data *)device_get_softc(dev)) static devclass_t lp_devclass; @@ -254,7 +254,7 @@ lpinittables(void) return (1); if (ctxmith == NULL) - ctxmith = malloc(4*LPIPTBLSIZE, M_DEVBUF, M_NOWAIT); + ctxmith = malloc(4 * LPIPTBLSIZE, M_DEVBUF, M_NOWAIT); if (ctxmith == NULL) return (1); @@ -446,7 +446,7 @@ static void lp_intr(void *arg) { device_t dev = (device_t)arg; - device_t ppbus = device_get_parent(dev); + device_t ppbus = device_get_parent(dev); struct lp_data *sc = DEVTOSOFTC(dev); int len, s, j; u_char *bp; @@ -559,7 +559,7 @@ lp_intr(void *arg) } goto done; - err: +err: ppb_wdtr(ppbus, 0); lprintf("R"); sc->sc_ifp->if_ierrors++; @@ -576,12 +576,12 @@ lp_intr(void *arg) sc->sc_iferrs = 0; } - done: +done: splx(s); } static __inline int -lpoutbyte (u_char byte, int spin, device_t ppbus) +lpoutbyte(u_char byte, int spin, device_t ppbus) { ppb_wdtr(ppbus, txmith[byte]); Modified: head/sys/dev/ppbus/immio.c ============================================================================== --- head/sys/dev/ppbus/immio.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/immio.c Sun Nov 16 17:42:02 2008 (r185003) @@ -250,10 +250,10 @@ static struct ppb_microseq spp_outbyte_s MS_CASS(0x4), /* loop: */ - MS_RASSERT_P(1, MS_REG_DTR), + MS_RASSERT_P(1, MS_REG_DTR), MS_CASS(0x5), MS_DBRA(0), /* decrement counter */ - MS_RASSERT_P(1, MS_REG_DTR), + MS_RASSERT_P(1, MS_REG_DTR), MS_CASS(0x0), MS_DBRA(-6 /* loop */), @@ -265,14 +265,14 @@ static struct ppb_microseq spp_outbyte_s /* EPP 1.7 microsequences, ptr and len set at runtime */ static struct ppb_microseq epp17_outstr[] = { MS_CASS(0x4), - MS_RASSERT_P(MS_ACCUM, MS_REG_EPP_D), + MS_RASSERT_P(MS_ACCUM, MS_REG_EPP_D), MS_CASS(0xc), MS_RET(0), }; static struct ppb_microseq epp17_instr[] = { MS_CASS(PCD | 0x4), - MS_RFETCH_P(MS_ACCUM, MS_REG_EPP_D, MS_FETCH_ALL), + MS_RFETCH_P(MS_ACCUM, MS_REG_EPP_D, MS_FETCH_ALL), MS_CASS(PCD | 0xc), MS_RET(0), }; @@ -416,7 +416,7 @@ imm_detect(struct vpoio_data *vpo) /* release the bus now */ imm_disconnect(vpo, &error, 1); - /* ensure we are disconnected or daisy chained peripheral + /* ensure we are disconnected or daisy chained peripheral * may cause serious problem to the disk */ if (error) { @@ -479,7 +479,7 @@ imm_select(struct vpoio_data *vpo, int i /* initialize the select microsequence */ ppb_MS_init_msq(select_microseq, 1, SELECT_TARGET, 1 << initiator | 1 << target); - + ppb_MS_microseq(ppbus, vpo->vpo_dev, select_microseq, &ret); return (ret); @@ -514,7 +514,7 @@ imm_wait(struct vpoio_data *vpo, int tmo ppb_MS_microseq(ppbus, vpo->vpo_dev, wait_microseq, &err); if (err) - return (0); /* command timed out */ + return (0); /* command timed out */ return(ret); } @@ -540,7 +540,7 @@ imm_negociate(struct vpoio_data *vpo) if (ret) return (VP0_ENEGOCIATE); #endif - + ppb_MS_init_msq(negociate_microseq, 1, NEGOCIATED_MODE, negociate_mode); @@ -580,7 +580,7 @@ imm_probe(device_t dev, struct vpoio_dat int imm_attach(struct vpoio_data *vpo) { - DECLARE_NIBBLE_INBYTE_SUBMICROSEQ; + DECLARE_NIBBLE_INBYTE_SUBMICROSEQ; device_t ppbus = device_get_parent(vpo->vpo_dev); int error = 0; @@ -601,7 +601,7 @@ imm_attach(struct vpoio_data *vpo) INB_NIBBLE_H, (void *)&(vpo)->vpo_nibble.h, INB_NIBBLE_L, (void *)&(vpo)->vpo_nibble.l, INB_NIBBLE_F, nibble_inbyte_hook, - INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble); + INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble); /* * Initialize mode dependent in/out microsequences @@ -666,7 +666,7 @@ imm_reset_bus(struct vpoio_data *vpo) * Send an SCSI command * */ -int +int imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command, int clen, char *buffer, int blen, int *result, int *count, int *ret) @@ -690,7 +690,8 @@ imm_do_scsi(struct vpoio_data *vpo, int return (error); if (not_connected) { - *ret = VP0_ECONNECT; goto error; + *ret = VP0_ECONNECT; + goto error; } /* @@ -714,7 +715,8 @@ imm_do_scsi(struct vpoio_data *vpo, int } if (!(r = imm_wait(vpo, VP0_LOW_SPINTMO))) { - *ret = VP0_ESTATUS_TIMEOUT; goto error; + *ret = VP0_ESTATUS_TIMEOUT; + goto error; } if ((r & 0x30) == 0x10) { @@ -725,14 +727,15 @@ imm_do_scsi(struct vpoio_data *vpo, int negociated = 1; } - /* - * Complete transfer ... + /* + * Complete transfer ... */ *count = 0; for (;;) { if (!(r = imm_wait(vpo, VP0_LOW_SPINTMO))) { - *ret = VP0_ESTATUS_TIMEOUT; goto error; + *ret = VP0_ESTATUS_TIMEOUT; + goto error; } /* stop when the ZIP+ wants to send status */ @@ -782,13 +785,15 @@ imm_do_scsi(struct vpoio_data *vpo, int negociated = 1; if (imm_instr(vpo, &l, 1)) { - *ret = VP0_EOTHER; goto error; + *ret = VP0_EOTHER; + goto error; } /* check if the ZIP+ wants to send more status */ if (imm_wait(vpo, VP0_FAST_SPINTMO) == (char)0xb8) if (imm_instr(vpo, &h, 1)) { - *ret = VP0_EOTHER+2; goto error; + *ret = VP0_EOTHER + 2; + goto error; } /* Experience showed that we should discard this */ Modified: head/sys/dev/ppbus/lpbb.c ============================================================================== --- head/sys/dev/ppbus/lpbb.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/lpbb.c Sun Nov 16 17:42:02 2008 (r185003) @@ -84,7 +84,7 @@ static int lpbb_attach(device_t dev) { device_t bitbang; - + /* add generic bit-banging code */ bitbang = device_add_child(dev, "iicbb", -1); device_probe_and_attach(bitbang); @@ -159,7 +159,7 @@ lpbb_setsda(device_t dev, char val) mtx_lock(&Giant); if (val == 0) ppb_wdtr(ppbus, (u_char)SDA_out); - else + else ppb_wdtr(ppbus, (u_char)~SDA_out); mtx_unlock(&Giant); } @@ -172,8 +172,8 @@ lpbb_setscl(device_t dev, unsigned char mtx_lock(&Giant); if (val == 0) ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) & ~SCL_out)); - else - ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) | SCL_out)); + else + ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) | SCL_out)); mtx_unlock(&Giant); } Modified: head/sys/dev/ppbus/lpt.c ============================================================================== --- head/sys/dev/ppbus/lpt.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/lpt.c Sun Nov 16 17:42:02 2008 (r185003) @@ -87,9 +87,9 @@ __FBSDID("$FreeBSD$"); #include #ifndef LPT_DEBUG -#define lprintf(args) +#define lprintf(args) #else -#define lprintf(args) \ +#define lprintf(args) \ do { \ if (lptflag) \ printf args; \ @@ -113,36 +113,35 @@ struct lpt_data { prime once */ u_char sc_control; char sc_flags; -#define LP_POS_INIT 0x04 /* if we are a postive init signal */ -#define LP_POS_ACK 0x08 /* if we are a positive going ack */ -#define LP_NO_PRIME 0x10 /* don't prime the printer at all */ -#define LP_PRIMEOPEN 0x20 /* prime on every open */ -#define LP_AUTOLF 0x40 /* tell printer to do an automatic lf */ -#define LP_BYPASS 0x80 /* bypass printer ready checks */ +#define LP_POS_INIT 0x04 /* if we are a postive init signal */ +#define LP_POS_ACK 0x08 /* if we are a positive going ack */ +#define LP_NO_PRIME 0x10 /* don't prime the printer at all */ +#define LP_PRIMEOPEN 0x20 /* prime on every open */ +#define LP_AUTOLF 0x40 /* tell printer to do an automatic lf */ +#define LP_BYPASS 0x80 /* bypass printer ready checks */ void *sc_inbuf; void *sc_statbuf; short sc_xfercnt ; char sc_primed; char *sc_cp ; u_short sc_irq ; /* IRQ status of port */ -#define LP_HAS_IRQ 0x01 /* we have an irq available */ -#define LP_USE_IRQ 0x02 /* we are using our irq */ -#define LP_ENABLE_IRQ 0x04 /* enable IRQ on open */ -#define LP_ENABLE_EXT 0x10 /* we shall use advanced mode when possible */ +#define LP_HAS_IRQ 0x01 /* we have an irq available */ +#define LP_USE_IRQ 0x02 /* we are using our irq */ +#define LP_ENABLE_IRQ 0x04 /* enable IRQ on open */ +#define LP_ENABLE_EXT 0x10 /* we shall use advanced mode when possible */ u_char sc_backoff ; /* time to call lptout() again */ struct resource *intr_resource; /* interrupt resource */ void *intr_cookie; /* interrupt registration cookie */ - }; -#define LPT_NAME "lpt" /* our official name */ +#define LPT_NAME "lpt" /* our official name */ static timeout_t lptout; static int lpt_port_test(device_t dev, u_char data, u_char mask); static int lpt_detect(device_t dev); -#define DEVTOSOFTC(dev) \ +#define DEVTOSOFTC(dev) \ ((struct lpt_data *)device_get_softc(dev)) static void lptintr(device_t dev); @@ -156,17 +155,15 @@ static devclass_t lpt_devclass; #define ASLP (1<<1) /* awaiting draining of printer */ #define EERROR (1<<2) /* error was received from printer */ #define OBUSY (1<<3) /* printer is busy doing output */ -#define LPTOUT (1<<4) /* timeout while not selected */ -#define TOUT (1<<5) /* timeout while not selected */ -#define LPTINIT (1<<6) /* waiting to initialize for open */ -#define INTERRUPTED (1<<7) /* write call was interrupted */ - -#define HAVEBUS (1<<8) /* the driver owns the bus */ - +#define LPTOUT (1<<4) /* timeout while not selected */ +#define TOUT (1<<5) /* timeout while not selected */ +#define LPTINIT (1<<6) /* waiting to initialize for open */ +#define INTERRUPTED (1<<7) /* write call was interrupted */ +#define HAVEBUS (1<<8) /* the driver owns the bus */ /* status masks to interrogate printer status */ -#define RDY_MASK (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */ -#define LP_READY (LPS_SEL|LPS_NBSY|LPS_NERR) +#define RDY_MASK (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */ +#define LP_READY (LPS_SEL|LPS_NBSY|LPS_NERR) /* Printer Ready condition - from lpa.c */ /* Only used in polling code */ @@ -503,7 +500,7 @@ lptopen(struct cdev *dev, int flags, int /* init printer */ if ((sc->sc_flags & LP_NO_PRIME) == 0) { - if((sc->sc_flags & LP_PRIMEOPEN) || sc->sc_primed == 0) { + if ((sc->sc_flags & LP_PRIMEOPEN) || sc->sc_primed == 0) { ppb_wctr(ppbus, 0); sc->sc_primed++; DELAY(500); @@ -582,7 +579,7 @@ lptclose(struct cdev *dev, int flags, in { struct lpt_data *sc = dev->si_drv1; device_t lptdev = sc->dev; - device_t ppbus = device_get_parent(lptdev); + device_t ppbus = device_get_parent(lptdev); int err; if (sc->sc_flags & LP_BYPASS) @@ -594,7 +591,7 @@ lptclose(struct cdev *dev, int flags, in sc->sc_state &= ~OPEN; /* if the last write was interrupted, don't complete it */ - if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) + if ((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) while ((ppb_rstr(ppbus) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) @@ -690,7 +687,7 @@ lptread(struct cdev *dev, struct uio *ui { struct lpt_data *sc = dev->si_drv1; device_t lptdev = sc->dev; - device_t ppbus = device_get_parent(lptdev); + device_t ppbus = device_get_parent(lptdev); int error = 0, len; if (sc->sc_flags & LP_BYPASS) { @@ -736,9 +733,9 @@ lptwrite(struct cdev *dev, struct uio *u int err; struct lpt_data *sc = dev->si_drv1; device_t lptdev = sc->dev; - device_t ppbus = device_get_parent(lptdev); + device_t ppbus = device_get_parent(lptdev); - if(sc->sc_flags & LP_BYPASS) { + if (sc->sc_flags & LP_BYPASS) { /* we can't do writes in bypass mode */ return(EPERM); } @@ -777,7 +774,7 @@ lptwrite(struct cdev *dev, struct uio *u sc->sc_xfercnt = 0; break; case EINTR: - sc->sc_state |= INTERRUPTED; + sc->sc_state |= INTERRUPTED; return(err); case EINVAL: /* advanced mode not avail */ @@ -806,7 +803,7 @@ lptwrite(struct cdev *dev, struct uio *u } /* check to see if we must do a polled write */ - if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { + if (!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { lprintf(("p")); err = lpt_pushbytes(lptdev); @@ -828,16 +825,15 @@ lptwrite(struct cdev *dev, struct uio *u * * do checking for interrupted write call. */ - static void lpt_intr(void *arg) { device_t lptdev = (device_t)arg; - device_t ppbus = device_get_parent(lptdev); + device_t ppbus = device_get_parent(lptdev); struct lpt_data *sc = DEVTOSOFTC(lptdev); int sts = 0; int i; - + /* we must own the bus to use it */ if ((sc->sc_state & HAVEBUS) == 0) return; @@ -853,7 +849,7 @@ lpt_intr(void *arg) if ((sts & RDY_MASK) == LP_READY) { sc->sc_state = (sc->sc_state | OBUSY) & ~EERROR; - sc->sc_backoff = hz/LPTOUTINITIAL; + sc->sc_backoff = hz / LPTOUTINITIAL; if (sc->sc_xfercnt) { /* send char */ @@ -864,7 +860,8 @@ lpt_intr(void *arg) ppb_wctr(ppbus, sc->sc_control); /* any more data for printer */ - if(--(sc->sc_xfercnt) > 0) return; + if (--(sc->sc_xfercnt) > 0) + return; } /* @@ -873,12 +870,12 @@ lpt_intr(void *arg) */ sc->sc_state &= ~OBUSY; - if(!(sc->sc_state & INTERRUPTED)) + if (!(sc->sc_state & INTERRUPTED)) wakeup(lptdev); lprintf(("w ")); return; } else { /* check for error */ - if(((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) && + if (((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) && (sc->sc_state & OPEN)) sc->sc_state |= EERROR; /* lptout() will jump in and try to restart. */ @@ -907,7 +904,7 @@ lptioctl(struct cdev *dev, u_long cmd, c switch (cmd) { case LPT_IRQ : - if(sc->sc_irq & LP_HAS_IRQ) { + if (sc->sc_irq & LP_HAS_IRQ) { /* * NOTE: * If the IRQ status is changed, @@ -939,7 +936,7 @@ lptioctl(struct cdev *dev, u_long cmd, c default: break; } - + if (old_sc_irq != sc->sc_irq ) log(LOG_NOTICE, "%s: switched to %s %s mode\n", device_get_nameunit(sc->dev), Modified: head/sys/dev/ppbus/lpt.h ============================================================================== --- head/sys/dev/ppbus/lpt.h Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/lpt.h Sun Nov 16 17:42:02 2008 (r185003) @@ -31,7 +31,7 @@ * * Distantly from : * @(#)lptreg.h 1.1 (Berkeley) 12/19/90 - * Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp + * Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp * From Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp * * $FreeBSD$ @@ -45,7 +45,7 @@ */ #ifndef __LPT_H -#define __LPT_H +#define __LPT_H /* machine independent definitions, it shall only depend on the ppbus * parallel port model */ Modified: head/sys/dev/ppbus/pcfclock.c ============================================================================== --- head/sys/dev/ppbus/pcfclock.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/pcfclock.c Sun Nov 16 17:42:02 2008 (r185003) @@ -9,7 +9,7 @@ * 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 SASCHA SCHUMANN ``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 @@ -105,7 +105,7 @@ static struct cdevsw pcfclock_cdevsw = { NR(buf, 2) <= 59) #define PCFCLOCK_BATTERY_STATUS_LOW(buf) (buf[8] & 4) - + #define PCFCLOCK_CMD_TIME 0 /* send current time */ #define PCFCLOCK_CMD_COPY 7 /* copy received signal to PC */ @@ -133,7 +133,7 @@ pcfclock_attach(device_t dev) { struct pcfclock_data *sc = device_get_softc(dev); int unit; - + unit = device_get_unit(dev); sc->dev = dev; @@ -148,14 +148,14 @@ pcfclock_attach(device_t dev) return (0); } -static int +static int pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td) { struct pcfclock_data *sc = dev->si_drv1; device_t pcfclockdev = sc->dev; device_t ppbus = device_get_parent(pcfclockdev); int res; - + if (!sc) return (ENXIO); @@ -164,7 +164,7 @@ pcfclock_open(struct cdev *dev, int flag return (res); sc->count++; - + return (0); } @@ -187,10 +187,10 @@ pcfclock_write_cmd(struct cdev *dev, uns { struct pcfclock_data *sc = dev->si_drv1; device_t pcfclockdev = sc->dev; - device_t ppbus = device_get_parent(pcfclockdev); + device_t ppbus = device_get_parent(pcfclockdev); unsigned char ctr = 14; char i; - + for (i = 0; i <= 7; i++) { ppb_wdtr(ppbus, i); AUTOFEED_CLOCK(i & 1 ? AFC_HI : AFC_LO); @@ -203,7 +203,7 @@ pcfclock_write_cmd(struct cdev *dev, uns } static void -pcfclock_display_data(struct cdev *dev, char buf[18]) +pcfclock_display_data(struct cdev *dev, char buf[18]) { struct pcfclock_data *sc = dev->si_drv1; #ifdef PCFCLOCK_VERBOSE @@ -224,19 +224,19 @@ pcfclock_display_data(struct cdev *dev, #endif } -static int +static int pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits) { struct pcfclock_data *sc = dev->si_drv1; device_t pcfclockdev = sc->dev; - device_t ppbus = device_get_parent(pcfclockdev); + device_t ppbus = device_get_parent(pcfclockdev); int i; char waitfor; int offset; /* one byte per four bits */ bzero(buf, ((bits + 3) >> 2) + 1); - + waitfor = 100; for (i = 0; i <= bits; i++) { /* wait for clock, maximum (waitfor*100) usec */ @@ -244,11 +244,11 @@ pcfclock_read_data(struct cdev *dev, cha DELAY(100); /* timed out? */ - if (!waitfor) + if (!waitfor) return (EIO); - + waitfor = 100; /* reload */ - + /* give it some time */ DELAY(500); @@ -263,12 +263,12 @@ pcfclock_read_data(struct cdev *dev, cha return (0); } -static int -pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries) +static int +pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries) { struct pcfclock_data *sc = dev->si_drv1; device_t pcfclockdev = sc->dev; - device_t ppbus = device_get_parent(pcfclockdev); + device_t ppbus = device_get_parent(pcfclockdev); int error = 0; ppb_set_mode(ppbus, PPB_COMPATIBLE); @@ -277,7 +277,7 @@ pcfclock_read_dev(struct cdev *dev, char pcfclock_write_cmd(dev, PCFCLOCK_CMD_TIME); if (pcfclock_read_data(dev, buf, 68)) continue; - + if (!PCFCLOCK_CORRECT_SYNC(buf)) continue; @@ -289,7 +289,7 @@ pcfclock_read_dev(struct cdev *dev, char if (!maxretries) error = EIO; - + return (error); } @@ -304,15 +304,15 @@ pcfclock_read(struct cdev *dev, struct u return (ERANGE); error = pcfclock_read_dev(dev, buf, PCFCLOCK_MAX_RETRIES); - + if (error) { device_printf(sc->dev, "no PCF found\n"); } else { pcfclock_display_data(dev, buf); - + uiomove(buf, 18, uio); } - + return (error); } Modified: head/sys/dev/ppbus/ppb_1284.c ============================================================================== --- head/sys/dev/ppbus/ppb_1284.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/ppb_1284.c Sun Nov 16 17:42:02 2008 (r185003) @@ -92,7 +92,8 @@ ppb_1284_reset_error(device_t bus, int s int ppb_1284_get_state(device_t bus) { - return (DEVTOSOFTC(bus)->state); + + return (DEVTOSOFTC(bus)->state); } /* @@ -293,7 +294,7 @@ ppb_peripheral_terminate(device_t bus, i } /* Event 24 */ - ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); + ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); /* Event 25 - wait up to host response time (1s) */ if ((error = do_peripheral_wait(bus, nBUSY, nBUSY))) { @@ -302,17 +303,17 @@ ppb_peripheral_terminate(device_t bus, i } /* Event 26 */ - ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED)); + ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED)); DELAY(1); /* Event 27 */ - ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED)); + ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED)); /* Event 28 - wait up to host response time (1s) */ if ((error = do_peripheral_wait(bus, nBUSY, 0))) { ppb_1284_set_error(bus, PPB_TIMEOUT, 28); goto error; } - + error: ppb_set_mode(bus, PPB_COMPATIBLE); ppb_1284_set_state(bus, PPB_FORWARD_IDLE); @@ -538,7 +539,7 @@ spp_1284_read(device_t bus, int mode, ch case PPB_REVERSE_IDLE: terminate_after_transfer = 0; break; - + default: ppb_1284_terminate(bus); if ((error = ppb_1284_negociate(bus, mode, 0))) @@ -689,9 +690,9 @@ ppb_1284_negociate(device_t bus, int mod #ifdef PERIPH_1284 /* request remote host attention */ - ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); - DELAY(1); - ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN)); + ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); + DELAY(1); + ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN)); #else DELAY(1); @@ -701,14 +702,14 @@ ppb_1284_negociate(device_t bus, int mod ppb_wctr(bus, (nINIT | AUTOFEED) & ~(STROBE | SELECTIN)); #ifdef PERIPH_1284 - /* ignore the PError line, wait a bit more, remote host's + /* ignore the PError line, wait a bit more, remote host's * interrupts don't respond fast enough */ if (ppb_poll_bus(bus, 40, nACK | SELECT | nFAULT, SELECT | nFAULT, PPB_NOINTR | PPB_POLL)) { - ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2); - error = ENODEV; - goto error; - } + ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2); + error = ENODEV; + goto error; + } #else /* Event 2 - trying IEEE1284 dialog */ if (do_1284_wait(bus, nACK | PERROR | SELECT | nFAULT, @@ -770,11 +771,11 @@ ppb_1284_negociate(device_t bus, int mod #ifdef PERIPH_1284 /* ignore PError line */ if (do_1284_wait(bus, nACK | SELECT | nBUSY, - nACK | SELECT | nBUSY)) { - ppb_1284_set_error(bus, PPB_TIMEOUT, 30); - error = ENODEV; - goto error; - } + nACK | SELECT | nBUSY)) { + ppb_1284_set_error(bus, PPB_TIMEOUT, 30); + error = ENODEV; + goto error; + } #else if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY, nACK | SELECT | PERROR | nBUSY)) { @@ -824,8 +825,8 @@ ppb_1284_terminate(device_t bus) #ifdef PERIPH_1284 /* request remote host attention */ - ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED)); - DELAY(1); + ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED)); + DELAY(1); #endif /* PERIPH_1284 */ /* Event 22 - set nSelectin low and nAutoFeed high */ Modified: head/sys/dev/ppbus/ppb_base.c ============================================================================== --- head/sys/dev/ppbus/ppb_base.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/ppb_base.c Sun Nov 16 17:42:02 2008 (r185003) @@ -34,15 +34,15 @@ __FBSDID("$FreeBSD$"); #include #include - + #include "ppbus_if.h" #include - + MODULE_VERSION(ppbus, 1); #define DEVTOSOFTC(dev) ((struct ppb_data *)device_get_softc(dev)) - + /* * ppb_poll_bus() * @@ -133,7 +133,7 @@ ppb_set_mode(device_t bus, int mode) int old_mode = ppb_get_mode(bus); if (PPBUS_SETMODE(device_get_parent(bus), mode)) - return -1; + return (-1); /* XXX yet device mode = ppbus mode = chipset mode */ ppb->mode = (mode & PPB_MASK); Modified: head/sys/dev/ppbus/ppb_msq.c ============================================================================== --- head/sys/dev/ppbus/ppb_msq.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/ppb_msq.c Sun Nov 16 17:42:02 2008 (r185003) @@ -210,7 +210,7 @@ ppb_MS_init_msq(struct ppb_microseq *msq __func__, param); #if 0 - printf("%s: param = %d, ins = %d, arg = %d, type = %d\n", + printf("%s: param = %d, ins = %d, arg = %d, type = %d\n", __func__, param, ins, arg, type); #endif @@ -272,7 +272,7 @@ ppb_MS_microseq(device_t bus, device_t d mi = msq; for (;;) { - switch (mi->opcode) { + switch (mi->opcode) { case MS_OP_PUT: case MS_OP_GET: @@ -315,11 +315,10 @@ ppb_MS_microseq(device_t bus, device_t d INCR_PC; break; - case MS_OP_RET: + case MS_OP_RET: if (ret) *ret = mi->arg[0].i; /* return code */ return (0); - break; default: /* executing microinstructions at ppc level is Modified: head/sys/dev/ppbus/ppbconf.c ============================================================================== --- head/sys/dev/ppbus/ppbconf.c Sun Nov 16 15:45:41 2008 (r185002) +++ head/sys/dev/ppbus/ppbconf.c Sun Nov 16 17:42:02 2008 (r185003) @@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$"); #include #include "ppbus_if.h" - + #define DEVTOSOFTC(dev) ((struct ppb_data *)device_get_softc(dev)) - + static MALLOC_DEFINE(M_PPBUSDEV, "ppbusdev", "Parallel Port bus device"); @@ -90,12 +90,12 @@ ppbus_add_child(device_t dev, int order, { struct ppb_device *ppbdev; device_t child; - + /* allocate ivars for the new ppbus child */ ppbdev = malloc(sizeof(struct ppb_device), M_PPBUSDEV, M_NOWAIT | M_ZERO); if (!ppbdev) - return NULL; + return (NULL); /* initialize the ivars */ ppbdev->name = name; @@ -105,13 +105,13 @@ ppbus_add_child(device_t dev, int order, child = device_add_child_ordered(dev, order, name, unit); device_set_ivars(child, ppbdev); - return child; + return (child); } static int ppbus_read_ivar(device_t bus, device_t dev, int index, uintptr_t* val) { - + switch (index) { case PPBUS_IVAR_MODE: /* XXX yet device mode = ppbus mode = chipset mode */ @@ -120,12 +120,12 @@ ppbus_read_ivar(device_t bus, device_t d default: return (ENOENT); } - + return (0); } - + static int -ppbus_write_ivar(device_t bus, device_t dev, int index, u_long val) +ppbus_write_ivar(device_t bus, device_t dev, int index, uintptr_t val) { switch (index) { @@ -208,7 +208,7 @@ ppb_pnp_detect(device_t bus) char str[PPB_PnP_STRING_SIZE+1]; device_printf(bus, "Probing for PnP devices:\n"); - + if ((error = ppb_1284_read_id(bus, PPB_NIBBLE, str, PPB_PnP_STRING_SIZE, &len))) goto end_detect; @@ -287,7 +287,7 @@ ppb_scan_bus(device_t bus) int error = 0; /* try all IEEE1284 modes, for one device only - * + * * XXX We should implement the IEEE1284.3 standard to detect * daisy chained devices */ @@ -384,7 +384,7 @@ ppbus_attach(device_t dev) ppb_scan_bus(dev); #endif /* !DONTPROBE_1284 */ - /* launch attachement of the added children */ + /* launch attachment of the added children */ bus_generic_attach(dev); return (0); @@ -393,8 +393,8 @@ ppbus_attach(device_t dev) static int ppbus_detach(device_t dev) { - device_t *children; - int error, nchildren, i; + device_t *children; + int error, nchildren, i; error = bus_generic_detach(dev); if (error) @@ -406,7 +406,7 @@ ppbus_detach(device_t dev) if (children[i]) device_delete_child(dev, children[i]); free(children, M_TEMP); - } + } return (0); } @@ -441,7 +441,7 @@ ppbus_teardown_intr(device_t bus, device { struct ppb_data *ppb = DEVTOSOFTC(bus); struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(child); - + /* a device driver must own the bus to unregister an interrupt */ if ((ppb->ppb_owner != child) || (ppbdev->intr_cookie != ih) || (ppbdev->intr_resource != r)) @@ -469,7 +469,7 @@ ppb_request_bus(device_t bus, device_t d struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(dev); while (!error) { - s = splhigh(); + s = splhigh(); if (ppb->ppb_owner) { splx(s); @@ -493,7 +493,7 @@ ppb_request_bus(device_t bus, device_t d /* restore the context of the device * The first time, ctx.valid is certainly false * then do not change anything. This is usefull for *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 18:30:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDD681065672; Sun, 16 Nov 2008 18:30:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C26AB8FC1D; Sun, 16 Nov 2008 18:30:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGIUGl3061693; Sun, 16 Nov 2008 18:30:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGIUGaa061692; Sun, 16 Nov 2008 18:30:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811161830.mAGIUGaa061692@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Nov 2008 18:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185004 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 18:30:16 -0000 Author: marius Date: Sun Nov 16 18:30:16 2008 New Revision: 185004 URL: http://svn.freebsd.org/changeset/base/185004 Log: - For maximum flexibility, sparc64 supports BUS_DMA_COHERENT also with bus_dmamap_create() and not only bus_dmamem_alloc() so move the description of this flag up accordingly in order to document this fact. While at, it refine this description with an application example. - Reword the description of BUS_DMA_NOCACHE as this flag is also implemented on sparc64. MFC after: 1 week Modified: head/share/man/man9/bus_dma.9 Modified: head/share/man/man9/bus_dma.9 ============================================================================== --- head/share/man/man9/bus_dma.9 Sun Nov 16 17:42:02 2008 (r185003) +++ head/share/man/man9/bus_dma.9 Sun Nov 16 18:30:16 2008 (r185004) @@ -60,7 +60,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd March 6, 2007 +.Dd November 16, 2008 .Dt BUS_DMA 9 .Os .Sh NAME @@ -483,9 +483,23 @@ Arguments are as follows: .It Fa dmat DMA tag. .It Fa flags -The value of this argument is currently undefined and should be -specified as -.Ql 0 . +Are as follows: +.Bl -tag -width ".Dv BUS_DMA_COHERENT" +.It Dv BUS_DMA_COHERENT +Attempt to map the memory loaded with this map such that cache sync +operations are as cheap as possible. +This flag is typically set on maps when the memory loaded with these will +be accessed by both a CPU and a DMA engine, frequently such as control data +and as opposed to streamable data such as receive and transmit buffers. +Use of this flag does not remove the requirement of using +.Fn bus_dmamap_sync , +but it may reduce the cost of performing these operations. +For +.Fn bus_dmamap_create , +the +.Dv BUS_DMA_COHERENT +flag is currently implemented on sparc64. +.El .It Fa mapp Pointer to a .Vt bus_dmamap_t @@ -551,9 +565,11 @@ and instead should return immediately wi The allocated memory will not be cached in the processor caches. All memory accesses appear on the bus and are executed without reordering. -Currently the flag is implemented for i386 and amd64 architectures -only, where it results in the Strong Uncacheable -PAT to be set for the allocated virtual address range. +On the amd64 and i386 architectures this flag results in the +Strong Uncacheable PAT to be set for the allocated virtual address range. +The +.Dv BUS_DMA_NOCACHE +flag is currently implemented on amd64, i386 and sparc64. .El .El .Pp @@ -758,16 +774,15 @@ If resources are not available, .Dv ENOMEM is returned. .It Dv BUS_DMA_COHERENT -Attempt to map this memory such that cache sync operations are -as cheap as possible. -This flag is typically set on memory that will be accessed by both -a CPU and a DMA engine, frequently. -Use of this flag does not remove the requirement of using -bus_dmamap_sync, but it may reduce the cost of performing -these operations. -The +Attempt to map this memory in a coherent fashion. +See +.Fn bus_dmamap_create +above for a description of this flag. +For +.Fn bus_dmamem_alloc , +the .Dv BUS_DMA_COHERENT -flag is currently implemented on sparc64 and arm. +flag is currently implemented on arm and sparc64. .It Dv BUS_DMA_ZERO Causes the allocated memory to be set to all zeros. .El From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 19:20:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BABE11065677; Sun, 16 Nov 2008 19:20:29 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE8118FC28; Sun, 16 Nov 2008 19:20:29 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGJKT8O062603; Sun, 16 Nov 2008 19:20:29 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGJKTgR062602; Sun, 16 Nov 2008 19:20:29 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811161920.mAGJKTgR062602@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Nov 2008 19:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185005 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 19:20:29 -0000 Author: marcel Date: Sun Nov 16 19:20:29 2008 New Revision: 185005 URL: http://svn.freebsd.org/changeset/base/185005 Log: Define LDBL_EPSILON, LDBL_MAX and LDBL_MIN as long double constants. Submitted by: Andreas Tobler Reviewed by: das@ Modified: head/sys/powerpc/include/float.h Modified: head/sys/powerpc/include/float.h ============================================================================== --- head/sys/powerpc/include/float.h Sun Nov 16 18:30:16 2008 (r185004) +++ head/sys/powerpc/include/float.h Sun Nov 16 19:20:29 2008 (r185005) @@ -72,13 +72,13 @@ __END_DECLS #define DBL_MAX_10_EXP 308 #define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON DBL_EPSILON +#define LDBL_EPSILON (long double)DBL_EPSILON #define LDBL_DIG DBL_DIG #define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN DBL_MIN +#define LDBL_MIN (long double)DBL_MIN #define LDBL_MIN_10_EXP DBL_MIN_10_EXP #define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX DBL_MAX +#define LDBL_MAX (long double)DBL_MAX #define LDBL_MAX_10_EXP DBL_MAX_10_EXP #endif /* _MACHINE_FLOAT_H_ */ From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 19:28:56 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DC4D1065694; Sun, 16 Nov 2008 19:28:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 116968FC1A; Sun, 16 Nov 2008 19:28:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGJStd3062778; Sun, 16 Nov 2008 19:28:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGJStI1062777; Sun, 16 Nov 2008 19:28:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811161928.mAGJStI1062777@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Nov 2008 19:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185006 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 19:28:56 -0000 Author: marius Date: Sun Nov 16 19:28:55 2008 New Revision: 185006 URL: http://svn.freebsd.org/changeset/base/185006 Log: Micro-optimize spitfire_block_{copy,zero}(): - Predict the loop as taken as it's more likely that there's still data to copy and memory to zero respectively. - Don't waste the delay slot. Modified: head/sys/sparc64/sparc64/support.S Modified: head/sys/sparc64/sparc64/support.S ============================================================================== --- head/sys/sparc64/sparc64/support.S Sun Nov 16 19:20:29 2008 (r185005) +++ head/sys/sparc64/sparc64/support.S Sun Nov 16 19:28:55 2008 (r185006) @@ -647,7 +647,7 @@ ENTRY(spitfire_block_copy) stda %f32, [%o1] %asi add %o0, 64, %o0 sub %o2, 64, %o2 - ba %xcc, 2b + ba,pt %xcc, 2b add %o1, 64, %o1 3: membar #Sync @@ -655,10 +655,8 @@ ENTRY(spitfire_block_copy) stda %f16, [%o1] %asi membar #Sync - wr %g0, 0, %fprs - retl - nop + wr %g0, 0, %fprs END(spitfire_block_copy) /* @@ -704,14 +702,12 @@ ENTRY(spitfire_block_zero) stda %f0, [%o0 + 128] %asi stda %f0, [%o0 + 192] %asi sub %o1, 256, %o1 - brnz %o1, 1b + brnz,pt %o1, 1b add %o0, 256, %o0 membar #Sync - wr %g0, 0, %fprs - retl - nop + wr %g0, 0, %fprs END(spitfire_block_zero) .globl fpu_fault_end @@ -806,7 +802,6 @@ ENTRY(bintr) ENTRY(eintr) nop - /* * XXX including sys/gmon.h in genassym.c is not possible due to uintfptr_t * badness. From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 19:30:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 805FC1065687; Sun, 16 Nov 2008 19:30:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73E338FC1E; Sun, 16 Nov 2008 19:30:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGJUHpx062842; Sun, 16 Nov 2008 19:30:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGJUH2T062841; Sun, 16 Nov 2008 19:30:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811161930.mAGJUH2T062841@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Nov 2008 19:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185007 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 19:30:17 -0000 Author: marius Date: Sun Nov 16 19:30:17 2008 New Revision: 185007 URL: http://svn.freebsd.org/changeset/base/185007 Log: Use the spitfire VIS block copy/zero functions also with cheetah- class CPUs. In theory one could also use versions additionally taking advantage of the prefetch cache with cheetah-class CPUs, in my worldstone runs these either didn't provide extra speedup (USIII+) in comparison to the existing spitfire versions or were even slightly slower (USIIIi) though, so they aren't committed for now. The basic problem leading to the VIS-based copy/zero functions being initially disabled for cheetah-class CPUs was solved by letting cheetah_init() clear DCR_IFPOE. Modified: head/sys/sparc64/sparc64/machdep.c Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Sun Nov 16 19:28:55 2008 (r185006) +++ head/sys/sparc64/sparc64/machdep.c Sun Nov 16 19:30:17 2008 (r185007) @@ -387,6 +387,12 @@ sparc64_init(caddr_t mdp, u_long o1, u_l case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: case CPU_IMPL_ULTRASPARCIIe: + case CPU_IMPL_ULTRASPARCIII: /* NB: we've disabled P$. */ + case CPU_IMPL_ULTRASPARCIIIp: + case CPU_IMPL_ULTRASPARCIIIi: + case CPU_IMPL_ULTRASPARCIV: + case CPU_IMPL_ULTRASPARCIVp: + case CPU_IMPL_ULTRASPARCIIIip: cpu_block_copy = spitfire_block_copy; cpu_block_zero = spitfire_block_zero; break; @@ -772,7 +778,7 @@ sparc64_shutdown_final(void *dummy, int /* Turn the power off? */ if ((howto & RB_POWEROFF) != 0) cpu_shutdown(&args); - /* In case of halt, return to the firmware */ + /* In case of halt, return to the firmware. */ if ((howto & RB_HALT) != 0) cpu_halt(); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 19:53:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B1881065678; Sun, 16 Nov 2008 19:53:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E7C18FC0C; Sun, 16 Nov 2008 19:53:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGJro0c063273; Sun, 16 Nov 2008 19:53:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGJroZt063270; Sun, 16 Nov 2008 19:53:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811161953.mAGJroZt063270@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Nov 2008 19:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185008 - in head/sys/sparc64: include sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 19:53:50 -0000 Author: marius Date: Sun Nov 16 19:53:49 2008 New Revision: 185008 URL: http://svn.freebsd.org/changeset/base/185008 Log: - Allow the front-end to specify that iommu(4) should disable rerun of the streaming cache for silicon bug workarounds. - Announce the presence of a streaming cache on attach for informational purposes. - For performance reasons don't do unnecessary flushes of the streaming cache when coherent mappings are synced. - Fix some minor style issues. Modified: head/sys/sparc64/include/iommureg.h head/sys/sparc64/include/iommuvar.h head/sys/sparc64/sparc64/iommu.c Modified: head/sys/sparc64/include/iommureg.h ============================================================================== --- head/sys/sparc64/include/iommureg.h Sun Nov 16 19:30:17 2008 (r185007) +++ head/sys/sparc64/include/iommureg.h Sun Nov 16 19:53:49 2008 (r185008) @@ -54,7 +54,7 @@ #define ISR_PGFLUSH 0x0008 /* streaming buffer page flush */ #define ISR_FLUSHSYNC 0x0010 /* streaming buffer flush sync */ -/* streaming buffer diagnostics registers. */ +/* streaming buffer diagnostics registers */ #define ISD_DATA_DIAG 0x0000 /* streaming buffer data RAM diag 0..127 */ #define ISD_ERROR_DIAG 0x0400 /* streaming buffer error status diag 0..127 */ #define ISD_PG_TAG_DIAG 0x0800 /* streaming buffer page tag diag 0..15 */ @@ -63,6 +63,7 @@ /* streaming buffer control register */ #define STRBUF_EN 0x0000000000000001UL #define STRBUF_D 0x0000000000000002UL +#define STRBUF_RR_DIS 0x0000000000000004UL #define IOMMU_MAXADDR(bits) ((1UL << (bits)) - 1) @@ -91,7 +92,7 @@ #define IOMMUCR_EN 0x0000000000000001UL /* - * Diagnostic register definitions. + * Diagnostic register definitions */ #define IOMMU_DTAG_VPNBITS 19 #define IOMMU_DTAG_VPNMASK ((1 << IOMMU_DTAG_VPNBITS) - 1) @@ -126,10 +127,10 @@ /* Writeable */ #define IOTTE_W 0x0000000000000002UL -/* log2 of the IOMMU TTE size. */ +/* log2 of the IOMMU TTE size */ #define IOTTE_SHIFT 3 -/* Streaming buffer line size. */ +/* Streaming buffer line size */ #define STRBUF_LINESZ 64 /* Modified: head/sys/sparc64/include/iommuvar.h ============================================================================== --- head/sys/sparc64/include/iommuvar.h Sun Nov 16 19:30:17 2008 (r185007) +++ head/sys/sparc64/include/iommuvar.h Sun Nov 16 19:53:49 2008 (r185008) @@ -45,12 +45,12 @@ TAILQ_HEAD(iommu_maplruq_head, bus_dmamap); /* - * Per-IOMMU state. The parenthesized comments indicate the locking strategy: + * Per-IOMMU state; the parenthesized comments indicate the locking strategy: * i - protected by is_mtx. * r - read-only after initialization. * * - comment refers to pointer target / target hardware registers * (for bus_addr_t). - * is_maplruq is also locked by is_mtx. Elements of is_tsb may only be + * is_maplruq is also locked by is_mtx. Elements of is_tsb may only be * accessed from functions operating on the map owning the corresponding * resource, so the locking the user is required to do to protect the * map is sufficient. @@ -81,7 +81,7 @@ struct iommu_state { */ volatile char is_flush[STRBUF_FLUSHSYNC_NBYTES * 3 - 1]; - /* copies of our parents state, to allow us to be self contained */ + /* copies of our parent's state, to allow us to be self contained */ bus_space_tag_t is_bustag; /* (r) Our bus tag */ bus_space_handle_t is_bushandle; /* (r) */ bus_addr_t is_iommu; /* (r, *i) IOMMU registers */ @@ -96,6 +96,9 @@ struct iommu_state { bus_addr_t is_dva; /* (r, *r) */ /* Tag compare diagnostics access */ bus_addr_t is_dtcmp; /* (r, *r) */ + /* behavior flags */ + u_int is_flags; /* (r) */ +#define IOMMU_RERUN_DISABLE (1 << 0) }; /* interfaces for PCI/SBus code */ Modified: head/sys/sparc64/sparc64/iommu.c ============================================================================== --- head/sys/sparc64/sparc64/iommu.c Sun Nov 16 19:30:17 2008 (r185007) +++ head/sys/sparc64/sparc64/iommu.c Sun Nov 16 19:53:49 2008 (r185008) @@ -119,8 +119,7 @@ __FBSDID("$FreeBSD$"); * - When running out of DVMA space, return EINPROGRESS in the non- * BUS_DMA_NOWAIT case and delay the callback until sufficient space * becomes available. - * - Use the streaming cache unless BUS_DMA_COHERENT is specified; do not - * flush the streaming cache when coherent mappings are synced. + * - Use the streaming cache unless BUS_DMA_COHERENT is specified. */ #include "opt_iommu.h" @@ -150,12 +149,12 @@ __FBSDID("$FreeBSD$"); #include /* - * Tuning constants. + * Tuning constants */ #define IOMMU_MAX_PRE (32 * 1024) #define IOMMU_MAX_PRE_SEG 3 -/* Threshold for using the streaming buffer. */ +/* Threshold for using the streaming buffer */ #define IOMMU_STREAM_THRESH 128 MALLOC_DEFINE(M_IOMMU, "dvmamem", "IOMMU DVMA Buffers"); @@ -309,9 +308,10 @@ iommu_init(const char *name, struct iomm is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize); size = IOTSB_BASESZ << is->is_tsbsize; - printf("%s: DVMA map: %#lx to %#lx\n", name, + printf("%s: DVMA map: %#lx to %#lx%s\n", name, is->is_dvmabase, is->is_dvmabase + - (size << (IO_PAGE_SHIFT - IOTTE_SHIFT)) - 1); + (size << (IO_PAGE_SHIFT - IOTTE_SHIFT)) - 1, + IOMMU_HAS_SB(is) ? ", streaming buffer" : ""); /* * Set up resource mamangement. @@ -376,11 +376,13 @@ iommu_reset(struct iommu_state *is) for (i = 0; i < 2; i++) { if (is->is_sb[i] != 0) { - /* Enable diagnostics mode? */ - IOMMU_WRITE8(is, is_sb[i], ISR_CTL, STRBUF_EN); - - /* No streaming buffers? Disable them */ - if (IOMMU_READ8(is, is_sb[i], ISR_CTL) == 0) + IOMMU_WRITE8(is, is_sb[i], ISR_CTL, STRBUF_EN | + ((is->is_flags & IOMMU_RERUN_DISABLE) != 0 ? + STRBUF_RR_DIS : 0)); + + /* No streaming buffers? Disable them. */ + if ((IOMMU_READ8(is, is_sb[i], ISR_CTL) & + STRBUF_EN) == 0) is->is_sb[i] = 0; } } @@ -585,7 +587,7 @@ iommu_dvmamap_vunload(struct iommu_state struct bus_dmamap_res *r; int streamed = 0; - IS_LOCK_ASSERT(is); /* for iommu_strbuf_sync() below. */ + IS_LOCK_ASSERT(is); /* for iommu_strbuf_sync() below */ SLIST_FOREACH(r, &map->dm_reslist, dr_link) { streamed |= iommu_remove(is, BDR_START(r), r->dr_used); r->dr_used = 0; @@ -1139,7 +1141,7 @@ iommu_dvmamap_sync(bus_dma_tag_t dt, bus /* XXX This is probably bogus. */ if ((op & BUS_DMASYNC_PREREAD) != 0) membar(Sync); - if (IOMMU_HAS_SB(is) && + if ((map->dm_flags & DMF_COHERENT) == 0 && IOMMU_HAS_SB(is) && ((op & BUS_DMASYNC_POSTREAD) != 0 || (op & BUS_DMASYNC_PREWRITE) != 0)) { IS_LOCK(is); From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 21:21:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBE35106564A; Sun, 16 Nov 2008 21:21:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9876E8FC0A; Sun, 16 Nov 2008 21:21:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGLLA0Z064921; Sun, 16 Nov 2008 21:21:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGLLA6O064919; Sun, 16 Nov 2008 21:21:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811162121.mAGLLA6O064919@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 16 Nov 2008 21:21:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185009 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 21:21:11 -0000 Author: kib Date: Sun Nov 16 21:21:09 2008 New Revision: 185009 URL: http://svn.freebsd.org/changeset/base/185009 Log: Welcome back Peter Holm. The initial plan is to bring stress2 into the projects/. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Sun Nov 16 19:53:49 2008 (r185008) +++ svnadmin/conf/access Sun Nov 16 21:21:09 2008 (r185009) @@ -157,6 +157,7 @@ peter peter@wemm.org phantom philip phk +pho piso pjd ps Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Sun Nov 16 19:53:49 2008 (r185008) +++ svnadmin/conf/mentors Sun Nov 16 21:21:09 2008 (r185009) @@ -11,6 +11,7 @@ # Mentee Mentor Optional comment eri mlaier Co-mentor: thompsa +pho kib rdivacky kib remko imp rnoland jhb From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 21:26:56 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A0351065670; Sun, 16 Nov 2008 21:26:56 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B6728FC08; Sun, 16 Nov 2008 21:26:56 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGLQu6s065060; Sun, 16 Nov 2008 21:26:56 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGLQu2R065059; Sun, 16 Nov 2008 21:26:56 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200811162126.mAGLQu2R065059@svn.freebsd.org> From: Ed Schouten Date: Sun, 16 Nov 2008 21:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185010 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 21:26:56 -0000 Author: ed Date: Sun Nov 16 21:26:56 2008 New Revision: 185010 URL: http://svn.freebsd.org/changeset/base/185010 Log: Fix argument layout of devfs_get_cdevpriv(). Right now it shows `void' and `**datap' as two different arguments, while they belong together. Modified: head/share/man/man9/devfs_set_cdevpriv.9 Modified: head/share/man/man9/devfs_set_cdevpriv.9 ============================================================================== --- head/share/man/man9/devfs_set_cdevpriv.9 Sun Nov 16 21:21:09 2008 (r185009) +++ head/share/man/man9/devfs_set_cdevpriv.9 Sun Nov 16 21:26:56 2008 (r185010) @@ -39,7 +39,7 @@ typedef void (*cdevpriv_dtr_t)(void *data); .Ed .Ft int -.Fn devfs_get_cdevpriv void **datap +.Fn devfs_get_cdevpriv "void **datap" .Ft int .Fn devfs_set_cdevpriv "void *priv" "cdevpriv_dtr_t dtr" .Ft void From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 21:56:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E289E1065680; Sun, 16 Nov 2008 21:56:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D36848FC08; Sun, 16 Nov 2008 21:56:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGLuTZi065605; Sun, 16 Nov 2008 21:56:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGLuTSe065604; Sun, 16 Nov 2008 21:56:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811162156.mAGLuTSe065604@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 16 Nov 2008 21:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185011 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 21:56:30 -0000 Author: kib Date: Sun Nov 16 21:56:29 2008 New Revision: 185011 URL: http://svn.freebsd.org/changeset/base/185011 Log: Revert r184118. There is actually a code in the kernel, for instance in kern_unlinkat(), that expects that vn_start_write() actually fills the mp even when the call failed. As Tor noted, that pattern relies on the the type stability of the mount points, as well as that suspended mount points are never freed and V_XSLEEP is always passed to vn_start_write() when called on a freed mount point. Reported by: stass Reviewed by: tegge PR: 123768 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Nov 16 21:26:56 2008 (r185010) +++ head/sys/kern/vfs_vnops.c Sun Nov 16 21:56:29 2008 (r185011) @@ -977,17 +977,12 @@ vn_start_write(vp, mpp, flags) while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { if (flags & V_NOWAIT) { error = EWOULDBLOCK; - if (vp != NULL) - *mpp = NULL; goto unlock; } error = msleep(&mp->mnt_flag, MNT_MTX(mp), (PUSER - 1) | (flags & PCATCH), "suspfs", 0); - if (error) { - if (vp != NULL) - *mpp = NULL; + if (error) goto unlock; - } } } if (flags & V_XSLEEP) @@ -1051,8 +1046,6 @@ vn_start_secondary_write(vp, mpp, flags) if (flags & V_NOWAIT) { MNT_REL(mp); MNT_IUNLOCK(mp); - if (vp != NULL) - *mpp = NULL; return (EWOULDBLOCK); } /* @@ -1063,8 +1056,6 @@ vn_start_secondary_write(vp, mpp, flags) vfs_rel(mp); if (error == 0) goto retry; - if (vp != NULL) - *mpp = NULL; return (error); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 21:57:55 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25CE21065672; Sun, 16 Nov 2008 21:57:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 169078FC0A; Sun, 16 Nov 2008 21:57:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGLvsnu065667; Sun, 16 Nov 2008 21:57:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGLvs7V065666; Sun, 16 Nov 2008 21:57:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811162157.mAGLvs7V065666@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 16 Nov 2008 21:57:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185012 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 21:57:55 -0000 Author: kib Date: Sun Nov 16 21:57:54 2008 New Revision: 185012 URL: http://svn.freebsd.org/changeset/base/185012 Log: Instead of forcing vn_start_write() to reset mp back to NULL for the failed calls with non-NULL vp, explicitely clear mp after failure. Tested by: stass Reviewed by: tegge PR: 123768 MFC after: 1 week Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Nov 16 21:56:29 2008 (r185011) +++ head/sys/vm/vm_pageout.c Sun Nov 16 21:57:54 2008 (r185012) @@ -944,8 +944,7 @@ rescan0: vp = object->handle; if (vp->v_type == VREG && vn_start_write(vp, &mp, V_NOWAIT) != 0) { - KASSERT(mp == NULL, - ("vm_pageout_scan: mp != NULL")); + mp = NULL; ++pageout_lock_miss; if (object->flags & OBJ_MIGHTBEDIRTY) vnodes_skipped++; From owner-svn-src-all@FreeBSD.ORG Sun Nov 16 22:39:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06804106567E; Sun, 16 Nov 2008 22:39:05 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB4A68FC1B; Sun, 16 Nov 2008 22:39:04 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGMd4Rv066534; Sun, 16 Nov 2008 22:39:04 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAGMd4mh066533; Sun, 16 Nov 2008 22:39:04 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200811162239.mAGMd4mh066533@svn.freebsd.org> From: Maksim Yevmenkin Date: Sun, 16 Nov 2008 22:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185013 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 22:39:05 -0000 Author: emax Date: Sun Nov 16 22:39:04 2008 New Revision: 185013 URL: http://svn.freebsd.org/changeset/base/185013 Log: More locking for syscons(4). This should prevent races with sckbdevent(). PR: kern/127446 Submitted by: Eygene Ryabinkin rea-fbsd at codelabs dot ru Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sun Nov 16 21:57:54 2008 (r185012) +++ head/sys/dev/syscons/syscons.c Sun Nov 16 22:39:04 2008 (r185013) @@ -1572,6 +1572,7 @@ sccngetch(int flags) int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ int c; + mtx_lock(&Giant); /* assert(sc_console != NULL) */ /* @@ -1583,11 +1584,13 @@ sccngetch(int flags) sccnupdate(scp); if (fkeycp < fkey.len) { + mtx_unlock(&Giant); splx(s); return fkey.str[fkeycp++]; } if (scp->sc->kbd == NULL) { + mtx_unlock(&Giant); splx(s); return -1; } @@ -1610,6 +1613,7 @@ sccngetch(int flags) scp->kbd_mode = cur_mode; kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); kbdd_disable(scp->sc->kbd); + mtx_unlock(&Giant); splx(s); switch (KEYFLAGS(c)) { From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 00:50:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5E511065693; Mon, 17 Nov 2008 00:50:59 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 958D28FC12; Mon, 17 Nov 2008 00:50:59 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAH0oxme068864; Mon, 17 Nov 2008 00:50:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAH0ox7C068863; Mon, 17 Nov 2008 00:50:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811170050.mAH0ox7C068863@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 17 Nov 2008 00:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185014 - head/sys/dev/vr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 00:50:59 -0000 Author: yongari Date: Mon Nov 17 00:50:59 2008 New Revision: 185014 URL: http://svn.freebsd.org/changeset/base/185014 Log: Fix typo. It restuled in activating unwanted Rx filtering as well as resetting Rx threshold configuration. Submitted by: Joost Mulders < Joost.Mulders <> Sun DOT COM > Modified: head/sys/dev/vr/if_vr.c Modified: head/sys/dev/vr/if_vr.c ============================================================================== --- head/sys/dev/vr/if_vr.c Sun Nov 16 22:39:04 2008 (r185013) +++ head/sys/dev/vr/if_vr.c Mon Nov 17 00:50:59 2008 (r185014) @@ -465,7 +465,8 @@ vr_set_filter(struct vr_softc *sc) ifp = sc->vr_ifp; rxfilt = CSR_READ_1(sc, VR_RXCFG); - rxfilt = ~(VR_RXCFG_RX_PROMISC | VR_RXCFG_RX_BROAD | VR_RXCFG_RX_MULTI); + rxfilt &= ~(VR_RXCFG_RX_PROMISC | VR_RXCFG_RX_BROAD | + VR_RXCFG_RX_MULTI); if (ifp->if_flags & IFF_BROADCAST) rxfilt |= VR_RXCFG_RX_BROAD; if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 01:32:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8A31106564A; Mon, 17 Nov 2008 01:32:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 916978FC08; Mon, 17 Nov 2008 01:32:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAH1WTB0069615; Mon, 17 Nov 2008 01:32:29 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAH1WT2j069611; Mon, 17 Nov 2008 01:32:29 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811170132.mAH1WT2j069611@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Nov 2008 01:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185015 - head/sys/dev/cardbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 01:32:30 -0000 Author: imp Date: Mon Nov 17 01:32:29 2008 New Revision: 185015 URL: http://svn.freebsd.org/changeset/base/185015 Log: Overhaul of CIS parsing, next step: keep a cached copy of the CIS, read before we configure the card, so we can implement /dev/cardbus*.cis. Also, do this on a per-child basis, so we now have a different name than before. I think i'll have to fix that for some legacy tools to keep working. I can now do a dumpcis on my running atheros card and have it still work! Modified: head/sys/dev/cardbus/cardbus.c head/sys/dev/cardbus/cardbus_cis.c head/sys/dev/cardbus/cardbus_device.c head/sys/dev/cardbus/cardbusvar.h Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Mon Nov 17 00:50:59 2008 (r185014) +++ head/sys/dev/cardbus/cardbus.c Mon Nov 17 01:32:29 2008 (r185015) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003 M. Warner Losh. All Rights Reserved. + * Copyright (c) 2003-2008 M. Warner Losh. All Rights Reserved. * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,20 +99,18 @@ cardbus_probe(device_t cbdev) static int cardbus_attach(device_t cbdev) { - struct cardbus_softc *sc = device_get_softc(cbdev); + struct cardbus_softc *sc; + sc = device_get_softc(cbdev); sc->sc_dev = cbdev; - cardbus_device_create(sc); return (0); } static int cardbus_detach(device_t cbdev) { - struct cardbus_softc *sc = device_get_softc(cbdev); cardbus_detach_card(cbdev); - cardbus_device_destroy(sc); return (0); } @@ -165,7 +163,9 @@ cardbus_attach_card(device_t cbdev) int bus, domain, slot, func; int cardattached = 0; int cardbusfunchigh = 0; + struct cardbus_softc *sc; + sc = device_get_softc(cbdev); cardbus_detach_card(cbdev); /* detach existing cards */ POWER_ENABLE_SOCKET(brdev, cbdev); domain = pcib_get_domain(cbdev); @@ -192,6 +192,7 @@ cardbus_attach_card(device_t cbdev) dinfo->pci.cfg.dev = child; resource_list_init(&dinfo->pci.resources); device_set_ivars(child, dinfo); + cardbus_device_create(sc, dinfo, cbdev, child); if (cardbus_do_cis(cbdev, child) != 0) DEVPRINTF((cbdev, "Warning: Bogus CIS ignored\n")); pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 0); @@ -235,6 +236,7 @@ cardbus_detach_card(device_t cbdev) if (status == DS_ATTACHED || status == DS_BUSY) device_detach(devlist[tmp]); cardbus_release_all_resources(cbdev, dinfo); + cardbus_device_destroy(dinfo); device_delete_child(cbdev, devlist[tmp]); pci_freecfg((struct pci_devinfo *)dinfo); } Modified: head/sys/dev/cardbus/cardbus_cis.c ============================================================================== --- head/sys/dev/cardbus/cardbus_cis.c Mon Nov 17 00:50:59 2008 (r185014) +++ head/sys/dev/cardbus/cardbus_cis.c Mon Nov 17 01:32:29 2008 (r185015) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2005-2008, M. Warner Losh * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * Modified: head/sys/dev/cardbus/cardbus_device.c ============================================================================== --- head/sys/dev/cardbus/cardbus_device.c Mon Nov 17 00:50:59 2008 (r185014) +++ head/sys/dev/cardbus/cardbus_device.c Mon Nov 17 01:32:29 2008 (r185015) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005, M. Warner Losh + * Copyright (c) 2005-2008, M. Warner Losh * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,26 +63,6 @@ static struct cdevsw cardbus_cdevsw = { .d_name = "cardbus" }; -int -cardbus_device_create(struct cardbus_softc *sc) -{ - uint32_t minor; - - minor = device_get_unit(sc->sc_dev) << 16; - sc->sc_cisdev = make_dev(&cardbus_cdevsw, minor, 0, 0, 0666, - "cardbus%u.cis", device_get_unit(sc->sc_dev)); - sc->sc_cisdev->si_drv1 = sc; - return (0); -} - -int -cardbus_device_destroy(struct cardbus_softc *sc) -{ - if (sc->sc_cisdev) - destroy_dev(sc->sc_cisdev); - return (0); -} - static int cardbus_build_cis(device_t cbdev, device_t child, int id, int len, uint8_t *tupledata, uint32_t start, uint32_t *off, @@ -115,7 +95,8 @@ cardbus_build_cis(device_t cbdev, device } static int -cardbus_device_buffer_cis(device_t parent, device_t child) +cardbus_device_buffer_cis(device_t parent, device_t child, + struct cis_buffer *cbp) { struct cardbus_softc *sc; struct tuple_callbacks cb[] = { @@ -123,46 +104,44 @@ cardbus_device_buffer_cis(device_t paren }; sc = device_get_softc(parent); - return (cardbus_parse_cis(parent, child, cb, &sc->sc_cis)); + return (cardbus_parse_cis(parent, child, cb, cbp)); +} + +int +cardbus_device_create(struct cardbus_softc *sc, struct cardbus_devinfo *devi, + device_t parent, device_t child) +{ + uint32_t minor; + + cardbus_device_buffer_cis(parent, child, &devi->sc_cis); + minor = (device_get_unit(sc->sc_dev) << 8) + devi->pci.cfg.func; + devi->sc_cisdev = make_dev(&cardbus_cdevsw, minor, 0, 0, 0666, + "cardbus%d.%d.cis", device_get_unit(sc->sc_dev), + devi->pci.cfg.func); + /* XXX need cardbus%d.cis compat layer here ? */ + devi->sc_cisdev->si_drv1 = devi; + return (0); +} + +int +cardbus_device_destroy(struct cardbus_devinfo *devi) +{ + if (devi->sc_cisdev) + destroy_dev(devi->sc_cisdev); + return (0); } static int cardbus_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { - device_t parent, child; - device_t *kids; - int cnt, err; - struct cardbus_softc *sc; - sc = dev->si_drv1; - if (sc->sc_cis_open) - return (EBUSY); - parent = sc->sc_dev; - err = device_get_children(parent, &kids, &cnt); - if (err) - return err; - sc->sc_cis.len = 0; - if (cnt == 0) { - free(kids, M_TEMP); - sc->sc_cis_open++; - return (0); - } - child = kids[0]; - free(kids, M_TEMP); - err = cardbus_device_buffer_cis(parent, child); - if (err) - return (err); - sc->sc_cis_open++; return (0); } static int cardbus_close(struct cdev *dev, int fflags, int devtype, struct thread *td) { - struct cardbus_softc *sc; - sc = dev->si_drv1; - sc->sc_cis_open = 0; return (0); } @@ -176,12 +155,12 @@ cardbus_ioctl(struct cdev *dev, u_long c static int cardbus_read(struct cdev *dev, struct uio *uio, int ioflag) { - struct cardbus_softc *sc; + struct cardbus_devinfo *devi; - sc = dev->si_drv1; + devi = dev->si_drv1; /* EOF */ - if (uio->uio_offset >= sc->sc_cis.len) + if (uio->uio_offset >= devi->sc_cis.len) return (0); - return (uiomove(sc->sc_cis.buffer + uio->uio_offset, - MIN(uio->uio_resid, sc->sc_cis.len - uio->uio_offset), uio)); + return (uiomove(devi->sc_cis.buffer + uio->uio_offset, + MIN(uio->uio_resid, devi->sc_cis.len - uio->uio_offset), uio)); } Modified: head/sys/dev/cardbus/cardbusvar.h ============================================================================== --- head/sys/dev/cardbus/cardbusvar.h Mon Nov 17 00:50:59 2008 (r185014) +++ head/sys/dev/cardbus/cardbusvar.h Mon Nov 17 01:32:29 2008 (r185015) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2008, M. Warner Losh * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * @@ -29,6 +30,21 @@ /* * Structure definitions for the Cardbus Bus driver */ + +/* + * Static copy of the CIS buffer. Technically, you aren't supposed + * to do this. In practice, however, it works well. + */ +struct cis_buffer +{ + size_t len; /* Actual length of the CIS */ + uint8_t buffer[2040]; /* small enough to be 2k */ +}; + +/* + * Per child information for the PCI device. Cardbus layers on some + * additional data. + */ struct cardbus_devinfo { struct pci_devinfo pci; @@ -43,36 +59,33 @@ struct cardbus_devinfo } lan; } funce; uint32_t fepresent; /* bit mask of funce values present */ + struct cdev *sc_cisdev; + struct cis_buffer sc_cis; }; -struct cis_buffer -{ - size_t len; /* Actual length of the CIS */ - uint8_t buffer[2040]; /* small enough to be 2k */ -}; - +/* + * Per cardbus soft info. Not sure why we even keep this around... + */ struct cardbus_softc { device_t sc_dev; - /* The following fields should in be in struct cardbus_devinfo */ - struct cdev *sc_cisdev; - struct cis_buffer sc_cis; - int sc_cis_open; }; +/* + * Per node callback structures. + */ struct tuple_callbacks; - typedef int (tuple_cb) (device_t cbdev, device_t child, int id, int len, uint8_t *tupledata, uint32_t start, uint32_t *off, struct tuple_callbacks *info, void *); - struct tuple_callbacks { int id; char *name; tuple_cb *func; }; -int cardbus_device_create(struct cardbus_softc *); -int cardbus_device_destroy(struct cardbus_softc *); +int cardbus_device_create(struct cardbus_softc *sc, + struct cardbus_devinfo *devi, device_t parent, device_t child); +int cardbus_device_destroy(struct cardbus_devinfo *devi); int cardbus_parse_cis(device_t cbdev, device_t child, struct tuple_callbacks *callbacks, void *); From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 02:37:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 788AC106564A; Mon, 17 Nov 2008 02:37:46 +0000 (UTC) (envelope-from ambrisko@ambrisko.com) Received: from mail.ambrisko.com (mail.ambrisko.com [64.174.51.43]) by mx1.freebsd.org (Postfix) with ESMTP id 361A98FC1A; Mon, 17 Nov 2008 02:37:45 +0000 (UTC) (envelope-from ambrisko@ambrisko.com) X-Ambrisko-Me: Yes Received: from server2.ambrisko.com (HELO www.ambrisko.com) ([192.168.1.2]) by ironport.ambrisko.com with ESMTP; 16 Nov 2008 18:37:57 -0800 Received: from ambrisko.com (localhost [127.0.0.1]) by www.ambrisko.com (8.14.1/8.14.1) with ESMTP id mAH2bjc5088187; Sun, 16 Nov 2008 18:37:45 -0800 (PST) (envelope-from ambrisko@ambrisko.com) Received: (from ambrisko@localhost) by ambrisko.com (8.14.1/8.14.1/Submit) id mAH2bjY5088186; Sun, 16 Nov 2008 18:37:45 -0800 (PST) (envelope-from ambrisko) From: Doug Ambrisko Message-Id: <200811170237.mAH2bjY5088186@ambrisko.com> In-Reply-To: <20081116115120.GC2037@deviant.kiev.zoral.com.ua> To: Kostik Belousov Date: Sun, 16 Nov 2008 18:37:45 -0800 (PST) X-Mailer: ELM [version 2.4ME+ PL94b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Cc: svn-src-head@freebsd.org, Doug Ambrisko , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 02:37:46 -0000 Kostik Belousov writes: | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: | > Author: ambrisko | > Date: Fri Nov 14 21:05:45 2008 | > New Revision: 184974 | > URL: http://svn.freebsd.org/changeset/base/184974 | > | > Log: | > When running a 32bit app. on amd64, ensure the bits above 32bit | > are zero for the copyout. Confirmed by LSI. | > | > Modified: | > head/sys/dev/mfi/mfi.c | > | > Modified: head/sys/dev/mfi/mfi.c | > ============================================================================== | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, | > ->mfi_frame.raw[ioc->mfi_sense_off], | > &sense_ptr.sense_ptr_data[0], | > sizeof(sense_ptr.sense_ptr_data)); | > +#ifdef __amd64__ | > + if (cmd != MFI_CMD) { | > + /* | > + * not 64bit native so zero out any address | > + * over 32bit */ | > + sense_ptr.high = 0; | > + } | > +#endif | > error = copyout(cm->cm_sense, sense_ptr.user_space, | > ioc->mfi_sense_len); | > if (error != 0) { | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ | > ->lioc_frame.raw[l_ioc.lioc_sense_off], | > &sense_ptr.sense_ptr_data[0], | > sizeof(sense_ptr.sense_ptr_data)); | > +#ifdef __amd64__ | > + /* | > + * only 32bit Linux support so zero out any | > + * address over 32bit | > + */ | > + sense_ptr.high = 0; | > +#endif | > error = copyout(cm->cm_sense, sense_ptr.user_space, | > l_ioc.lioc_sense_len); | > if (error != 0) { | | Would it make sense to perform this cut slightly more generically, by | checking whether the current process is 32bit ? | | We still have not grew the easy to check flag or attribute of the image, | but usual practice is to compare p_sysent with corresponding sysvec, | like | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) | or | if (td->td_proc->p_sysent == &elf_linux_sysvec) So far we do it based on the ioctl since the 32bit or 64bit ioctl value is different. I put in that comment for Linux since there is talk/work for Linux amd64 emulation. For 64bit Linux ioctl support we need a 64bit structure defined. When the ioctl can't be figured out then I've used the p_sysent. Eventually, something that is more generic then the #ifdef __amd64__ should be done in all the drivers that do this emulation. Doug A. From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 03:51:24 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECB3F1065670; Mon, 17 Nov 2008 03:51:24 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 95B098FC0A; Mon, 17 Nov 2008 03:51:24 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id mAH3pIEH058897; Sun, 16 Nov 2008 20:51:19 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <4920EA36.5020909@samsco.org> Date: Sun, 16 Nov 2008 20:51:18 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Doug Ambrisko References: <200811170237.mAH2bjY5088186@ambrisko.com> In-Reply-To: <200811170237.mAH2bjY5088186@ambrisko.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: Kostik Belousov , Doug Ambrisko , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 03:51:25 -0000 Doug Ambrisko wrote: > Kostik Belousov writes: > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > | > Author: ambrisko > | > Date: Fri Nov 14 21:05:45 2008 > | > New Revision: 184974 > | > URL: http://svn.freebsd.org/changeset/base/184974 > | > > | > Log: > | > When running a 32bit app. on amd64, ensure the bits above 32bit > | > are zero for the copyout. Confirmed by LSI. > | > > | > Modified: > | > head/sys/dev/mfi/mfi.c > | > > | > Modified: head/sys/dev/mfi/mfi.c > | > ============================================================================== > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > | > ->mfi_frame.raw[ioc->mfi_sense_off], > | > &sense_ptr.sense_ptr_data[0], > | > sizeof(sense_ptr.sense_ptr_data)); > | > +#ifdef __amd64__ > | > + if (cmd != MFI_CMD) { > | > + /* > | > + * not 64bit native so zero out any address > | > + * over 32bit */ > | > + sense_ptr.high = 0; > | > + } > | > +#endif > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > | > ioc->mfi_sense_len); > | > if (error != 0) { > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > | > &sense_ptr.sense_ptr_data[0], > | > sizeof(sense_ptr.sense_ptr_data)); > | > +#ifdef __amd64__ > | > + /* > | > + * only 32bit Linux support so zero out any > | > + * address over 32bit > | > + */ > | > + sense_ptr.high = 0; > | > +#endif > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > | > l_ioc.lioc_sense_len); > | > if (error != 0) { > | > | Would it make sense to perform this cut slightly more generically, by > | checking whether the current process is 32bit ? > | > | We still have not grew the easy to check flag or attribute of the image, > | but usual practice is to compare p_sysent with corresponding sysvec, > | like > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) > | or > | if (td->td_proc->p_sysent == &elf_linux_sysvec) > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > value is different. I put in that comment for Linux since there > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > support we need a 64bit structure defined. When the ioctl can't > be figured out then I've used the p_sysent. Eventually, something > that is more generic then the #ifdef __amd64__ should be done > in all the drivers that do this emulation. > > Doug A. Something that identifies the ABI needs to be put into the proc structure. This isn't the only place where such information is needed. Comparing against the sysent table symbol doesn't work very well because it requires all sysent tables be loaded, which isn't always true for the linux ABI. Scott From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 04:13:47 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7203B106564A; Mon, 17 Nov 2008 04:13:47 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F5BE8FC17; Mon, 17 Nov 2008 04:13:47 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAH4DlMd072794; Mon, 17 Nov 2008 04:13:47 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAH4Dlvx072793; Mon, 17 Nov 2008 04:13:47 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200811170413.mAH4Dlvx072793@svn.freebsd.org> From: Lawrence Stewart Date: Mon, 17 Nov 2008 04:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185017 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 04:13:47 -0000 Author: lstewart Date: Mon Nov 17 04:13:45 2008 New Revision: 185017 URL: http://svn.freebsd.org/changeset/base/185017 Log: Syncing my project branch with head pulled in a number of large diffs which in turn caused the pre-commit hook to barf claiming I had exceeded the commit size limit. Temporarily raise my commit size limit as a work around. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Nov 17 03:04:45 2008 (r185016) +++ svnadmin/conf/sizelimit.conf Mon Nov 17 04:13:45 2008 (r185017) @@ -17,3 +17,4 @@ #peter 3141592 #grog #kan +lstewart From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 07:09:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEF671065688; Mon, 17 Nov 2008 07:09:40 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA6CD8FC1B; Mon, 17 Nov 2008 07:09:40 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAH79eV8075978; Mon, 17 Nov 2008 07:09:40 GMT (envelope-from philip@svn.freebsd.org) Received: (from philip@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAH79ecr075977; Mon, 17 Nov 2008 07:09:40 GMT (envelope-from philip@svn.freebsd.org) Message-Id: <200811170709.mAH79ecr075977@svn.freebsd.org> From: Philip Paeps Date: Mon, 17 Nov 2008 07:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185021 - head/sys/dev/glxsb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 07:09:41 -0000 Author: philip Date: Mon Nov 17 07:09:40 2008 New Revision: 185021 URL: http://svn.freebsd.org/changeset/base/185021 Log: Fix two possible (but unlikely) NULL-pointer dereferences in glxsb(4). Spotted by: Coverity MFC after: 1 week Modified: head/sys/dev/glxsb/glxsb.c Modified: head/sys/dev/glxsb/glxsb.c ============================================================================== --- head/sys/dev/glxsb/glxsb.c Mon Nov 17 07:03:05 2008 (r185020) +++ head/sys/dev/glxsb/glxsb.c Mon Nov 17 07:09:40 2008 (r185021) @@ -358,7 +358,8 @@ glxsb_detach(device_t dev) return (EBUSY); } } - while ((ses = TAILQ_FIRST(&sc->sc_sessions)) != NULL) { + while (!TAILQ_EMPTY(&sc->sc_sessions)) { + ses = TAILQ_FIRST(&sc->sc_sessions); TAILQ_REMOVE(&sc->sc_sessions, ses, ses_next); free(ses, M_GLXSB); } @@ -867,8 +868,11 @@ glxsb_crypto_process(device_t dev, struc enccrd = maccrd = NULL; - if (crp == NULL || - crp->crp_callback == NULL || crp->crp_desc == NULL) { + /* Sanity check. */ + if (crp == NULL) + return (EINVAL); + + if (crp->crp_callback == NULL || crp->crp_desc == NULL) { error = EINVAL; goto fail; } From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 11:22:53 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44814106564A; Mon, 17 Nov 2008 11:22:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail10.syd.optusnet.com.au (mail10.syd.optusnet.com.au [211.29.132.191]) by mx1.freebsd.org (Postfix) with ESMTP id BF61A8FC14; Mon, 17 Nov 2008 11:22:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-115-33.carlnfd1.nsw.optusnet.com.au (c122-107-115-33.carlnfd1.nsw.optusnet.com.au [122.107.115.33]) by mail10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mAHBMb91021883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 Nov 2008 22:22:42 +1100 Date: Mon, 17 Nov 2008 22:22:36 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Maksim Yevmenkin In-Reply-To: <200811162239.mAGMd4mh066533@svn.freebsd.org> Message-ID: <20081117222219.I95669@delplex.bde.org> References: <200811162239.mAGMd4mh066533@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185013 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 11:22:53 -0000 On Sun, 16 Nov 2008, Maksim Yevmenkin wrote: > Author: emax > Date: Sun Nov 16 22:39:04 2008 > New Revision: 185013 > URL: http://svn.freebsd.org/changeset/base/185013 > > Log: > More locking for syscons(4). This should prevent races with sckbdevent(). This cannot be the correct fix. It should cause panics due to failure of the (missing) assertion that no locks may be accessed in debugger mode. Locks may not be accessed in debugger mode because: (1) locks may be in an inconsistent state (when locking code is being debugged) (unless they are made to work virtually -- switch all locks to a safe state while in debugger mode, but display the unswitched state in all debugger commands) (2) deadlock is possible (would also be avoided by virtualization). > Modified: > head/sys/dev/syscons/syscons.c > > Modified: head/sys/dev/syscons/syscons.c > ============================================================================== > --- head/sys/dev/syscons/syscons.c Sun Nov 16 21:57:54 2008 (r185012) > +++ head/sys/dev/syscons/syscons.c Sun Nov 16 22:39:04 2008 (r185013) > @@ -1572,6 +1572,7 @@ sccngetch(int flags) > int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ The comment still says that this is what blocks sckbdevent(). The comment was wrong too for debugger mode -- in debugger mode, interrupts are masked in hardware and other CPUs are stopped, so nothing except possibly this functions internals can call sckbdevent(). Internal calls to scrn_timer() used to be prevented by sccndbctl() setting syscons' `debugger' flag and this function and others checking this flag. This has been lost. I think the flag isn't needed and wasn't used to protect sckbdevent(), and your problem has nothing to do with debugger mode except for breaking it. Instead your problem is a layering one (continued below (*)). > int c; > > + mtx_lock(&Giant); > /* assert(sc_console != NULL) */ > > /* Acquiring Giant in debugger mode is especially invalid (except deadlock is not so likely for a recursive lock). > @@ -1583,11 +1584,13 @@ sccngetch(int flags) > sccnupdate(scp); > > if (fkeycp < fkey.len) { > + mtx_unlock(&Giant); > splx(s); > return fkey.str[fkeycp++]; > } > > if (scp->sc->kbd == NULL) { > + mtx_unlock(&Giant); > splx(s); > return -1; > } > @@ -1610,6 +1613,7 @@ sccngetch(int flags) > scp->kbd_mode = cur_mode; > kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); > kbdd_disable(scp->sc->kbd); > + mtx_unlock(&Giant); > splx(s); > > switch (KEYFLAGS(c)) { > BTW, sccngetch() shouldn't exist. It existed to demultiplex the 2 console driver entry points sc_cngetch() and sc_cncheckc(), but sc_cncheckc() has gone away. (*) syscons has several getc routines. The layering and locking for these should be something like: sc_cngetc(): must not access any locks; currently implemented by calling scgetc(); therefore: scgetc(): must not access any locks sccngetch(): bogus layering -- see above sckbdevent(): I think this is the entry point for all normal (non- low-level-console) syscons input. It is currently implemented by calling scgetc(), which must not access any locks. Therefore, any locking must be in this function. I think it currently uses Giant locking. There is still a problem for calls to sc_cngetc() from the low-console driver. These can race with sckbdevent(). In debugger mode, no locking is permitted, so syscons' getc functions must be carefully written to do only harmless things when they lose races. They are not carefully written (e.g., almost the first thing they do, shown in the above, may give a buffer overrun: if (fkeycp < fkey.len) { mtx_unlock(&Giant); splx(s); return fkey.str[fkeycp++]; } since the increment is not atomic with the bounds check), but they mostly work. (Syscons' putc routines have a much larger number of races like this, but they mostly work too. It used to be easy to cause panics by racing normal console output with printfs from an interrupt handler (use a high frequency timeout interrupt handler that prints something), but almost any locking would fix that and I think Giant-locking everything fixed it accidentally (**). So there is only a problem modes like debugger mode where locking is not permitted.) The races for sc_cngetc() were normally limited: - most calls were in debugger mode, and debugger mode limits problems - the only other calls were for things like gets() for non-auto mountroot and cngetc() for the "hit any key to reboot". This case might even supply the needed and permitted Giant locking accidentally. However, you seem to have made the races very common by (ab)using cngetc() for keyboard multiplexing. cngetc() is not designed for this. You need to know syscons' internals and do the necessary Giant locking in the caller. (**) Giant locking for printf: I can't find any. tprintf() and uprintf() used to acquire Giant to fix related problems, and even that went away with the MPSAFE tty changes. Ah, the related problem is very closely related: ttys used to require Giant locking for everything *except* low- level consoles. tprintf() and uprintf() use normal i/o so they had to supply the Giant locking. OTOH, low-level console i/o uses (broken for some console drivers including syscons) null locking. The keyboard multiplexor needs to work mainly for normal i/o (it would be a nightmare to make it work for low-level i/o, with correct null locking, since it touches a lot of code and data). Thus it needs to supply the Giant locking if syscons still needs it. It still seems to use Giant locking after the MPSAFE tty changes. I don't completely understand those. They make it even harder supply correct locking -- now you might need Giant or the tty lock, or both... In fact, the main change to sckbdevent() to make syscons MPSAFE was to use Giant locking in sckbdevent(). That seems sort of backwards (the low levels which benefit most from low latency keep high latency), but might be needed because keyboard drivers aren't MPSAFE yet, and wouldn't want to know about the tty lock even if they were. So supplying Giant locking seems to be the correct way to interface with sckbdevent(). Bruce From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 16:32:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51A1A106564A; Mon, 17 Nov 2008 16:32:58 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D79E8FC16; Mon, 17 Nov 2008 16:32:58 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHGWwNK087399; Mon, 17 Nov 2008 16:32:58 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHGWv2c087395; Mon, 17 Nov 2008 16:32:57 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811171632.mAHGWv2c087395@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 17 Nov 2008 16:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185023 - in head/gnu/usr.bin/gdb: . gdbserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 16:32:58 -0000 Author: raj Date: Mon Nov 17 16:32:57 2008 New Revision: 185023 URL: http://svn.freebsd.org/changeset/base/185023 Log: Initial gdbserver support for ARM. Obtained from: Juniper Networks, Semihalf Added: head/gnu/usr.bin/gdb/gdbserver/fbsd-arm-low.c (contents, props changed) head/gnu/usr.bin/gdb/gdbserver/reg-arm.c (contents, props changed) Modified: head/gnu/usr.bin/gdb/Makefile head/gnu/usr.bin/gdb/gdbserver/Makefile Modified: head/gnu/usr.bin/gdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/Makefile Mon Nov 17 07:39:39 2008 (r185022) +++ head/gnu/usr.bin/gdb/Makefile Mon Nov 17 16:32:57 2008 (r185023) @@ -2,7 +2,7 @@ SUBDIR= doc libgdb gdb gdbtui kgdb -.if ${MACHINE_ARCH} == "i386" +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "arm" SUBDIR+=gdbserver .endif Modified: head/gnu/usr.bin/gdb/gdbserver/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/gdbserver/Makefile Mon Nov 17 07:39:39 2008 (r185022) +++ head/gnu/usr.bin/gdb/gdbserver/Makefile Mon Nov 17 16:32:57 2008 (r185023) @@ -10,9 +10,17 @@ GDBDIR= ${.CURDIR}/../../../../contrib/g PROG= gdbserver -SRCS= i387-fp.c inferiors.c mem-break.c regcache.c remote-utils.c \ - server.c signals.c target.c reg-i386.c utils.c -SRCS+= fbsd-low.c fbsd-i386-low.c +SRCS= inferiors.c mem-break.c regcache.c remote-utils.c \ + server.c signals.c target.c utils.c +SRCS+= fbsd-low.c + +.if ${MACHINE_ARCH} == "i386" +SRCS+= fbsd-i386-low.c i387-fp.c reg-i386.c +.endif + +.if ${MACHINE_ARCH} == "arm" +SRCS+= fbsd-arm-low.c reg-arm.c +.endif #CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_ARCH} CFLAGS+= -I${GDBDIR}/gdb/gdbserver Added: head/gnu/usr.bin/gdb/gdbserver/fbsd-arm-low.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/gdb/gdbserver/fbsd-arm-low.c Mon Nov 17 16:32:57 2008 (r185023) @@ -0,0 +1,146 @@ +/* FreeBSD/ARM specific low level interface, for the remote server for GDB. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "server.h" +#include "fbsd-low.h" + +#ifdef HAVE_SYS_REG_H +#include +#endif + +#include +#include + +#define arm_num_regs 26 + +static int arm_regmap[] = { + 0, 4, 8, 12, 16, 20, 24, 28, + 32, 36, 40, 44, 48, 52, 56, 60, + -1, -1, -1, -1, -1, -1, -1, -1, -1, + 64 +}; + +static int +arm_cannot_store_register (int regno) +{ + return (regno >= arm_num_regs); +} + +static int +arm_cannot_fetch_register (int regno) +{ + return (regno >= arm_num_regs); +} + +extern int debug_threads; + +static CORE_ADDR +arm_get_pc () +{ + unsigned long pc; + collect_register_by_name ("pc", &pc); + if (debug_threads) + fprintf (stderr, "stop pc is %08lx\n", pc); + return pc; +} + +static void +arm_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. We do not support Thumb yet. */ +static const unsigned long arm_breakpoint = 0xef9f0001; +#define arm_breakpoint_len 4 + +static int +arm_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == arm_breakpoint) + return 1; + + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + +/* We only place breakpoints in empty marker functions, and thread locking + is outside of the function. So rather than importing software single-step, + we can just run until exit. */ +static CORE_ADDR +arm_reinsert_addr () +{ + unsigned long pc; + collect_register_by_name ("lr", &pc); + return pc; +} + +static void +arm_fill_gregset (void *buf) +{ + int i; + + for (i = 0; i < arm_num_regs; i++) + if (arm_regmap[i] != -1) + collect_register (i, ((char *) buf) + arm_regmap[i]); + +} + +static void +arm_store_gregset (const void *buf) +{ + int i; + + for (i = 0; i < arm_num_regs; i++) + if (arm_regmap[i] != -1) + supply_register (i, ((char *) buf) + arm_regmap[i]); + +} + + +struct regset_info target_regsets[] = { + {PT_GETREGS, PT_SETREGS, sizeof (struct reg), + GENERAL_REGS, + arm_fill_gregset, arm_store_gregset }, + { 0, 0, -1, -1, NULL, NULL } +}; + +struct fbsd_target_ops the_low_target = { + arm_num_regs, + arm_regmap, + arm_cannot_fetch_register, + arm_cannot_store_register, + arm_get_pc, + arm_set_pc, + (const char *) &arm_breakpoint, + arm_breakpoint_len, + arm_reinsert_addr, + 0, + arm_breakpoint_at, +}; Added: head/gnu/usr.bin/gdb/gdbserver/reg-arm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/gdb/gdbserver/reg-arm.c Mon Nov 17 16:32:57 2008 (r185023) @@ -0,0 +1,68 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* A register protocol for GDB, the GNU debugger. + Copyright 2001, 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``regdat.sh'' and ``reg-arm.dat''. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "regdef.h" +#include "regcache.h" + +struct reg regs_arm[] = { + { "r0", 0, 32 }, + { "r1", 32, 32 }, + { "r2", 64, 32 }, + { "r3", 96, 32 }, + { "r4", 128, 32 }, + { "r5", 160, 32 }, + { "r6", 192, 32 }, + { "r7", 224, 32 }, + { "r8", 256, 32 }, + { "r9", 288, 32 }, + { "r10", 320, 32 }, + { "r11", 352, 32 }, + { "r12", 384, 32 }, + { "sp", 416, 32 }, + { "lr", 448, 32 }, + { "pc", 480, 32 }, + { "f0", 512, 96 }, + { "f1", 608, 96 }, + { "f2", 704, 96 }, + { "f3", 800, 96 }, + { "f4", 896, 96 }, + { "f5", 992, 96 }, + { "f6", 1088, 96 }, + { "f7", 1184, 96 }, + { "fps", 1280, 32 }, + { "cpsr", 1312, 32 }, +}; + +const char *expedite_regs_arm[] = { "r11", "sp", "pc", 0 }; + +void +init_registers () +{ + set_register_cache (regs_arm, + sizeof (regs_arm) / sizeof (regs_arm[0])); + gdbserver_expedite_regs = expedite_regs_arm; +} From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 16:37:04 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61CA5106564A; Mon, 17 Nov 2008 16:37:04 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EF918FC19; Mon, 17 Nov 2008 16:37:04 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHGb4hg087547; Mon, 17 Nov 2008 16:37:04 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHGb4gd087546; Mon, 17 Nov 2008 16:37:04 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811171637.mAHGb4gd087546@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 17 Nov 2008 16:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185024 - head/contrib/gdb/gdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 16:37:04 -0000 Author: raj Date: Mon Nov 17 16:37:04 2008 New Revision: 185024 URL: http://svn.freebsd.org/changeset/base/185024 Log: gdb: Remove arm_pc_is_thumb_dummy() and related code. This is basically an import of the following gdb change: http://sourceware.org/ml/gdb-cvs/2005-03/msg00143.html (which in effect fixes problems with gracefully closing down the non-Thumb program being debugged). Modified: head/contrib/gdb/gdb/arm-tdep.c Modified: head/contrib/gdb/gdb/arm-tdep.c ============================================================================== --- head/contrib/gdb/gdb/arm-tdep.c Mon Nov 17 16:32:57 2008 (r185023) +++ head/contrib/gdb/gdb/arm-tdep.c Mon Nov 17 16:37:04 2008 (r185024) @@ -181,20 +181,6 @@ struct arm_prologue_cache int arm_apcs_32 = 1; -/* Flag set by arm_fix_call_dummy that tells whether the target - function is a Thumb function. This flag is checked by - arm_push_arguments. FIXME: Change the PUSH_ARGUMENTS macro (and - its use in valops.c) to pass the function address as an additional - parameter. */ - -static int target_is_thumb; - -/* Flag set by arm_fix_call_dummy that tells whether the calling - function is a Thumb function. This flag is checked by - arm_pc_is_thumb and arm_call_dummy_breakpoint_offset. */ - -static int caller_is_thumb; - /* Determine if the program counter specified in MEMADDR is in a Thumb function. */ @@ -219,27 +205,6 @@ arm_pc_is_thumb (CORE_ADDR memaddr) } } -/* Determine if the program counter specified in MEMADDR is in a call - dummy being called from a Thumb function. */ - -int -arm_pc_is_thumb_dummy (CORE_ADDR memaddr) -{ - CORE_ADDR sp = read_sp (); - - /* FIXME: Until we switch for the new call dummy macros, this heuristic - is the best we can do. We are trying to determine if the pc is on - the stack, which (hopefully) will only happen in a call dummy. - We hope the current stack pointer is not so far alway from the dummy - frame location (true if we have not pushed large data structures or - gone too many levels deep) and that our 1024 is not enough to consider - code regions as part of the stack (true for most practical purposes). */ - if (DEPRECATED_PC_IN_CALL_DUMMY (memaddr, sp, sp + 1024)) - return caller_is_thumb; - else - return 0; -} - /* Remove useless bits from addresses in a running program. */ static CORE_ADDR arm_addr_bits_remove (CORE_ADDR val) @@ -2021,7 +1986,7 @@ arm_breakpoint_from_pc (CORE_ADDR *pcptr { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (arm_pc_is_thumb (*pcptr) || arm_pc_is_thumb_dummy (*pcptr)) + if (arm_pc_is_thumb (*pcptr)) { *pcptr = UNMAKE_THUMB_ADDR (*pcptr); *lenptr = tdep->thumb_breakpoint_size; From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 17:13:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 643A410656AE; Mon, 17 Nov 2008 17:13:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id E329E8FC20; Mon, 17 Nov 2008 17:13:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAHHDMIo032310; Mon, 17 Nov 2008 12:13:41 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Doug Ambrisko Date: Mon, 17 Nov 2008 12:11:41 -0500 User-Agent: KMail/1.9.7 References: <200811170237.mAH2bjY5088186@ambrisko.com> In-Reply-To: <200811170237.mAH2bjY5088186@ambrisko.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811171211.42740.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 17 Nov 2008 12:13:42 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8642/Sun Nov 16 23:01:08 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Kostik Belousov , Doug Ambrisko , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 17:13:50 -0000 On Sunday 16 November 2008 09:37:45 pm Doug Ambrisko wrote: > Kostik Belousov writes: > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > | > Author: ambrisko > | > Date: Fri Nov 14 21:05:45 2008 > | > New Revision: 184974 > | > URL: http://svn.freebsd.org/changeset/base/184974 > | > > | > Log: > | > When running a 32bit app. on amd64, ensure the bits above 32bit > | > are zero for the copyout. Confirmed by LSI. > | > > | > Modified: > | > head/sys/dev/mfi/mfi.c > | > > | > Modified: head/sys/dev/mfi/mfi.c > | > ============================================================================== > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > | > ->mfi_frame.raw[ioc->mfi_sense_off], > | > &sense_ptr.sense_ptr_data[0], > | > sizeof(sense_ptr.sense_ptr_data)); > | > +#ifdef __amd64__ > | > + if (cmd != MFI_CMD) { > | > + /* > | > + * not 64bit native so zero out any address > | > + * over 32bit */ > | > + sense_ptr.high = 0; > | > + } > | > +#endif > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > | > ioc->mfi_sense_len); > | > if (error != 0) { > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > | > &sense_ptr.sense_ptr_data[0], > | > sizeof(sense_ptr.sense_ptr_data)); > | > +#ifdef __amd64__ > | > + /* > | > + * only 32bit Linux support so zero out any > | > + * address over 32bit > | > + */ > | > + sense_ptr.high = 0; > | > +#endif > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > | > l_ioc.lioc_sense_len); > | > if (error != 0) { > | > | Would it make sense to perform this cut slightly more generically, by > | checking whether the current process is 32bit ? > | > | We still have not grew the easy to check flag or attribute of the image, > | but usual practice is to compare p_sysent with corresponding sysvec, > | like > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) > | or > | if (td->td_proc->p_sysent == &elf_linux_sysvec) > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > value is different. I put in that comment for Linux since there > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > support we need a 64bit structure defined. When the ioctl can't > be figured out then I've used the p_sysent. Eventually, something > that is more generic then the #ifdef __amd64__ should be done > in all the drivers that do this emulation. I prefer depending on things like ioctl values and the 32-bit sysctl flag when possible. If we do have to directly check for the ABI, I'd much rather have a flags field in sysent rather than trying to compare against global symbols, as you can't compare against a global symbol unless it is present in the kernel. Something like: if (td->td_proc->p_sysent->sy_flags & SY_32) or some such. I've wanted to have a COMPAT_FREEBSD32 that gets auto-enabled when you turn on COMPAT_IA32 on amd64 and ia64. It would also potentially be enabled by a COMPAT_SPARC8 or some such on sparc64 if we ever had that. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 17:20:19 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A5411065672; Mon, 17 Nov 2008 17:20:19 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045082.chello.pl [87.206.45.82]) by mx1.freebsd.org (Postfix) with ESMTP id A64A28FC17; Mon, 17 Nov 2008 17:20:18 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id D454F4569A; Mon, 17 Nov 2008 17:52:01 +0100 (CET) Received: from localhost (ghf58.internetdsl.tpnet.pl [83.12.187.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id D7C5745684; Mon, 17 Nov 2008 17:51:55 +0100 (CET) Date: Mon, 17 Nov 2008 17:51:52 +0100 From: Pawel Jakub Dawidek To: Philip Paeps Message-ID: <20081117165006.GA1489@garage.freebsd.pl> References: <200811170709.mAH79ecr075977@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v9Ux+11Zm5mwPlX6" Content-Disposition: inline In-Reply-To: <200811170709.mAH79ecr075977@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185021 - head/sys/dev/glxsb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 17:20:19 -0000 --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 17, 2008 at 07:09:40AM +0000, Philip Paeps wrote: > Author: philip > Date: Mon Nov 17 07:09:40 2008 > New Revision: 185021 > URL: http://svn.freebsd.org/changeset/base/185021 >=20 > Log: > Fix two possible (but unlikely) NULL-pointer dereferences in glxsb(4). > > Spotted by: Coverity > MFC after: 1 week > > Modified: > head/sys/dev/glxsb/glxsb.c >=20 > Modified: head/sys/dev/glxsb/glxsb.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/glxsb/glxsb.c Mon Nov 17 07:03:05 2008 (r185020) > +++ head/sys/dev/glxsb/glxsb.c Mon Nov 17 07:09:40 2008 (r185021) > @@ -358,7 +358,8 @@ glxsb_detach(device_t dev) > return (EBUSY); > } > } > - while ((ses =3D TAILQ_FIRST(&sc->sc_sessions)) !=3D NULL) { > + while (!TAILQ_EMPTY(&sc->sc_sessions)) { > + ses =3D TAILQ_FIRST(&sc->sc_sessions); This is perfectly valid, and if it was reported by coverity, it is a false positive. > TAILQ_REMOVE(&sc->sc_sessions, ses, ses_next); > free(ses, M_GLXSB); > } > @@ -867,8 +868,11 @@ glxsb_crypto_process(device_t dev, struc > =20 > enccrd =3D maccrd =3D NULL; > =20 > - if (crp =3D=3D NULL || > - crp->crp_callback =3D=3D NULL || crp->crp_desc =3D=3D NULL) { > + /* Sanity check. */ > + if (crp =3D=3D NULL) > + return (EINVAL); > + > + if (crp->crp_callback =3D=3D NULL || crp->crp_desc =3D=3D NULL) { > error =3D EINVAL; > goto fail; > } This one is ok. The same one exists in padlock(4), could you fix it too? --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --v9Ux+11Zm5mwPlX6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFJIaEnForvXbEpPzQRAvGJAKDj1rBiE87U8NhGD5Ysx9OZw9Uj7QCg7NFn ZBs/4Fit8tewl0kGyhj4N6E= =K407 -----END PGP SIGNATURE----- --v9Ux+11Zm5mwPlX6-- From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 17:58:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A0E91065670; Mon, 17 Nov 2008 17:58:45 +0000 (UTC) (envelope-from root@dchagin.dialup.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id D79138FC1B; Mon, 17 Nov 2008 17:58:44 +0000 (UTC) (envelope-from root@dchagin.dialup.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id 92820236AD; Mon, 17 Nov 2008 20:39:32 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from dchagin.dialup.corbina.ru ([78.107.232.239] verified) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1463799616; Mon, 17 Nov 2008 20:39:32 +0300 Received: from dchagin.dialup.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.dialup.corbina.ru (8.14.3/8.14.3) with ESMTP id mAHHdWZJ093187; Mon, 17 Nov 2008 20:39:32 +0300 (MSK) (envelope-from root@dchagin.dialup.corbina.ru) Received: (from root@localhost) by dchagin.dialup.corbina.ru (8.14.3/8.14.3/Submit) id mAHHdTfH093186; Mon, 17 Nov 2008 20:39:29 +0300 (MSK) (envelope-from root) Date: Mon, 17 Nov 2008 20:39:29 +0300 From: Chagin Dmitry To: Scott Long Message-ID: <20081117173929.GA93046@dchagin.dialup.corbina.ru> References: <200811170237.mAH2bjY5088186@ambrisko.com> <4920EA36.5020909@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4920EA36.5020909@samsco.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 17:58:45 -0000 On Sun, Nov 16, 2008 at 08:51:18PM -0700, Scott Long wrote: > Doug Ambrisko wrote: > > Kostik Belousov writes: > > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > > | > Author: ambrisko > > | > Date: Fri Nov 14 21:05:45 2008 > > | > New Revision: 184974 > > | > URL: http://svn.freebsd.org/changeset/base/184974 > > | > > > | > Log: > > | > When running a 32bit app. on amd64, ensure the bits above 32bit > > | > are zero for the copyout. Confirmed by LSI. > > | > > > | > Modified: > > | > head/sys/dev/mfi/mfi.c > > | > > > | > Modified: head/sys/dev/mfi/mfi.c > > | > ============================================================================== > > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > > | > ->mfi_frame.raw[ioc->mfi_sense_off], > > | > &sense_ptr.sense_ptr_data[0], > > | > sizeof(sense_ptr.sense_ptr_data)); > > | > +#ifdef __amd64__ > > | > + if (cmd != MFI_CMD) { > > | > + /* > > | > + * not 64bit native so zero out any address > > | > + * over 32bit */ > > | > + sense_ptr.high = 0; > > | > + } > > | > +#endif > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > > | > ioc->mfi_sense_len); > > | > if (error != 0) { > > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > > | > &sense_ptr.sense_ptr_data[0], > > | > sizeof(sense_ptr.sense_ptr_data)); > > | > +#ifdef __amd64__ > > | > + /* > > | > + * only 32bit Linux support so zero out any > > | > + * address over 32bit > > | > + */ > > | > + sense_ptr.high = 0; > > | > +#endif > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > > | > l_ioc.lioc_sense_len); > > | > if (error != 0) { > > | > > | Would it make sense to perform this cut slightly more generically, by > > | checking whether the current process is 32bit ? > > | > > | We still have not grew the easy to check flag or attribute of the image, > > | but usual practice is to compare p_sysent with corresponding sysvec, > > | like > > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) > > | or > > | if (td->td_proc->p_sysent == &elf_linux_sysvec) > > > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > > value is different. I put in that comment for Linux since there > > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > > support we need a 64bit structure defined. When the ioctl can't > > be figured out then I've used the p_sysent. Eventually, something > > that is more generic then the #ifdef __amd64__ should be done > > in all the drivers that do this emulation. > > > > Doug A. > > Something that identifies the ABI needs to be put into the proc > structure. This isn't the only place where such information is needed. > Comparing against the sysent table symbol doesn't work very well because > it requires all sysent tables be loaded, which isn't always true for the > linux ABI. > > Scott > 100% agree, I suggest to make somehow so: diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index e233700..0ea4cd8 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -999,6 +999,7 @@ linux32_fixlimit(struct rlimit *rl, int which) } struct sysentvec elf_linux_sysvec = { + .sv_wordsize = __ELF_WORD_SIZE, .sv_size = LINUX_SYS_MAXSYSCALL, .sv_table = linux_sysent, .sv_mask = 0, diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 0ec07a7..757b929 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -68,6 +68,7 @@ struct trapframe; struct vnode; struct sysentvec { + int sv_wordsize; /* arch wordsize */ int sv_size; /* number of entries */ struct sysent *sv_table; /* pointer to sysent */ u_int sv_mask; /* optional mask to index */ and use it like: if (td->td_proc->p_sysent->sv_wordsize == 32) thnx! -- Have fun! chd From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 18:27:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB6751065670; Mon, 17 Nov 2008 18:27:46 +0000 (UTC) (envelope-from philip@paeps.cx) Received: from gateway.nixsys.be (gateway.nixsys.be [IPv6:2001:6f8:32f::42]) by mx1.freebsd.org (Postfix) with ESMTP id 9613C8FC08; Mon, 17 Nov 2008 18:27:46 +0000 (UTC) (envelope-from philip@paeps.cx) Received: from detritus.paeps.cx (detritus.paeps.cx [IPv6:2001:6f8:1408::4]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "detritus.paeps.cx", Issuer "CAcert Class 3 Root" (verified OK)) by gateway.nixsys.be (Postfix) with ESMTPS id E2F254056; Mon, 17 Nov 2008 19:27:45 +0100 (CET) Received: by detritus.paeps.cx (Postfix, from userid 1001) id 63B9720C8; Mon, 17 Nov 2008 19:27:44 +0100 (CET) Date: Mon, 17 Nov 2008 10:27:44 -0800 From: Philip Paeps To: Pawel Jakub Dawidek Message-ID: <20081117182744.GN17340@detritus.paeps.cx> Mail-Followup-To: Pawel Jakub Dawidek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <200811170709.mAH79ecr075977@svn.freebsd.org> <20081117165006.GA1489@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20081117165006.GA1489@garage.freebsd.pl> X-PGP-Fingerprint: 356B AE02 4763 F739 2FA2 E438 2649 E628 C5D3 4D05 X-Date: Today is Sweetmorn, the 29th day of The Aftermath in the YOLD 3174 X-Phase-of-Moon: The Moon is Waning Gibbous (74% of Full) X-Message-Flag: Get a proper mailclient! Organization: Happily Disorganized User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185021 - head/sys/dev/glxsb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 18:27:47 -0000 On 2008-11-17 17:51:52 (+0100), Pawel Jakub Dawidek wrote: > On Mon, Nov 17, 2008 at 07:09:40AM +0000, Philip Paeps wrote: > > Fix two possible (but unlikely) NULL-pointer dereferences in glxsb(4). > > > > [...] > > > > - while ((ses = TAILQ_FIRST(&sc->sc_sessions)) != NULL) { > > + while (!TAILQ_EMPTY(&sc->sc_sessions)) { > > + ses = TAILQ_FIRST(&sc->sc_sessions); > > This is perfectly valid, and if it was reported by coverity, it is a > false positive. True. Sorry for the noise. Reminds me to find a way to get Coverity not to complain about this. > > - if (crp == NULL || > > - crp->crp_callback == NULL || crp->crp_desc == NULL) { > > + /* Sanity check. */ > > + if (crp == NULL) > > + return (EINVAL); > > + > > + if (crp->crp_callback == NULL || crp->crp_desc == NULL) { > > error = EINVAL; > > goto fail; > > } > > This one is ok. The same one exists in padlock(4), could you fix it too? Will do. Thanks. - Philip -- Philip Paeps Please don't Cc me, I am philip@freebsd.org subscribed to the list. The worse your line is tangled, the better is the fishing around you. From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 18:45:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 624461065670; Mon, 17 Nov 2008 18:45:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B8C38FC19; Mon, 17 Nov 2008 18:45:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHIj8pT089998; Mon, 17 Nov 2008 18:45:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHIj7Wr089992; Mon, 17 Nov 2008 18:45:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811171845.mAHIj7Wr089992@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Nov 2008 18:45:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185025 - in stable/7: include lib/libc lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 18:45:08 -0000 Author: kib Date: Mon Nov 17 18:45:07 2008 New Revision: 185025 URL: http://svn.freebsd.org/changeset/base/185025 Log: MFC r184587: Add the ffsll and flsll functions. These are ffs and fls operating on long long arguments. Approved by: re (kensmith) Added: stable/7/lib/libc/string/ffsll.c - copied unchanged from r184587, head/lib/libc/string/ffsll.c stable/7/lib/libc/string/flsll.c - copied unchanged from r184587, head/lib/libc/string/flsll.c Modified: stable/7/include/ (props changed) stable/7/include/strings.h stable/7/lib/libc/ (props changed) stable/7/lib/libc/string/Makefile.inc stable/7/lib/libc/string/Symbol.map stable/7/lib/libc/string/ffs.3 Modified: stable/7/include/strings.h ============================================================================== --- stable/7/include/strings.h Mon Nov 17 16:37:04 2008 (r185024) +++ stable/7/include/strings.h Mon Nov 17 18:45:07 2008 (r185025) @@ -44,8 +44,10 @@ void bzero(void *, size_t); /* LEGA int ffs(int) __pure2; #ifdef __BSD_VISIBLE int ffsl(long) __pure2; +int ffsll(long long) __pure2; int fls(int) __pure2; int flsl(long) __pure2; +int flsll(long long) __pure2; #endif char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ Modified: stable/7/lib/libc/string/Makefile.inc ============================================================================== --- stable/7/lib/libc/string/Makefile.inc Mon Nov 17 16:37:04 2008 (r185024) +++ stable/7/lib/libc/string/Makefile.inc Mon Nov 17 18:45:07 2008 (r185025) @@ -6,8 +6,8 @@ CFLAGS+= -I${.CURDIR}/locale # machine-independent string sources -MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c fls.c flsl.c index.c memccpy.c \ - memchr.c memrchr.c memcmp.c \ +MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ + index.c memccpy.c memchr.c memrchr.c memcmp.c \ memcpy.c memmem.c memmove.c memset.c rindex.c stpcpy.c strcasecmp.c \ strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \ strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c \ @@ -38,6 +38,8 @@ MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 f MLINKS+=ffs.3 ffsl.3 MLINKS+=ffs.3 fls.3 MLINKS+=ffs.3 flsl.3 +MLINKS+=ffs.3 ffsll.3 +MLINKS+=ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 MLINKS+=strcasecmp.3 strncasecmp.3 Modified: stable/7/lib/libc/string/Symbol.map ============================================================================== --- stable/7/lib/libc/string/Symbol.map Mon Nov 17 16:37:04 2008 (r185024) +++ stable/7/lib/libc/string/Symbol.map Mon Nov 17 18:45:07 2008 (r185025) @@ -78,6 +78,8 @@ FBSD_1.0 { }; FBSD_1.1 { + ffsll; + flsll; memrchr; }; Modified: stable/7/lib/libc/string/ffs.3 ============================================================================== --- stable/7/lib/libc/string/ffs.3 Mon Nov 17 16:37:04 2008 (r185024) +++ stable/7/lib/libc/string/ffs.3 Mon Nov 17 18:45:07 2008 (r185025) @@ -30,14 +30,16 @@ .\" @(#)ffs.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd October 12, 2006 +.Dd October 26, 2008 .Dt FFS 3 .Os .Sh NAME .Nm ffs , .Nm ffsl , +.Nm ffsll , .Nm fls , -.Nm flsl +.Nm flsl , +.Nm flsll .Nd find first or last bit set in a bit string .Sh LIBRARY .Lb libc @@ -48,14 +50,19 @@ .Ft int .Fn ffsl "long value" .Ft int +.Ft int +.Fn ffsll "long long value" .Fn fls "int value" .Ft int .Fn flsl "long value" +.Ft int +.Fn flsll "long long value" .Sh DESCRIPTION The -.Fn ffs -and +.Fn ffs , .Fn ffsl +and +.Fn ffsll functions find the first bit set (beginning with the least significant bit) in @@ -63,9 +70,10 @@ in and return the index of that bit. .Pp The -.Fn fls -and +.Fn fls , .Fn flsl +and +.Fn flsll functions find the last bit set in .Fa value and return the index of that bit. @@ -95,3 +103,9 @@ and .Fn flsl functions appeared in .Fx 5.3 . +The +.Fn ffsll +and +.Fn flsll +functions appeared in +.Fx 8.0 . Copied: stable/7/lib/libc/string/ffsll.c (from r184587, head/lib/libc/string/ffsll.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libc/string/ffsll.c Mon Nov 17 18:45:07 2008 (r185025, copy of r184587, head/lib/libc/string/ffsll.c) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +/* + * Find First Set bit + */ +int +ffsll(long long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned long long)mask >> 1; + return (bit); +} Copied: stable/7/lib/libc/string/flsll.c (from r184587, head/lib/libc/string/flsll.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libc/string/flsll.c Mon Nov 17 18:45:07 2008 (r185025, copy of r184587, head/lib/libc/string/flsll.c) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +/* + * Find Last Set bit + */ +int +flsll(long long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; mask != 1; bit++) + mask = (unsigned long long)mask >> 1; + return (bit); +} From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 19:00:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAF611065690; Mon, 17 Nov 2008 19:00:36 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D76388FC21; Mon, 17 Nov 2008 19:00:36 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHJ0aiP090305; Mon, 17 Nov 2008 19:00:36 GMT (envelope-from philip@svn.freebsd.org) Received: (from philip@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHJ0aFe090304; Mon, 17 Nov 2008 19:00:36 GMT (envelope-from philip@svn.freebsd.org) Message-Id: <200811171900.mAHJ0aFe090304@svn.freebsd.org> From: Philip Paeps Date: Mon, 17 Nov 2008 19:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185026 - head/sys/crypto/via X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 19:00:37 -0000 Author: philip Date: Mon Nov 17 19:00:36 2008 New Revision: 185026 URL: http://svn.freebsd.org/changeset/base/185026 Log: Fix a potential NULL-pointer dereference in padlock(4). Spotted by: Coverity (via pjd) MFC after: 1 week Modified: head/sys/crypto/via/padlock.c Modified: head/sys/crypto/via/padlock.c ============================================================================== --- head/sys/crypto/via/padlock.c Mon Nov 17 18:45:07 2008 (r185025) +++ head/sys/crypto/via/padlock.c Mon Nov 17 19:00:36 2008 (r185026) @@ -297,7 +297,11 @@ padlock_process(device_t dev, struct cry enccrd = maccrd = NULL; - if (crp == NULL || crp->crp_callback == NULL || crp->crp_desc == NULL) { + /* Sanity check. */ + if (crp == NULL) + return (EINVAL); + + if (crp->crp_callback == NULL || crp->crp_desc == NULL) { error = EINVAL; goto out; } From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 19:36:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98B381065673; Mon, 17 Nov 2008 19:36:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id E19D48FC14; Mon, 17 Nov 2008 19:36:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L29t6-0003Nl-KJ; Mon, 17 Nov 2008 21:35:56 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAHJZgd7021700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 Nov 2008 21:35:42 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAHJZgcT017783; Mon, 17 Nov 2008 21:35:42 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAHJZfvp017781; Mon, 17 Nov 2008 21:35:41 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 Nov 2008 21:35:41 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20081117193541.GG90129@deviant.kiev.zoral.com.ua> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BzCohdixPhurzSK4" Content-Disposition: inline In-Reply-To: <200811171211.42740.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L29t6-0003Nl-KJ f899c4d90032a1ef5c754e02c36aad84 X-Terabit: YES Cc: svn-src-head@freebsd.org, Doug Ambrisko , svn-src-all@freebsd.org, src-committers@freebsd.org, Doug Ambrisko Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 19:36:02 -0000 --BzCohdixPhurzSK4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 17, 2008 at 12:11:41PM -0500, John Baldwin wrote: > On Sunday 16 November 2008 09:37:45 pm Doug Ambrisko wrote: > > Kostik Belousov writes: > > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > > | > Author: ambrisko > > | > Date: Fri Nov 14 21:05:45 2008 > > | > New Revision: 184974 > > | > URL: http://svn.freebsd.org/changeset/base/184974 > > | >=20 > > | > Log: > > | > When running a 32bit app. on amd64, ensure the bits above 32bit > > | > are zero for the copyout. Confirmed by LSI. > > | >=20 > > | > Modified: > > | > head/sys/dev/mfi/mfi.c > > | >=20 > > | > Modified: head/sys/dev/mfi/mfi.c > > | >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd,=20 > > | > ->mfi_frame.raw[ioc->mfi_sense_off], > > | > &sense_ptr.sense_ptr_data[0], > > | > sizeof(sense_ptr.sense_ptr_data)); > > | > +#ifdef __amd64__ > > | > + if (cmd !=3D MFI_CMD) { > > | > + /* > > | > + * not 64bit native so zero out any address > > | > + * over 32bit */ > > | > + sense_ptr.high =3D 0; > > | > + } > > | > +#endif > > | > error =3D copyout(cm->cm_sense, sense_ptr.user_space, > > | > ioc->mfi_sense_len); > > | > if (error !=3D 0) { > > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > > | > &sense_ptr.sense_ptr_data[0], > > | > sizeof(sense_ptr.sense_ptr_data)); > > | > +#ifdef __amd64__ > > | > + /* > > | > + * only 32bit Linux support so zero out any > > | > + * address over 32bit > > | > + */ > > | > + sense_ptr.high =3D 0; > > | > +#endif > > | > error =3D copyout(cm->cm_sense, sense_ptr.user_space, > > | > l_ioc.lioc_sense_len); > > | > if (error !=3D 0) { > > |=20 > > | Would it make sense to perform this cut slightly more generically, by > > | checking whether the current process is 32bit ? > > |=20 > > | We still have not grew the easy to check flag or attribute of the ima= ge, > > | but usual practice is to compare p_sysent with corresponding sysvec, > > | like > > | if (td->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) > > | or > > | if (td->td_proc->p_sysent =3D=3D &elf_linux_sysvec) > >=20 > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > > value is different. I put in that comment for Linux since there > > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl=20 > > support we need a 64bit structure defined. When the ioctl can't > > be figured out then I've used the p_sysent. Eventually, something > > that is more generic then the #ifdef __amd64__ should be done > > in all the drivers that do this emulation. >=20 > I prefer depending on things like ioctl values and the 32-bit sysctl flag= when=20 > possible. If we do have to directly check for the ABI, I'd much rather h= ave=20 > a flags field in sysent rather than trying to compare against global symb= ols,=20 > as you can't compare against a global symbol unless it is present in the= =20 > kernel. Something like: >=20 > if (td->td_proc->p_sysent->sy_flags & SY_32) >=20 > or some such. I've wanted to have a COMPAT_FREEBSD32 that gets auto-enab= led=20 > when you turn on COMPAT_IA32 on amd64 and ia64. It would also potentiall= y be=20 > enabled by a COMPAT_SPARC8 or some such on sparc64 if we ever had that. Ok, what about the following. I only compiled it on i386/amd64. And, there are more places to convert to such checks, for sure. diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index ec1afc7..24370c8 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -72,7 +72,8 @@ struct sysentvec elf64_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_LP64 }; =20 static Elf64_Brandinfo freebsd_brand_info =3D { diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32= _sysvec.c index e233700..ac36dca 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -1026,6 +1026,7 @@ struct sysentvec elf_linux_sysvec =3D { .sv_setregs =3D exec_linux_setregs, .sv_fixlimit =3D linux32_fixlimit, .sv_maxssiz =3D &linux32_maxssiz, + .sv_flags =3D SV_ILP32 | SV_IA32 | SV_ALIENABI }; =20 static Elf32_Brandinfo linux_brand =3D { diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index f44a622..9d8bb46 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index ef74ba0..bdd426f 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -135,7 +135,8 @@ struct sysentvec ia32_freebsd_sysvec =3D { .sv_copyout_strings =3D ia32_copyout_strings, .sv_setregs =3D ia32_setregs, .sv_fixlimit =3D ia32_fixlimit, - .sv_maxssiz =3D &ia32_maxssiz + .sv_maxssiz =3D &ia32_maxssiz, + .sv_flags =3D SV_COMPAT | SV_IA32 | SV_ILP32 }; =20 =20 diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c index 60cca7b..ddd6643 100644 --- a/sys/compat/svr4/svr4_sysvec.c +++ b/sys/compat/svr4/svr4_sysvec.c @@ -190,7 +190,8 @@ struct sysentvec svr4_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ALIENABI | SV_IA32 | SV_ILP32 }; =20 const char svr4_emul_path[] =3D "/compat/svr4"; diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index 93f1d45..698fc7e 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_IA32 | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/i386/ibcs2/ibcs2_sysvec.c b/sys/i386/ibcs2/ibcs2_sysvec.c index 2c834dd..e989d7b 100644 --- a/sys/i386/ibcs2/ibcs2_sysvec.c +++ b/sys/i386/ibcs2/ibcs2_sysvec.c @@ -85,7 +85,8 @@ struct sysentvec ibcs2_svr3_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ALIENABI | SV_IA32 | SV_ILP32 }; =20 static int diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index a3acfc9..4696c14 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -837,7 +837,8 @@ struct sysentvec linux_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_linux_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ALIENABI | SV_IA32 | SV_ILP32 }; =20 struct sysentvec elf_linux_sysvec =3D { diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c index 94f4cdc..7050a69 100644 --- a/sys/ia64/ia64/elf_machdep.c +++ b/sys/ia64/ia64/elf_machdep.c @@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_LP64 }; =20 static Elf64_Brandinfo freebsd_brand_info =3D { diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index f4e4614..114e0ba 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -82,7 +82,17 @@ struct sysentvec aout_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_AOUT | +#if defined(__i386__) + SV_IA32 | SV_ILP32 +#elif defined(__powerpc__) || defined(__mips__) + SV_ILP32 +#elif defined(__ia64__) || defined(__sparc64__) || defined(__amd64__) + SV_LP64 +#else +#error Choose SV_XXX flags for the platform +#endif }; =20 static int diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index dade1c2..1edbe6f 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -57,14 +57,12 @@ __FBSDID("$FreeBSD$"); =20 #ifdef COMPAT_IA32 =20 -extern struct sysentvec ia32_freebsd_sysvec; - static inline int suword_lwpid(void *addr, lwpid_t lwpid) { int error; =20 - if (curproc->p_sysent !=3D &ia32_freebsd_sysvec) + if (curproc->p_sysent->sv_flags & SV_LP64) error =3D suword(addr, lwpid); else error =3D suword32(addr, lwpid); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index eb587fb..5aeb476 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -136,9 +136,8 @@ __FBSDID("$FreeBSD$"); =20 #ifdef COMPAT_IA32 #include +#include #include - -extern struct sysentvec ia32_freebsd_sysvec; #endif =20 static int soreceive_rcvoob(struct socket *so, struct uio *uio, @@ -2277,7 +2276,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) case SO_SNDTIMEO: case SO_RCVTIMEO: #ifdef COMPAT_IA32 - if (curthread->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) { + if (curthread->td_proc->p_sysent->sv_flags & SV_ILP32) { struct timeval32 tv32; =20 error =3D sooptcopyin(sopt, &tv32, sizeof tv32, @@ -2458,7 +2457,7 @@ integer: tv.tv_sec =3D optval / hz; tv.tv_usec =3D (optval % hz) * tick; #ifdef COMPAT_IA32 - if (curthread->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) { + if (curthread->td_proc->p_sysent->sv_flags & SV_ILP32) { struct timeval32 tv32; =20 CP(tv, tv32, tv_sec); diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c index 0234722..ba9751f 100644 --- a/sys/mips/mips/elf_machdep.c +++ b/sys/mips/mips/elf_machdep.c @@ -74,7 +74,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/powerpc/powerpc/elf_machdep.c b/sys/powerpc/powerpc/elf_ma= chdep.c index dadf3ca..255e7a0 100644 --- a/sys/powerpc/powerpc/elf_machdep.c +++ b/sys/powerpc/powerpc/elf_machdep.c @@ -75,7 +75,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_ma= chdep.c index d1e610a..aea4198 100644 --- a/sys/sparc64/sparc64/elf_machdep.c +++ b/sys/sparc64/sparc64/elf_machdep.c @@ -87,7 +87,8 @@ static struct sysentvec elf64_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_LP64 }; =20 static Elf64_Brandinfo freebsd_brand_info =3D { diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 0ec07a7..25c41c6 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -100,8 +100,17 @@ struct sysentvec { void (*sv_setregs)(struct thread *, u_long, u_long, u_long); void (*sv_fixlimit)(struct rlimit *, int); u_long *sv_maxssiz; + u_int sv_flags; }; =20 +#define SV_NATIVE 0x0001 +#define SV_COMPAT 0x0002 +#define SV_ILP32 0x0004 +#define SV_LP64 0x0008 +#define SV_IA32 0x0010 +#define SV_ALIENABI 0x0020 +#define SV_AOUT 0x0040 + #ifdef _KERNEL extern struct sysentvec aout_sysvec; extern struct sysentvec elf_freebsd_sysvec; --BzCohdixPhurzSK4 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkhx40ACgkQC3+MBN1Mb4iv4QCeP7pTd/YAhEfhSksDuSCAJw6m QGoAmwZDzyYIXtgDZ3rFZqCp+YSX5R0G =sQfl -----END PGP SIGNATURE----- --BzCohdixPhurzSK4-- From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 19:53:37 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3C4E106564A; Mon, 17 Nov 2008 19:53:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 9B8EC8FC16; Mon, 17 Nov 2008 19:53:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id mAHJppjc023979; Mon, 17 Nov 2008 12:51:51 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 17 Nov 2008 12:53:10 -0700 (MST) Message-Id: <20081117.125310.-233674490.imp@bsdimp.com> To: kostikbel@gmail.com From: "M. Warner Losh" In-Reply-To: <20081117193541.GG90129@deviant.kiev.zoral.com.ua> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: ambrisko@FreeBSD.org, src-committers@FreeBSD.org, ambrisko@ambrisko.com, jhb@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 19:53:38 -0000 In message: <20081117193541.GG90129@deviant.kiev.zoral.com.ua> Kostik Belousov writes: : diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c : index f4e4614..114e0ba 100644 : --- a/sys/kern/imgact_aout.c : +++ b/sys/kern/imgact_aout.c : @@ -82,7 +82,17 @@ struct sysentvec aout_sysvec = { : .sv_copyout_strings = exec_copyout_strings, : .sv_setregs = exec_setregs, : .sv_fixlimit = NULL, : - .sv_maxssiz = NULL : + .sv_maxssiz = NULL, : + .sv_flags = SV_NATIVE | SV_AOUT | : +#if defined(__i386__) : + SV_IA32 | SV_ILP32 : +#elif defined(__powerpc__) || defined(__mips__) : + SV_ILP32 : +#elif defined(__ia64__) || defined(__sparc64__) || defined(__amd64__) : + SV_LP64 : +#else : +#error Choose SV_XXX flags for the platform : +#endif : }; I didn't think we supported aout for mips. Also, arm is missing from the list :-) Warner From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 20:04:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 424A91065673; Mon, 17 Nov 2008 20:04:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id D09A78FC19; Mon, 17 Nov 2008 20:04:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L2AKm-0004n4-4D; Mon, 17 Nov 2008 22:04:32 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAHK4SnM023085 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 Nov 2008 22:04:28 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAHK4SRm020727; Mon, 17 Nov 2008 22:04:28 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAHK4Rr4020726; Mon, 17 Nov 2008 22:04:27 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 Nov 2008 22:04:27 +0200 From: Kostik Belousov To: "M. Warner Losh" Message-ID: <20081117200427.GI90129@deviant.kiev.zoral.com.ua> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> <20081117.125310.-233674490.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uJWb33pM2TcUAXIl" Content-Disposition: inline In-Reply-To: <20081117.125310.-233674490.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L2AKm-0004n4-4D 663f96a8955034620c56d8d8cce3a8ab X-Terabit: YES Cc: ambrisko@freebsd.org, src-committers@freebsd.org, ambrisko@ambrisko.com, jhb@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 20:04:34 -0000 --uJWb33pM2TcUAXIl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 17, 2008 at 12:53:10PM -0700, M. Warner Losh wrote: > In message: <20081117193541.GG90129@deviant.kiev.zoral.com.ua> > Kostik Belousov writes: > : diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c > : index f4e4614..114e0ba 100644 > : --- a/sys/kern/imgact_aout.c > : +++ b/sys/kern/imgact_aout.c > : @@ -82,7 +82,17 @@ struct sysentvec aout_sysvec =3D { > : .sv_copyout_strings =3D exec_copyout_strings, > : .sv_setregs =3D exec_setregs, > : .sv_fixlimit =3D NULL, > : - .sv_maxssiz =3D NULL > : + .sv_maxssiz =3D NULL, > : + .sv_flags =3D SV_NATIVE | SV_AOUT | > : +#if defined(__i386__) > : + SV_IA32 | SV_ILP32 > : +#elif defined(__powerpc__) || defined(__mips__) > : + SV_ILP32 > : +#elif defined(__ia64__) || defined(__sparc64__) || defined(__amd64__) > : + SV_LP64 > : +#else > : +#error Choose SV_XXX flags for the platform > : +#endif > : }; >=20 > I didn't think we supported aout for mips. Also, arm is missing from > the list :-) Thanks. In fact, aout works for i386 (and pc98) only. I changed the #ifdef to the following: diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index f4e4614..78055f7 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -82,7 +82,13 @@ struct sysentvec aout_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_NATIVE | SV_AOUT | +#if defined(__i386__) + SV_IA32 | SV_ILP32 +#else +#error Choose SV_XXX flags for the platform +#endif }; =20 static int --uJWb33pM2TcUAXIl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkhzksACgkQC3+MBN1Mb4i5MACfd4UDfKXImrIYHVjEOpRzhxzI ZakAoLiFwX5L5geI1B1IOrpdhjuKdzCV =HPp6 -----END PGP SIGNATURE----- --uJWb33pM2TcUAXIl-- From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 20:11:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B9E410656B7; Mon, 17 Nov 2008 20:11:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FA758FC19; Mon, 17 Nov 2008 20:11:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHKBs4g091628; Mon, 17 Nov 2008 20:11:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHKBsYG091627; Mon, 17 Nov 2008 20:11:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811172011.mAHKBsYG091627@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Nov 2008 20:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185027 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 20:11:54 -0000 Author: pjd Date: Mon Nov 17 20:11:53 2008 New Revision: 185027 URL: http://svn.freebsd.org/changeset/base/185027 Log: Increase the limit for the Big ZFS Update. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Nov 17 19:00:36 2008 (r185026) +++ svnadmin/conf/sizelimit.conf Mon Nov 17 20:11:53 2008 (r185027) @@ -18,3 +18,4 @@ #grog #kan lstewart +pjd 10485760 From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 20:33:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3616B106564A; Mon, 17 Nov 2008 20:33:14 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2322D8FC13; Mon, 17 Nov 2008 20:33:14 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHKXEDj092182; Mon, 17 Nov 2008 20:33:14 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHKXD5i092181; Mon, 17 Nov 2008 20:33:13 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200811172033.mAHKXD5i092181@svn.freebsd.org> From: Maksim Yevmenkin Date: Mon, 17 Nov 2008 20:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185028 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 20:33:14 -0000 Author: emax Date: Mon Nov 17 20:33:13 2008 New Revision: 185028 URL: http://svn.freebsd.org/changeset/base/185028 Log: Undo revision 185013 until better solution is found. Pointed out by: bde Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Mon Nov 17 20:11:53 2008 (r185027) +++ head/sys/dev/syscons/syscons.c Mon Nov 17 20:33:13 2008 (r185028) @@ -1572,7 +1572,6 @@ sccngetch(int flags) int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ int c; - mtx_lock(&Giant); /* assert(sc_console != NULL) */ /* @@ -1584,13 +1583,11 @@ sccngetch(int flags) sccnupdate(scp); if (fkeycp < fkey.len) { - mtx_unlock(&Giant); splx(s); return fkey.str[fkeycp++]; } if (scp->sc->kbd == NULL) { - mtx_unlock(&Giant); splx(s); return -1; } @@ -1613,7 +1610,6 @@ sccngetch(int flags) scp->kbd_mode = cur_mode; kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); kbdd_disable(scp->sc->kbd); - mtx_unlock(&Giant); splx(s); switch (KEYFLAGS(c)) { From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 20:49:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B2911065673; Mon, 17 Nov 2008 20:49:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7238A8FC1A; Mon, 17 Nov 2008 20:49:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHKnUAa092518; Mon, 17 Nov 2008 20:49:30 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHKnUDw092510; Mon, 17 Nov 2008 20:49:30 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811172049.mAHKnUDw092510@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Nov 2008 20:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 20:49:30 -0000 Author: pjd Date: Mon Nov 17 20:49:29 2008 New Revision: 185029 URL: http://svn.freebsd.org/changeset/base/185029 Log: Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. This bring huge amount of changes, I'll enumerate only user-visible changes: - Delegated Administration Allows regular users to perform ZFS operations, like file system creation, snapshot creation, etc. - L2ARC Level 2 cache for ZFS - allows to use additional disks for cache. Huge performance improvements mostly for random read of mostly static content. - slog Allow to use additional disks for ZFS Intent Log to speed up operations like fsync(2). - vfs.zfs.super_owner Allows regular users to perform privileged operations on files stored on ZFS file systems owned by him. Very careful with this one. - chflags(2) Not all the flags are supported. This still needs work. - ZFSBoot Support to boot off of ZFS pool. Not finished, AFAIK. Submitted by: dfr - Snapshot properties - New failure modes Before if write requested failed, system paniced. Now one can select from one of three failure modes: - panic - panic on write error - wait - wait for disk to reappear - continue - serve read requests if possible, block write requests - Refquota, refreservation properties Just quota and reservation properties, but don't count space consumed by children file systems, clones and snapshots. - Sparse volumes ZVOLs that don't reserve space in the pool. - External attributes Compatible with extattr(2). - NFSv4-ACLs Not sure about the status, might not be complete yet. Submitted by: trasz - Creation-time properties - Regression tests for zpool(8) command. Obtained from: OpenSolaris Added: head/cddl/compat/opensolaris/include/libshare.h (contents, props changed) head/cddl/contrib/opensolaris/cmd/zinject/ head/cddl/contrib/opensolaris/cmd/zinject/translate.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zinject/zinject.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zinject/zinject.h (contents, props changed) head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c (contents, props changed) head/cddl/usr.bin/zinject/ head/cddl/usr.bin/zinject/Makefile (contents, props changed) head/sys/boot/i386/zfsboot/ head/sys/boot/i386/zfsboot/Makefile (contents, props changed) head/sys/boot/i386/zfsboot/zfsboot.c (contents, props changed) head/sys/boot/i386/zfsboot/zfsldr.S (contents, props changed) head/sys/boot/zfs/ head/sys/boot/zfs/Makefile (contents, props changed) head/sys/boot/zfs/zfs.c (contents, props changed) head/sys/boot/zfs/zfsimpl.c (contents, props changed) head/sys/cddl/boot/ head/sys/cddl/boot/zfs/ head/sys/cddl/boot/zfs/README (contents, props changed) head/sys/cddl/boot/zfs/fletcher.c (contents, props changed) head/sys/cddl/boot/zfs/lzjb.c (contents, props changed) head/sys/cddl/boot/zfs/sha256.c (contents, props changed) head/sys/cddl/boot/zfs/zfsimpl.h (contents, props changed) head/sys/cddl/boot/zfs/zfssubr.c (contents, props changed) head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c (contents, props changed) head/sys/cddl/compat/opensolaris/sys/file.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/kidmap.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/pathname.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/refstr.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/sid.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/sig.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/unicode/ head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_fuid.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/extdirent.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/idmap.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep_data.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h (contents, props changed) head/sys/kern/kern_osd.c (contents, props changed) head/sys/sys/osd.h (contents, props changed) head/tools/regression/zfs/ head/tools/regression/zfs/LICENSE (contents, props changed) head/tools/regression/zfs/misc.sh (contents, props changed) head/tools/regression/zfs/zpool/ head/tools/regression/zfs/zpool/add/ head/tools/regression/zfs/zpool/add/cache.t (contents, props changed) head/tools/regression/zfs/zpool/add/disks.t (contents, props changed) head/tools/regression/zfs/zpool/add/doesnt_exist.t (contents, props changed) head/tools/regression/zfs/zpool/add/files.t (contents, props changed) head/tools/regression/zfs/zpool/add/log.t (contents, props changed) head/tools/regression/zfs/zpool/add/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_inuse.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-n.t (contents, props changed) head/tools/regression/zfs/zpool/add/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/add/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/add/spare.t (contents, props changed) head/tools/regression/zfs/zpool/attach/ head/tools/regression/zfs/zpool/attach/log.t (contents, props changed) head/tools/regression/zfs/zpool/attach/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/attach/option-f_inuse.t (contents, props changed) head/tools/regression/zfs/zpool/create/ head/tools/regression/zfs/zpool/create/already_exists.t (contents, props changed) head/tools/regression/zfs/zpool/create/automount.t (contents, props changed) head/tools/regression/zfs/zpool/create/cache.t (contents, props changed) head/tools/regression/zfs/zpool/create/disks.t (contents, props changed) head/tools/regression/zfs/zpool/create/files.t (contents, props changed) head/tools/regression/zfs/zpool/create/log.t (contents, props changed) head/tools/regression/zfs/zpool/create/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-R.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_inuse.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_size_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_type_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-m.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-n.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-o.t (contents, props changed) head/tools/regression/zfs/zpool/create/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/create/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/create/spare.t (contents, props changed) head/tools/regression/zfs/zpool/offline/ head/tools/regression/zfs/zpool/offline/io.t (contents, props changed) head/tools/regression/zfs/zpool/offline/log.t (contents, props changed) head/tools/regression/zfs/zpool/offline/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/offline/option-t.t (contents, props changed) head/tools/regression/zfs/zpool/offline/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/offline/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/remove/ head/tools/regression/zfs/zpool/remove/cache.t (contents, props changed) head/tools/regression/zfs/zpool/remove/spare.t (contents, props changed) head/tools/regression/zfs/zpool/replace/ head/tools/regression/zfs/zpool/replace/cache.t (contents, props changed) head/tools/regression/zfs/zpool/replace/disk.t (contents, props changed) head/tools/regression/zfs/zpool/replace/log.t (contents, props changed) head/tools/regression/zfs/zpool/replace/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/replace/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/replace/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/replace/spare.t (contents, props changed) Deleted: head/sys/cddl/compat/opensolaris/sys/acl.h head/sys/cddl/compat/opensolaris/sys/callb.h Modified: head/cddl/compat/opensolaris/include/mnttab.h head/cddl/compat/opensolaris/misc/mnttab.c head/cddl/compat/opensolaris/misc/zmount.c head/cddl/compat/opensolaris/misc/zone.c head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/head/assert.h head/cddl/contrib/opensolaris/head/libintl.h head/cddl/contrib/opensolaris/head/synch.h head/cddl/contrib/opensolaris/head/thread.h head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h head/cddl/contrib/opensolaris/lib/libuutil/common/libuutil.h head/cddl/contrib/opensolaris/lib/libuutil/common/libuutil_common.h head/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_avl.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_dprintf.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_graph.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c head/cddl/contrib/opensolaris/lib/libzpool/common/util.c head/cddl/lib/libzfs/Makefile head/cddl/lib/libzpool/Makefile head/cddl/sbin/zpool/Makefile head/cddl/usr.bin/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile head/lib/libc/gen/getvfsbyname.3 head/share/man/man9/VFS_SET.9 head/sys/boot/Makefile head/sys/boot/common/bootstrap.h head/sys/boot/i386/Makefile head/sys/boot/i386/libi386/bootinfo32.c head/sys/boot/i386/libi386/devicename.c head/sys/boot/i386/loader/Makefile head/sys/boot/i386/loader/conf.c head/sys/boot/i386/loader/main.c head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/cddl/compat/opensolaris/sys/cred.h head/sys/cddl/compat/opensolaris/sys/dnlc.h head/sys/cddl/compat/opensolaris/sys/kmem.h head/sys/cddl/compat/opensolaris/sys/misc.h head/sys/cddl/compat/opensolaris/sys/mntent.h head/sys/cddl/compat/opensolaris/sys/param.h head/sys/cddl/compat/opensolaris/sys/policy.h head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/compat/opensolaris/sys/sunddi.h head/sys/cddl/compat/opensolaris/sys/sysmacros.h head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/compat/opensolaris/sys/types.h head/sys/cddl/compat/opensolaris/sys/uio.h head/sys/cddl/compat/opensolaris/sys/vfs.h head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/compat/opensolaris/sys/zone.h head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h head/sys/cddl/contrib/opensolaris/common/atomic/amd64/atomic.S head/sys/cddl/contrib/opensolaris/common/atomic/i386/atomic.S head/sys/cddl/contrib/opensolaris/common/avl/avl.c head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bplist.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/os/callb.c head/sys/cddl/contrib/opensolaris/uts/common/os/list.c head/sys/cddl/contrib/opensolaris/uts/common/os/taskq.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/byteorder.h head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cred.h head/sys/cddl/contrib/opensolaris/uts/common/sys/dkio.h head/sys/cddl/contrib/opensolaris/uts/common/sys/dklabel.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/protocol.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/list.h head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h head/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h head/sys/cddl/contrib/opensolaris/uts/common/sys/synch.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c head/sys/conf/files head/sys/kern/kern_jail.c head/sys/kern/kern_proc.c head/sys/kern/kern_thread.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_subr.c head/sys/modules/zfs/Makefile head/sys/sys/conf.h head/sys/sys/jail.h head/sys/sys/mount.h head/sys/sys/namei.h head/sys/sys/priv.h head/sys/sys/proc.h head/sys/sys/vnode.h head/usr.bin/lsvfs/lsvfs.c Added: head/cddl/compat/opensolaris/include/libshare.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/compat/opensolaris/include/libshare.h Mon Nov 17 20:49:29 2008 (r185029) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2007 Pawel Jakub Dawidek + * 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 AUTHORS 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 AUTHORS 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. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_LIBSHARE_H_ +#define _OPENSOLARIS_LIBSHARE_H_ + +#define SA_OK 0 + +#define SA_INIT_CONTROL_API 0 + +#endif /* !_OPENSOLARIS_LIBSHARE_H_ */ Modified: head/cddl/compat/opensolaris/include/mnttab.h ============================================================================== --- head/cddl/compat/opensolaris/include/mnttab.h Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/include/mnttab.h Mon Nov 17 20:49:29 2008 (r185029) @@ -9,6 +9,8 @@ #define MNTTAB _PATH_DEVNULL #define MNT_LINE_MAX 1024 +#define umount2(p, f) unmount(p, f) + struct mnttab { char *mnt_special; char *mnt_mountp; Modified: head/cddl/compat/opensolaris/misc/mnttab.c ============================================================================== --- head/cddl/compat/opensolaris/misc/mnttab.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/misc/mnttab.c Mon Nov 17 20:49:29 2008 (r185029) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include static char * mntopt(char **p) Modified: head/cddl/compat/opensolaris/misc/zmount.c ============================================================================== --- head/cddl/compat/opensolaris/misc/zmount.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/misc/zmount.c Mon Nov 17 20:49:29 2008 (r185029) @@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include -#include +#include static void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, @@ -86,7 +87,7 @@ zmount(const char *spec, const char *dir assert(optlen > 0); optstr = strdup(optptr); - assert(optptr != NULL); + assert(optstr != NULL); iov = NULL; iovlen = 0; Modified: head/cddl/compat/opensolaris/misc/zone.c ============================================================================== --- head/cddl/compat/opensolaris/misc/zone.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/misc/zone.c Mon Nov 17 20:49:29 2008 (r185029) @@ -32,7 +32,7 @@ #include #include -int +zoneid_t getzoneid(void) { size_t size; @@ -42,5 +42,5 @@ getzoneid(void) size = sizeof(jailid); if (sysctlbyname("security.jail.jailed", &jailid, &size, NULL, 0) == -1) assert(!"No security.jail.jailed sysctl!"); - return (jailid); + return ((zoneid_t)jailid); } Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Mon Nov 17 20:49:29 2008 (r185029) @@ -28,13 +28,17 @@ zdb \- ZFS debugger .fi .SH DESCRIPTION +.sp .LP The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer. +.sp .LP If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected. +.sp .LP Any options supported by this command are internal to Sun and subject to change at any time. .SH EXIT STATUS +.sp .LP The following exit values are returned: .sp @@ -71,6 +75,7 @@ Invalid command line options were specif .RE .SH ATTRIBUTES +.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -89,5 +94,6 @@ Interface StabilityUnstable .TE .SH SEE ALSO +.sp .LP \fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Nov 17 20:49:29 2008 (r185029) @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -51,6 +49,10 @@ #include #include #include +#include +#undef ZFS_MAXNAMELEN +#undef verify +#include const char cmdname[] = "zdb"; uint8_t dump_opt[256]; @@ -62,6 +64,9 @@ uint64_t *zopt_object = NULL; int zopt_objects = 0; int zdb_advance = ADVANCE_PRE; zbookmark_t zdb_noread = { 0, 0, ZB_NO_LEVEL, 0 }; +libzfs_handle_t *g_zfs; +boolean_t zdb_sig_user_data = B_TRUE; +int zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -83,12 +88,15 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-udibcsvLU] [-O order] [-B os:obj:level:blkid] " + "Usage: %s [-udibcsvL] [-U cachefile_path] [-O order] " + "[-B os:obj:level:blkid] [-S user:cksumalg] " "dataset [object...]\n" " %s -C [pool]\n" " %s -l dev\n" - " %s -R vdev:offset:size:flags\n", - cmdname, cmdname, cmdname, cmdname); + " %s -R pool:vdev:offset:size:flags\n" + " %s [-p path_to_vdev_dir]\n" + " %s -e pool | GUID | devid ...\n", + cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); (void) fprintf(stderr, " -u uberblock\n"); (void) fprintf(stderr, " -d datasets\n"); @@ -97,16 +105,22 @@ usage(void) (void) fprintf(stderr, " -b block statistics\n"); (void) fprintf(stderr, " -c checksum all data blocks\n"); (void) fprintf(stderr, " -s report stats on zdb's I/O\n"); + (void) fprintf(stderr, " -S : -- " + "dump blkptr signatures\n"); (void) fprintf(stderr, " -v verbose (applies to all others)\n"); (void) fprintf(stderr, " -l dump label contents\n"); (void) fprintf(stderr, " -L live pool (allows some errors)\n"); (void) fprintf(stderr, " -O [!] " "visitation order\n"); - (void) fprintf(stderr, " -U use zpool.cache in /tmp\n"); + (void) fprintf(stderr, " -U cachefile_path -- use alternate " + "cachefile\n"); (void) fprintf(stderr, " -B objset:object:level:blkid -- " "simulate bad block\n"); - (void) fprintf(stderr, " -R read and display block from a" + (void) fprintf(stderr, " -R read and display block from a " "device\n"); + (void) fprintf(stderr, " -e Pool is exported/destroyed/" + "has altroot\n"); + (void) fprintf(stderr, " -p (use with -e)\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -367,6 +381,44 @@ dump_zap(objset_t *os, uint64_t object, zap_cursor_fini(&zc); } +/*ARGSUSED*/ +static void +dump_zpldir(objset_t *os, uint64_t object, void *data, size_t size) +{ + zap_cursor_t zc; + zap_attribute_t attr; + const char *typenames[] = { + /* 0 */ "not specified", + /* 1 */ "FIFO", + /* 2 */ "Character Device", + /* 3 */ "3 (invalid)", + /* 4 */ "Directory", + /* 5 */ "5 (invalid)", + /* 6 */ "Block Device", + /* 7 */ "7 (invalid)", + /* 8 */ "Regular File", + /* 9 */ "9 (invalid)", + /* 10 */ "Symbolic Link", + /* 11 */ "11 (invalid)", + /* 12 */ "Socket", + /* 13 */ "Door", + /* 14 */ "Event Port", + /* 15 */ "15 (invalid)", + }; + + dump_zap_stats(os, object); + (void) printf("\n"); + + for (zap_cursor_init(&zc, os, object); + zap_cursor_retrieve(&zc, &attr) == 0; + zap_cursor_advance(&zc)) { + (void) printf("\t\t%s = %lld (type: %s)\n", + attr.za_name, ZFS_DIRENT_OBJ(attr.za_first_integer), + typenames[ZFS_DIRENT_TYPE(attr.za_first_integer)]); + } + zap_cursor_fini(&zc); +} + static void dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm) { @@ -456,10 +508,7 @@ dump_metaslabs(spa_t *spa) for (c = 0; c < rvd->vdev_children; c++) { vd = rvd->vdev_child[c]; - spa_config_enter(spa, RW_READER, FTAG); - (void) printf("\n vdev %llu = %s\n\n", - (u_longlong_t)vd->vdev_id, vdev_description(vd)); - spa_config_exit(spa, FTAG); + (void) printf("\n vdev %llu\n\n", (u_longlong_t)vd->vdev_id); if (dump_opt['d'] <= 5) { (void) printf("\t%10s %10s %5s\n", @@ -477,7 +526,6 @@ static void dump_dtl(vdev_t *vd, int indent) { avl_tree_t *t = &vd->vdev_dtl_map.sm_root; - spa_t *spa = vd->vdev_spa; space_seg_t *ss; vdev_t *pvd; int c; @@ -485,9 +533,10 @@ dump_dtl(vdev_t *vd, int indent) if (indent == 0) (void) printf("\nDirty time logs:\n\n"); - spa_config_enter(spa, RW_READER, FTAG); - (void) printf("\t%*s%s\n", indent, "", vdev_description(vd)); - spa_config_exit(spa, FTAG); + (void) printf("\t%*s%s\n", indent, "", + vd->vdev_path ? vd->vdev_path : + vd->vdev_parent ? vd->vdev_ops->vdev_op_type : + spa_name(vd->vdev_spa)); for (ss = avl_first(t); ss; ss = AVL_NEXT(t, ss)) { /* @@ -670,36 +719,49 @@ dump_dsl_dir(objset_t *os, uint64_t obje { dsl_dir_phys_t *dd = data; time_t crtime; - char used[6], compressed[6], uncompressed[6], quota[6], resv[6]; + char nice[6]; if (dd == NULL) return; - ASSERT(size == sizeof (*dd)); + ASSERT3U(size, >=, sizeof (dsl_dir_phys_t)); crtime = dd->dd_creation_time; - nicenum(dd->dd_used_bytes, used); - nicenum(dd->dd_compressed_bytes, compressed); - nicenum(dd->dd_uncompressed_bytes, uncompressed); - nicenum(dd->dd_quota, quota); - nicenum(dd->dd_reserved, resv); - (void) printf("\t\tcreation_time = %s", ctime(&crtime)); (void) printf("\t\thead_dataset_obj = %llu\n", (u_longlong_t)dd->dd_head_dataset_obj); (void) printf("\t\tparent_dir_obj = %llu\n", (u_longlong_t)dd->dd_parent_obj); - (void) printf("\t\tclone_parent_obj = %llu\n", - (u_longlong_t)dd->dd_clone_parent_obj); + (void) printf("\t\torigin_obj = %llu\n", + (u_longlong_t)dd->dd_origin_obj); (void) printf("\t\tchild_dir_zapobj = %llu\n", (u_longlong_t)dd->dd_child_dir_zapobj); - (void) printf("\t\tused_bytes = %s\n", used); - (void) printf("\t\tcompressed_bytes = %s\n", compressed); - (void) printf("\t\tuncompressed_bytes = %s\n", uncompressed); - (void) printf("\t\tquota = %s\n", quota); - (void) printf("\t\treserved = %s\n", resv); + nicenum(dd->dd_used_bytes, nice); + (void) printf("\t\tused_bytes = %s\n", nice); + nicenum(dd->dd_compressed_bytes, nice); + (void) printf("\t\tcompressed_bytes = %s\n", nice); + nicenum(dd->dd_uncompressed_bytes, nice); + (void) printf("\t\tuncompressed_bytes = %s\n", nice); + nicenum(dd->dd_quota, nice); + (void) printf("\t\tquota = %s\n", nice); + nicenum(dd->dd_reserved, nice); + (void) printf("\t\treserved = %s\n", nice); (void) printf("\t\tprops_zapobj = %llu\n", (u_longlong_t)dd->dd_props_zapobj); + (void) printf("\t\tdeleg_zapobj = %llu\n", + (u_longlong_t)dd->dd_deleg_zapobj); + (void) printf("\t\tflags = %llx\n", + (u_longlong_t)dd->dd_flags); + +#define DO(which) \ + nicenum(dd->dd_used_breakdown[DD_USED_ ## which], nice); \ + (void) printf("\t\tused_breakdown[" #which "] = %s\n", nice) + DO(HEAD); + DO(SNAP); + DO(CHILD); + DO(CHILD_RSRV); + DO(REFRSRV); +#undef DO } /*ARGSUSED*/ @@ -722,7 +784,7 @@ dump_dsl_dataset(objset_t *os, uint64_t nicenum(ds->ds_unique_bytes, unique); sprintf_blkptr(blkbuf, BP_SPRINTF_LEN, &ds->ds_bp); - (void) printf("\t\tdataset_obj = %llu\n", + (void) printf("\t\tdir_obj = %llu\n", (u_longlong_t)ds->ds_dir_obj); (void) printf("\t\tprev_snap_obj = %llu\n", (u_longlong_t)ds->ds_prev_snap_obj); @@ -749,6 +811,10 @@ dump_dsl_dataset(objset_t *os, uint64_t (u_longlong_t)ds->ds_guid); (void) printf("\t\tflags = %llx\n", (u_longlong_t)ds->ds_flags); + (void) printf("\t\tnext_clones_obj = %llu\n", + (u_longlong_t)ds->ds_next_clones_obj); + (void) printf("\t\tprops_obj = %llu\n", + (u_longlong_t)ds->ds_props_obj); (void) printf("\t\tbp = %s\n", blkbuf); } @@ -765,9 +831,11 @@ dump_bplist(objset_t *mos, uint64_t obje if (dump_opt['d'] < 3) return; + mutex_init(&bpl.bpl_lock, NULL, MUTEX_DEFAULT, NULL); VERIFY(0 == bplist_open(&bpl, mos, object)); if (bplist_empty(&bpl)) { bplist_close(&bpl); + mutex_destroy(&bpl.bpl_lock); return; } @@ -785,6 +853,7 @@ dump_bplist(objset_t *mos, uint64_t obje if (dump_opt['d'] < 5) { bplist_close(&bpl); + mutex_destroy(&bpl.bpl_lock); return; } @@ -800,6 +869,65 @@ dump_bplist(objset_t *mos, uint64_t obje } bplist_close(&bpl); + mutex_destroy(&bpl.bpl_lock); +} + +static avl_tree_t idx_tree; +static avl_tree_t domain_tree; +static boolean_t fuid_table_loaded; + +static void +fuid_table_destroy() +{ + if (fuid_table_loaded) { + zfs_fuid_table_destroy(&idx_tree, &domain_tree); + fuid_table_loaded = B_FALSE; + } +} + +/* + * print uid or gid information. + * For normal POSIX id just the id is printed in decimal format. + * For CIFS files with FUID the fuid is printed in hex followed by + * the doman-rid string. + */ +static void +print_idstr(uint64_t id, const char *id_type) +{ + if (FUID_INDEX(id)) { + char *domain; + + domain = zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id)); + (void) printf("\t%s %llx [%s-%d]\n", id_type, + (u_longlong_t)id, domain, (int)FUID_RID(id)); + } else { + (void) printf("\t%s %llu\n", id_type, (u_longlong_t)id); + } + +} + +static void +dump_uidgid(objset_t *os, znode_phys_t *zp) +{ + uint32_t uid_idx, gid_idx; + + uid_idx = FUID_INDEX(zp->zp_uid); + gid_idx = FUID_INDEX(zp->zp_gid); + + /* Load domain table, if not already loaded */ + if (!fuid_table_loaded && (uid_idx || gid_idx)) { + uint64_t fuid_obj; + + /* first find the fuid object. It lives in the master node */ + VERIFY(zap_lookup(os, MASTER_NODE_OBJ, ZFS_FUID_TABLES, + 8, 1, &fuid_obj) == 0); + (void) zfs_fuid_table_load(os, fuid_obj, + &idx_tree, &domain_tree); + fuid_table_loaded = B_TRUE; + } + + print_idstr(zp->zp_uid, "uid"); + print_idstr(zp->zp_gid, "gid"); } /*ARGSUSED*/ @@ -830,6 +958,7 @@ dump_znode(objset_t *os, uint64_t object z_ctime = (time_t)zp->zp_ctime[0]; (void) printf("\tpath %s\n", path); + dump_uidgid(os, zp); (void) printf("\tatime %s", ctime(&z_atime)); (void) printf("\tmtime %s", ctime(&z_mtime)); (void) printf("\tctime %s", ctime(&z_ctime)); @@ -874,9 +1003,9 @@ static object_viewer_t *object_viewer[DM dump_zap, /* DSL props */ dump_dsl_dataset, /* DSL dataset */ dump_znode, /* ZFS znode */ - dump_acl, /* ZFS ACL */ + dump_acl, /* ZFS V0 ACL */ dump_uint8, /* ZFS plain file */ - dump_zap, /* ZFS directory */ + dump_zpldir, /* ZFS directory */ dump_zap, /* ZFS master node */ dump_zap, /* ZFS delete queue */ dump_uint8, /* zvol object */ @@ -888,6 +1017,13 @@ static object_viewer_t *object_viewer[DM dump_uint8, /* SPA history */ dump_uint64, /* SPA history offsets */ dump_zap, /* Pool properties */ + dump_zap, /* DSL permissions */ + dump_acl, /* ZFS ACL */ + dump_uint8, /* ZFS SYSACL */ + dump_none, /* FUID nvlist */ + dump_packed_nvlist, /* FUID nvlist size */ + dump_zap, /* DSL dataset next clones */ + dump_zap, /* DSL scrub queue */ }; static void @@ -930,13 +1066,15 @@ dump_object(objset_t *os, uint64_t objec aux[0] = '\0'; - if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6) + if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6) { (void) snprintf(aux + strlen(aux), sizeof (aux), " (K=%s)", - zio_checksum_table[doi.doi_checksum].ci_name); + zio_checksum_table[doi.doi_checksum].ci_name); + } - if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) + if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) { (void) snprintf(aux + strlen(aux), sizeof (aux), " (Z=%s)", - zio_compress_table[doi.doi_compress].ci_name); + zio_compress_table[doi.doi_compress].ci_name); + } (void) printf("%10lld %3u %5s %5s %5s %5s %s%s\n", (u_longlong_t)object, doi.doi_indirection, iblk, dblk, lsize, @@ -972,13 +1110,13 @@ dump_object(objset_t *os, uint64_t objec } for (;;) { - error = dnode_next_offset(dn, B_FALSE, &start, minlvl, - blkfill, 0); + error = dnode_next_offset(dn, + 0, &start, minlvl, blkfill, 0); if (error) break; end = start; - error = dnode_next_offset(dn, B_TRUE, &end, minlvl, - blkfill, 0); + error = dnode_next_offset(dn, + DNODE_FIND_HOLE, &end, minlvl, blkfill, 0); nicenum(end - start, segsize); (void) printf("\t\tsegment [%016llx, %016llx)" " size %5s\n", (u_longlong_t)start, @@ -996,7 +1134,6 @@ dump_object(objset_t *os, uint64_t objec static char *objset_types[DMU_OST_NUMTYPES] = { "NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; -/*ARGSUSED*/ static void dump_dir(objset_t *os) { @@ -1019,8 +1156,8 @@ dump_dir(objset_t *os) if (dds.dds_type == DMU_OST_META) { dds.dds_creation_txg = TXG_INITIAL; usedobjs = os->os->os_rootbp->blk_fill; - refdbytes = - os->os->os_spa->spa_dsl_pool->dp_mos_dir->dd_used_bytes; + refdbytes = os->os->os_spa->spa_dsl_pool-> + dp_mos_dir->dd_phys->dd_used_bytes; } else { dmu_objset_space(os, &refdbytes, &scratch, &usedobjs, &scratch); } @@ -1054,6 +1191,9 @@ dump_dir(objset_t *os) if (verbosity < 2) return; + if (os->os->os_rootbp->blk_birth == 0) + return; + if (zopt_objects != 0) { for (i = 0; i < zopt_objects; i++) dump_object(os, zopt_object[i], verbosity, @@ -1115,6 +1255,52 @@ dump_config(const char *pool) } static void +dump_cachefile(const char *cachefile) +{ + int fd; + struct stat64 statbuf; + char *buf; + nvlist_t *config; + + if ((fd = open64(cachefile, O_RDONLY)) < 0) { + (void) printf("cannot open '%s': %s\n", cachefile, + strerror(errno)); + exit(1); + } + + if (fstat64(fd, &statbuf) != 0) { + (void) printf("failed to stat '%s': %s\n", cachefile, + strerror(errno)); + exit(1); + } + + if ((buf = malloc(statbuf.st_size)) == NULL) { + (void) fprintf(stderr, "failed to allocate %llu bytes\n", + (u_longlong_t)statbuf.st_size); + exit(1); + } + + if (read(fd, buf, statbuf.st_size) != statbuf.st_size) { + (void) fprintf(stderr, "failed to read %llu bytes\n", + (u_longlong_t)statbuf.st_size); + exit(1); + } + + (void) close(fd); + + if (nvlist_unpack(buf, statbuf.st_size, &config, 0) != 0) { + (void) fprintf(stderr, "failed to unpack nvlist\n"); + exit(1); + } + + free(buf); + + dump_nvlist(config, 0); + + nvlist_free(config); +} + +static void dump_label(const char *dev) { int fd; @@ -1136,15 +1322,7 @@ dump_label(const char *dev) exit(1); } - if (S_ISCHR(statbuf.st_mode)) { - if (ioctl(fd, DIOCGMEDIASIZE, &psize) != 0) { - (void) printf("failed to get size '%s': %s\n", dev, - strerror(errno)); - exit(1); - } - } else - psize = statbuf.st_size; - + psize = statbuf.st_size; psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); for (l = 0; l < VDEV_LABELS; l++) { @@ -1178,170 +1356,84 @@ dump_one_dir(char *dsname, void *arg) objset_t *os; error = dmu_objset_open(dsname, DMU_OST_ANY, - DS_MODE_STANDARD | DS_MODE_READONLY, &os); + DS_MODE_USER | DS_MODE_READONLY, &os); if (error) { (void) printf("Could not open %s\n", dsname); return (0); } dump_dir(os); dmu_objset_close(os); + fuid_table_destroy(); return (0); } static void -zdb_space_map_load(spa_t *spa) +zdb_leak(space_map_t *sm, uint64_t start, uint64_t size) { - vdev_t *rvd = spa->spa_root_vdev; - vdev_t *vd; - int c, m, error; + vdev_t *vd = sm->sm_ppd; - for (c = 0; c < rvd->vdev_children; c++) { - vd = rvd->vdev_child[c]; - for (m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - mutex_enter(&msp->ms_lock); - error = space_map_load(&msp->ms_allocmap[0], NULL, - SM_ALLOC, &msp->ms_smo, spa->spa_meta_objset); - mutex_exit(&msp->ms_lock); - if (error) - fatal("%s bad space map #%d, error %d", - spa->spa_name, c, error); - } - } + (void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n", + (u_longlong_t)vd->vdev_id, (u_longlong_t)start, (u_longlong_t)size); } -static int -zdb_space_map_claim(spa_t *spa, blkptr_t *bp, zbookmark_t *zb) +/* ARGSUSED */ +static void +zdb_space_map_load(space_map_t *sm) { - dva_t *dva = bp->blk_dva; - vdev_t *vd; - metaslab_t *msp; - space_map_t *allocmap, *freemap; - int error; - int d; - blkptr_t blk = *bp; - - for (d = 0; d < BP_GET_NDVAS(bp); d++) { - uint64_t vdev = DVA_GET_VDEV(&dva[d]); - uint64_t offset = DVA_GET_OFFSET(&dva[d]); - uint64_t size = DVA_GET_ASIZE(&dva[d]); - - if ((vd = vdev_lookup_top(spa, vdev)) == NULL) - return (ENXIO); - - if ((offset >> vd->vdev_ms_shift) >= vd->vdev_ms_count) - return (ENXIO); - - msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; - allocmap = &msp->ms_allocmap[0]; - freemap = &msp->ms_freemap[0]; - - /* Prepare our copy of the bp in case we need to read GBHs */ - if (DVA_GET_GANG(&dva[d])) { - size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); - DVA_SET_ASIZE(&blk.blk_dva[d], size); - DVA_SET_GANG(&blk.blk_dva[d], 0); - } - - mutex_enter(&msp->ms_lock); - if (space_map_contains(freemap, offset, size)) { - mutex_exit(&msp->ms_lock); - return (EAGAIN); /* allocated more than once */ - } - - if (!space_map_contains(allocmap, offset, size)) { - mutex_exit(&msp->ms_lock); - return (ESTALE); /* not allocated at all */ - } - - space_map_remove(allocmap, offset, size); - space_map_add(freemap, offset, size); - - mutex_exit(&msp->ms_lock); - } - - if (BP_IS_GANG(bp)) { - zio_gbh_phys_t gbh; - int g; - - /* LINTED - compile time assert */ - ASSERT(sizeof (zio_gbh_phys_t) == SPA_GANGBLOCKSIZE); - - BP_SET_CHECKSUM(&blk, ZIO_CHECKSUM_GANG_HEADER); - BP_SET_PSIZE(&blk, SPA_GANGBLOCKSIZE); - BP_SET_LSIZE(&blk, SPA_GANGBLOCKSIZE); - BP_SET_COMPRESS(&blk, ZIO_COMPRESS_OFF); - error = zio_wait(zio_read(NULL, spa, &blk, &gbh, - SPA_GANGBLOCKSIZE, NULL, NULL, ZIO_PRIORITY_SYNC_READ, - ZIO_FLAG_CANFAIL | ZIO_FLAG_CONFIG_HELD, zb)); - if (error) - return (error); - if (BP_SHOULD_BYTESWAP(&blk)) - byteswap_uint64_array(&gbh, SPA_GANGBLOCKSIZE); - for (g = 0; g < SPA_GBH_NBLKPTRS; g++) { - if (BP_IS_HOLE(&gbh.zg_blkptr[g])) - break; - error = zdb_space_map_claim(spa, &gbh.zg_blkptr[g], zb); - if (error) - return (error); - } - } - - return (0); } static void -zdb_leak(space_map_t *sm, uint64_t start, uint64_t size) +zdb_space_map_unload(space_map_t *sm) { - metaslab_t *msp; - - /* LINTED */ - msp = (metaslab_t *)((char *)sm - offsetof(metaslab_t, ms_allocmap[0])); + space_map_vacate(sm, zdb_leak, sm); +} - (void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n", - (u_longlong_t)msp->ms_group->mg_vd->vdev_id, - (u_longlong_t)start, - (u_longlong_t)size); +/* ARGSUSED */ +static void +zdb_space_map_claim(space_map_t *sm, uint64_t start, uint64_t size) +{ } +static space_map_ops_t zdb_space_map_ops = { + zdb_space_map_load, + zdb_space_map_unload, + NULL, /* alloc */ + zdb_space_map_claim, + NULL /* free */ +}; + static void -zdb_space_map_unload(spa_t *spa) +zdb_leak_init(spa_t *spa) { vdev_t *rvd = spa->spa_root_vdev; - vdev_t *vd; - int c, m; - for (c = 0; c < rvd->vdev_children; c++) { - vd = rvd->vdev_child[c]; - for (m = 0; m < vd->vdev_ms_count; m++) { + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; + for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); - space_map_vacate(&msp->ms_allocmap[0], zdb_leak, - &msp->ms_allocmap[0]); - space_map_unload(&msp->ms_allocmap[0]); - space_map_vacate(&msp->ms_freemap[0], NULL, NULL); + VERIFY(space_map_load(&msp->ms_map, &zdb_space_map_ops, + SM_ALLOC, &msp->ms_smo, spa->spa_meta_objset) == 0); + msp->ms_map.sm_ppd = vd; mutex_exit(&msp->ms_lock); } } } static void -zdb_refresh_ubsync(spa_t *spa) +zdb_leak_fini(spa_t *spa) { - uberblock_t ub = { 0 }; vdev_t *rvd = spa->spa_root_vdev; - zio_t *zio; - /* - * Reload the uberblock. - */ - zio = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); - vdev_uberblock_load(zio, rvd, &ub); - (void) zio_wait(zio); - - if (ub.ub_txg != 0) - spa->spa_ubsync = ub; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; + for (int m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + mutex_enter(&msp->ms_lock); + space_map_unload(&msp->ms_map); + mutex_exit(&msp->ms_lock); + } + } } /* @@ -1371,9 +1463,7 @@ typedef struct zdb_cb { static void zdb_count_block(spa_t *spa, zdb_cb_t *zcb, blkptr_t *bp, int type) { - int i, error; - - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int t = (i & 1) ? type : DMU_OT_TOTAL; zdb_blkstats_t *zb = &zcb->zcb_type[l][t]; @@ -1384,21 +1474,34 @@ zdb_count_block(spa_t *spa, zdb_cb_t *zc zb->zb_count++; } - if (dump_opt['L']) - return; + if (dump_opt['S']) { + boolean_t print_sig; - error = zdb_space_map_claim(spa, bp, &zcb->zcb_cache->bc_bookmark); - - if (error == 0) - return; + print_sig = !zdb_sig_user_data || (BP_GET_LEVEL(bp) == 0 && + BP_GET_TYPE(bp) == DMU_OT_PLAIN_FILE_CONTENTS); - if (error == EAGAIN) - (void) fatal("double-allocation, bp=%p", bp); + if (BP_GET_CHECKSUM(bp) < zdb_sig_cksumalg) + print_sig = B_FALSE; - if (error == ESTALE) - (void) fatal("reference to freed block, bp=%p", bp); + if (print_sig) { + (void) printf("%llu\t%lld\t%lld\t%s\t%s\t%s\t" + "%llx:%llx:%llx:%llx\n", + (u_longlong_t)BP_GET_LEVEL(bp), + (longlong_t)BP_GET_PSIZE(bp), + (longlong_t)BP_GET_NDVAS(bp), + dmu_ot[BP_GET_TYPE(bp)].ot_name, + zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name, + zio_compress_table[BP_GET_COMPRESS(bp)].ci_name, + (u_longlong_t)bp->blk_cksum.zc_word[0], + (u_longlong_t)bp->blk_cksum.zc_word[1], + (u_longlong_t)bp->blk_cksum.zc_word[2], + (u_longlong_t)bp->blk_cksum.zc_word[3]); + } + } - (void) fatal("fatal error %d in bp %p", error, bp); + if (!dump_opt['L']) + VERIFY(zio_wait(zio_claim(NULL, spa, spa_first_txg(spa), bp, + NULL, NULL, ZIO_FLAG_MUSTSUCCEED)) == 0); } static int @@ -1411,9 +1514,16 @@ zdb_blkptr_cb(traverse_blk_cache_t *bc, char blkbuf[BP_SPRINTF_LEN]; int error = 0; + ASSERT(!BP_IS_HOLE(bp)); + + zdb_count_block(spa, zcb, bp, type); + if (bc->bc_errno) { if (zcb->zcb_readfails++ < 10 && dump_opt['L']) { - zdb_refresh_ubsync(spa); + uberblock_t ub; + vdev_uberblock_load(NULL, spa->spa_root_vdev, &ub); + if (ub.ub_txg != 0) + spa->spa_ubsync = ub; error = EAGAIN; } else { zcb->zcb_haderrors = 1; @@ -1426,35 +1536,32 @@ zdb_blkptr_cb(traverse_blk_cache_t *bc, else blkbuf[0] = '\0'; - (void) printf("zdb_blkptr_cb: Got error %d reading " - "<%llu, %llu, %lld, %llx> %s -- %s\n", - bc->bc_errno, - (u_longlong_t)zb->zb_objset, - (u_longlong_t)zb->zb_object, - (u_longlong_t)zb->zb_level, - (u_longlong_t)zb->zb_blkid, - blkbuf, - error == EAGAIN ? "retrying" : "skipping"); + if (!dump_opt['S']) { + (void) printf("zdb_blkptr_cb: Got error %d reading " + "<%llu, %llu, %lld, %llx> %s -- %s\n", + bc->bc_errno, + (u_longlong_t)zb->zb_objset, + (u_longlong_t)zb->zb_object, + (u_longlong_t)zb->zb_level, + (u_longlong_t)zb->zb_blkid, + blkbuf, + error == EAGAIN ? "retrying" : "skipping"); + } return (error); } zcb->zcb_readfails = 0; - ASSERT(!BP_IS_HOLE(bp)); - if (dump_opt['b'] >= 4) { sprintf_blkptr(blkbuf, BP_SPRINTF_LEN, bp); (void) printf("objset %llu object %llu offset 0x%llx %s\n", (u_longlong_t)zb->zb_objset, (u_longlong_t)zb->zb_object, (u_longlong_t)blkid2offset(bc->bc_dnode, - zb->zb_level, zb->zb_blkid), - blkbuf); + zb->zb_level, zb->zb_blkid), blkbuf); } - zdb_count_block(spa, zcb, bp, type); - return (0); } @@ -1465,32 +1572,35 @@ dump_block_stats(spa_t *spa) zdb_cb_t zcb = { 0 }; traverse_blk_cache_t dummy_cache = { 0 }; zdb_blkstats_t *zb, *tzb; - uint64_t alloc, space; + uint64_t alloc, space, logalloc; + vdev_t *rvd = spa->spa_root_vdev; int leaks = 0; int advance = zdb_advance; - int flags; - int e; + int c, e, flags; zcb.zcb_cache = &dummy_cache; - if (dump_opt['c']) + if (dump_opt['c'] || dump_opt['S']) advance |= ADVANCE_DATA; advance |= ADVANCE_PRUNE | ADVANCE_ZIL; - (void) printf("\nTraversing all blocks to %sverify" - " nothing leaked ...\n", - dump_opt['c'] ? "verify checksums and " : ""); + if (!dump_opt['S']) { + (void) printf("\nTraversing all blocks to %sverify" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 21:06:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1506106567B; Mon, 17 Nov 2008 21:06:17 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDC7E8FC14; Mon, 17 Nov 2008 21:06:17 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHL6H6c092945; Mon, 17 Nov 2008 21:06:17 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHL6H1s092944; Mon, 17 Nov 2008 21:06:17 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811172106.mAHL6H1s092944@svn.freebsd.org> From: Tim Kientzle Date: Mon, 17 Nov 2008 21:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185030 - head/lib/libarchive/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 21:06:18 -0000 Author: kientzle Date: Mon Nov 17 21:06:17 2008 New Revision: 185030 URL: http://svn.freebsd.org/changeset/base/185030 Log: When running on a filesystem that lacks ACL support, just SKIP the test, don't report a test failure. Modified: head/lib/libarchive/test/test_acl_freebsd.c Modified: head/lib/libarchive/test/test_acl_freebsd.c ============================================================================== --- head/lib/libarchive/test/test_acl_freebsd.c Mon Nov 17 20:49:29 2008 (r185029) +++ head/lib/libarchive/test/test_acl_freebsd.c Mon Nov 17 21:06:17 2008 (r185030) @@ -200,19 +200,19 @@ DEFINE_TEST(test_acl_freebsd) /* Create a test file and try to set an ACL on it. */ fd = open("pretest", O_WRONLY | O_CREAT | O_EXCL, 0777); failure("Could not create test file?!"); - n = -1; - if (assert(fd >= 0)) { - n = acl_set_fd(fd, acl); - failure("acl_set_fd(): errno = %d (%s)", - errno, strerror(errno)); - assertEqualInt(0, n); - close(fd); - } + if (!assert(fd >= 0)) + return; - if (fd < 0 || n != 0) { + n = acl_set_fd(fd, acl); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); skipping("ACL tests require that ACL support be enabled on the filesystem"); return; } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); /* Create a write-to-disk object. */ assert(NULL != (a = archive_write_disk_new())); From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 21:14:13 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AE711065670; Mon, 17 Nov 2008 21:14:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id CA2B98FC12; Mon, 17 Nov 2008 21:14:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAHLDguu033788; Mon, 17 Nov 2008 16:14:01 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Mon, 17 Nov 2008 16:13:36 -0500 User-Agent: KMail/1.9.7 References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> In-Reply-To: <20081117193541.GG90129@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200811171613.36602.jhb@freebsd.org> Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 17 Nov 2008 16:14:02 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8642/Sun Nov 16 23:01:08 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, Doug Ambrisko , svn-src-all@freebsd.org, src-committers@freebsd.org, Doug Ambrisko Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 21:14:13 -0000 On Monday 17 November 2008 02:35:41 pm Kostik Belousov wrote: > On Mon, Nov 17, 2008 at 12:11:41PM -0500, John Baldwin wrote: > > On Sunday 16 November 2008 09:37:45 pm Doug Ambrisko wrote: > > > Kostik Belousov writes: > > > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > > > | > Author: ambrisko > > > | > Date: Fri Nov 14 21:05:45 2008 > > > | > New Revision: 184974 > > > | > URL: http://svn.freebsd.org/changeset/base/184974 > > > | > > > > | > Log: > > > | > When running a 32bit app. on amd64, ensure the bits above 32bit > > > | > are zero for the copyout. Confirmed by LSI. > > > | > > > > | > Modified: > > > | > head/sys/dev/mfi/mfi.c > > > | > > > > | > Modified: head/sys/dev/mfi/mfi.c > > > | > > > ============================================================================== > > > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > > > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > > > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > > > | > ->mfi_frame.raw[ioc->mfi_sense_off], > > > | > &sense_ptr.sense_ptr_data[0], > > > | > sizeof(sense_ptr.sense_ptr_data)); > > > | > +#ifdef __amd64__ > > > | > + if (cmd != MFI_CMD) { > > > | > + /* > > > | > + * not 64bit native so zero out any address > > > | > + * over 32bit */ > > > | > + sense_ptr.high = 0; > > > | > + } > > > | > +#endif > > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > > > | > ioc->mfi_sense_len); > > > | > if (error != 0) { > > > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > > > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > > > | > &sense_ptr.sense_ptr_data[0], > > > | > sizeof(sense_ptr.sense_ptr_data)); > > > | > +#ifdef __amd64__ > > > | > + /* > > > | > + * only 32bit Linux support so zero out any > > > | > + * address over 32bit > > > | > + */ > > > | > + sense_ptr.high = 0; > > > | > +#endif > > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > > > | > l_ioc.lioc_sense_len); > > > | > if (error != 0) { > > > | > > > | Would it make sense to perform this cut slightly more generically, by > > > | checking whether the current process is 32bit ? > > > | > > > | We still have not grew the easy to check flag or attribute of the image, > > > | but usual practice is to compare p_sysent with corresponding sysvec, > > > | like > > > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) > > > | or > > > | if (td->td_proc->p_sysent == &elf_linux_sysvec) > > > > > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > > > value is different. I put in that comment for Linux since there > > > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > > > support we need a 64bit structure defined. When the ioctl can't > > > be figured out then I've used the p_sysent. Eventually, something > > > that is more generic then the #ifdef __amd64__ should be done > > > in all the drivers that do this emulation. > > > > I prefer depending on things like ioctl values and the 32-bit sysctl flag when > > possible. If we do have to directly check for the ABI, I'd much rather have > > a flags field in sysent rather than trying to compare against global symbols, > > as you can't compare against a global symbol unless it is present in the > > kernel. Something like: > > > > if (td->td_proc->p_sysent->sy_flags & SY_32) > > > > or some such. I've wanted to have a COMPAT_FREEBSD32 that gets auto-enabled > > when you turn on COMPAT_IA32 on amd64 and ia64. It would also potentially be > > enabled by a COMPAT_SPARC8 or some such on sparc64 if we ever had that. > > Ok, what about the following. I only compiled it on i386/amd64. And, > there are more places to convert to such checks, for sure. > > [yummy patch] Commit! Note that this is not MFC'able due to ABI breakage for older linux.ko modules, but this is the proper solution for 8.0+. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 21:21:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E83D41065776 for ; Mon, 17 Nov 2008 21:21:54 +0000 (UTC) (envelope-from peter@wemm.org) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id A11098FC18 for ; Mon, 17 Nov 2008 21:21:54 +0000 (UTC) (envelope-from peter@wemm.org) Received: by yw-out-2324.google.com with SMTP id 9so1101100ywe.13 for ; Mon, 17 Nov 2008 13:21:53 -0800 (PST) Received: by 10.142.156.19 with SMTP id d19mr2172789wfe.289.1226956913141; Mon, 17 Nov 2008 13:21:53 -0800 (PST) Received: by 10.142.255.21 with HTTP; Mon, 17 Nov 2008 13:21:53 -0800 (PST) Message-ID: Date: Mon, 17 Nov 2008 13:21:53 -0800 From: "Peter Wemm" To: "John Baldwin" In-Reply-To: <200811171613.36602.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> <200811171613.36602.jhb@freebsd.org> Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 21:21:55 -0000 On Mon, Nov 17, 2008 at 1:13 PM, John Baldwin wrote: > On Monday 17 November 2008 02:35:41 pm Kostik Belousov wrote: >> On Mon, Nov 17, 2008 at 12:11:41PM -0500, John Baldwin wrote: >> > On Sunday 16 November 2008 09:37:45 pm Doug Ambrisko wrote: >> > > Kostik Belousov writes: >> > > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: >> > > | > Author: ambrisko >> > > | > Date: Fri Nov 14 21:05:45 2008 >> > > | > New Revision: 184974 >> > > | > URL: http://svn.freebsd.org/changeset/base/184974 >> > > | > >> > > | > Log: >> > > | > When running a 32bit app. on amd64, ensure the bits above 32bit >> > > | > are zero for the copyout. Confirmed by LSI. >> > > | > >> > > | > Modified: >> > > | > head/sys/dev/mfi/mfi.c >> > > | > >> > > | > Modified: head/sys/dev/mfi/mfi.c >> > > | > >> > > ============================================================================== >> > > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) >> > > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) >> > > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, >> > > | > ->mfi_frame.raw[ioc->mfi_sense_off], >> > > | > &sense_ptr.sense_ptr_data[0], >> > > | > sizeof(sense_ptr.sense_ptr_data)); >> > > | > +#ifdef __amd64__ >> > > | > + if (cmd != MFI_CMD) { >> > > | > + /* >> > > | > + * not 64bit native so zero out any address >> > > | > + * over 32bit */ >> > > | > + sense_ptr.high = 0; >> > > | > + } >> > > | > +#endif >> > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, >> > > | > ioc->mfi_sense_len); >> > > | > if (error != 0) { >> > > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ >> > > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], >> > > | > &sense_ptr.sense_ptr_data[0], >> > > | > sizeof(sense_ptr.sense_ptr_data)); >> > > | > +#ifdef __amd64__ >> > > | > + /* >> > > | > + * only 32bit Linux support so zero out any >> > > | > + * address over 32bit >> > > | > + */ >> > > | > + sense_ptr.high = 0; >> > > | > +#endif >> > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, >> > > | > l_ioc.lioc_sense_len); >> > > | > if (error != 0) { >> > > | >> > > | Would it make sense to perform this cut slightly more generically, by >> > > | checking whether the current process is 32bit ? >> > > | >> > > | We still have not grew the easy to check flag or attribute of the > image, >> > > | but usual practice is to compare p_sysent with corresponding sysvec, >> > > | like >> > > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) >> > > | or >> > > | if (td->td_proc->p_sysent == &elf_linux_sysvec) >> > > >> > > So far we do it based on the ioctl since the 32bit or 64bit ioctl >> > > value is different. I put in that comment for Linux since there >> > > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl >> > > support we need a 64bit structure defined. When the ioctl can't >> > > be figured out then I've used the p_sysent. Eventually, something >> > > that is more generic then the #ifdef __amd64__ should be done >> > > in all the drivers that do this emulation. >> > >> > I prefer depending on things like ioctl values and the 32-bit sysctl flag > when >> > possible. If we do have to directly check for the ABI, I'd much rather > have >> > a flags field in sysent rather than trying to compare against global > symbols, >> > as you can't compare against a global symbol unless it is present in the >> > kernel. Something like: >> > >> > if (td->td_proc->p_sysent->sy_flags & SY_32) >> > >> > or some such. I've wanted to have a COMPAT_FREEBSD32 that gets > auto-enabled >> > when you turn on COMPAT_IA32 on amd64 and ia64. It would also potentially > be >> > enabled by a COMPAT_SPARC8 or some such on sparc64 if we ever had that. >> >> Ok, what about the following. I only compiled it on i386/amd64. And, >> there are more places to convert to such checks, for sure. >> >> [yummy patch] > > Commit! Note that this is not MFC'able due to ABI breakage for older linux.ko > modules, but this is the proper solution for 8.0+. > > -- > John Baldwin > I was thinking of suggesting a macro to replace the verbose test if curproc->td_proc->p_sysent->sv_flags, but I couldn't think of something off the top of my head. - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (curthread->td_proc->p_sysent->sv_flags & SV_ILP32) { if (SV_FLAGS(curthread) & SV_ILP32) ... or the like. I'm not set on this, it just seemed like it might be worth mentioning. Also, change curthread->td_proc with curproc, for what its worth. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 22:05:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 394A21065672; Mon, 17 Nov 2008 22:05:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 257358FC13; Mon, 17 Nov 2008 22:05:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHM5sZ1094468; Mon, 17 Nov 2008 22:05:54 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHM5s7q094467; Mon, 17 Nov 2008 22:05:54 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811172205.mAHM5s7q094467@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Nov 2008 22:05:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185031 - head/usr.sbin/pccard/pccardc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 22:05:54 -0000 Author: imp Date: Mon Nov 17 22:05:53 2008 New Revision: 185031 URL: http://svn.freebsd.org/changeset/base/185031 Log: Minor ANSI tweaks. Modified: head/usr.sbin/pccard/pccardc/dumpcis.c Modified: head/usr.sbin/pccard/pccardc/dumpcis.c ============================================================================== --- head/usr.sbin/pccard/pccardc/dumpcis.c Mon Nov 17 21:06:17 2008 (r185030) +++ head/usr.sbin/pccard/pccardc/dumpcis.c Mon Nov 17 22:05:53 2008 (r185031) @@ -44,8 +44,7 @@ static const char rcsid[] = int nocards; static void -scan(slot) - int slot; +scan(int slot) { int fd; char name[64]; @@ -71,9 +70,7 @@ scan(slot) } void -dump(p, sz) - unsigned char *p; - int sz; +dump(unsigned char *p, int sz) { int ad = 0, i; From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 22:19:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97D33106564A; Mon, 17 Nov 2008 22:19:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 805BA8FC19; Mon, 17 Nov 2008 22:19:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHMJKhW058994; Mon, 17 Nov 2008 22:19:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHMJJ4b058986; Mon, 17 Nov 2008 22:19:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811172219.mAHMJJ4b058986@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Nov 2008 22:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185032 - in head/usr.sbin: . dumpcis pccard pccard/dumpcis pccard/pccardc pccard/pccardd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 22:19:20 -0000 Author: imp Date: Mon Nov 17 22:19:19 2008 New Revision: 185032 URL: http://svn.freebsd.org/changeset/base/185032 Log: Move dumpcis to its own directory, start to decouple from the pccardc/pccardd history. Added: head/usr.sbin/dumpcis/ head/usr.sbin/dumpcis/Makefile - copied, changed from r185031, head/usr.sbin/pccard/dumpcis/Makefile head/usr.sbin/dumpcis/dumpcis.8 - copied unchanged from r185031, head/usr.sbin/pccard/dumpcis/dumpcis.8 head/usr.sbin/dumpcis/dumpcis.c - copied unchanged from r185031, head/usr.sbin/pccard/pccardc/dumpcis.c head/usr.sbin/dumpcis/dumpcisfile.c - copied unchanged from r185031, head/usr.sbin/pccard/pccardc/dumpcisfile.c head/usr.sbin/dumpcis/main.c - copied unchanged from r185031, head/usr.sbin/pccard/dumpcis/main.c head/usr.sbin/dumpcis/printcis.c - copied unchanged from r185031, head/usr.sbin/pccard/pccardc/printcis.c head/usr.sbin/dumpcis/readcis.c - copied unchanged from r185031, head/usr.sbin/pccard/pccardd/readcis.c head/usr.sbin/dumpcis/readcis.h - copied unchanged from r185031, head/usr.sbin/pccard/pccardd/readcis.h Deleted: head/usr.sbin/pccard/Makefile head/usr.sbin/pccard/Makefile.inc head/usr.sbin/pccard/dumpcis/Makefile head/usr.sbin/pccard/dumpcis/dumpcis.8 head/usr.sbin/pccard/dumpcis/main.c head/usr.sbin/pccard/pccardc/Makefile head/usr.sbin/pccard/pccardc/beep.c head/usr.sbin/pccard/pccardc/dumpcis.c head/usr.sbin/pccard/pccardc/dumpcisfile.c head/usr.sbin/pccard/pccardc/enabler.c head/usr.sbin/pccard/pccardc/pccardc.8 head/usr.sbin/pccard/pccardc/pccardc.c head/usr.sbin/pccard/pccardc/pccardmem.c head/usr.sbin/pccard/pccardc/power.c head/usr.sbin/pccard/pccardc/printcis.c head/usr.sbin/pccard/pccardc/rdattr.c head/usr.sbin/pccard/pccardc/rdmap.c head/usr.sbin/pccard/pccardc/rdreg.c head/usr.sbin/pccard/pccardc/wrattr.c head/usr.sbin/pccard/pccardc/wrreg.c head/usr.sbin/pccard/pccardd/readcis.c head/usr.sbin/pccard/pccardd/readcis.h Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Mon Nov 17 22:05:53 2008 (r185031) +++ head/usr.sbin/Makefile Mon Nov 17 22:19:19 2008 (r185032) @@ -45,6 +45,7 @@ SUBDIR= ${_ac} \ diskinfo \ ${_dnssec-keygen} \ ${_dnssec-signzone} \ + dumpcis \ ${_editmap} \ ${_edquota} \ ${_eeprom} \ @@ -115,7 +116,6 @@ SUBDIR= ${_ac} \ ${_ntp} \ ${_nvram} \ ${_ofwdump} \ - pccard \ pciconf \ periodic \ ${_pkg_install} \ Copied and modified: head/usr.sbin/dumpcis/Makefile (from r185031, head/usr.sbin/pccard/dumpcis/Makefile) ============================================================================== --- head/usr.sbin/pccard/dumpcis/Makefile Mon Nov 17 22:05:53 2008 (r185031, copy source) +++ head/usr.sbin/dumpcis/Makefile Mon Nov 17 22:19:19 2008 (r185032) @@ -2,12 +2,8 @@ # # $FreeBSD$ -.PATH: ${.CURDIR}/../pccardd ${.CURDIR}/../pccardc - PROG= dumpcis MAN= dumpcis.8 SRCS= main.c dumpcis.c dumpcisfile.c readcis.c printcis.c -CFLAGS+= -I${.CURDIR}/../pccardd -I${.CURDIR}/../pccardc - .include Copied: head/usr.sbin/dumpcis/dumpcis.8 (from r185031, head/usr.sbin/pccard/dumpcis/dumpcis.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/dumpcis/dumpcis.8 Mon Nov 17 22:19:19 2008 (r185032, copy of r185031, head/usr.sbin/pccard/dumpcis/dumpcis.8) @@ -0,0 +1,49 @@ +.\" +.\" Copyright (c) 2006 M. Warner Losh +.\" 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. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. +.\" +.\" $FreeBSD$ +.\" +.Dd October 18, 2006 +.Dt DUMPCIS 8 +.Os +.Sh NAME +.Nm dumpcis +.Nd PC Card and Cardbus (PCMCIA) CIS display tool +.Sh SYNOPSIS +.Nm +.Ar +.Sh DESCRIPTION +The +.Nm +utility translates a raw CIS stream into human readable form. +.Sh SEE ALSO +.Xr cardbus 4 , +.Xr cbb 4 , +.Xr pccard 4 +.Sh AUTHORS +.An -nosplit +The original version was written by +.An Warner Losh Aq imp@FreeBSD.org . Copied: head/usr.sbin/dumpcis/dumpcis.c (from r185031, head/usr.sbin/pccard/pccardc/dumpcis.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/dumpcis/dumpcis.c Mon Nov 17 22:19:19 2008 (r185032, copy of r185031, head/usr.sbin/pccard/pccardc/dumpcis.c) @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1995 Andrew McRae. 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. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "readcis.h" + +int nocards; + +static void +scan(int slot) +{ + int fd; + char name[64]; + struct cis *cp; + struct slotstate st; + + sprintf(name, CARD_DEVICE, slot); + fd = open(name, O_RDONLY); + if (fd < 0) + return; + nocards++; + if (ioctl(fd, PIOCGSTATE, &st)) + err(1, "ioctl (PIOCGSTATE)"); + if (st.state == filled) { + cp = readcis(fd); + if (cp) { + printf("Configuration data for card in slot %d\n", + slot); + dumpcis(cp); + freecis(cp); + } + } +} + +void +dump(unsigned char *p, int sz) +{ + int ad = 0, i; + + while (sz > 0) { + printf("%03x: ", ad); + for (i = 0; i < ((sz < 16) ? sz : 16); i++) + printf(" %02x", p[i]); + printf("\n"); + sz -= 16; + p += 16; + ad += 16; + } +} + +void * +xmalloc(int sz) +{ + void *p; + + sz = (sz + 7) & ~7; + p = malloc(sz); + if (p) + bzero(p, sz); + else + errx(1, "malloc"); + return (p); +} + +int +dumpcis_main(int argc, char **argv) +{ + int node; + + for (node = 0; node < 8; node++) + scan(node); + printf("%d slots found\n", nocards); + return 0; +} Copied: head/usr.sbin/dumpcis/dumpcisfile.c (from r185031, head/usr.sbin/pccard/pccardc/dumpcisfile.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/dumpcis/dumpcisfile.c Mon Nov 17 22:19:19 2008 (r185032, copy of r185031, head/usr.sbin/pccard/pccardc/dumpcisfile.c) @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1995 Andrew McRae. 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. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "readcis.h" + +static void +scanfile(name) + char *name; +{ + int fd; + struct cis *cp; + + fd = open(name, O_RDONLY); + if (fd < 0) + return; + cp = readcis(fd); + if (cp) { + printf("Configuration data for file %s\n", + name); + dumpcis(cp); + freecis(cp); + } + close(fd); +} + +int +dumpcisfile_main(int argc, char **argv) +{ + + isdumpcisfile = 1; + for (argc--, argv++; argc; argc--, argv++) + scanfile(*argv); + return 0; +} Copied: head/usr.sbin/dumpcis/main.c (from r185031, head/usr.sbin/pccard/dumpcis/main.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/dumpcis/main.c Mon Nov 17 22:19:19 2008 (r185032, copy of r185031, head/usr.sbin/pccard/dumpcis/main.c) @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2006 M. Warner Losh. 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 ``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 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +int dumpcisfile_main(int, char **); + +int +main(int argc, char **argv) +{ + return dumpcisfile_main(argc, argv); +} Copied: head/usr.sbin/dumpcis/printcis.c (from r185031, head/usr.sbin/pccard/pccardc/printcis.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/dumpcis/printcis.c Mon Nov 17 22:19:19 2008 (r185032, copy of r185031, head/usr.sbin/pccard/pccardc/printcis.c) @@ -0,0 +1,1107 @@ +/* + * Copyright (c) 1995 Andrew McRae. 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. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ + +/* + * Code cleanup, bug-fix and extension + * by Tatsumi Hosokawa + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "readcis.h" + +static void dump_config_map(struct tuple *tp); +static void dump_cis_config(struct tuple *tp); +static void dump_other_cond(u_char *p, int len); +static void dump_device_desc(u_char *p, int len, char *type); +static void dump_info_v1(u_char *p, int len); +static void dump_longlink_mfc(u_char *p, int len); +static void dump_bar(u_char *p, int len); +static void dump_device_geo(u_char *p, int len); +static void dump_func_id(u_char *p); +static void dump_serial_ext(u_char *p, int len); +static void dump_disk_ext(u_char *p, int len); +static void dump_network_ext(u_char *p, int len); +static void dump_info_v2(u_char *p, int len); +static void dump_org(u_char *p, int len); + +void +dumpcis(struct cis *cp) +{ + struct tuple *tp; + struct tuple_list *tl; + int count = 0, sz, ad, i; + u_char *p; + int func = 0; + + for (tl = cp->tlist; tl; tl = tl->next) + for (tp = tl->tuples; tp; tp = tp->next) { + printf("Tuple #%d, code = 0x%x (%s), length = %d\n", + ++count, tp->code, tuple_name(tp->code), tp->length); + p = tp->data; + sz = tp->length; + ad = 0; + while (sz > 0) { + printf(" %03x: ", ad); + for (i = 0; i < ((sz < 16) ? sz : 16); i++) + printf(" %02x", p[i]); + printf("\n"); + sz -= 16; + p += 16; + ad += 16; + } + switch (tp->code) { + default: + break; + case CIS_MEM_COMMON: /* 0x01 */ + dump_device_desc(tp->data, tp->length, "Common"); + break; + case CIS_CONF_MAP_CB: /* 0x04 */ + dump_config_map(tp); + break; + case CIS_CONFIG_CB: /* 0x05 */ + dump_cis_config(tp); + break; + case CIS_LONGLINK_MFC: /* 0x06 */ + dump_longlink_mfc(tp->data, tp->length); + break; + case CIS_BAR: /* 0x07 */ + dump_bar(tp->data, tp->length); + break; + case CIS_CHECKSUM: /* 0x10 */ + printf("\tChecksum from offset %d, length %d, value is 0x%x\n", + tpl16(tp->data), + tpl16(tp->data + 2), + tp->data[4]); + break; + case CIS_LONGLINK_A: /* 0x11 */ + printf("\tLong link to attribute memory, address 0x%x\n", + tpl32(tp->data)); + break; + case CIS_LONGLINK_C: /* 0x12 */ + printf("\tLong link to common memory, address 0x%x\n", + tpl32(tp->data)); + break; + case CIS_INFO_V1: /* 0x15 */ + dump_info_v1(tp->data, tp->length); + break; + case CIS_ALTSTR: /* 0x16 */ + break; + case CIS_MEM_ATTR: /* 0x17 */ + dump_device_desc(tp->data, tp->length, "Attribute"); + break; + case CIS_JEDEC_C: /* 0x18 */ + case CIS_JEDEC_A: /* 0x19 */ + break; + case CIS_CONF_MAP: /* 0x1A */ + dump_config_map(tp); + break; + case CIS_CONFIG: /* 0x1B */ + dump_cis_config(tp); + break; + case CIS_DEVICE_OC: /* 0x1C */ + case CIS_DEVICE_OA: /* 0x1D */ + dump_other_cond(tp->data, tp->length); + break; + case CIS_DEVICEGEO: /* 0x1E */ + case CIS_DEVICEGEO_A: /* 0x1F */ + dump_device_geo(tp->data, tp->length); + break; + case CIS_MANUF_ID: /* 0x20 */ + printf("\tPCMCIA ID = 0x%x, OEM ID = 0x%x\n", + tpl16(tp->data), + tpl16(tp->data + 2)); + break; + case CIS_FUNC_ID: /* 0x21 */ + func = tp->data[0]; + dump_func_id(tp->data); + break; + case CIS_FUNC_EXT: /* 0x22 */ + switch (func) { + case 2: + dump_serial_ext(tp->data, tp->length); + break; + case 4: + dump_disk_ext(tp->data, tp->length); + break; + case 6: + dump_network_ext(tp->data, tp->length); + break; + } + break; + case CIS_VERS_2: /* 0x40 */ + dump_info_v2(tp->data, tp->length); + break; + case CIS_ORG: /* 0x46 */ + dump_org(tp->data, tp->length); + break; + } + } +} + +/* + * CIS_CONF_MAP : Dump configuration map tuple. + * CIS_CONF_MAP_CB: Dump configuration map for CardBus + */ +static void +dump_config_map(struct tuple *tp) +{ + u_char *p = tp->data, x; + int rlen, mlen = 0; + int i; + + rlen = (p[0] & 3) + 1; + if (tp->code == CIS_CONF_MAP) + mlen = ((p[0] >> 2) & 3) + 1; + if (tp->length < rlen + mlen + 2) { + printf("\tWrong length for configuration map tuple\n"); + return; + } + printf("\tReg len = %d, config register addr = 0x%x, last config = 0x%x\n", + rlen, parse_num(rlen | 0x10, p + 2, &p, 0), p[1]); + if (mlen) { + printf("\tRegisters: "); + for (i = 0; i < mlen; i++, p++) { + for (x = 0x1; x; x <<= 1) + printf("%c", x & *p ? 'X' : '-'); + putchar(' '); + } + } + i = tp->length - (rlen + mlen + 2); + if (i) { + if (!mlen) + putchar('\t'); + printf("%d bytes in subtuples", i); + } + if (mlen || i) + putchar('\n'); +} + +/* + * Dump power descriptor. + * call from dump_cis_config() + */ +static int +print_pwr_desc(u_char *p) +{ + int len = 1, i; + u_char mask; + char **expp; + static char *pname[] = + {"Nominal operating supply voltage", + "Minimum operating supply voltage", + "Maximum operating supply voltage", + "Continuous supply current", + "Max current average over 1 second", + "Max current average over 10 ms", + "Power down supply current", + "Reserved" + }; + static char *vexp[] = + {"10uV", "100uV", "1mV", "10mV", "100mV", "1V", "10V", "100V"}; + static char *cexp[] = + {"10nA", "1uA", "10uA", "100uA", "1mA", "10mA", "100mA", "1A"}; + static char *mant[] = + {"1", "1.2", "1.3", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", + "5", "5.5", "6", "7", "8", "9"}; + + mask = *p++; + expp = vexp; + for (i = 0; i < 8; i++) + if (mask & (1 << i)) { + len++; + if (i >= 3) + expp = cexp; + printf("\t\t%s: ", pname[i]); + printf("%s x %s", + mant[(*p >> 3) & 0xF], + expp[*p & 7]); + while (*p & 0x80) { + len++; + p++; + printf(", ext = 0x%x", *p); + } + printf("\n"); + p++; + } + return (len); +} + +/* + * print_ext_speed - Print extended speed. + * call from dump_cis_config(), dump_device_desc() + */ +static void +print_ext_speed(u_char x, int scale) +{ + static char *mant[] = + {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0", + "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0"}; + static char *exp[] = + {"1 ns", "10 ns", "100 ns", "1 us", "10 us", "100 us", + "1 ms", "10 ms"}; + static char *scale_name[] = + {"None", "10", "100", "1,000", "10,000", "100,000", + "1,000,000", "10,000,000"}; + + printf("Speed = %s x %s", mant[(x >> 3) & 0xF], exp[x & 7]); + if (scale) + printf(", scaled by %s", scale_name[scale & 7]); +} + +/* + * Print variable length value. + * call from print_io_map(), print_mem_map() + */ +static int +print_num(int sz, char *fmt, u_char *p, int ofs) +{ + switch (sz) { + case 0: + case 0x10: + return 0; + case 1: + case 0x11: + printf(fmt, *p + ofs); + return 1; + case 2: + case 0x12: + printf(fmt, tpl16(p) + ofs); + return 2; + case 0x13: + printf(fmt, tpl24(p) + ofs); + return 3; + case 3: + case 0x14: + printf(fmt, tpl32(p) + ofs); + return 4; + } + errx(1, "print_num(0x%x): Illegal arguments", sz); +/*NOTREACHED*/ +} + +/* + * Print I/O mapping sub-tuple. + * call from dump_cis_config() + */ +static u_char * +print_io_map(u_char *p, u_char *q) +{ + int i, j; + u_char c; + + if (q <= p) + goto err; + if (CIS_IO_ADDR(*p)) /* I/O address line */ + printf("\tCard decodes %d address lines", + CIS_IO_ADDR(*p)); + else + printf("\tCard provides address decode"); + + /* 8/16 bit I/O */ + switch (*p & (CIS_IO_8BIT | CIS_IO_16BIT)) { + case CIS_IO_8BIT: + printf(", 8 Bit I/O only"); + break; + case CIS_IO_16BIT: + printf(", limited 8/16 Bit I/O"); + break; + case (CIS_IO_8BIT | CIS_IO_16BIT): + printf(", full 8/16 Bit I/O"); + break; + } + putchar('\n'); + + /* I/O block sub-tuple exist */ + if (*p++ & CIS_IO_RANGE) { + if (q <= p) + goto err; + c = *p++; + /* calculate byte length */ + j = CIS_IO_ADSZ(c) + CIS_IO_BLKSZ(c); + if (CIS_IO_ADSZ(c) == 3) + j++; + if (CIS_IO_BLKSZ(c) == 3) + j++; + /* number of I/O block sub-tuples */ + for (i = 0; i <= CIS_IO_BLKS(c); i++) { + if (q - p < j) + goto err; + printf("\t\tI/O address # %d: ", i + 1); + /* start block address */ + p += print_num(CIS_IO_ADSZ(c), + "block start = 0x%x", p, 0); + /* block size */ + p += print_num(CIS_IO_BLKSZ(c), + " block length = 0x%x", p, 1); + putchar('\n'); + } + } + return p; + + err: /* warning */ + printf("\tWrong length for I/O mapping sub-tuple\n"); + return p; +} + +/* + * Print IRQ sub-tuple. + * call from dump_cis_config() + */ +static u_char * +print_irq_map(u_char *p, u_char *q) +{ + int i, j; + u_char c; + + if (q <= p) + goto err; + printf("\t\tIRQ modes:"); + c = ' '; + if (*p & CIS_IRQ_LEVEL) { /* Level triggered interrupts */ + printf(" Level"); + c = ','; + } + if (*p & CIS_IRQ_PULSE) { /* Pulse triggered requests */ + printf("%c Pulse", c); + c = ','; + } + if (*p & CIS_IRQ_SHARING) /* Interrupt sharing */ + printf("%c Shared", c); + putchar('\n'); + + /* IRQ mask values exist */ + if (*p & CIS_IRQ_MASK) { + if (q - p < 3) + goto err; + i = tpl16(p + 1); /* IRQ mask */ + printf("\t\tIRQs: "); + if (*p & 1) + printf(" NMI"); + if (*p & 0x2) + printf(" IOCK"); + if (*p & 0x4) + printf(" BERR"); + if (*p & 0x8) + printf(" VEND"); + for (j = 0; j < 16; j++) + if (i & (1 << j)) + printf(" %d", j); + putchar('\n'); + p += 3; + } else { + printf("\t\tIRQ level = %d\n", CIS_IRQ_IRQN(*p)); + p++; + } + return p; + + err: /* warning */ + printf("\tWrong length for IRQ sub-tuple\n"); + return p; +} + +/* + * Print memory map sub-tuple. + * call from dump_cis_config() + */ +static u_char * +print_mem_map(u_char feat, u_char *p, u_char *q) +{ + int i, j; + u_char c; + + switch (CIS_FEAT_MEMORY(feat)) { + + case CIS_FEAT_MEM_NONE: /* No memory block */ + break; + case CIS_FEAT_MEM_LEN: /* Specify memory length */ + if (q - p < 2) + goto err; + printf("\tMemory space length = 0x%x\n", tpl16(p)); + p += 2; + break; + case CIS_FEAT_MEM_ADDR: /* Memory address and length */ + if (q - p < 4) + goto err; + printf("\tMemory space address = 0x%x, length = 0x%x\n", + tpl16(p + 2), tpl16(p)); + p += 4; + break; + case CIS_FEAT_MEM_WIN: /* Memory descriptors. */ + if (q <= p) + goto err; + c = *p++; + /* calculate byte length */ + j = CIS_MEM_LENSZ(c) + CIS_MEM_ADDRSZ(c); + if (c & CIS_MEM_HOST) + j += CIS_MEM_ADDRSZ(c); + /* number of memory block */ + for (i = 0; i < CIS_MEM_WINS(c); i++) { + if (q - p < j) + goto err; + printf("\tMemory descriptor %d\n\t\t", i + 1); + /* memory length */ + p += print_num(CIS_MEM_LENSZ(c) | 0x10, + " blk length = 0x%x00", p, 0); + /* card address */ + p += print_num(CIS_MEM_ADDRSZ(c) | 0x10, + " card addr = 0x%x00", p, 0); + if (c & CIS_MEM_HOST) /* Host address value exist */ + p += print_num(CIS_MEM_ADDRSZ(c) | 0x10, + " host addr = 0x%x00", p, 0); + putchar('\n'); + } + break; + } + return p; + + err: /* warning */ + printf("\tWrong length for memory mapping sub-tuple\n"); + return p; +} + +/* + * CIS_CONFIG : Dump a config entry. + * CIS_CONFIG_CB: Dump a configuration entry for CardBus + */ +static void +dump_cis_config(struct tuple *tp) +{ + u_char *p, *q, feat; + int i, j; + char c; + + p = tp->data; + q = p + tp->length; + printf("\tConfig index = 0x%x%s\n", *p & 0x3F, + *p & 0x40 ? "(default)" : ""); + + /* Interface byte exists */ + if (tp->code == CIS_CONFIG && (*p & 0x80)) { + p++; + printf("\tInterface byte = 0x%x ", *p); + switch (*p & 0xF) { /* Interface type */ + default: + printf("(reserved)"); + break; + case 0: + printf("(memory)"); + break; + case 1: + printf("(I/O)"); + break; + case 4: + case 5: + case 6: + case 7: + case 8: + printf("(custom)"); + break; + } + c = ' '; + if (*p & 0x10) { /* Battery voltage detect */ + printf(" BVD1/2 active"); + c = ','; + } + if (*p & 0x20) { /* Write protect active */ + printf("%c card WP active", c); /* Write protect */ + c = ','; + } + if (*p & 0x40) { /* RdyBsy active bit */ + printf("%c +RDY/-BSY active", c); + c = ','; + } + if (*p & 0x80) /* Wait signal required */ + printf("%c wait signal supported", c); + printf("\n"); + } + + /* features byte */ + p++; + feat = *p++; + + /* Power structure sub-tuple */ + switch (CIS_FEAT_POWER(feat)) { /* Power sub-tuple(s) exists */ + case 0: + break; + case 1: + printf("\tVcc pwr:\n"); + p += print_pwr_desc(p); + break; + case 2: + printf("\tVcc pwr:\n"); + p += print_pwr_desc(p); + printf("\tVpp pwr:\n"); + p += print_pwr_desc(p); + break; + case 3: + printf("\tVcc pwr:\n"); + p += print_pwr_desc(p); + printf("\tVpp1 pwr:\n"); + p += print_pwr_desc(p); + printf("\tVpp2 pwr:\n"); + p += print_pwr_desc(p); + break; + } + + /* Timing sub-tuple */ + if (tp->code == CIS_CONFIG && + (feat & CIS_FEAT_TIMING)) { /* Timing sub-tuple exists */ + i = *p++; + j = CIS_WAIT_SCALE(i); + if (j != 3) { + printf("\tWait scale "); + print_ext_speed(*p++, j); + printf("\n"); + } + j = CIS_READY_SCALE(i); + if (j != 7) { + printf("\tRDY/BSY scale "); + print_ext_speed(*p++, j); + printf("\n"); + } + j = CIS_RESERVED_SCALE(i); + if (j != 7) { + printf("\tExternal scale "); + print_ext_speed(*p++, j); + printf("\n"); + } + } + + /* I/O mapping sub-tuple */ + if (feat & CIS_FEAT_I_O) { /* I/O space sub-tuple exists */ + if (tp->code == CIS_CONFIG) + p = print_io_map(p, q); + else { /* CIS_CONFIG_CB */ + printf("\tI/O base:"); + for (i = 0; i < 8; i++) + if (*p & (1 << i)) + printf(" %d", i); + putchar('\n'); + p++; + } + } + + /* IRQ descriptor sub-tuple */ + if (feat & CIS_FEAT_IRQ) /* IRQ sub-tuple exists */ + p = print_irq_map(p, q); + + /* Memory map sub-tuple */ + if (CIS_FEAT_MEMORY(feat)) { /* Memory space sub-tuple(s) exists */ + if (tp->code == CIS_CONFIG) + p = print_mem_map(feat, p, q); + else { /* CIS_CONFIG_CB */ + printf("\tMemory base:"); + for (i = 0; i < 8; i++) + if (*p & (1 << i)) + printf(" %d", i); + putchar('\n'); + p++; + } + } + + /* Misc sub-tuple */ + if (feat & CIS_FEAT_MISC) { /* Miscellaneous sub-tuple exists */ + if (tp->code == CIS_CONFIG) { + printf("\tMax twin cards = %d\n", *p & 7); + printf("\tMisc attr:%s%s%s", + (*p & 8) ? " (Audio-BVD2)" : "", + (*p & 0x10) ? " (Read-only)" : "", + (*p & 0x20) ? " (Power down supported)" : ""); + if (*p++ & 0x80) { + printf(" (Ext byte = 0x%x)", *p); + p++; + } + putchar('\n'); + } + else { /* CIS_CONFIG_CB */ + printf("\tMisc attr:"); + printf("%s%s%s%s%s%s%s", + (*p & 1) ? " (Master)" : "", + (*p & 2) ? " (Invalidate)" : "", + (*p & 4) ? " (VGA palette)" : "", + (*p & 8) ? " (Parity)" : "", + (*p & 0x10) ? " (Wait)" : "", + (*p & 0x20) ? " (Serr)" : "", + (*p & 0x40) ? " (Fast back)" : ""); + if (*p++ & 0x80) { + printf("%s%s", + (*p & 1) ? " (Binary audio)" : "", + (*p & 2) ? " (pwm audio)" : ""); + p++; + } + putchar('\n'); + } + } +} + +/* + * CIS_DEVICE_OC, CIS_DEVICE_OA: + * Dump other conditions for common/attribute memory + */ +static void +dump_other_cond(u_char *p, int len) +{ + if (p[0] && len > 0) { + printf("\t"); + if (p[0] & 1) + printf("(MWAIT)"); + if (p[0] & 2) + printf(" (3V card)"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 22:40:56 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 115D710656A8; Mon, 17 Nov 2008 22:40:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 230ED8FC24; Mon, 17 Nov 2008 22:40:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L2Cm4-000DGJ-PY; Tue, 18 Nov 2008 00:40:52 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAHMemOc030091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Nov 2008 00:40:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAHMem6V036792; Tue, 18 Nov 2008 00:40:48 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAHMeml4036791; Tue, 18 Nov 2008 00:40:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 18 Nov 2008 00:40:48 +0200 From: Kostik Belousov To: Peter Wemm Message-ID: <20081117224048.GN90129@deviant.kiev.zoral.com.ua> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> <200811171613.36602.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rFUhhEVnhEf/dYhU" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L2Cm4-000DGJ-PY 809f250e62032c2a47f2e34f768426bb X-Terabit: YES Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , John Baldwin , svn-src-all@freebsd.org, dchagin@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 22:40:56 -0000 --rFUhhEVnhEf/dYhU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 17, 2008 at 01:21:53PM -0800, Peter Wemm wrote: > On Mon, Nov 17, 2008 at 1:13 PM, John Baldwin wrote: > > On Monday 17 November 2008 02:35:41 pm Kostik Belousov wrote: > >> On Mon, Nov 17, 2008 at 12:11:41PM -0500, John Baldwin wrote: > >> > On Sunday 16 November 2008 09:37:45 pm Doug Ambrisko wrote: > >> > > Kostik Belousov writes: > >> > > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > >> > > | > Author: ambrisko > >> > > | > Date: Fri Nov 14 21:05:45 2008 > >> > > | > New Revision: 184974 > >> > > | > URL: http://svn.freebsd.org/changeset/base/184974 > >> > > | > > >> > > | > Log: > >> > > | > When running a 32bit app. on amd64, ensure the bits above 32= bit > >> > > | > are zero for the copyout. Confirmed by LSI. > >> > > | > > >> > > | > Modified: > >> > > | > head/sys/dev/mfi/mfi.c > >> > > | > > >> > > | > Modified: head/sys/dev/mfi/mfi.c > >> > > | > > >> > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >> > > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 = (r184973) > >> > > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 = (r184974) > >> > > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > >> > > | > ->mfi_frame.raw[ioc->mfi_sense_off], > >> > > | > &sense_ptr.sense_ptr_data[0], > >> > > | > sizeof(sense_ptr.sense_ptr_data)); > >> > > | > +#ifdef __amd64__ > >> > > | > + if (cmd !=3D MFI_CMD) { > >> > > | > + /* > >> > > | > + * not 64bit native so zero out = any address > >> > > | > + * over 32bit */ > >> > > | > + sense_ptr.high =3D 0; > >> > > | > + } > >> > > | > +#endif > >> > > | > error =3D copyout(cm->cm_sense, sense_pt= r.user_space, > >> > > | > ioc->mfi_sense_len); > >> > > | > if (error !=3D 0) { > >> > > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > >> > > | > ->lioc_frame.raw[l_ioc.lioc_sense= _off], > >> > > | > &sense_ptr.sense_ptr_data[0], > >> > > | > sizeof(sense_ptr.sense_ptr_data)); > >> > > | > +#ifdef __amd64__ > >> > > | > + /* > >> > > | > + * only 32bit Linux support so zero out = any > >> > > | > + * address over 32bit > >> > > | > + */ > >> > > | > + sense_ptr.high =3D 0; > >> > > | > +#endif > >> > > | > error =3D copyout(cm->cm_sense, sense_pt= r.user_space, > >> > > | > l_ioc.lioc_sense_len); > >> > > | > if (error !=3D 0) { > >> > > | > >> > > | Would it make sense to perform this cut slightly more genericall= y, by > >> > > | checking whether the current process is 32bit ? > >> > > | > >> > > | We still have not grew the easy to check flag or attribute of the > > image, > >> > > | but usual practice is to compare p_sysent with corresponding sys= vec, > >> > > | like > >> > > | if (td->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) > >> > > | or > >> > > | if (td->td_proc->p_sysent =3D=3D &elf_linux_sysvec) > >> > > > >> > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > >> > > value is different. I put in that comment for Linux since there > >> > > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > >> > > support we need a 64bit structure defined. When the ioctl can't > >> > > be figured out then I've used the p_sysent. Eventually, something > >> > > that is more generic then the #ifdef __amd64__ should be done > >> > > in all the drivers that do this emulation. > >> > > >> > I prefer depending on things like ioctl values and the 32-bit sysctl= flag > > when > >> > possible. If we do have to directly check for the ABI, I'd much rat= her > > have > >> > a flags field in sysent rather than trying to compare against global > > symbols, > >> > as you can't compare against a global symbol unless it is present in= the > >> > kernel. Something like: > >> > > >> > if (td->td_proc->p_sysent->sy_flags & SY_32) > >> > > >> > or some such. I've wanted to have a COMPAT_FREEBSD32 that gets > > auto-enabled > >> > when you turn on COMPAT_IA32 on amd64 and ia64. It would also poten= tially > > be > >> > enabled by a COMPAT_SPARC8 or some such on sparc64 if we ever had th= at. > >> > >> Ok, what about the following. I only compiled it on i386/amd64. And, > >> there are more places to convert to such checks, for sure. > >> > >> [yummy patch] > > > > Commit! Note that this is not MFC'able due to ABI breakage for older l= inux.ko > > modules, but this is the proper solution for 8.0+. I do not think that sysent KBI shall be preserved on the stable branch, it is too core functionality. Our KBI guarantee mostly center around drivers and less so for filesystem modules. linux or any other ABI emulator probably do not deserve KBI stability guarantee, IMHO. Anyway, I do not insist. > > > > -- > > John Baldwin > > >=20 >=20 > I was thinking of suggesting a macro to replace the verbose test if > curproc->td_proc->p_sysent->sv_flags, but I couldn't think of > something off the top of my head. >=20 > - if (curthread->td_proc->p_sysent =3D=3D > &ia32_freebsd_sysvec) { > + if (curthread->td_proc->p_sysent->sv_flags & SV_I= LP32) { >=20 > if (SV_FLAGS(curthread) & SV_ILP32) ... or the like. I'm not set on > this, it just seemed like it might be worth mentioning. >=20 > Also, change curthread->td_proc with curproc, for what its worth. Did it. I discussed the change with Dmitry Chagin, and he wants explicit mark of the image ABI, for linux64/amd64 work. diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index ec1afc7..4f6d178 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -72,7 +72,8 @@ struct sysentvec elf64_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_LP64 }; =20 static Elf64_Brandinfo freebsd_brand_info =3D { diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32= _sysvec.c index e233700..3acee30 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -1026,6 +1026,7 @@ struct sysentvec elf_linux_sysvec =3D { .sv_setregs =3D exec_linux_setregs, .sv_fixlimit =3D linux32_fixlimit, .sv_maxssiz =3D &linux32_maxssiz, + .sv_flags =3D SV_ABI_LINUX | SV_ILP32 | SV_IA32 }; =20 static Elf32_Brandinfo linux_brand =3D { diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index f44a622..693eab1 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index ef74ba0..0b32b9a 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -135,7 +135,8 @@ struct sysentvec ia32_freebsd_sysvec =3D { .sv_copyout_strings =3D ia32_copyout_strings, .sv_setregs =3D ia32_setregs, .sv_fixlimit =3D ia32_fixlimit, - .sv_maxssiz =3D &ia32_maxssiz + .sv_maxssiz =3D &ia32_maxssiz, + .sv_flags =3D SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 }; =20 =20 diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c index 60cca7b..63e8e54 100644 --- a/sys/compat/svr4/svr4_sysvec.c +++ b/sys/compat/svr4/svr4_sysvec.c @@ -190,7 +190,8 @@ struct sysentvec svr4_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_UNDEF | SV_IA32 | SV_ILP32 }; =20 const char svr4_emul_path[] =3D "/compat/svr4"; diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index 93f1d45..19eddd0 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/i386/ibcs2/ibcs2_sysvec.c b/sys/i386/ibcs2/ibcs2_sysvec.c index 2c834dd..9112ed7 100644 --- a/sys/i386/ibcs2/ibcs2_sysvec.c +++ b/sys/i386/ibcs2/ibcs2_sysvec.c @@ -85,7 +85,8 @@ struct sysentvec ibcs2_svr3_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_UNDEF | SV_IA32 | SV_ILP32 }; =20 static int diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index a3acfc9..7444901 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -837,7 +837,8 @@ struct sysentvec linux_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_linux_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32 }; =20 struct sysentvec elf_linux_sysvec =3D { @@ -867,7 +868,8 @@ struct sysentvec elf_linux_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_linux_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_LINUX | SV_IA32 | SV_ILP32 }; =20 static Elf32_Brandinfo linux_brand =3D { diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c index 94f4cdc..a3a6e57 100644 --- a/sys/ia64/ia64/elf_machdep.c +++ b/sys/ia64/ia64/elf_machdep.c @@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_LP64 }; =20 static Elf64_Brandinfo freebsd_brand_info =3D { diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index f4e4614..6c2f627 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -82,7 +82,13 @@ struct sysentvec aout_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_AOUT | +#if defined(__i386__) + SV_IA32 | SV_ILP32 +#else +#error Choose SV_XXX flags for the platform +#endif }; =20 static int diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index dade1c2..3802259 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -57,14 +57,12 @@ __FBSDID("$FreeBSD$"); =20 #ifdef COMPAT_IA32 =20 -extern struct sysentvec ia32_freebsd_sysvec; - static inline int suword_lwpid(void *addr, lwpid_t lwpid) { int error; =20 - if (curproc->p_sysent !=3D &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_LP64)) error =3D suword(addr, lwpid); else error =3D suword32(addr, lwpid); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index eb587fb..9a7237d 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -136,9 +136,8 @@ __FBSDID("$FreeBSD$"); =20 #ifdef COMPAT_IA32 #include +#include #include - -extern struct sysentvec ia32_freebsd_sysvec; #endif =20 static int soreceive_rcvoob(struct socket *so, struct uio *uio, @@ -2277,7 +2276,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) case SO_SNDTIMEO: case SO_RCVTIMEO: #ifdef COMPAT_IA32 - if (curthread->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { struct timeval32 tv32; =20 error =3D sooptcopyin(sopt, &tv32, sizeof tv32, @@ -2458,7 +2457,7 @@ integer: tv.tv_sec =3D optval / hz; tv.tv_usec =3D (optval % hz) * tick; #ifdef COMPAT_IA32 - if (curthread->td_proc->p_sysent =3D=3D &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { struct timeval32 tv32; =20 CP(tv, tv32, tv_sec); diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c index 0234722..dc08bc2 100644 --- a/sys/mips/mips/elf_machdep.c +++ b/sys/mips/mips/elf_machdep.c @@ -74,7 +74,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/powerpc/powerpc/elf_machdep.c b/sys/powerpc/powerpc/elf_ma= chdep.c index dadf3ca..69ac55b 100644 --- a/sys/powerpc/powerpc/elf_machdep.c +++ b/sys/powerpc/powerpc/elf_machdep.c @@ -75,7 +75,8 @@ struct sysentvec elf32_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_ILP32 }; =20 static Elf32_Brandinfo freebsd_brand_info =3D { diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_ma= chdep.c index d1e610a..a956c5c 100644 --- a/sys/sparc64/sparc64/elf_machdep.c +++ b/sys/sparc64/sparc64/elf_machdep.c @@ -87,7 +87,8 @@ static struct sysentvec elf64_freebsd_sysvec =3D { .sv_copyout_strings =3D exec_copyout_strings, .sv_setregs =3D exec_setregs, .sv_fixlimit =3D NULL, - .sv_maxssiz =3D NULL + .sv_maxssiz =3D NULL, + .sv_flags =3D SV_ABI_FREEBSD | SV_LP64 }; =20 static Elf64_Brandinfo freebsd_brand_info =3D { diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 0ec07a7..c068946 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -100,8 +100,22 @@ struct sysentvec { void (*sv_setregs)(struct thread *, u_long, u_long, u_long); void (*sv_fixlimit)(struct rlimit *, int); u_long *sv_maxssiz; + u_int sv_flags; }; =20 +#define SV_ILP32 0x000100 +#define SV_LP64 0x000200 +#define SV_IA32 0x004000 +#define SV_AOUT 0x008000 + +#define SV_ABI_MASK 0xff +#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x)) +#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK) +/* same as ELFOSABI_XXX, to prevent header pollution */ +#define SV_ABI_LINUX 3 +#define SV_ABI_FREEBSD 9 +#define SV_ABI_UNDEF 255 + #ifdef _KERNEL extern struct sysentvec aout_sysvec; extern struct sysentvec elf_freebsd_sysvec; --rFUhhEVnhEf/dYhU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkh8u8ACgkQC3+MBN1Mb4iMDQCgudEVnKVU+JYHmOXCbQPwdHOK QikAniwxGFAfMbmQjf5iKkVsAfOabta/ =8iLC -----END PGP SIGNATURE----- --rFUhhEVnhEf/dYhU-- From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 22:46:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BD441065670; Mon, 17 Nov 2008 22:46:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 558BE8FC08; Mon, 17 Nov 2008 22:46:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHMkUF2060073; Mon, 17 Nov 2008 22:46:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHMkTHm060067; Mon, 17 Nov 2008 22:46:29 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811172246.mAHMkTHm060067@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Nov 2008 22:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185033 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 22:46:30 -0000 Author: imp Date: Mon Nov 17 22:46:29 2008 New Revision: 185033 URL: http://svn.freebsd.org/changeset/base/185033 Log: make this warns=5 clean Modified: head/usr.sbin/dumpcis/Makefile head/usr.sbin/dumpcis/dumpcis.c head/usr.sbin/dumpcis/dumpcisfile.c head/usr.sbin/dumpcis/printcis.c head/usr.sbin/dumpcis/readcis.c head/usr.sbin/dumpcis/readcis.h Modified: head/usr.sbin/dumpcis/Makefile ============================================================================== --- head/usr.sbin/dumpcis/Makefile Mon Nov 17 22:19:19 2008 (r185032) +++ head/usr.sbin/dumpcis/Makefile Mon Nov 17 22:46:29 2008 (r185033) @@ -5,5 +5,6 @@ PROG= dumpcis MAN= dumpcis.8 SRCS= main.c dumpcis.c dumpcisfile.c readcis.c printcis.c +WARNS?= 5 .include Modified: head/usr.sbin/dumpcis/dumpcis.c ============================================================================== --- head/usr.sbin/dumpcis/dumpcis.c Mon Nov 17 22:19:19 2008 (r185032) +++ head/usr.sbin/dumpcis/dumpcis.c Mon Nov 17 22:46:29 2008 (r185033) @@ -41,34 +41,6 @@ static const char rcsid[] = #include #include "readcis.h" -int nocards; - -static void -scan(int slot) -{ - int fd; - char name[64]; - struct cis *cp; - struct slotstate st; - - sprintf(name, CARD_DEVICE, slot); - fd = open(name, O_RDONLY); - if (fd < 0) - return; - nocards++; - if (ioctl(fd, PIOCGSTATE, &st)) - err(1, "ioctl (PIOCGSTATE)"); - if (st.state == filled) { - cp = readcis(fd); - if (cp) { - printf("Configuration data for card in slot %d\n", - slot); - dumpcis(cp); - freecis(cp); - } - } -} - void dump(unsigned char *p, int sz) { @@ -84,28 +56,3 @@ dump(unsigned char *p, int sz) ad += 16; } } - -void * -xmalloc(int sz) -{ - void *p; - - sz = (sz + 7) & ~7; - p = malloc(sz); - if (p) - bzero(p, sz); - else - errx(1, "malloc"); - return (p); -} - -int -dumpcis_main(int argc, char **argv) -{ - int node; - - for (node = 0; node < 8; node++) - scan(node); - printf("%d slots found\n", nocards); - return 0; -} Modified: head/usr.sbin/dumpcis/dumpcisfile.c ============================================================================== --- head/usr.sbin/dumpcis/dumpcisfile.c Mon Nov 17 22:19:19 2008 (r185032) +++ head/usr.sbin/dumpcis/dumpcisfile.c Mon Nov 17 22:46:29 2008 (r185033) @@ -42,8 +42,7 @@ static const char rcsid[] = #include "readcis.h" static void -scanfile(name) - char *name; +scanfile(char *name) { int fd; struct cis *cp; Modified: head/usr.sbin/dumpcis/printcis.c ============================================================================== --- head/usr.sbin/dumpcis/printcis.c Mon Nov 17 22:19:19 2008 (r185032) +++ head/usr.sbin/dumpcis/printcis.c Mon Nov 17 22:46:29 2008 (r185033) @@ -49,7 +49,7 @@ static const char rcsid[] = static void dump_config_map(struct tuple *tp); static void dump_cis_config(struct tuple *tp); static void dump_other_cond(u_char *p, int len); -static void dump_device_desc(u_char *p, int len, char *type); +static void dump_device_desc(u_char *p, int len, const char *type); static void dump_info_v1(u_char *p, int len); static void dump_longlink_mfc(u_char *p, int len); static void dump_bar(u_char *p, int len); @@ -222,8 +222,8 @@ print_pwr_desc(u_char *p) { int len = 1, i; u_char mask; - char **expp; - static char *pname[] = + const char **expp; + static const char *pname[] = {"Nominal operating supply voltage", "Minimum operating supply voltage", "Maximum operating supply voltage", @@ -233,11 +233,11 @@ print_pwr_desc(u_char *p) "Power down supply current", "Reserved" }; - static char *vexp[] = + static const char *vexp[] = {"10uV", "100uV", "1mV", "10mV", "100mV", "1V", "10V", "100V"}; - static char *cexp[] = + static const char *cexp[] = {"10nA", "1uA", "10uA", "100uA", "1mA", "10mA", "100mA", "1A"}; - static char *mant[] = + static const char *mant[] = {"1", "1.2", "1.3", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6", "7", "8", "9"}; @@ -270,13 +270,13 @@ print_pwr_desc(u_char *p) static void print_ext_speed(u_char x, int scale) { - static char *mant[] = + static const char *mant[] = {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0"}; - static char *exp[] = + static const char *exp[] = {"1 ns", "10 ns", "100 ns", "1 us", "10 us", "100 us", "1 ms", "10 ms"}; - static char *scale_name[] = + static const char *scale_name[] = {"None", "10", "100", "1,000", "10,000", "100,000", "1,000,000", "10,000,000"}; @@ -290,7 +290,7 @@ print_ext_speed(u_char x, int scale) * call from print_io_map(), print_mem_map() */ static int -print_num(int sz, char *fmt, u_char *p, int ofs) +print_num(int sz, const char *fmt, u_char *p, int ofs) { switch (sz) { case 0: @@ -695,14 +695,14 @@ dump_other_cond(u_char *p, int len) * Common / Attribute memory descripter */ static void -dump_device_desc(u_char *p, int len, char *type) +dump_device_desc(u_char *p, int len, const char *type) { - static char *un_name[] = + static const char *un_name[] = {"512b", "2Kb", "8Kb", "32Kb", "128Kb", "512Kb", "2Mb", "reserved"}; - static char *speed[] = + static const char *speed[] = {"No speed", "250nS", "200nS", "150nS", "100nS", "Reserved", "Reserved"}; - static char *dev[] = + static const char *dev[] = {"No device", "Mask ROM", "OTPROM", "UV EPROM", "EEPROM", "FLASH EEPROM", "SRAM", "DRAM", "Reserved", "Reserved", "Reserved", "Reserved", @@ -778,7 +778,7 @@ dump_info_v1(u_char *p, int len) static void dump_func_id(u_char *p) { - static char *id[] = { + static const char *id[] = { "Multifunction card", "Memory card", "Serial port/modem", @@ -804,7 +804,7 @@ dump_func_id(u_char *p) static void dump_serial_ext(u_char *p, int len) { - static char *type[] = { + static const char *type[] = { "", "Modem", "Data", "Fax", "Voice", "Data modem", "Fax/modem", "Voice", " (Data)", " (Fax)", " (Voice)" }; @@ -821,7 +821,7 @@ dump_serial_ext(u_char *p, int len) goto err; switch (p[1] & 0x1F) { default: - printf("\t\tUnkn device"); + printf("\t\tUnknown device"); break; case 0: printf("\t\t8250 UART"); Modified: head/usr.sbin/dumpcis/readcis.c ============================================================================== --- head/usr.sbin/dumpcis/readcis.c Mon Nov 17 22:19:19 2008 (r185032) +++ head/usr.sbin/dumpcis/readcis.c Mon Nov 17 22:46:29 2008 (r185033) @@ -46,12 +46,6 @@ static const char rcsid[] = #include "readcis.h" -#ifdef RATOCLAN -static int rex5588 = 0; -#endif -int isdumpcisfile = 0; - -static int read_attr(int, char *, int); static int ck_linktarget(int, off_t, int); static void cis_info(struct cis *, unsigned char *, int); static void device_desc(unsigned char *, int, struct dev_mem *); @@ -105,6 +99,21 @@ static struct tuple_info tuple_info[] = {0, 0, 0} }; + +static void * +xmalloc(int sz) +{ + void *p; + + sz = (sz + 7) & ~7; + p = malloc(sz); + if (p) + bzero(p, sz); + else + errx(1, "malloc"); + return (p); +} + /* * After reading the tuples, decode the relevant ones. */ @@ -261,14 +270,14 @@ cis_manuf_id(struct cis *cp, unsigned ch * Fills in CIS function ID. */ static void -cis_func_id(struct cis *cp, unsigned char *p, int len) +cis_func_id(struct cis *cp, unsigned char *p, int len __unused) { cp->func_id1 = *p++; cp->func_id2 = *p++; } static void -cis_network_ext(struct cis *cp, unsigned char *p, int len) +cis_network_ext(struct cis *cp, unsigned char *p, int len __unused) { int i; @@ -288,68 +297,6 @@ cis_network_ext(struct cis *cp, unsigned } /* - * "FUJITSU LAN Card (FMV-J182)" has broken CIS - */ -static int -fmvj182_check(unsigned char *p) -{ - char manuf[BUFSIZ], vers[BUFSIZ]; - - p++; /* major version */ - p++; /* minor version */ - strncpy(manuf, p, sizeof(manuf) - 1); - while (*p++); - strncpy(vers, p, sizeof(vers) - 1); - if (!strcmp(manuf, "FUJITSU") && !strcmp(vers, "LAN Card(FMV-J182)")) - return 1; - else - return 0; -} - -#ifdef RATOCLAN -/* - * "RATOC LAN Card (REX-5588)" has broken CIS - */ -static int -rex5588_check(unsigned char *p) -{ - char manuf[BUFSIZ], vers[BUFSIZ]; - - p++; /* major version */ - p++; /* minor version */ - strncpy(manuf, p, sizeof(manuf) - 1); - while (*p++); - strncpy(vers, p, sizeof(manuf) - 1); - if (!strcmp(manuf, "PCMCIA LAN MBH10304 ES")) - return 1; - else - return 0; -} -#endif - -#ifdef HSSYNTH -/* - * Broken CIS for "HITACHI MICROCOMPUTER SYSTEM LTD." "MSSHVPC02" - */ -static int -hss_check(unsigned char *p) -{ - char manuf[BUFSIZ], vers[BUFSIZ]; - - p++; /* major version */ - p++; /* minor version */ - strncpy(manuf, p, sizeof(manuf) - 1); - while (*p++); - strncpy(vers, p, sizeof(vers) - 1); - if (!strcmp(manuf, "HITACHI MICROCOMPUTER SYSTEMS LTD.") - && !strcmp(vers, "MSSHVPC02")) - return 1; - else - return 0; -} -#endif /* HSSYNTH */ - -/* * device_desc - decode device descriptor. */ static void @@ -374,7 +321,7 @@ device_desc(unsigned char *p, int len, s * configuration map of card control register. */ static void -config_map(struct cis *cp, unsigned char *p, int len) +config_map(struct cis *cp, unsigned char *p, int len __unused) { unsigned char *p1; int rlen = (*p & 3) + 1; @@ -425,7 +372,7 @@ parse_num(int sz, u_char *p, u_char **q, * CIS config entry - Decode and build configuration entry. */ static void -cis_config(struct cis *cp, unsigned char *p, int len) +cis_config(struct cis *cp, unsigned char *p, int len __unused) { int x; int i, j; @@ -440,10 +387,6 @@ cis_config(struct cis *cp, unsigned char } else cp->conf = conf; conf->id = *p & 0x3F; /* Config index */ -#ifdef RATOCLAN - if (rex5588 && conf->id >= 0x08 && conf->id <= 0x1d) - conf->id |= 0x20; -#endif if (*p & 0x40) /* Default flag */ cp->def_config = conf; if (*p++ & 0x80) @@ -638,7 +581,7 @@ read_one_tuplelist(int fd, int flags, of ioctl(fd, PIOCRWFLAG, &flags); lseek(fd, offs, SEEK_SET); do { - if (read_attr(fd, &code, 1) != 1) { + if (read(fd, &code, 1) != 1) { warn("CIS code read"); break; } @@ -650,7 +593,7 @@ read_one_tuplelist(int fd, int flags, of if (code == CIS_END) length = 0; else { - if (read_attr(fd, &length, 1) != 1) { + if (read(fd, &length, 1) != 1) { warn("CIS len read"); break; } @@ -669,7 +612,7 @@ read_one_tuplelist(int fd, int flags, of if (length != 0) { total += length; tp->data = xmalloc(length); - if (read_attr(fd, tp->data, length) != length) { + if (read(fd, tp->data, length) != length) { warn("CIS read"); break; } @@ -680,18 +623,6 @@ read_one_tuplelist(int fd, int flags, of * or the length is illegal. */ tinfo = get_tuple_info(code); - if (code == CIS_INFO_V1) { - /* Hack for broken CIS of FMV-J182 Ethernet card */ - fmvj182 = fmvj182_check(tp->data); -#ifdef RATOCLAN - /* Hack for RATOC LAN card */ - rex5588 = rex5588_check(tp->data); -#endif /* RATOCLAN */ -#ifdef HSSYNTH - /* Hack for Hitachi Speech Synthesis card */ - hss = hss_check(tp->data); -#endif /* HSSYNTH */ - } if (tinfo != NULL && (tinfo->length != 255 && tinfo->length > length)) { printf("code %s ignored\n", tuple_name(code)); tp->code = CIS_NULL; @@ -715,7 +646,7 @@ ck_linktarget(int fd, off_t offs, int fl ioctl(fd, PIOCRWFLAG, &flag); lseek(fd, offs, SEEK_SET); - if (read_attr(fd, blk, 5) != 5) + if (read(fd, blk, 5) != 5) return (0); if (blk[0] == 0x13 && blk[1] == 0x3 && @@ -741,29 +672,6 @@ find_tuple_in_list(struct tuple_list *tl return (tp); } -static int -read_attr(int fd, char *bp, int len) -{ - char blk[1024], *p = blk; - int i, l; - - if (isdumpcisfile) - return (read(fd, bp, len)); - if (len > sizeof(blk) / 2) - len = sizeof(blk) / 2; - l = i = read(fd, blk, len * 2); - if (i <= 0) { - printf("Read return %d bytes (expected %d)\n", i, len * 2); - return (i); - } - while (i > 0) { - *bp++ = *p++; - p++; - i -= 2; - } - return (l / 2); -} - /* * return table entry for code. */ @@ -778,7 +686,7 @@ get_tuple_info(unsigned char code) return (0); } -char * +const char * tuple_name(unsigned char code) { struct tuple_info *tp; Modified: head/usr.sbin/dumpcis/readcis.h ============================================================================== --- head/usr.sbin/dumpcis/readcis.h Mon Nov 17 22:19:19 2008 (r185032) +++ head/usr.sbin/dumpcis/readcis.h Mon Nov 17 22:46:29 2008 (r185033) @@ -41,7 +41,7 @@ struct tuple_list { }; struct tuple_info { - char *name; + const char *name; unsigned char code; unsigned char length; /* 255 means variable length */ }; @@ -136,13 +136,13 @@ struct cis { (*((tp) + 1) << 8) | *(tp)) #define tpl16(tp) ((*((tp) + 1) << 8) | *(tp)) -void *xmalloc(int); +int dumpcisfile_main(int, char **); void dump(unsigned char *, int); void dumpcis(struct cis *); void freecis(struct cis *); struct cis *readcis(int); -char *tuple_name(unsigned char); +const char *tuple_name(unsigned char); u_int parse_num(int, u_char *, u_char **, int); int isdumpcisfile; From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 23:04:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 403F71065674; Mon, 17 Nov 2008 23:04:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id A905D8FC19; Mon, 17 Nov 2008 23:04:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAHN4Ddg034550; Mon, 17 Nov 2008 18:04:13 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Pawel Jakub Dawidek Date: Mon, 17 Nov 2008 16:32:19 -0500 User-Agent: KMail/1.9.7 References: <200811170709.mAH79ecr075977@svn.freebsd.org> <20081117165006.GA1489@garage.freebsd.pl> In-Reply-To: <20081117165006.GA1489@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811171632.19955.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 17 Nov 2008 18:04:13 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8643/Mon Nov 17 14:40:22 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Philip Paeps Subject: Re: svn commit: r185021 - head/sys/dev/glxsb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 23:04:20 -0000 On Monday 17 November 2008 11:51:52 am Pawel Jakub Dawidek wrote: > On Mon, Nov 17, 2008 at 07:09:40AM +0000, Philip Paeps wrote: > > Author: philip > > Date: Mon Nov 17 07:09:40 2008 > > New Revision: 185021 > > URL: http://svn.freebsd.org/changeset/base/185021 > > > > Log: > > Fix two possible (but unlikely) NULL-pointer dereferences in glxsb(4). > > > > Spotted by: Coverity > > MFC after: 1 week > > > > Modified: > > head/sys/dev/glxsb/glxsb.c > > > > Modified: head/sys/dev/glxsb/glxsb.c > > ============================================================================== > > --- head/sys/dev/glxsb/glxsb.c Mon Nov 17 07:03:05 2008 (r185020) > > +++ head/sys/dev/glxsb/glxsb.c Mon Nov 17 07:09:40 2008 (r185021) > > @@ -358,7 +358,8 @@ glxsb_detach(device_t dev) > > return (EBUSY); > > } > > } > > - while ((ses = TAILQ_FIRST(&sc->sc_sessions)) != NULL) { > > + while (!TAILQ_EMPTY(&sc->sc_sessions)) { > > + ses = TAILQ_FIRST(&sc->sc_sessions); > > This is perfectly valid, and if it was reported by coverity, it is a > false positive. Yes, I've flagged several false positives of this type in Coverity previously. It doesn't like that construct as it doesn't realize that TAILQ_REMOVE is changing the head (hard for it to go through the *tqe_prev indirection I think). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 23:04:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A1771065673; Mon, 17 Nov 2008 23:04:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 97C438FC22; Mon, 17 Nov 2008 23:04:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAHN4JiY034555; Mon, 17 Nov 2008 18:04:20 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Mon, 17 Nov 2008 18:02:17 -0500 User-Agent: KMail/1.9.7 References: <200811170237.mAH2bjY5088186@ambrisko.com> <20081117224048.GN90129@deviant.kiev.zoral.com.ua> In-Reply-To: <20081117224048.GN90129@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811171802.17674.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 17 Nov 2008 18:04:20 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8643/Mon Nov 17 14:40:22 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , Peter Wemm , svn-src-all@freebsd.org, dchagin@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 23:04:29 -0000 On Monday 17 November 2008 05:40:48 pm Kostik Belousov wrote: > On Mon, Nov 17, 2008 at 01:21:53PM -0800, Peter Wemm wrote: > > On Mon, Nov 17, 2008 at 1:13 PM, John Baldwin wrote: > > > On Monday 17 November 2008 02:35:41 pm Kostik Belousov wrote: > > >> On Mon, Nov 17, 2008 at 12:11:41PM -0500, John Baldwin wrote: > > >> > On Sunday 16 November 2008 09:37:45 pm Doug Ambrisko wrote: > > >> > > Kostik Belousov writes: > > >> > > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > > >> > > | > Author: ambrisko > > >> > > | > Date: Fri Nov 14 21:05:45 2008 > > >> > > | > New Revision: 184974 > > >> > > | > URL: http://svn.freebsd.org/changeset/base/184974 > > >> > > | > > > >> > > | > Log: > > >> > > | > When running a 32bit app. on amd64, ensure the bits above 32bit > > >> > > | > are zero for the copyout. Confirmed by LSI. > > >> > > | > > > >> > > | > Modified: > > >> > > | > head/sys/dev/mfi/mfi.c > > >> > > | > > > >> > > | > Modified: head/sys/dev/mfi/mfi.c > > >> > > | > > > >> > > > > ============================================================================== > > >> > > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > > >> > > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > > >> > > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > > >> > > | > ->mfi_frame.raw[ioc->mfi_sense_off], > > >> > > | > &sense_ptr.sense_ptr_data[0], > > >> > > | > sizeof(sense_ptr.sense_ptr_data)); > > >> > > | > +#ifdef __amd64__ > > >> > > | > + if (cmd != MFI_CMD) { > > >> > > | > + /* > > >> > > | > + * not 64bit native so zero out any address > > >> > > | > + * over 32bit */ > > >> > > | > + sense_ptr.high = 0; > > >> > > | > + } > > >> > > | > +#endif > > >> > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > > >> > > | > ioc->mfi_sense_len); > > >> > > | > if (error != 0) { > > >> > > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > > >> > > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > > >> > > | > &sense_ptr.sense_ptr_data[0], > > >> > > | > sizeof(sense_ptr.sense_ptr_data)); > > >> > > | > +#ifdef __amd64__ > > >> > > | > + /* > > >> > > | > + * only 32bit Linux support so zero out any > > >> > > | > + * address over 32bit > > >> > > | > + */ > > >> > > | > + sense_ptr.high = 0; > > >> > > | > +#endif > > >> > > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > > >> > > | > l_ioc.lioc_sense_len); > > >> > > | > if (error != 0) { > > >> > > | > > >> > > | Would it make sense to perform this cut slightly more generically, by > > >> > > | checking whether the current process is 32bit ? > > >> > > | > > >> > > | We still have not grew the easy to check flag or attribute of the > > > image, > > >> > > | but usual practice is to compare p_sysent with corresponding sysvec, > > >> > > | like > > >> > > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) > > >> > > | or > > >> > > | if (td->td_proc->p_sysent == &elf_linux_sysvec) > > >> > > > > >> > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > > >> > > value is different. I put in that comment for Linux since there > > >> > > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > > >> > > support we need a 64bit structure defined. When the ioctl can't > > >> > > be figured out then I've used the p_sysent. Eventually, something > > >> > > that is more generic then the #ifdef __amd64__ should be done > > >> > > in all the drivers that do this emulation. > > >> > > > >> > I prefer depending on things like ioctl values and the 32-bit sysctl flag > > > when > > >> > possible. If we do have to directly check for the ABI, I'd much rather > > > have > > >> > a flags field in sysent rather than trying to compare against global > > > symbols, > > >> > as you can't compare against a global symbol unless it is present in the > > >> > kernel. Something like: > > >> > > > >> > if (td->td_proc->p_sysent->sy_flags & SY_32) > > >> > > > >> > or some such. I've wanted to have a COMPAT_FREEBSD32 that gets > > > auto-enabled > > >> > when you turn on COMPAT_IA32 on amd64 and ia64. It would also potentially > > > be > > >> > enabled by a COMPAT_SPARC8 or some such on sparc64 if we ever had that. > > >> > > >> Ok, what about the following. I only compiled it on i386/amd64. And, > > >> there are more places to convert to such checks, for sure. > > >> > > >> [yummy patch] > > > > > > Commit! Note that this is not MFC'able due to ABI breakage for older linux.ko > > > modules, but this is the proper solution for 8.0+. > I do not think that sysent KBI shall be preserved on the stable branch, > it is too core functionality. Our KBI guarantee mostly center around > drivers and less so for filesystem modules. Well, I didn't MFC the .sv_maxssiz fix to 6.x due to ABI concerns. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 23:07:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7801E1065670; Mon, 17 Nov 2008 23:07:19 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60C788FC0C; Mon, 17 Nov 2008 23:07:19 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHN7JE4060628; Mon, 17 Nov 2008 23:07:19 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHN7J1p060623; Mon, 17 Nov 2008 23:07:19 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <200811172307.mAHN7J1p060623@svn.freebsd.org> From: Doug Ambrisko Date: Mon, 17 Nov 2008 23:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185034 - in stable/7/sys: . dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 23:07:20 -0000 Author: ambrisko Date: Mon Nov 17 23:07:18 2008 New Revision: 185034 URL: http://svn.freebsd.org/changeset/base/185034 Log: MFC 182085, 184897, 184933, 184974, 184975 This addresses: 1) New HW support from LSI (they want to get the HW support into a FreeBSD release before the HW comes out!). 2) Bug fix in the ioctl path with zero length command. 3) Adds functional support so that SCSI sense will work when requested from user-land. This is a little strange, since they store a user-land pointer in the "data" space of the ioctl packet. So copy the data out into another structure that is a union of the data and pointer (mfi_sense_ptr union). This way we can cleanly use the pointer, as pointer on both 64bit and 32bit machines (i386/amd64). Submitted by: LSI Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/mfi/mfi.c stable/7/sys/dev/mfi/mfi_ioctl.h stable/7/sys/dev/mfi/mfi_pci.c stable/7/sys/dev/mfi/mfireg.h stable/7/sys/dev/mfi/mfivar.h Modified: stable/7/sys/dev/mfi/mfi.c ============================================================================== --- stable/7/sys/dev/mfi/mfi.c Mon Nov 17 22:46:29 2008 (r185033) +++ stable/7/sys/dev/mfi/mfi.c Mon Nov 17 23:07:18 2008 (r185034) @@ -163,7 +163,11 @@ static void mfi_enable_intr_ppc(struct mfi_softc *sc) { MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); - MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); + if (sc->mfi_flags & MFI_FLAGS_1078) { + MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); + } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + MFI_WRITE4(sc, MFI_OMSK, ~MFI_GEN2_EIM); + } } static int32_t @@ -171,14 +175,14 @@ mfi_read_fw_status_xscale(struct mfi_sof { return MFI_READ4(sc, MFI_OMSG0); } - + static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc) { return MFI_READ4(sc, MFI_OSP0); } -static int +static int mfi_check_clear_intr_xscale(struct mfi_softc *sc) { int32_t status; @@ -189,28 +193,35 @@ mfi_check_clear_intr_xscale(struct mfi_s MFI_WRITE4(sc, MFI_OSTS, status); return 0; - } +} -static int +static int mfi_check_clear_intr_ppc(struct mfi_softc *sc) { int32_t status; status = MFI_READ4(sc, MFI_OSTS); - if (!status) - return 1; + if (sc->mfi_flags & MFI_FLAGS_1078) { + if (!(status & MFI_1078_RM)) { + return 1; + } + } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + if (!(status & MFI_GEN2_RM)) { + return 1; + } + } MFI_WRITE4(sc, MFI_ODCR0, status); return 0; - } +} -static void +static void mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt) { MFI_WRITE4(sc, MFI_IQP,(bus_add >>3)|frame_cnt); } - -static void + +static void mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt) { MFI_WRITE4(sc, MFI_IQP, (bus_add |frame_cnt <<1)|1 ); @@ -1399,6 +1410,8 @@ mfi_bio_complete(struct mfi_command *cm) device_printf(sc->mfi_dev, "I/O error, status= %d " "scsi_status= %d\n", hdr->cmd_status, hdr->scsi_status); mfi_print_sense(cm->cm_sc, cm->cm_sense); + } else if (cm->cm_error != 0) { + bio->bio_flags |= BIO_ERROR; } mfi_release_command(cm); @@ -1815,6 +1828,9 @@ mfi_check_command_post(struct mfi_softc case MFI_DCMD_CFG_ADD: mfi_ldprobe(sc); break; + case MFI_DCMD_CFG_FOREIGN_IMPORT: + mfi_ldprobe(sc); + break; } } @@ -1904,7 +1920,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, struct mfi_ioc_aen *aen; struct mfi_command *cm = NULL; uint32_t context; - uint8_t *sense_ptr; + union mfi_sense_ptr sense_ptr; uint8_t *data = NULL, *temp; int i; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; @@ -1986,8 +2002,9 @@ mfi_ioctl(struct cdev *dev, u_long cmd, context = cm->cm_frame->header.context; bcopy(ioc->mfi_frame.raw, cm->cm_frame, - 2 * MFI_DCMD_FRAME_SIZE); /* this isn't quite right */ - cm->cm_total_frame_size = (sizeof(union mfi_sgl) * ioc->mfi_sge_count) + ioc->mfi_sgl_off; + 2 * MFI_DCMD_FRAME_SIZE); /* this isn't quite right */ + cm->cm_total_frame_size = (sizeof(union mfi_sgl) + * ioc->mfi_sge_count) + ioc->mfi_sgl_off; if (ioc->mfi_sge_count) { cm->cm_sg = (union mfi_sgl *)&cm->cm_frame->bytes[ioc->mfi_sgl_off]; @@ -2001,7 +2018,8 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_flags == 0) cm->cm_flags |= MFI_CMD_DATAIN | MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; - if (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT)) { + if (cm->cm_len && + (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, M_WAITOK | M_ZERO); if (cm->cm_data == NULL) { @@ -2051,6 +2069,11 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_frame->header.cmd == MFI_CMD_DCMD) locked = mfi_config_lock(sc, cm->cm_frame->dcmd.opcode); + if (cm->cm_frame->header.cmd == MFI_CMD_PD_SCSI_IO) { + cm->cm_frame->pass.sense_addr_lo = cm->cm_sense_busaddr; + cm->cm_frame->pass.sense_addr_hi = 0; + } + mtx_lock(&sc->mfi_io_lock); error = mfi_check_command_pre(sc, cm); if (error) { @@ -2102,10 +2125,20 @@ mfi_ioctl(struct cdev *dev, u_long cmd, } if (ioc->mfi_sense_len) { - /* copy out sense */ - sense_ptr = &((struct mfi_ioc_packet*)arg) - ->mfi_frame.raw[0]; - error = copyout(cm->cm_sense, sense_ptr, + /* get user-space sense ptr then copy out sense */ + bcopy(&((struct mfi_ioc_packet*)arg) + ->mfi_frame.raw[ioc->mfi_sense_off], + &sense_ptr.sense_ptr_data[0], + sizeof(sense_ptr.sense_ptr_data)); +#ifdef __amd64__ + if (cmd != MFI_CMD) { + /* + * not 64bit native so zero out any address + * over 32bit */ + sense_ptr.addr.high = 0; + } +#endif + error = copyout(cm->cm_sense, sense_ptr.user_space, ioc->mfi_sense_len); if (error != 0) { device_printf(sc->mfi_dev, @@ -2207,7 +2240,7 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ struct mfi_linux_ioc_aen l_aen; struct mfi_command *cm = NULL; struct mfi_aen *mfi_aen_entry; - uint8_t *sense_ptr; + union mfi_sense_ptr sense_ptr; uint32_t context; uint8_t *data = NULL, *temp; int i; @@ -2241,7 +2274,8 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ bcopy(l_ioc.lioc_frame.raw, cm->cm_frame, 2 * MFI_DCMD_FRAME_SIZE); /* this isn't quite right */ - cm->cm_total_frame_size = (sizeof(union mfi_sgl) * l_ioc.lioc_sge_count) + l_ioc.lioc_sgl_off; + cm->cm_total_frame_size = (sizeof(union mfi_sgl) + * l_ioc.lioc_sge_count) + l_ioc.lioc_sgl_off; if (l_ioc.lioc_sge_count) cm->cm_sg = (union mfi_sgl *)&cm->cm_frame->bytes[l_ioc.lioc_sgl_off]; @@ -2251,7 +2285,8 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ if (cm->cm_frame->header.flags & MFI_FRAME_DATAOUT) cm->cm_flags |= MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; - if (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT)) { + if (cm->cm_len && + (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, M_WAITOK | M_ZERO); if (cm->cm_data == NULL) { @@ -2283,6 +2318,11 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ if (cm->cm_frame->header.cmd == MFI_CMD_DCMD) locked = mfi_config_lock(sc, cm->cm_frame->dcmd.opcode); + if (cm->cm_frame->header.cmd == MFI_CMD_PD_SCSI_IO) { + cm->cm_frame->pass.sense_addr_lo = cm->cm_sense_busaddr; + cm->cm_frame->pass.sense_addr_hi = 0; + } + mtx_lock(&sc->mfi_io_lock); error = mfi_check_command_pre(sc, cm); if (error) { @@ -2316,10 +2356,19 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ } if (l_ioc.lioc_sense_len) { - /* copy out sense */ - sense_ptr = &((struct mfi_linux_ioc_packet*)arg) - ->lioc_frame.raw[0]; - error = copyout(cm->cm_sense, sense_ptr, + /* get user-space sense ptr then copy out sense */ + bcopy(&((struct mfi_linux_ioc_packet*)arg) + ->lioc_frame.raw[l_ioc.lioc_sense_off], + &sense_ptr.sense_ptr_data[0], + sizeof(sense_ptr.sense_ptr_data)); +#ifdef __amd64__ + /* + * only 32bit Linux support so zero out any + * address over 32bit + */ + sense_ptr.addr.high = 0; +#endif + error = copyout(cm->cm_sense, sense_ptr.user_space, l_ioc.lioc_sense_len); if (error != 0) { device_printf(sc->mfi_dev, Modified: stable/7/sys/dev/mfi/mfi_ioctl.h ============================================================================== --- stable/7/sys/dev/mfi/mfi_ioctl.h Mon Nov 17 22:46:29 2008 (r185033) +++ stable/7/sys/dev/mfi/mfi_ioctl.h Mon Nov 17 23:07:18 2008 (r185034) @@ -50,6 +50,16 @@ union mfi_statrequest { struct mfi_qstat ms_qstat; }; +#define MAX_SPACE_FOR_SENSE_PTR 32 +union mfi_sense_ptr { + uint8_t sense_ptr_data[MAX_SPACE_FOR_SENSE_PTR]; + void *user_space; + struct { + uint32_t low; + uint32_t high; + } addr; +} __packed; + #define MAX_IOCTL_SGE 16 struct mfi_ioc_packet { Modified: stable/7/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/7/sys/dev/mfi/mfi_pci.c Mon Nov 17 22:46:29 2008 (r185033) +++ stable/7/sys/dev/mfi/mfi_pci.c Mon Nov 17 23:07:18 2008 (r185034) @@ -118,7 +118,14 @@ struct mfi_ident { {0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */ {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6"}, - {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC 607E Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC 607I Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC 607I Integrated"}, + {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC 607I Modular"}, + {0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, + {0x1000, 0x0079, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, + {0x1000, 0x007c, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, {0, 0, 0, 0, 0, NULL} }; @@ -163,6 +170,8 @@ mfi_pci_attach(device_t dev) sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); sc->mfi_dev = dev; + m = mfi_find_ident(dev); + sc->mfi_flags = m->flags; /* Verify that the adapter can be set up in PCI space */ command = pci_read_config(dev, PCIR_COMMAND, 2); @@ -179,7 +188,14 @@ mfi_pci_attach(device_t dev) } /* Allocate PCI registers */ - sc->mfi_regs_rid = PCIR_BAR(0); + if ((sc->mfi_flags & MFI_FLAGS_1064R) || + (sc->mfi_flags & MFI_FLAGS_1078)) { + /* 1068/1078: Memory mapped BAR is at offset 0x10 */ + sc->mfi_regs_rid = PCIR_BAR(0); + } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + /* GEN2: Memory mapped BAR is at offset 0x14 */ + sc->mfi_regs_rid = PCIR_BAR(1); + } if ((sc->mfi_regs_resource = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_MEMORY, &sc->mfi_regs_rid, RF_ACTIVE)) == NULL) { device_printf(dev, "Cannot allocate PCI registers\n"); @@ -206,9 +222,6 @@ mfi_pci_attach(device_t dev) goto out; } - m = mfi_find_ident(dev); - sc->mfi_flags = m->flags; - error = mfi_attach(sc); out: if (error) { Modified: stable/7/sys/dev/mfi/mfireg.h ============================================================================== --- stable/7/sys/dev/mfi/mfireg.h Mon Nov 17 22:46:29 2008 (r185033) +++ stable/7/sys/dev/mfi/mfireg.h Mon Nov 17 23:07:18 2008 (r185034) @@ -89,10 +89,16 @@ __FBSDID("$FreeBSD$"); #define MFI_ODCR0 0xa0 /* outbound doorbell clear register0 */ #define MFI_OSP0 0xb0 /* outbound scratch pad0 */ #define MFI_1078_EIM 0x80000004 /* 1078 enable intrrupt mask */ -#define MFI_RMI 0x2 /* reply message interrupt */ +#define MFI_RMI 0x2 /* reply message interrupt */ #define MFI_1078_RM 0x80000000 /* reply 1078 message interrupt */ #define MFI_ODC 0x4 /* outbound doorbell change interrupt */ +/* + * GEN2 specific changes + */ +#define MFI_GEN2_EIM 0x00000005 /* GEN2 enable interrupt mask */ +#define MFI_GEN2_RM 0x00000001 /* reply GEN2 message interrupt */ + /* Bits for MFI_OSTS */ #define MFI_OSTS_INTR_VALID 0x00000002 @@ -153,6 +159,7 @@ typedef enum { MFI_DCMD_CFG_READ = 0x04010000, MFI_DCMD_CFG_ADD = 0x04020000, MFI_DCMD_CFG_CLEAR = 0x04030000, + MFI_DCMD_CFG_FOREIGN_IMPORT = 0x04060400, MFI_DCMD_CLUSTER = 0x08000000, MFI_DCMD_CLUSTER_RESET_ALL = 0x08010100, MFI_DCMD_CLUSTER_RESET_LD = 0x08010200 Modified: stable/7/sys/dev/mfi/mfivar.h ============================================================================== --- stable/7/sys/dev/mfi/mfivar.h Mon Nov 17 22:46:29 2008 (r185033) +++ stable/7/sys/dev/mfi/mfivar.h Mon Nov 17 23:07:18 2008 (r185034) @@ -133,6 +133,7 @@ struct mfi_softc { #define MFI_FLAGS_STOP (1<<3) #define MFI_FLAGS_1064R (1<<4) #define MFI_FLAGS_1078 (1<<5) +#define MFI_FLAGS_GEN2 (1<<6) struct mfi_hwcomms *mfi_comms; TAILQ_HEAD(,mfi_command) mfi_free; From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 23:30:19 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87FF71065675; Mon, 17 Nov 2008 23:30:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 731FC8FC08; Mon, 17 Nov 2008 23:30:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHNUJZV061141; Mon, 17 Nov 2008 23:30:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHNUJ5T061140; Mon, 17 Nov 2008 23:30:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811172330.mAHNUJ5T061140@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Nov 2008 23:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185035 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 23:30:19 -0000 Author: jhb Date: Mon Nov 17 23:30:19 2008 New Revision: 185035 URL: http://svn.freebsd.org/changeset/base/185035 Log: Fix the maximum transfer size for mfi(4) disk devices to not exceed the maximum number of scatter/gather elements supported in the bus dma tag. Reviewed by: scottl MFC after: 1 week Modified: head/sys/dev/mfi/mfi_disk.c Modified: head/sys/dev/mfi/mfi_disk.c ============================================================================== --- head/sys/dev/mfi/mfi_disk.c Mon Nov 17 23:07:18 2008 (r185034) +++ head/sys/dev/mfi/mfi_disk.c Mon Nov 17 23:30:19 2008 (r185035) @@ -136,7 +136,8 @@ mfi_disk_attach(device_t dev) sc->ld_disk = disk_alloc(); sc->ld_disk->d_drv1 = sc; - sc->ld_disk->d_maxsize = sc->ld_controller->mfi_max_io * secsize; + sc->ld_disk->d_maxsize = min(sc->ld_controller->mfi_max_io * secsize, + (sc->ld_controller->mfi_max_sge - 1) * PAGE_SIZE); sc->ld_disk->d_name = "mfid"; sc->ld_disk->d_open = mfi_disk_open; sc->ld_disk->d_close = mfi_disk_close; From owner-svn-src-all@FreeBSD.ORG Mon Nov 17 23:57:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B9FC106567C; Mon, 17 Nov 2008 23:57:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7657A8FC1B; Mon, 17 Nov 2008 23:57:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHNve1W061764; Mon, 17 Nov 2008 23:57:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAHNveij061763; Mon, 17 Nov 2008 23:57:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811172357.mAHNveij061763@svn.freebsd.org> From: Xin LI Date: Mon, 17 Nov 2008 23:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185036 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 23:57:40 -0000 Author: delphij Date: Mon Nov 17 23:57:40 2008 New Revision: 185036 URL: http://svn.freebsd.org/changeset/base/185036 Log: Obey signedness flag in %z case. MFC after: 2 months Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Mon Nov 17 23:30:19 2008 (r185035) +++ head/sys/kern/subr_prf.c Mon Nov 17 23:57:40 2008 (r185036) @@ -814,7 +814,7 @@ handle_sign: else if (lflag) num = va_arg(ap, long); else if (zflag) - num = va_arg(ap, size_t); + num = va_arg(ap, ssize_t); else if (hflag) num = (short)va_arg(ap, int); else if (cflag) From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 00:01:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A67A1065678; Tue, 18 Nov 2008 00:01:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1597E8FC13; Tue, 18 Nov 2008 00:01:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI01GEd061915; Tue, 18 Nov 2008 00:01:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI01GXG061914; Tue, 18 Nov 2008 00:01:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811180001.mAI01GXG061914@svn.freebsd.org> From: Xin LI Date: Tue, 18 Nov 2008 00:01:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185037 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 00:01:17 -0000 Author: delphij Date: Tue Nov 18 00:01:16 2008 New Revision: 185037 URL: http://svn.freebsd.org/changeset/base/185037 Log: Obey signedness flag in %z case. MFC after: 2 months Modified: head/lib/libstand/printf.c Modified: head/lib/libstand/printf.c ============================================================================== --- head/lib/libstand/printf.c Mon Nov 17 23:57:40 2008 (r185036) +++ head/lib/libstand/printf.c Tue Nov 18 00:01:16 2008 (r185037) @@ -381,7 +381,7 @@ handle_sign: else if (lflag) num = va_arg(ap, long); else if (zflag) - num = va_arg(ap, size_t); + num = va_arg(ap, ssize_t); else num = va_arg(ap, int); number: From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 00:03:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECB0B1065670; Tue, 18 Nov 2008 00:03:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D79518FC16; Tue, 18 Nov 2008 00:03:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI03USI061999; Tue, 18 Nov 2008 00:03:30 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI03UKc061998; Tue, 18 Nov 2008 00:03:30 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811180003.mAI03UKc061998@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 18 Nov 2008 00:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185038 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 00:03:31 -0000 Author: marcel Date: Tue Nov 18 00:03:30 2008 New Revision: 185038 URL: http://svn.freebsd.org/changeset/base/185038 Log: Pad the bootcode we write to the partition to a multiple of the sector size. Submitted by: Alexey Shuvaev Prompted by: delphij MFC after: 3 days Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Tue Nov 18 00:01:16 2008 (r185037) +++ head/sbin/geom/class/part/geom_part.c Tue Nov 18 00:03:30 2008 (r185038) @@ -393,6 +393,8 @@ gpart_write_partcode(struct gctl_req *re struct ggeom *gp; struct gprovider *pp; const char *s; + char *buf; + off_t bsize; int error, fd; s = gctl_get_ascii(req, "class"); @@ -428,8 +430,21 @@ gpart_write_partcode(struct gctl_req *re errx(EXIT_FAILURE, "%s: not enough space", dsf); if (lseek(fd, 0, SEEK_SET) != 0) err(EXIT_FAILURE, "%s", dsf); - if (write(fd, code, size) != size) + + /* + * When writing to a disk device, the write must be + * sector aligned and not write to any partial sectors, + * so round up the buffer size to the next sector and zero it. + */ + bsize = (size + pp->lg_sectorsize - 1) / + pp->lg_sectorsize * pp->lg_sectorsize; + buf = calloc(1, bsize); + if (buf == NULL) + err(EXIT_FAILURE, "%s", dsf); + bcopy(code, buf, size); + if (write(fd, buf, bsize) != bsize) err(EXIT_FAILURE, "%s", dsf); + free(buf); close(fd); } else errx(EXIT_FAILURE, "invalid partition index"); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 00:03:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAACA106568E; Tue, 18 Nov 2008 00:03:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B57688FC19; Tue, 18 Nov 2008 00:03:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI03cbG062043; Tue, 18 Nov 2008 00:03:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI03cgk062041; Tue, 18 Nov 2008 00:03:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811180003.mAI03cgk062041@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 18 Nov 2008 00:03:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185039 - head/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 00:03:38 -0000 Author: pjd Date: Tue Nov 18 00:03:38 2008 New Revision: 185039 URL: http://svn.freebsd.org/changeset/base/185039 Log: Fix a warning on amd64 caused by using int for request argument instead of unsigned long: WARNING pid 12888 (zfs/zpool): ioctl sign-extension ioctl ffffffffcc285aXX Reported by: kris Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Nov 18 00:03:30 2008 (r185038) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Nov 18 00:03:38 2008 (r185039) @@ -319,7 +319,7 @@ extern void zpool_set_history_str(const extern int zpool_stage_history(libzfs_handle_t *, const char *); extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, size_t len); -extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *); +extern int zfs_ioctl(libzfs_handle_t *, unsigned long, struct zfs_cmd *); extern int zpool_get_physpath(zpool_handle_t *, char *); /* * Basic handle manipulations. These functions do not create or destroy the Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Tue Nov 18 00:03:30 2008 (r185038) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Tue Nov 18 00:03:38 2008 (r185039) @@ -758,7 +758,7 @@ zcmd_read_dst_nvlist(libzfs_handle_t *hd } int -zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc) +zfs_ioctl(libzfs_handle_t *hdl, unsigned long request, zfs_cmd_t *zc) { int error; From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 00:12:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C0F31065670; Tue, 18 Nov 2008 00:12:16 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D5EE8FC1C; Tue, 18 Nov 2008 00:12:16 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI0CF4Z062218; Tue, 18 Nov 2008 00:12:15 GMT (envelope-from matteo@svn.freebsd.org) Received: (from matteo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI0CFfb062217; Tue, 18 Nov 2008 00:12:15 GMT (envelope-from matteo@svn.freebsd.org) Message-Id: <200811180012.mAI0CFfb062217@svn.freebsd.org> From: Matteo Riondato Date: Tue, 18 Nov 2008 00:12:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185040 - head/usr.sbin/cron/crontab X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 00:12:16 -0000 Author: matteo Date: Tue Nov 18 00:12:15 2008 New Revision: 185040 URL: http://svn.freebsd.org/changeset/base/185040 Log: Use WARNS?= instead of WARNS= MFC after: 3 days Modified: head/usr.sbin/cron/crontab/Makefile Modified: head/usr.sbin/cron/crontab/Makefile ============================================================================== --- head/usr.sbin/cron/crontab/Makefile Tue Nov 18 00:03:38 2008 (r185039) +++ head/usr.sbin/cron/crontab/Makefile Tue Nov 18 00:12:15 2008 (r185040) @@ -8,7 +8,7 @@ BINOWN= root BINMODE=4555 PRECIOUSPROG= -WARNS=3 +WARNS?= 3 CFLAGS+= -I${.CURDIR}/../cron From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 00:39:51 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D77C106567B; Tue, 18 Nov 2008 00:39:51 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0849F8FC0C; Tue, 18 Nov 2008 00:39:51 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI0dog7062855; Tue, 18 Nov 2008 00:39:50 GMT (envelope-from matteo@svn.freebsd.org) Received: (from matteo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI0doH2062854; Tue, 18 Nov 2008 00:39:50 GMT (envelope-from matteo@svn.freebsd.org) Message-Id: <200811180039.mAI0doH2062854@svn.freebsd.org> From: Matteo Riondato Date: Tue, 18 Nov 2008 00:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185041 - head/usr.sbin/cron/crontab X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 00:39:51 -0000 Author: matteo Date: Tue Nov 18 00:39:50 2008 New Revision: 185041 URL: http://svn.freebsd.org/changeset/base/185041 Log: Be more precise and use sizeof(tn) Pointed out by: glewis@ MFC after: 3 days Modified: head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Tue Nov 18 00:12:15 2008 (r185040) +++ head/usr.sbin/cron/crontab/crontab.c Tue Nov 18 00:39:50 2008 (r185041) @@ -502,7 +502,7 @@ replace_cmd() { } (void) snprintf(n, sizeof(n), "tmp.%d", Pid); - (void) snprintf(tn, sizeof(n), CRON_TAB(n)); + (void) snprintf(tn, sizeof(tn), CRON_TAB(n)); if (!(tmp = fopen(tn, "w+"))) { warn("%s", tn); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 00:59:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BFE31065672; Tue, 18 Nov 2008 00:59:27 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3755E8FC13; Tue, 18 Nov 2008 00:59:27 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI0xRBm063232; Tue, 18 Nov 2008 00:59:27 GMT (envelope-from matteo@svn.freebsd.org) Received: (from matteo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI0xR9v063231; Tue, 18 Nov 2008 00:59:27 GMT (envelope-from matteo@svn.freebsd.org) Message-Id: <200811180059.mAI0xR9v063231@svn.freebsd.org> From: Matteo Riondato Date: Tue, 18 Nov 2008 00:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185042 - head/usr.sbin/cron/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 00:59:27 -0000 Author: matteo Date: Tue Nov 18 00:59:26 2008 New Revision: 185042 URL: http://svn.freebsd.org/changeset/base/185042 Log: use WARNS?= instead of WARNS= MFC after: 3 days Modified: head/usr.sbin/cron/lib/Makefile Modified: head/usr.sbin/cron/lib/Makefile ============================================================================== --- head/usr.sbin/cron/lib/Makefile Tue Nov 18 00:39:50 2008 (r185041) +++ head/usr.sbin/cron/lib/Makefile Tue Nov 18 00:59:26 2008 (r185042) @@ -4,7 +4,7 @@ LIB= cron INTERNALLIB= SRCS= entry.c env.c misc.c -WARNS = 3 +WARNS?= 3 CFLAGS+= -I${.CURDIR}/../cron CFLAGS+= -DLOGIN_CAP -DPAM From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 01:19:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A30D106564A; Tue, 18 Nov 2008 01:19:25 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55E818FC0A; Tue, 18 Nov 2008 01:19:25 +0000 (UTC) (envelope-from matteo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI1JPFa063648; Tue, 18 Nov 2008 01:19:25 GMT (envelope-from matteo@svn.freebsd.org) Received: (from matteo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI1JPGa063647; Tue, 18 Nov 2008 01:19:25 GMT (envelope-from matteo@svn.freebsd.org) Message-Id: <200811180119.mAI1JPGa063647@svn.freebsd.org> From: Matteo Riondato Date: Tue, 18 Nov 2008 01:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185043 - head/usr.sbin/cron/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 01:19:25 -0000 Author: matteo Date: Tue Nov 18 01:19:25 2008 New Revision: 185043 URL: http://svn.freebsd.org/changeset/base/185043 Log: remove a pointless prototype and static-fy the corresponding function MFC after: 3 days Modified: head/usr.sbin/cron/lib/misc.c Modified: head/usr.sbin/cron/lib/misc.c ============================================================================== --- head/usr.sbin/cron/lib/misc.c Tue Nov 18 00:59:26 2008 (r185042) +++ head/usr.sbin/cron/lib/misc.c Tue Nov 18 01:19:25 2008 (r185043) @@ -48,7 +48,6 @@ static const char rcsid[] = static int LogFD = ERR; -void mkprint(register char*, register unsigned char*, register int); int @@ -519,7 +518,7 @@ first_word(s, t) /* warning: * heavily ascii-dependent. */ -void +static void mkprint(register char *dst, register unsigned char *src, register int len) { while (len-- > 0) From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 03:43:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8FD8106564A; Tue, 18 Nov 2008 03:43:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A63158FC17; Tue, 18 Nov 2008 03:43:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI3h2A7066464; Tue, 18 Nov 2008 03:43:02 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI3h2jO066463; Tue, 18 Nov 2008 03:43:02 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811180343.mAI3h2jO066463@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 18 Nov 2008 03:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185044 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 03:43:02 -0000 Author: marcel Date: Tue Nov 18 03:43:02 2008 New Revision: 185044 URL: http://svn.freebsd.org/changeset/base/185044 Log: Sort includes Submitted by: delphij Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Tue Nov 18 01:19:25 2008 (r185043) +++ head/sbin/geom/class/part/geom_part.c Tue Nov 18 03:43:02 2008 (r185044) @@ -27,19 +27,20 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include +#include + +#include #include +#include #include -#include -#include #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "core/geom.h" #include "misc/subr.h" From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 03:55:55 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D73F0106564A; Tue, 18 Nov 2008 03:55:55 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C49C18FC12; Tue, 18 Nov 2008 03:55:55 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI3ttUB066731; Tue, 18 Nov 2008 03:55:55 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI3tt2D066730; Tue, 18 Nov 2008 03:55:55 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <200811180355.mAI3tt2D066730@svn.freebsd.org> From: "Andrey A. Chernov" Date: Tue, 18 Nov 2008 03:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185045 - head/sys/boot/i386/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 03:55:56 -0000 Author: ache Date: Tue Nov 18 03:55:55 2008 New Revision: 185045 URL: http://svn.freebsd.org/changeset/base/185045 Log: Fix building without ZFS (can't find library) Modified: head/sys/boot/i386/loader/Makefile Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Tue Nov 18 03:43:02 2008 (r185044) +++ head/sys/boot/i386/loader/Makefile Tue Nov 18 03:55:55 2008 (r185045) @@ -21,6 +21,8 @@ LIBFIREWIRE= ${.OBJDIR}/../libfirewire/l .if defined(LOADER_ZFS_SUPPORT) CFLAGS+= -DLOADER_ZFS_SUPPORT LIBZFS= ${.OBJDIR}/../../zfs/libzfsboot.a +.else +LIBZFS= .endif # Enable PXE TFTP or NFS support, not both. From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 04:04:01 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E674106564A; Tue, 18 Nov 2008 04:04:01 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8458FC12; Tue, 18 Nov 2008 04:04:01 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI441lf066916; Tue, 18 Nov 2008 04:04:01 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI441Kb066914; Tue, 18 Nov 2008 04:04:01 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811180404.mAI441Kb066914@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 18 Nov 2008 04:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185046 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 04:04:01 -0000 Author: marcel Date: Tue Nov 18 04:04:01 2008 New Revision: 185046 URL: http://svn.freebsd.org/changeset/base/185046 Log: Use humanize_number(), rather than a home-grown algorithm for formatting a number in a human-friendly way. Note that with this commit a megabyte changed from 1000000 to 1048576 and a 80G disk is now printed as being 75G in size. This is deliberate. It's consistent with the core of geom(8). However, the original choice for a megabyte being 1000000 was on purpose and matches what disk vendors put on the box. The consistency is considered more important. Submitted by: delphij Modified: head/sbin/geom/class/part/Makefile head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/Makefile ============================================================================== --- head/sbin/geom/class/part/Makefile Tue Nov 18 03:55:55 2008 (r185045) +++ head/sbin/geom/class/part/Makefile Tue Nov 18 04:04:01 2008 (r185046) @@ -4,6 +4,8 @@ CLASS= part +LDADD= -lutil + WARNS?= 4 .include Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Tue Nov 18 03:55:55 2008 (r185045) +++ head/sbin/geom/class/part/geom_part.c Tue Nov 18 04:04:01 2008 (r185046) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -203,21 +204,12 @@ find_provider(struct ggeom *gp, unsigned } static const char * -fmtsize(long double rawsz) +fmtsize(int64_t rawsz) { - static char buf[32]; - static const char *sfx[] = { "B", "KB", "MB", "GB", "TB" }; - long double sz; - int sfxidx; + static char buf[5]; - sfxidx = 0; - sz = (long double)rawsz; - while (sfxidx < 4 && sz > 1099.0) { - sz /= 1000; - sfxidx++; - } - - sprintf(buf, "%.1Lf%s", sz, sfx[sfxidx]); + humanize_number(buf, sizeof(buf), rawsz, "", HN_AUTOSCALE, + HN_B | HN_NOSPACE | HN_DECIMAL); return (buf); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 04:54:28 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFDA2106564A for ; Tue, 18 Nov 2008 04:54:28 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.186]) by mx1.freebsd.org (Postfix) with ESMTP id 5B60B8FC0C for ; Tue, 18 Nov 2008 04:54:28 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so3323851fkk.11 for ; Mon, 17 Nov 2008 20:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=oCf9tKgEu5CuDHp4H7ln/Iy5kdeNunW7UsSHSbbjIj0=; b=HFS/HFWwZBvDEMgS3VXFzddnYpjn52gT9pIEGPnzOD3vS3uFSBpC9ga8jt2GxoRL0b ABAUxBAcL+Uj/9O6+vhV6GHOAX2Og1mDFNQpZ0cUWWjoLgbp4c+7bP4fqxy8VV1XK1zC nKXfiXdJApcnUM1EJgTU1J5hW7RyNMcipfzg4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=UCQ+RDweKujHlqo7S2e1liGVwKQVc9Vt3odLJVr+lLLK/oPJjBYG3w8x+0DKX2Jq5p 4LcxIoXupW1PX+L9YwaooKjJBKjH+WUk26c804VDGfnjxQSY+lnqPqccJEB3gcoxRRiK hedlYx0qY4dsFnFV/exGIBjoHmIMvkqyThJ5c= Received: by 10.181.135.12 with SMTP id m12mr1199818bkn.88.1226982588944; Mon, 17 Nov 2008 20:29:48 -0800 (PST) Received: by 10.180.242.16 with HTTP; Mon, 17 Nov 2008 20:29:48 -0800 (PST) Message-ID: Date: Mon, 17 Nov 2008 20:29:48 -0800 From: "Xin LI" To: "Marcel Moolenaar" In-Reply-To: <200811180003.mAI03UKc061998@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811180003.mAI03UKc061998@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185038 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: delphij@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 04:54:29 -0000 Thanks! On Mon, Nov 17, 2008 at 4:03 PM, Marcel Moolenaar wrote: > Author: marcel > Date: Tue Nov 18 00:03:30 2008 > New Revision: 185038 > URL: http://svn.freebsd.org/changeset/base/185038 > > Log: > Pad the bootcode we write to the partition to a multiple of the > sector size. > > Submitted by: Alexey Shuvaev > Prompted by: delphij > MFC after: 3 days > > Modified: > head/sbin/geom/class/part/geom_part.c > > Modified: head/sbin/geom/class/part/geom_part.c > ============================================================================== > --- head/sbin/geom/class/part/geom_part.c Tue Nov 18 00:01:16 2008 (r185037) > +++ head/sbin/geom/class/part/geom_part.c Tue Nov 18 00:03:30 2008 (r185038) > @@ -393,6 +393,8 @@ gpart_write_partcode(struct gctl_req *re > struct ggeom *gp; > struct gprovider *pp; > const char *s; > + char *buf; > + off_t bsize; > int error, fd; > > s = gctl_get_ascii(req, "class"); > @@ -428,8 +430,21 @@ gpart_write_partcode(struct gctl_req *re > errx(EXIT_FAILURE, "%s: not enough space", dsf); > if (lseek(fd, 0, SEEK_SET) != 0) > err(EXIT_FAILURE, "%s", dsf); > - if (write(fd, code, size) != size) > + > + /* > + * When writing to a disk device, the write must be > + * sector aligned and not write to any partial sectors, > + * so round up the buffer size to the next sector and zero it. > + */ > + bsize = (size + pp->lg_sectorsize - 1) / > + pp->lg_sectorsize * pp->lg_sectorsize; > + buf = calloc(1, bsize); > + if (buf == NULL) > + err(EXIT_FAILURE, "%s", dsf); > + bcopy(code, buf, size); > + if (write(fd, buf, bsize) != bsize) > err(EXIT_FAILURE, "%s", dsf); > + free(buf); > close(fd); > } else > errx(EXIT_FAILURE, "invalid partition index"); > -- Xin LI http://www.delphij.net From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 05:41:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77A741065673; Tue, 18 Nov 2008 05:41:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64E0D8FC17; Tue, 18 Nov 2008 05:41:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI5fYjK068798; Tue, 18 Nov 2008 05:41:34 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI5fYw1068797; Tue, 18 Nov 2008 05:41:34 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811180541.mAI5fYw1068797@svn.freebsd.org> From: John Baldwin Date: Tue, 18 Nov 2008 05:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185047 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 05:41:34 -0000 Author: jhb Date: Tue Nov 18 05:41:34 2008 New Revision: 185047 URL: http://svn.freebsd.org/changeset/base/185047 Log: When checking to see if another CPU is running its idle thread, examine the thread running on the other CPU instead of the thread being placed on the run queue. Reported by: Ravi Murty @ Intel Reviewed by: jeff Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Tue Nov 18 04:04:01 2008 (r185046) +++ head/sys/kern/sched_ule.c Tue Nov 18 05:41:34 2008 (r185047) @@ -946,7 +946,7 @@ tdq_idled(struct tdq *tdq) static void tdq_notify(struct tdq *tdq, struct thread *td) { - int cpri; + struct thread *ctd; int pri; int cpu; @@ -954,10 +954,10 @@ tdq_notify(struct tdq *tdq, struct threa return; cpu = td->td_sched->ts_cpu; pri = td->td_priority; - cpri = pcpu_find(cpu)->pc_curthread->td_priority; - if (!sched_shouldpreempt(pri, cpri, 1)) + ctd = pcpu_find(cpu)->pc_curthread; + if (!sched_shouldpreempt(pri, ctd->td_priority, 1)) return; - if (TD_IS_IDLETHREAD(td)) { + if (TD_IS_IDLETHREAD(ctd)) { /* * If the idle thread is still 'running' it's probably * waiting on us to release the tdq spinlock already. No From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 05:55:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41358106564A; Tue, 18 Nov 2008 05:55:59 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DDF18FC12; Tue, 18 Nov 2008 05:55:59 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAI5twMP069099; Tue, 18 Nov 2008 05:55:58 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAI5twQh069098; Tue, 18 Nov 2008 05:55:58 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811180555.mAI5twQh069098@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 18 Nov 2008 05:55:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185048 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 05:55:59 -0000 Author: marcel Date: Tue Nov 18 05:55:58 2008 New Revision: 185048 URL: http://svn.freebsd.org/changeset/base/185048 Log: Partition type FS_UNUSED does not mean the partition entry is unused. Unused partition entries have a partition size of zero. Therefore, partitions can have type FS_UNUSED. MFC after: 3 days Modified: head/sys/geom/part/g_part_bsd.c Modified: head/sys/geom/part/g_part_bsd.c ============================================================================== --- head/sys/geom/part/g_part_bsd.c Tue Nov 18 05:41:34 2008 (r185047) +++ head/sys/geom/part/g_part_bsd.c Tue Nov 18 05:55:58 2008 (r185048) @@ -372,8 +372,6 @@ g_part_bsd_read(struct g_part_table *bas part.p_cpg = le16dec(p + 14); if (part.p_size == 0) continue; - if (part.p_fstype == FS_UNUSED && index != RAW_PART) - continue; if (part.p_offset < table->offset) continue; baseentry = g_part_new_entry(basetable, index + 1, @@ -381,7 +379,7 @@ g_part_bsd_read(struct g_part_table *bas part.p_offset - table->offset + part.p_size - 1); entry = (struct g_part_bsd_entry *)baseentry; entry->part = part; - if (part.p_fstype == FS_UNUSED) + if (index == RAW_PART) baseentry->gpe_internal = 1; } From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 06:15:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A1AD1065672; Tue, 18 Nov 2008 06:15:11 +0000 (UTC) (envelope-from root@dchagin.dialup.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF978FC18; Tue, 18 Nov 2008 06:15:10 +0000 (UTC) (envelope-from root@dchagin.dialup.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id 2A49121BD6; Tue, 18 Nov 2008 09:15:07 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from dchagin.dialup.corbina.ru ([78.107.232.239] verified) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1464477105; Tue, 18 Nov 2008 09:15:07 +0300 Received: from dchagin.dialup.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.dialup.corbina.ru (8.14.3/8.14.3) with ESMTP id mAI6F6jb001642; Tue, 18 Nov 2008 09:15:06 +0300 (MSK) (envelope-from root@dchagin.dialup.corbina.ru) Received: (from root@localhost) by dchagin.dialup.corbina.ru (8.14.3/8.14.3/Submit) id mAI6F34G001641; Tue, 18 Nov 2008 09:15:03 +0300 (MSK) (envelope-from root) Date: Tue, 18 Nov 2008 09:15:03 +0300 From: Chagin Dmitry To: Kostik Belousov Message-ID: <20081118061503.GA1596@dchagin.dialup.corbina.ru> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> <200811171613.36602.jhb@freebsd.org> <20081117224048.GN90129@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081117224048.GN90129@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , Peter Wemm , John Baldwin , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 06:15:11 -0000 On Tue, Nov 18, 2008 at 12:40:48AM +0200, Kostik Belousov wrote: > On Mon, Nov 17, 2008 at 01:21:53PM -0800, Peter Wemm wrote: > > On Mon, Nov 17, 2008 at 1:13 PM, John Baldwin wrote: > > >> > > >> Ok, what about the following. I only compiled it on i386/amd64. And, > > >> there are more places to convert to such checks, for sure. > > >> > > >> [yummy patch] > > > > > > Commit! Note that this is not MFC'able due to ABI breakage for older linux.ko > > > modules, but this is the proper solution for 8.0+. > I do not think that sysent KBI shall be preserved on the stable branch, > it is too core functionality. Our KBI guarantee mostly center around > drivers and less so for filesystem modules. > > linux or any other ABI emulator probably do not deserve KBI stability > guarantee, IMHO. > > Anyway, I do not insist. > > > > > > > -- > > > John Baldwin > > > > > > > > > I was thinking of suggesting a macro to replace the verbose test if > > curproc->td_proc->p_sysent->sv_flags, but I couldn't think of > > something off the top of my head. > > > > - if (curthread->td_proc->p_sysent == > > &ia32_freebsd_sysvec) { > > + if (curthread->td_proc->p_sysent->sv_flags & SV_ILP32) { > > > > if (SV_FLAGS(curthread) & SV_ILP32) ... or the like. I'm not set on > > this, it just seemed like it might be worth mentioning. > > > > Also, change curthread->td_proc with curproc, for what its worth. > Did it. > > I discussed the change with Dmitry Chagin, and he wants explicit mark > of the image ABI, for linux64/amd64 work. > thnx! tested at dchagin# uname -a FreeBSD dchagin.dialup.corbina.ru 8.0-CURRENT FreeBSD 8.0-CURRENT #28 r185047: T ue Nov 18 08:55:27 MSK 2008 root@dchagin.dialup.corbina.ru:/usr/obj/usr/loca l/root/pub/head/sys/YOY amd64 > diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c > index ec1afc7..4f6d178 100644 > --- a/sys/amd64/amd64/elf_machdep.c > +++ b/sys/amd64/amd64/elf_machdep.c > @@ -72,7 +72,8 @@ struct sysentvec elf64_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_LP64 > }; > > static Elf64_Brandinfo freebsd_brand_info = { > diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c > index e233700..3acee30 100644 > --- a/sys/amd64/linux32/linux32_sysvec.c > +++ b/sys/amd64/linux32/linux32_sysvec.c > @@ -1026,6 +1026,7 @@ struct sysentvec elf_linux_sysvec = { > .sv_setregs = exec_linux_setregs, > .sv_fixlimit = linux32_fixlimit, > .sv_maxssiz = &linux32_maxssiz, > + .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 > }; > > static Elf32_Brandinfo linux_brand = { > diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c > index f44a622..693eab1 100644 > --- a/sys/arm/arm/elf_machdep.c > +++ b/sys/arm/arm/elf_machdep.c > @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c > index ef74ba0..0b32b9a 100644 > --- a/sys/compat/ia32/ia32_sysvec.c > +++ b/sys/compat/ia32/ia32_sysvec.c > @@ -135,7 +135,8 @@ struct sysentvec ia32_freebsd_sysvec = { > .sv_copyout_strings = ia32_copyout_strings, > .sv_setregs = ia32_setregs, > .sv_fixlimit = ia32_fixlimit, > - .sv_maxssiz = &ia32_maxssiz > + .sv_maxssiz = &ia32_maxssiz, > + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 > }; > > > diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c > index 60cca7b..63e8e54 100644 > --- a/sys/compat/svr4/svr4_sysvec.c > +++ b/sys/compat/svr4/svr4_sysvec.c > @@ -190,7 +190,8 @@ struct sysentvec svr4_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_UNDEF | SV_IA32 | SV_ILP32 > }; > > const char svr4_emul_path[] = "/compat/svr4"; > diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c > index 93f1d45..19eddd0 100644 > --- a/sys/i386/i386/elf_machdep.c > +++ b/sys/i386/i386/elf_machdep.c > @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/i386/ibcs2/ibcs2_sysvec.c b/sys/i386/ibcs2/ibcs2_sysvec.c > index 2c834dd..9112ed7 100644 > --- a/sys/i386/ibcs2/ibcs2_sysvec.c > +++ b/sys/i386/ibcs2/ibcs2_sysvec.c > @@ -85,7 +85,8 @@ struct sysentvec ibcs2_svr3_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_UNDEF | SV_IA32 | SV_ILP32 > }; > > static int > diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c > index a3acfc9..7444901 100644 > --- a/sys/i386/linux/linux_sysvec.c > +++ b/sys/i386/linux/linux_sysvec.c > @@ -837,7 +837,8 @@ struct sysentvec linux_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_linux_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32 > }; > > struct sysentvec elf_linux_sysvec = { > @@ -867,7 +868,8 @@ struct sysentvec elf_linux_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_linux_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 > }; > > static Elf32_Brandinfo linux_brand = { > diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c > index 94f4cdc..a3a6e57 100644 > --- a/sys/ia64/ia64/elf_machdep.c > +++ b/sys/ia64/ia64/elf_machdep.c > @@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_LP64 > }; > > static Elf64_Brandinfo freebsd_brand_info = { > diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c > index f4e4614..6c2f627 100644 > --- a/sys/kern/imgact_aout.c > +++ b/sys/kern/imgact_aout.c > @@ -82,7 +82,13 @@ struct sysentvec aout_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_AOUT | > +#if defined(__i386__) > + SV_IA32 | SV_ILP32 > +#else > +#error Choose SV_XXX flags for the platform > +#endif > }; > > static int > diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c > index dade1c2..3802259 100644 > --- a/sys/kern/kern_thr.c > +++ b/sys/kern/kern_thr.c > @@ -57,14 +57,12 @@ __FBSDID("$FreeBSD$"); > > #ifdef COMPAT_IA32 > > -extern struct sysentvec ia32_freebsd_sysvec; > - > static inline int > suword_lwpid(void *addr, lwpid_t lwpid) > { > int error; > > - if (curproc->p_sysent != &ia32_freebsd_sysvec) > + if (SV_CURPROC_FLAG(SV_LP64)) > error = suword(addr, lwpid); > else > error = suword32(addr, lwpid); > diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c > index eb587fb..9a7237d 100644 > --- a/sys/kern/uipc_socket.c > +++ b/sys/kern/uipc_socket.c > @@ -136,9 +136,8 @@ __FBSDID("$FreeBSD$"); > > #ifdef COMPAT_IA32 > #include > +#include > #include > - > -extern struct sysentvec ia32_freebsd_sysvec; > #endif > > static int soreceive_rcvoob(struct socket *so, struct uio *uio, > @@ -2277,7 +2276,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) > case SO_SNDTIMEO: > case SO_RCVTIMEO: > #ifdef COMPAT_IA32 > - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { > + if (SV_CURPROC_FLAG(SV_ILP32)) { > struct timeval32 tv32; > > error = sooptcopyin(sopt, &tv32, sizeof tv32, > @@ -2458,7 +2457,7 @@ integer: > tv.tv_sec = optval / hz; > tv.tv_usec = (optval % hz) * tick; > #ifdef COMPAT_IA32 > - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { > + if (SV_CURPROC_FLAG(SV_ILP32)) { > struct timeval32 tv32; > > CP(tv, tv32, tv_sec); > diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c > index 0234722..dc08bc2 100644 > --- a/sys/mips/mips/elf_machdep.c > +++ b/sys/mips/mips/elf_machdep.c > @@ -74,7 +74,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/powerpc/powerpc/elf_machdep.c b/sys/powerpc/powerpc/elf_machdep.c > index dadf3ca..69ac55b 100644 > --- a/sys/powerpc/powerpc/elf_machdep.c > +++ b/sys/powerpc/powerpc/elf_machdep.c > @@ -75,7 +75,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_machdep.c > index d1e610a..a956c5c 100644 > --- a/sys/sparc64/sparc64/elf_machdep.c > +++ b/sys/sparc64/sparc64/elf_machdep.c > @@ -87,7 +87,8 @@ static struct sysentvec elf64_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_LP64 > }; > > static Elf64_Brandinfo freebsd_brand_info = { > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > index 0ec07a7..c068946 100644 > --- a/sys/sys/sysent.h > +++ b/sys/sys/sysent.h > @@ -100,8 +100,22 @@ struct sysentvec { > void (*sv_setregs)(struct thread *, u_long, u_long, u_long); > void (*sv_fixlimit)(struct rlimit *, int); > u_long *sv_maxssiz; > + u_int sv_flags; > }; > > +#define SV_ILP32 0x000100 > +#define SV_LP64 0x000200 > +#define SV_IA32 0x004000 > +#define SV_AOUT 0x008000 > + > +#define SV_ABI_MASK 0xff > +#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x)) > +#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK) > +/* same as ELFOSABI_XXX, to prevent header pollution */ > +#define SV_ABI_LINUX 3 > +#define SV_ABI_FREEBSD 9 > +#define SV_ABI_UNDEF 255 > + > #ifdef _KERNEL > extern struct sysentvec aout_sysvec; > extern struct sysentvec elf_freebsd_sysvec; and what about target proc macro? -- Have fun! chd From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 11:06:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FC2D1065672; Tue, 18 Nov 2008 11:06:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 9B62C8FC21; Tue, 18 Nov 2008 11:06:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L2OMn-0005zI-LW; Tue, 18 Nov 2008 13:03:33 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAIAnhig066451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Nov 2008 12:49:43 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAIAnhcS009849; Tue, 18 Nov 2008 12:49:43 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAIAnhHs009847; Tue, 18 Nov 2008 12:49:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 18 Nov 2008 12:49:43 +0200 From: Kostik Belousov To: Chagin Dmitry Message-ID: <20081118104943.GO90129@deviant.kiev.zoral.com.ua> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> <200811171613.36602.jhb@freebsd.org> <20081117224048.GN90129@deviant.kiev.zoral.com.ua> <20081118061503.GA1596@dchagin.dialup.corbina.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="z4D23EFnZpzTzcHd" Content-Disposition: inline In-Reply-To: <20081118061503.GA1596@dchagin.dialup.corbina.ru> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L2OMn-0005zI-LW bc3a4f7a39c212d93f66c198b2d21285 X-Terabit: YES Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , Peter Wemm , John Baldwin , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 11:06:30 -0000 --z4D23EFnZpzTzcHd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 18, 2008 at 09:15:03AM +0300, Chagin Dmitry wrote: > thnx! tested at > dchagin# uname -a > FreeBSD dchagin.dialup.corbina.ru 8.0-CURRENT FreeBSD 8.0-CURRENT #28 r18= 5047: T > ue Nov 18 08:55:27 MSK 2008 root@dchagin.dialup.corbina.ru:/usr/obj/u= sr/loca > l/root/pub/head/sys/YOY amd64 Thanks, I will commit this after make universe finished. > > +#define SV_ABI_MASK 0xff > > +#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x)) > > +#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK) > > +/* same as ELFOSABI_XXX, to prevent header pollution */ > > +#define SV_ABI_LINUX 3 > > +#define SV_ABI_FREEBSD 9 > > +#define SV_ABI_UNDEF 255 > > + > > #ifdef _KERNEL > > extern struct sysentvec aout_sysvec; > > extern struct sysentvec elf_freebsd_sysvec; >=20 > and what about target proc macro? Do you mean macros similar to SV_CURPROC_FLAG(x) and SV_CURPROC_ABI(), but for arbitrary proc ? ATM, it is not needed in the tree, I think. We will introduce them as needed. --z4D23EFnZpzTzcHd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkincYACgkQC3+MBN1Mb4jH1ACfesseSm/I2OaDxYjM7FpPoruo W2oAn2KClqZm+7rZVkT4xO01ef89p9T6 =yJi3 -----END PGP SIGNATURE----- --z4D23EFnZpzTzcHd-- From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 12:43:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 798231065677; Tue, 18 Nov 2008 12:43:00 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6385C8FC14; Tue, 18 Nov 2008 12:43:00 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAICh0Gk078240; Tue, 18 Nov 2008 12:43:00 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAICh0bi078238; Tue, 18 Nov 2008 12:43:00 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200811181243.mAICh0bi078238@svn.freebsd.org> From: Stanislav Sedov Date: Tue, 18 Nov 2008 12:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185049 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 12:43:00 -0000 Author: stas Date: Tue Nov 18 12:42:59 2008 New Revision: 185049 URL: http://svn.freebsd.org/changeset/base/185049 Log: - Fix two minor errors in at91 code. PR: arm/128959 Submitted by: Bjorn Konig Approved by: kib (mentor) Modified: head/sys/arm/at91/at91_mci.c head/sys/arm/at91/uart_dev_at91usart.c Modified: head/sys/arm/at91/at91_mci.c ============================================================================== --- head/sys/arm/at91/at91_mci.c Tue Nov 18 05:55:58 2008 (r185048) +++ head/sys/arm/at91/at91_mci.c Tue Nov 18 12:42:59 2008 (r185049) @@ -176,7 +176,7 @@ at91_mci_attach(device_t dev) * Allocate DMA tags and maps */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, US_SPACE_MAXADDR, NULL, NULL, MAXPHYS, 1, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MAXPHYS, 1, MAXPHYS, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); if (err != 0) goto out; Modified: head/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- head/sys/arm/at91/uart_dev_at91usart.c Tue Nov 18 05:55:58 2008 (r185048) +++ head/sys/arm/at91/uart_dev_at91usart.c Tue Nov 18 12:42:59 2008 (r185049) @@ -350,7 +350,7 @@ at91_usart_bus_attach(struct uart_softc /* * Allocate DMA tags and maps */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + err = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, USART_BUFFER_SIZE, 1, USART_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL, &atsc->dmatag); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 13:24:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A4F21065678; Tue, 18 Nov 2008 13:24:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0018FC1E; Tue, 18 Nov 2008 13:24:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIDOcUY079098; Tue, 18 Nov 2008 13:24:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIDOcOc079096; Tue, 18 Nov 2008 13:24:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811181324.mAIDOcOc079096@svn.freebsd.org> From: Alexander Motin Date: Tue, 18 Nov 2008 13:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185050 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 13:24:38 -0000 Author: mav Date: Tue Nov 18 13:24:38 2008 New Revision: 185050 URL: http://svn.freebsd.org/changeset/base/185050 Log: Set of powerd enchancements: 1. Make it more SMP polite. Previous version uses average CPU load that often leads to load underestimation. It make powerd with default configuration unusable on systems with more then 2 CPUs. I propose to use summary load instead of average one. IMO this is the best we can do without specially tuned scheduler. Also as soon as measuring total load on SMP systems is more useful then total idle, I have switched to it. 2. Make powerd's operation independent from number and size of frequency levels. I have added internal frequency counter which translated into real frequencies only on a last stage and only as good as gone. Some systems may have only several power levels, while others - many of them, so adaptation time with previous approach was completely different. 3. As part of previous I have changed adaptive mode to rise frequency on demand up to 2 times and fall on 1/8 per time internal. 4. For desktop (AC-powered) systems I have added one more mode - "hiadaptive". It rises frequency twice faster, drops it 4 times slower, prefers twice lower CPU load and has additional delay before leaving the highest frequency after the period of maximum load. This mode was specially made to improve interactivity of the systems where operation capabilities are more significant then power consumption, but keeping maximum frequency all the time is not needed. 5. I have reduced default polling interval from 1/2 to 1/4 of second. It is not so important for algorithm math now, but gives better system interactivity. Discussed on: mobile@ Modified: head/usr.sbin/powerd/powerd.8 head/usr.sbin/powerd/powerd.c Modified: head/usr.sbin/powerd/powerd.8 ============================================================================== --- head/usr.sbin/powerd/powerd.8 Tue Nov 18 12:42:59 2008 (r185049) +++ head/usr.sbin/powerd/powerd.8 Tue Nov 18 13:24:38 2008 (r185050) @@ -47,7 +47,8 @@ utility monitors the system state and se accordingly. It offers three modes (maximum, minimum, and adaptive) that can be individually selected while on AC power or batteries. -The modes maximum, minimum, and adaptive may be abbreviated max, min, adp. +The modes maximum, minimum, adaptive and hiadaptive may be abbreviated +max, min, adp, hadp. .Pp Maximum mode chooses the highest performance values. Minimum mode selects the lowest performance values to get the most power @@ -56,8 +57,10 @@ Adaptive mode attempts to strike a balan the system appears idle and increasing it when the system is busy. It offers a good balance between a small performance loss for greatly increased power savings. -The default mode is -adaptive. +Hiadaptive mode is alike adaptive mode, but tuned for systems where +performance and interactivity are more important then power consumption. +It rises frequency faster, drops slower and keeps twice lower CPU load. +The default mode is adaptive for battery power and hiadaptive for the rest. .Pp The .Nm @@ -72,10 +75,9 @@ Selects the .Ar mode to use while on battery power. .It Fl i Ar percent -Specifies the CPU idle percent level when -adaptive +Specifies the CPU load percent level when adaptive mode should begin to degrade performance to save power. -The default is 90% or higher. +The default is 50% or lower. .It Fl n Ar mode Selects the .Ar mode @@ -83,16 +85,15 @@ to use normally when the AC line state i .It Fl p Ar ival Specifies a different polling interval (in milliseconds) for AC line state and system idle levels. -The default is 500 ms. +The default is 250 ms. .It Fl P Ar pidfile Specifies an alternative file in which the process ID should be stored. The default is .Pa /var/run/powerd.pid . .It Fl r Ar percent -Specifies the CPU idle percent level where -adaptive +Specifies the CPU load percent level where adaptive mode should consider the CPU running and increase performance. -The default is 65% or lower. +The default is 75% or higther. .It Fl v Verbose mode. Messages about power changes will be printed to stdout and Modified: head/usr.sbin/powerd/powerd.c ============================================================================== --- head/usr.sbin/powerd/powerd.c Tue Nov 18 12:42:59 2008 (r185049) +++ head/usr.sbin/powerd/powerd.c Tue Nov 18 13:24:38 2008 (r185050) @@ -50,13 +50,14 @@ __FBSDID("$FreeBSD$"); #include #endif -#define DEFAULT_ACTIVE_PERCENT 65 -#define DEFAULT_IDLE_PERCENT 90 -#define DEFAULT_POLL_INTERVAL 500 /* Poll interval in milliseconds */ +#define DEFAULT_ACTIVE_PERCENT 75 +#define DEFAULT_IDLE_PERCENT 50 +#define DEFAULT_POLL_INTERVAL 250 /* Poll interval in milliseconds */ typedef enum { MODE_MIN, MODE_ADAPTIVE, + MODE_HIADAPTIVE, MODE_MAX, } modes_t; @@ -77,7 +78,7 @@ const char *modes[] = { #define DEVDPIPE "/var/run/devd.pipe" #define DEVCTL_MAXBUF 1024 -static int read_usage_times(long *idle, long *total); +static int read_usage_times(int *load); static int read_freqs(int *numfreqs, int **freqs, int **power); static int set_freq(int freq); static void acline_init(void); @@ -89,7 +90,7 @@ static void parse_mode(char *arg, int *m static void usage(void); /* Sysctl data structures. */ -static int cp_time_mib[2]; +static int cp_times_mib[2]; static int freq_mib[4]; static int levels_mib[4]; static int acline_mib[3]; @@ -119,27 +120,49 @@ static int devd_pipe = -1; static struct timeval tried_devd; static int -read_usage_times(long *idle, long *total) +read_usage_times(int *load) { - static long idle_old, total_old; - long cp_time[CPUSTATES], i, total_new; - size_t cp_time_len; - int error; + static long *cp_times = NULL, *cp_times_old = NULL; + static int ncpus = 0; + size_t cp_times_len; + int error, cpu, i, total; + + if (cp_times == NULL) { + cp_times_len = 0; + error = sysctl(cp_times_mib, 2, NULL, &cp_times_len, NULL, 0); + if (error) + return (error); + if ((cp_times = malloc(cp_times_len)) == NULL) + return (errno); + if ((cp_times_old = malloc(cp_times_len)) == NULL) { + free(cp_times); + cp_times = NULL; + return (errno); + } + ncpus = cp_times_len / (sizeof(long) * CPUSTATES); + } - cp_time_len = sizeof(cp_time); - error = sysctl(cp_time_mib, 2, cp_time, &cp_time_len, NULL, 0); + cp_times_len = sizeof(long) * CPUSTATES * ncpus; + error = sysctl(cp_times_mib, 2, cp_times, &cp_times_len, NULL, 0); if (error) return (error); - for (total_new = 0, i = 0; i < CPUSTATES; i++) - total_new += cp_time[i]; - - if (idle) - *idle = cp_time[CP_IDLE] - idle_old; - if (total) - *total = total_new - total_old; + + if (load) { + *load = 0; + for (cpu = 0; cpu < ncpus; cpu++) { + total = 0; + for (i = 0; i < CPUSTATES; i++) { + total += cp_times[cpu * CPUSTATES + i] - + cp_times_old[cpu * CPUSTATES + i]; + } + if (total == 0) + continue; + *load += 100 - (cp_times[cpu * CPUSTATES + CP_IDLE] - + cp_times_old[cpu * CPUSTATES + CP_IDLE]) * 100 / total; + } + } - idle_old = cp_time[CP_IDLE]; - total_old = total_new; + memcpy(cp_times_old, cp_times, cp_times_len); return (0); } @@ -190,6 +213,21 @@ read_freqs(int *numfreqs, int **freqs, i } static int +get_freq(void) +{ + size_t len; + int curfreq; + + len = sizeof(curfreq); + if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) != 0) { + if (vflag) + warn("error reading current CPU frequency"); + curfreq = 0; + } + return (curfreq); +} + +static int set_freq(int freq) { @@ -201,6 +239,19 @@ set_freq(int freq) return (0); } +static int +get_freq_id(int freq, int *freqs, int numfreqs) +{ + int i = 1; + + while (i < numfreqs) { + if (freqs[i] < freq) + break; + i++; + } + return (i - 1); +} + /* * Try to use ACPI to find the AC line status. If this fails, fall back * to APM. If nothing succeeds, we'll just run in default mode. @@ -341,6 +392,8 @@ parse_mode(char *arg, int *mode, int ch) *mode = MODE_MAX; else if (strcmp(arg, "adaptive") == 0 || strcmp(arg, "adp") == 0) *mode = MODE_ADAPTIVE; + else if (strcmp(arg, "hiadaptive") == 0 || strcmp(arg, "hadp") == 0) + *mode = MODE_HIADAPTIVE; else errx(1, "bad option: -%c %s", (char)ch, optarg); } @@ -369,14 +422,14 @@ main(int argc, char * argv[]) int nfds; struct pidfh *pfh = NULL; const char *pidfile = NULL; - long idle, total; - int curfreq, *freqs, i, *mwatts, numfreqs; + int freq, curfreq, *freqs, i, j, *mwatts, numfreqs, load; int ch, mode, mode_ac, mode_battery, mode_none; uint64_t mjoules_used; size_t len; /* Default mode for all AC states is adaptive. */ - mode_ac = mode_battery = mode_none = MODE_ADAPTIVE; + mode_ac = mode_none = MODE_HIADAPTIVE; + mode_battery = MODE_ADAPTIVE; cpu_running_mark = DEFAULT_ACTIVE_PERCENT; cpu_idle_mark = DEFAULT_IDLE_PERCENT; poll_ival = DEFAULT_POLL_INTERVAL; @@ -418,7 +471,7 @@ main(int argc, char * argv[]) break; case 'r': cpu_running_mark = atoi(optarg); - if (cpu_running_mark < 0 || cpu_running_mark > 100) { + if (cpu_running_mark <= 0 || cpu_running_mark > 100) { warnx("%d is not a valid percent", cpu_running_mark); usage(); @@ -438,8 +491,8 @@ main(int argc, char * argv[]) /* Look up various sysctl MIBs. */ len = 2; - if (sysctlnametomib("kern.cp_time", cp_time_mib, &len)) - err(1, "lookup kern.cp_time"); + if (sysctlnametomib("kern.cp_times", cp_times_mib, &len)) + err(1, "lookup kern.cp_times"); len = 4; if (sysctlnametomib("dev.cpu.0.freq", freq_mib, &len)) err(1, "lookup freq"); @@ -447,8 +500,8 @@ main(int argc, char * argv[]) if (sysctlnametomib("dev.cpu.0.freq_levels", levels_mib, &len)) err(1, "lookup freq_levels"); - /* Check if we can read the idle time and supported freqs. */ - if (read_usage_times(NULL, NULL)) + /* Check if we can read the load and supported freqs. */ + if (read_usage_times(NULL)) err(1, "read_usage_times"); if (read_freqs(&numfreqs, &freqs, &mwatts)) err(1, "error reading supported CPU frequencies"); @@ -483,6 +536,9 @@ main(int argc, char * argv[]) signal(SIGINT, handle_sigs); signal(SIGTERM, handle_sigs); + freq = get_freq(); + if (freq < 1) + freq = 1; /* Main loop. */ for (;;) { FD_ZERO(&fdset); @@ -522,37 +578,30 @@ main(int argc, char * argv[]) } /* Read the current frequency. */ - len = sizeof(curfreq); - if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) != 0) { - if (vflag) - warn("error reading current CPU frequency"); + if ((curfreq = get_freq()) == 0) continue; - } + i = get_freq_id(curfreq, freqs, numfreqs); + if (vflag) { - for (i = 0; i < numfreqs; i++) { - if (freqs[i] == curfreq) - break; - } - /* Keep a sum of all power actually used. */ - if (i < numfreqs && mwatts[i] != -1) + if (mwatts[i] != -1) mjoules_used += (mwatts[i] * (poll_ival / 1000)) / 1000; } /* Always switch to the lowest frequency in min mode. */ if (mode == MODE_MIN) { - if (curfreq != freqs[numfreqs - 1]) { + freq = freqs[numfreqs - 1]; + if (curfreq != freq) { if (vflag) { printf("now operating on %s power; " "changing frequency to %d MHz\n", - modes[acline_status], - freqs[numfreqs - 1]); + modes[acline_status], freq); } - if (set_freq(freqs[numfreqs - 1]) != 0) { + if (set_freq(freq) != 0) { warn("error setting CPU freq %d", - freqs[numfreqs - 1]); + freq); continue; } } @@ -561,16 +610,16 @@ main(int argc, char * argv[]) /* Always switch to the highest frequency in max mode. */ if (mode == MODE_MAX) { - if (curfreq != freqs[0]) { + freq = freqs[0]; + if (curfreq != freq) { if (vflag) { printf("now operating on %s power; " "changing frequency to %d MHz\n", - modes[acline_status], - freqs[0]); + modes[acline_status], freq); } - if (set_freq(freqs[0]) != 0) { + if (set_freq(freq) != 0) { warn("error setting CPU freq %d", - freqs[0]); + freq); continue; } } @@ -578,44 +627,59 @@ main(int argc, char * argv[]) } /* Adaptive mode; get the current CPU usage times. */ - if (read_usage_times(&idle, &total)) { + if (read_usage_times(&load)) { if (vflag) warn("read_usage_times() failed"); continue; } - - /* - * If we're idle less than the active mark, bump up two levels. - * If we're idle more than the idle mark, drop down one level. - */ - for (i = 0; i < numfreqs - 1; i++) { - if (freqs[i] == curfreq) - break; - } - if (idle < (total * cpu_running_mark) / 100 && - curfreq < freqs[0]) { - i -= 2; - if (i < 0) - i = 0; - if (vflag) { - printf("idle time < %d%%, increasing clock" - " speed from %d MHz to %d MHz\n", - cpu_running_mark, curfreq, freqs[i]); + + if (mode == MODE_ADAPTIVE) { + if (load > cpu_running_mark) { + if (load > 95 || load > cpu_running_mark * 2) + freq *= 2; + else + freq = freq * load / cpu_running_mark; + if (freq > freqs[0]) + freq = freqs[0]; + } else if (load < cpu_idle_mark && + curfreq * load < freqs[get_freq_id( + freq * 7 / 8, freqs, numfreqs)] * + cpu_running_mark) { + freq = freq * 7 / 8; + if (freq < freqs[numfreqs - 1]) + freq = freqs[numfreqs - 1]; } - if (set_freq(freqs[i])) - warn("error setting CPU frequency %d", - freqs[i]); - } else if (idle > (total * cpu_idle_mark) / 100 && - curfreq > freqs[numfreqs - 1]) { - i++; + } else { /* MODE_HIADAPTIVE */ + if (load > cpu_running_mark / 2) { + if (load > 95 || load > cpu_running_mark) + freq *= 4; + else + freq = freq * load * 2 / cpu_running_mark; + if (freq > freqs[0] * 2) + freq = freqs[0] * 2; + } else if (load < cpu_idle_mark / 2 && + curfreq * load < freqs[get_freq_id( + freq * 31 / 32, freqs, numfreqs)] * + cpu_running_mark / 2) { + freq = freq * 31 / 32; + if (freq < freqs[numfreqs - 1]) + freq = freqs[numfreqs - 1]; + } + } + if (vflag) { + printf("load %3d%%, current freq %4d MHz (%2d), wanted freq %4d MHz\n", + load, curfreq, i, freq); + } + j = get_freq_id(freq, freqs, numfreqs); + if (i != j) { if (vflag) { - printf("idle time > %d%%, decreasing clock" + printf("changing clock" " speed from %d MHz to %d MHz\n", - cpu_idle_mark, curfreq, freqs[i]); + freqs[i], freqs[j]); } - if (set_freq(freqs[i]) != 0) + if (set_freq(freqs[j])) warn("error setting CPU frequency %d", - freqs[i]); + freqs[j]); } } free(freqs); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 14:05:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8C031065678; Tue, 18 Nov 2008 14:05:11 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B96C38FC0C; Tue, 18 Nov 2008 14:05:11 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIE5B0S079957; Tue, 18 Nov 2008 14:05:11 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIE5BaB079955; Tue, 18 Nov 2008 14:05:11 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <200811181405.mAIE5BaB079955@svn.freebsd.org> From: Peter Holm Date: Tue, 18 Nov 2008 14:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185052 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 14:05:11 -0000 Author: pho Date: Tue Nov 18 14:05:11 2008 New Revision: 185052 URL: http://svn.freebsd.org/changeset/base/185052 Log: Add myself Approved by: kib (mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Tue Nov 18 13:36:01 2008 (r185051) +++ head/share/misc/committers-src.dot Tue Nov 18 14:05:11 2008 (r185052) @@ -142,6 +142,7 @@ peadar [label="Peter Edwards\npeadar@Fre peter [label="Peter Wemm\npeter@FreeBSD.org\n????/??/??"] philip [label="Philip Paeps\nphilip@FreBSD.org\n2004/01/21"] phk [label="Poul-Henning Kamp\nphk@FreeBSD.org\n1994/02/21"] +pho [label="Peter Holm \npho@FreeBSD.org\n2008/11/16"] pjd [label="Pawel Jakub Dawidek\npjd@FreeBSD.org\n2004/02/02"] ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"] qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"] Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Tue Nov 18 13:36:01 2008 (r185051) +++ head/usr.bin/calendar/calendars/calendar.freebsd Tue Nov 18 14:05:11 2008 (r185052) @@ -203,6 +203,7 @@ 07/29 Dirk Meyer born in Kassel, Hessen, Germany, 1965 07/29 Felippe M. Motta born in Maceio, Alagoas, Brazil, 1988 08/02 Gabor Kovesdan born in Budapest, Hungary, 1987 +08/03 Peter Holm born in Copenhagen, Denmark, 1955 08/05 Alfred Perlstein born in Brooklyn, New York, United States, 1978 08/06 Anton Berezin born in Dnepropetrovsk, Ukraine, 1970 08/06 John-Mark Gurney born in Detroit, Michigan, United States, 1978 From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 15:02:34 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A90B7106564A; Tue, 18 Nov 2008 15:02:34 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw2.york.ac.uk (mail-gw2.york.ac.uk [144.32.128.247]) by mx1.freebsd.org (Postfix) with ESMTP id 285768FC13; Tue, 18 Nov 2008 15:02:33 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw6.york.ac.uk (mail-gw6.york.ac.uk [144.32.129.26]) by mail-gw2.york.ac.uk (8.13.6/8.13.6) with ESMTP id mAIEUFlQ006102; Tue, 18 Nov 2008 14:30:16 GMT Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk) by mail-gw6.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1L2Rap-0004ej-SP; Tue, 18 Nov 2008 14:30:15 +0000 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.2/8.14.2) with ESMTP id mAIEUFCH025380; Tue, 18 Nov 2008 14:30:15 GMT (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.2/8.14.2/Submit) id mAIEUFGi025379; Tue, 18 Nov 2008 14:30:15 GMT (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Alexander Motin In-Reply-To: <200811181324.mAIDOcOc079096@svn.freebsd.org> References: <200811181324.mAIDOcOc079096@svn.freebsd.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 18 Nov 2008 14:30:15 +0000 Message-Id: <1227018615.23755.27.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port X-York-MailScanner: Found to be clean X-York-MailScanner-From: gavin@freebsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185050 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 15:02:34 -0000 On Tue, 2008-11-18 at 13:24 +0000, Alexander Motin wrote: > Author: mav > Date: Tue Nov 18 13:24:38 2008 > New Revision: 185050 > URL: http://svn.freebsd.org/changeset/base/185050 > > Log: > Set of powerd enchancements: > > 1. Make it more SMP polite. Previous version uses average CPU load that > often leads to load underestimation. It make powerd with default > configuration unusable on systems with more then 2 CPUs. I propose to use > summary load instead of average one. IMO this is the best we can do without > specially tuned scheduler. Also as soon as measuring total load on SMP > systems is more useful then total idle, I have switched to it. PRs: bin/125141 bin/119589 (and possibly others) > 4. For desktop (AC-powered) systems I have added one more mode - "hiadaptive". > It rises frequency twice faster, drops it 4 times slower, prefers twice > lower CPU load and has additional delay before leaving the highest frequency > after the period of maximum load. This mode was specially made to improve > interactivity of the systems where operation capabilities are more > significant then power consumption, but keeping maximum frequency all the > time is not needed. Thanks for this change! Also, I wonder if you would consider looking at the other powerd(8) PRs: http://people.freebsd.org/~linimon/studies/prs/prs_for_manpage_powerd(8).html There are a couple of simple looking PRs there, especially bin/113813 which keeps biting me :) Thanks! Gavin From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 15:39:04 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 249F61065679 for ; Tue, 18 Nov 2008 15:39:04 +0000 (UTC) (envelope-from joao.barros@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.185]) by mx1.freebsd.org (Postfix) with ESMTP id A2AF58FC17 for ; Tue, 18 Nov 2008 15:39:03 +0000 (UTC) (envelope-from joao.barros@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so3572731fkk.11 for ; Tue, 18 Nov 2008 07:39:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=UDRSFfV3BKYUz5YIB9s7iozJWR1N0qZ3wo7ida8NtCc=; b=jx+LJ4b0dbs2qBqT8/oo2iSTlyotnXBDfJ+zFey3EB2+stwFGy7jgGA0MkAYI4qVW+ G2IaoBE2dNvioxTBUqqQPyeiPoLNuhjLT3MfhbTc2aPE8J4DOFGt5Zi43PKe2zLY9y+e KqwLlhMf9zN435r2j4id9R5wNeKzyZwdII1ak= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=bp4pRqREMH/3MTEi/VCayFvAfBUfpszJS6BFHcnDXZwdJ8S/ZlCITSxhbjGJqwX+ah Ot/hF43+p3lefd4MxuLUXkSnlbzvhW0h/2TNW/D6RduAOkJvK327J5HmhAhJtOSOsWmr 8EFvsWWjYXnXHqPWxqi2FzJYajjDeHH12SKNg= Received: by 10.180.204.10 with SMTP id b10mr1345276bkg.201.1227022742179; Tue, 18 Nov 2008 07:39:02 -0800 (PST) Received: by 10.180.236.13 with HTTP; Tue, 18 Nov 2008 07:39:02 -0800 (PST) Message-ID: <70e8236f0811180739v5d843a9egfff6c0075103b9cf@mail.gmail.com> Date: Tue, 18 Nov 2008 15:39:02 +0000 From: "Joao Barros" To: "Pawel Jakub Dawidek" In-Reply-To: <200811172049.mAHKnUDw092510@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811172049.mAHKnUDw092510@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 15:39:04 -0000 On Mon, Nov 17, 2008 at 8:49 PM, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Nov 17 20:49:29 2008 > New Revision: 185029 > URL: http://svn.freebsd.org/changeset/base/185029 > > Log: > Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. I get: /usr/src/sys/boot/zfs.c:1: error: -mpreferred-stack-boundary=2 is not between 4 and 12 when compiling with LOADER_ZFS_SUPPORT=YES on amd64 There's a note on the Makefile about this, just wanted to show a case where make fu is needed. -- Joao Barros From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 15:48:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AE321065735; Tue, 18 Nov 2008 15:48:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BD598FC18; Tue, 18 Nov 2008 15:48:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIFmNM3081973; Tue, 18 Nov 2008 15:48:23 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIFmNuL081972; Tue, 18 Nov 2008 15:48:23 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811181548.mAIFmNuL081972@svn.freebsd.org> From: Alexander Motin Date: Tue, 18 Nov 2008 15:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185053 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 15:48:23 -0000 Author: mav Date: Tue Nov 18 15:48:23 2008 New Revision: 185053 URL: http://svn.freebsd.org/changeset/base/185053 Log: Restore original frequency on exit. PR: bin/113813 Modified: head/usr.sbin/powerd/powerd.c Modified: head/usr.sbin/powerd/powerd.c ============================================================================== --- head/usr.sbin/powerd/powerd.c Tue Nov 18 14:05:11 2008 (r185052) +++ head/usr.sbin/powerd/powerd.c Tue Nov 18 15:48:23 2008 (r185053) @@ -422,7 +422,7 @@ main(int argc, char * argv[]) int nfds; struct pidfh *pfh = NULL; const char *pidfile = NULL; - int freq, curfreq, *freqs, i, j, *mwatts, numfreqs, load; + int freq, curfreq, initfreq, *freqs, i, j, *mwatts, numfreqs, load; int ch, mode, mode_ac, mode_battery, mode_none; uint64_t mjoules_used; size_t len; @@ -536,7 +536,7 @@ main(int argc, char * argv[]) signal(SIGINT, handle_sigs); signal(SIGTERM, handle_sigs); - freq = get_freq(); + freq = initfreq = get_freq(); if (freq < 1) freq = 1; /* Main loop. */ @@ -682,6 +682,8 @@ main(int argc, char * argv[]) freqs[j]); } } + if (set_freq(initfreq)) + warn("error setting CPU frequency %d", initfreq); free(freqs); free(mwatts); devd_close(); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 18:21:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBBFF1065673; Tue, 18 Nov 2008 18:21:36 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC6448FC1D; Tue, 18 Nov 2008 18:21:36 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIILaCR084887; Tue, 18 Nov 2008 18:21:36 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIILa1W084886; Tue, 18 Nov 2008 18:21:36 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <200811181821.mAIILa1W084886@svn.freebsd.org> From: Doug Ambrisko Date: Tue, 18 Nov 2008 18:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185054 - in stable/7/sys: . ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 18:21:36 -0000 Author: ambrisko Date: Tue Nov 18 18:21:36 2008 New Revision: 185054 URL: http://svn.freebsd.org/changeset/base/185054 Log: MFC 184934: For now on every 10 cyclinder groups flush the buffer cache to free up space. If the buffer cache fills up then the disk systems can grind to a halt. PR: 128832 Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/ufs/ffs/ffs_snapshot.c Modified: stable/7/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_snapshot.c Tue Nov 18 15:48:23 2008 (r185053) +++ stable/7/sys/ufs/ffs/ffs_snapshot.c Tue Nov 18 18:21:36 2008 (r185054) @@ -345,6 +345,8 @@ restart: if (error) goto out; bawrite(nbp); + if (cg % 10 == 0) + ffs_syncvnode(vp, MNT_WAIT); } /* * Copy all the cylinder group maps. Although the @@ -366,6 +368,8 @@ restart: goto out; error = cgaccount(cg, vp, nbp, 1); bawrite(nbp); + if (cg % 10 == 0) + ffs_syncvnode(vp, MNT_WAIT); if (error) goto out; } From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 18:40:32 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF4121065675; Tue, 18 Nov 2008 18:40:32 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFB5A8FC16; Tue, 18 Nov 2008 18:40:32 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIIeWp2085342; Tue, 18 Nov 2008 18:40:32 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIIeWON085341; Tue, 18 Nov 2008 18:40:32 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200811181840.mAIIeWON085341@svn.freebsd.org> From: Hiroki Sato Date: Tue, 18 Nov 2008 18:40:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185055 - stable/6/release/doc/en_US.ISO8859-1/errata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 18:40:32 -0000 Author: hrs Date: Tue Nov 18 18:40:32 2008 New Revision: 185055 URL: http://svn.freebsd.org/changeset/base/185055 Log: Trim errata document. Approved by: re (implicit) Modified: stable/6/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/6/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/6/release/doc/en_US.ISO8859-1/errata/article.sgml Tue Nov 18 18:21:36 2008 (r185054) +++ stable/6/release/doc/en_US.ISO8859-1/errata/article.sgml Tue Nov 18 18:40:32 2008 (r185055) @@ -16,7 +16,7 @@ %release; - + ]>
@@ -62,7 +62,8 @@ &os;. This errata document for &os; &release.bugfix; - will be maintained until the release of &os; &release.next;. + will be maintained until the end of 6.4-STABLE development + line support. @@ -96,21 +97,7 @@ Late-Breaking News and Corrections - [20080204] The ISO images of &os; &release.bugfix; are sized - for 700MB CD-ROM media (ISO images of all prior versions assumed - 650MB media). This fact should have been mentioned in the - release notes. - - [20080204] Contrary to the release notes, ipfwpcap(8) - is not a feature included in &os; - &release.bugfix;. It was merged to the &release.branch; - codeline after the release branch was created. This utility - will be included in subsequent snapshots of &release.branch; and in - &release.next;. - - [20080229] The release notes gave an incorrect version - number for KDE. The correct version number is 3.5.8. - + No news. @@ -120,7 +107,9 @@ For more information, consult the individual advisories available from . + No advisories. + Known Problems and Solutions - [20080229] A bug in Linux emulation may cause segmentation - faults for some Linux programs using &man.mmap.2;. This issue - has been fixed on the HEAD and RELENG_6 branches. - - [20080229, updated 20080420] Multithreaded programs that perform a - &man.fork.2; operation may crash due to a race condition in the - threading library. This problem has been fixed on the HEAD, - RELENG_6, and RELENG_6_3 branches, and is addressed by errata - notice - FreeBSD-EN-08:01.libpthread. - - - [20080307] When using &man.sysinstall.8; to install the - X.org packages, selecting only specific components to be - installed may result in - the x11/xorg-drivers package - not being installed, and a corresponding failure of X.org server - to configure itself correctly. The recommended way to a - functioning X.org installation is simply to - select All from the Distributions - menu. - - [20080420] A reference counting bug in the IP multicast code - could cause kernel panics under some circumstances. It has been - fixed on the RELENG_6 branch by - revision 1.85.2.10 - of sys/netinet/in.c. - + No news.
From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 18:43:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44D9F1065677; Tue, 18 Nov 2008 18:43:45 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 364978FC19; Tue, 18 Nov 2008 18:43:45 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIIhjZm085437; Tue, 18 Nov 2008 18:43:45 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIIhjrJ085436; Tue, 18 Nov 2008 18:43:45 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200811181843.mAIIhjrJ085436@svn.freebsd.org> From: Hiroki Sato Date: Tue, 18 Nov 2008 18:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185056 - stable/6/release/doc/share/sgml X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 18:43:45 -0000 Author: hrs Date: Tue Nov 18 18:43:44 2008 New Revision: 185056 URL: http://svn.freebsd.org/changeset/base/185056 Log: Update &release.*;. Approved by: re (implicit) Modified: stable/6/release/doc/share/sgml/release.ent Modified: stable/6/release/doc/share/sgml/release.ent ============================================================================== --- stable/6/release/doc/share/sgml/release.ent Tue Nov 18 18:40:32 2008 (r185055) +++ stable/6/release/doc/share/sgml/release.ent Tue Nov 18 18:43:44 2008 (r185056) @@ -6,7 +6,7 @@ - + - - - + + - + From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 20:38:07 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE7641065670; Tue, 18 Nov 2008 20:38:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD9D38FC08; Tue, 18 Nov 2008 20:38:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIKc78u088240; Tue, 18 Nov 2008 20:38:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIKc7hZ088239; Tue, 18 Nov 2008 20:38:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811182038.mAIKc7hZ088239@svn.freebsd.org> From: Xin LI Date: Tue, 18 Nov 2008 20:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185057 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 20:38:08 -0000 Author: delphij Date: Tue Nov 18 20:38:07 2008 New Revision: 185057 URL: http://svn.freebsd.org/changeset/base/185057 Log: Grammar improvements. Submitted by: kensmith Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Tue Nov 18 18:43:44 2008 (r185056) +++ head/sbin/geom/class/part/gpart.8 Tue Nov 18 20:38:07 2008 (r185057) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 9, 2008 +.Dd Nov 18, 2008 .Dt GPART 8 .Os .Sh NAME @@ -423,9 +423,9 @@ partition that can boot FreeBSD from a partition, and install bootstrap code into it. This partition must be larger than .Pa /boot/gptboot , -or the GPT boot you are willing to write, -a size of 15 blocks (7680 bytes) would be sufficient for -booting from UFS, but let's use 128 blocks (64 KB) here in +or the GPT boot you are planning to write. +A size of 15 blocks (7680 bytes) would be sufficient for +booting from UFS but lets use 128 blocks (64 KB) here in this example, in order to reserve some space for potential future need (e.g. from a ZFS partition). .Bd -literal -offset indent From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 20:41:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16A021065674; Tue, 18 Nov 2008 20:41:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 049578FC18; Tue, 18 Nov 2008 20:41:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIKfEve088370; Tue, 18 Nov 2008 20:41:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIKfE4W088369; Tue, 18 Nov 2008 20:41:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811182041.mAIKfE4W088369@svn.freebsd.org> From: Xin LI Date: Tue, 18 Nov 2008 20:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185058 - in stable/7/sbin/geom: . class/part misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 20:41:15 -0000 Author: delphij Date: Tue Nov 18 20:41:14 2008 New Revision: 185058 URL: http://svn.freebsd.org/changeset/base/185058 Log: MFC r183718 and r185057: Add some examples to demostrate gpart(8). Approved by: re (kib) Modified: stable/7/sbin/geom/ (props changed) stable/7/sbin/geom/class/part/ (props changed) stable/7/sbin/geom/class/part/gpart.8 stable/7/sbin/geom/misc/ (props changed) Modified: stable/7/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/7/sbin/geom/class/part/gpart.8 Tue Nov 18 20:38:07 2008 (r185057) +++ stable/7/sbin/geom/class/part/gpart.8 Tue Nov 18 20:41:14 2008 (r185058) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jun 17, 2008 +.Dd Nov 18, 2008 .Dt GPART 8 .Os .Sh NAME @@ -404,6 +404,41 @@ action or reverted with the action. .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. +.Sh EXAMPLES +Create GPT scheme on +.Pa ad0 . +.Bd -literal -offset indent +/sbin/gpart create -s GPT ad0 +.Ed +.Pp +Embed GPT bootstrap code into protective MBR. +.Bd -literal -offset indent +/sbin/gpart bootcode -b /boot/pmbr ad0 +.Ed +.Pp +Create a dedicated +.Pa freebsd-boot +partition that can boot FreeBSD from a +.Pa freebsd-ufs +partition, and install bootstrap code into it. +This partition must be larger than +.Pa /boot/gptboot , +or the GPT boot you are planning to write. +A size of 15 blocks (7680 bytes) would be sufficient for +booting from UFS but lets use 128 blocks (64 KB) here in +this example, in order to reserve some space for potential +future need (e.g. from a ZFS partition). +.Bd -literal -offset indent +/sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0 +/sbin/gpart bootcode -p /boot/gptboot -i 1 ad0 +.Ed +.Pp +Create a 512MB-sized +.Pa freebsd-ufs +partition that would contain UFS where the system boot from. +.Bd -literal -offset indent +/sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0 +.Ed .Sh SEE ALSO .Xr geom 4 , .Xr geom 8 , From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 20:49:29 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B62461065670; Tue, 18 Nov 2008 20:49:29 +0000 (UTC) (envelope-from maxim@macomnet.ru) Received: from mp2.macomnet.net (cl-2958.ham-01.de.sixxs.net [IPv6:2001:6f8:900:b8d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 38F598FC13; Tue, 18 Nov 2008 20:49:29 +0000 (UTC) (envelope-from maxim@macomnet.ru) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.14.2/8.14.2) with ESMTP id mAIKnRff037114; Tue, 18 Nov 2008 23:49:27 +0300 (MSK) (envelope-from maxim@macomnet.ru) Date: Tue, 18 Nov 2008 23:49:27 +0300 (MSK) From: Maxim Konovalov To: Alexander Motin In-Reply-To: <200811181548.mAIFmNuL081972@svn.freebsd.org> Message-ID: <20081118234224.M56769@mp2.macomnet.net> References: <200811181548.mAIFmNuL081972@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r185053 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 20:49:29 -0000 On Tue, 18 Nov 2008, 15:48-0000, Alexander Motin wrote: > Author: mav > Date: Tue Nov 18 15:48:23 2008 > New Revision: 185053 > URL: http://svn.freebsd.org/changeset/base/185053 > > Log: > Restore original frequency on exit. > > PR: bin/113813 > [ patch skipped ] Not sure this is a correct aproach. What happen if admin changed (rose or lowered) the debug.cpufreq.lowest after he run powerd? So imho at exit we need to take an account a current value of debug.cpufreq.lowest. -- Maxim Konovalov From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 21:01:55 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D1F71065677; Tue, 18 Nov 2008 21:01:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE3048FC27; Tue, 18 Nov 2008 21:01:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIL1sAn088862; Tue, 18 Nov 2008 21:01:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIL1sFK088852; Tue, 18 Nov 2008 21:01:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811182101.mAIL1sFK088852@svn.freebsd.org> From: John Baldwin Date: Tue, 18 Nov 2008 21:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185059 - in head/sys: dev/acpica dev/sio isa kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 21:01:55 -0000 Author: jhb Date: Tue Nov 18 21:01:54 2008 New Revision: 185059 URL: http://svn.freebsd.org/changeset/base/185059 Log: Allow device hints to wire the unit numbers of devices. - An "at" hint now reserves a device name. - A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When determining the unit number of a device, this method is invoked to let the bus driver specify the unit of a device given a specific devclass. This is the only way a device can be given a name reserved via an "at" hint. - Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers. Both of these busses implement this by comparing the resources for a given hint device with the resources enumerated by ACPI/PnPBIOS and wire a unit if the hint resources are a subset of the "real" resources. - Use bus_hinted_children() for adding hinted devices on isa(4) busses now instead of doing it by hand. - Remove the unit kludging from sio(4) as it is no longer necessary. Prodding from: peter, imp OK'd by: marcel MFC after: 1 month Modified: head/sys/dev/acpica/acpi.c head/sys/dev/sio/sio_pci.c head/sys/dev/sio/sio_puc.c head/sys/isa/isa_common.c head/sys/isa/isa_common.h head/sys/isa/isahint.c head/sys/isa/isavar.h head/sys/kern/bus_if.m head/sys/kern/subr_bus.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/dev/acpica/acpi.c Tue Nov 18 21:01:54 2008 (r185059) @@ -158,6 +158,8 @@ static int acpi_child_pnpinfo_str_method #if defined(__i386__) || defined(__amd64__) static void acpi_enable_pcie(void); #endif +static void acpi_hint_device_unit(device_t acdev, device_t child, + const char *name, int *unitp); static device_method_t acpi_methods[] = { /* Device interface */ @@ -187,6 +189,7 @@ static device_method_t acpi_methods[] = DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit), /* ACPI bus */ DEVMETHOD(acpi_id_probe, acpi_device_id_probe), @@ -949,6 +952,89 @@ acpi_get_rlist(device_t dev, device_t ch return (&ad->ad_rl); } +static int +acpi_match_resource_hint(device_t dev, int type, long value) +{ + struct acpi_device *ad = device_get_ivars(dev); + struct resource_list *rl = &ad->ad_rl; + struct resource_list_entry *rle; + + STAILQ_FOREACH(rle, rl, link) { + if (rle->type != type) + continue; + if (rle->start <= value && rle->end >= value) + return (1); + } + return (0); +} + +/* + * Wire device unit numbers based on resource matches in hints. + */ +static void +acpi_hint_device_unit(device_t acdev, device_t child, const char *name, + int *unitp) +{ + const char *s; + long value; + int line, matches, unit; + + /* + * Iterate over all the hints for the devices with the specified + * name to see if one's resources are a subset of this device. + */ + line = 0; + for (;;) { + if (resource_find_dev(&line, name, &unit, "at", NULL) != 0) + break; + + /* Must have an "at" for acpi or isa. */ + resource_string_value(name, unit, "at", &s); + if (!(strcmp(s, "acpi0") == 0 || strcmp(s, "acpi") == 0 || + strcmp(s, "isa0") == 0 || strcmp(s, "isa") == 0)) + continue; + + /* + * Check for matching resources. We must have at least one, + * and all resources specified have to match. + * + * XXX: We may want to revisit this to be more lenient and wire + * as long as it gets one match. + */ + matches = 0; + if (resource_long_value(name, unit, "port", &value) == 0) { + if (acpi_match_resource_hint(child, SYS_RES_IOPORT, value)) + matches++; + else + continue; + } + if (resource_long_value(name, unit, "maddr", &value) == 0) { + if (acpi_match_resource_hint(child, SYS_RES_MEMORY, value)) + matches++; + else + continue; + } + if (resource_long_value(name, unit, "irq", &value) == 0) { + if (acpi_match_resource_hint(child, SYS_RES_IRQ, value)) + matches++; + else + continue; + } + if (resource_long_value(name, unit, "drq", &value) == 0) { + if (acpi_match_resource_hint(child, SYS_RES_DRQ, value)) + matches++; + else + continue; + } + + if (matches > 0) { + /* We have a winner! */ + *unitp = unit; + break; + } + } +} + /* * Pre-allocate/manage all memory and IO resources. Since rman can't handle * duplicates, we merge any in the sysresource attach routine. Modified: head/sys/dev/sio/sio_pci.c ============================================================================== --- head/sys/dev/sio/sio_pci.c Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/dev/sio/sio_pci.c Tue Nov 18 21:01:54 2008 (r185059) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include static int sio_pci_attach(device_t dev); -static void sio_pci_kludge_unit(device_t dev); static int sio_pci_probe(device_t dev); static device_method_t sio_pci_methods[] = { @@ -101,39 +100,9 @@ sio_pci_attach(dev) id++; if (id->desc == NULL) return (ENXIO); - sio_pci_kludge_unit(dev); return (sioattach(dev, id->rid, 0UL)); } -/* - * Don't cut and paste this to other drivers. It is a horrible kludge - * which will fail to work and also be unnecessary in future versions. - */ -static void -sio_pci_kludge_unit(dev) - device_t dev; -{ - devclass_t dc; - int err; - int start; - int unit; - - unit = 0; - start = 0; - while (resource_int_value("sio", unit, "port", &start) == 0 && - start > 0) - unit++; - if (device_get_unit(dev) < unit) { - dc = device_get_devclass(dev); - while (devclass_get_device(dc, unit)) - unit++; - device_printf(dev, "moving to sio%d\n", unit); - err = device_set_unit(dev, unit); /* EVIL DO NOT COPY */ - if (err) - device_printf(dev, "error moving device %d\n", err); - } -} - static int sio_pci_probe(dev) device_t dev; Modified: head/sys/dev/sio/sio_puc.c ============================================================================== --- head/sys/dev/sio/sio_puc.c Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/dev/sio/sio_puc.c Tue Nov 18 21:01:54 2008 (r185059) @@ -62,34 +62,6 @@ static driver_t sio_puc_driver = { 0, }; -/* - * Don't cut and paste this to other drivers. It is a horrible kludge - * which will fail to work and also be unnecessary in future versions. - */ -static void -sio_puc_kludge_unit(device_t dev) -{ - devclass_t dc; - int err; - int start; - int unit; - - unit = 0; - start = 0; - while (resource_int_value("sio", unit, "port", &start) == 0 && - start > 0) - unit++; - if (device_get_unit(dev) < unit) { - dc = device_get_devclass(dev); - while (devclass_get_device(dc, unit)) - unit++; - device_printf(dev, "moving to sio%d\n", unit); - err = device_set_unit(dev, unit); /* EVIL DO NOT COPY */ - if (err) - device_printf(dev, "error moving device %d\n", err); - } -} - static int sio_puc_attach(device_t dev) { @@ -98,7 +70,6 @@ sio_puc_attach(device_t dev) if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_CLOCK, &rclk) != 0) rclk = DEFAULT_RCLK; - sio_puc_kludge_unit(dev); return (sioattach(dev, 0, rclk)); } Modified: head/sys/isa/isa_common.c ============================================================================== --- head/sys/isa/isa_common.c Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/isa/isa_common.c Tue Nov 18 21:01:54 2008 (r185059) @@ -467,15 +467,41 @@ isa_assign_resources(device_t child) return (0); } +/* + * Claim any unallocated resources to keep other devices from using + * them. + */ +static void +isa_claim_resources(device_t dev, device_t child) +{ + struct isa_device *idev = DEVTOISA(child); + struct resource_list *rl = &idev->id_resources; + struct resource_list_entry *rle; + int rid; + + STAILQ_FOREACH(rle, rl, link) { + if (!rle->res) { + rid = rle->rid; + resource_list_alloc(rl, dev, child, rle->type, &rid, + 0ul, ~0ul, 1, 0); + } + } +} + +/* + * Called after other devices have initialised to probe for isa devices. + */ void isa_probe_children(device_t dev) { - device_t *children; + struct isa_device *idev; + device_t *children, child; struct isa_config *cfg; int nchildren, i; /* - * Create all the children by calling driver's identify methods. + * Create all the non-hinted children by calling drivers' + * identify methods. */ bus_generic_probe(dev); @@ -496,8 +522,7 @@ isa_probe_children(device_t dev) } for (i = 0; i < nchildren; i++) { - device_t child = children[i]; - struct isa_device *idev = DEVTOISA(child); + idev = DEVTOISA(children[i]); bzero(cfg, sizeof(*cfg)); if (idev->id_config_cb) @@ -507,16 +532,39 @@ isa_probe_children(device_t dev) free(cfg, M_TEMP); /* - * Next probe all non-pnp devices so that they claim their - * resources first. + * Next, probe all the PnP BIOS devices so they can subsume any + * hints. + */ + for (i = 0; i < nchildren; i++) { + child = children[i]; + idev = DEVTOISA(child); + + if (idev->id_order > ISA_ORDER_PNPBIOS) + continue; + if (!TAILQ_EMPTY(&idev->id_configs) && + !isa_assign_resources(child)) + continue; + + if (device_probe_and_attach(child) == 0) + isa_claim_resources(dev, child); + } + free(children, M_TEMP); + + /* + * Next, enumerate hinted devices and probe all non-pnp devices so + * that they claim their resources first. */ + bus_enumerate_hinted_children(dev); + if (device_get_children(dev, &children, &nchildren)) + return; if (bootverbose) printf("isa_probe_children: probing non-PnP devices\n"); for (i = 0; i < nchildren; i++) { - device_t child = children[i]; - struct isa_device *idev = DEVTOISA(child); + child = children[i]; + idev = DEVTOISA(child); - if (TAILQ_FIRST(&idev->id_configs)) + if (device_is_attached(child) || + !TAILQ_EMPTY(&idev->id_configs)) continue; device_probe_and_attach(child); @@ -528,31 +576,15 @@ isa_probe_children(device_t dev) if (bootverbose) printf("isa_probe_children: probing PnP devices\n"); for (i = 0; i < nchildren; i++) { - device_t child = children[i]; - struct isa_device* idev = DEVTOISA(child); + child = children[i]; + idev = DEVTOISA(child); - if (!TAILQ_FIRST(&idev->id_configs)) + if (device_is_attached(child) || TAILQ_EMPTY(&idev->id_configs)) continue; if (isa_assign_resources(child)) { - struct resource_list *rl = &idev->id_resources; - struct resource_list_entry *rle; - device_probe_and_attach(child); - - /* - * Claim any unallocated resources to keep other - * devices from using them. - */ - STAILQ_FOREACH(rle, rl, link) { - if (!rle->res) { - int rid = rle->rid; - resource_list_alloc(rl, dev, child, - rle->type, - &rid, - 0, ~0, 1, 0); - } - } + isa_claim_resources(dev, child); } } @@ -580,6 +612,7 @@ isa_add_child(device_t dev, int order, c resource_list_init(&idev->id_resources); TAILQ_INIT(&idev->id_configs); + idev->id_order = order; device_set_ivars(child, idev); @@ -833,23 +866,9 @@ static void isa_child_detached(device_t dev, device_t child) { struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - struct resource_list_entry *rle; - if (TAILQ_FIRST(&idev->id_configs)) { - /* - * Claim any unallocated resources to keep other - * devices from using them. - */ - STAILQ_FOREACH(rle, rl, link) { - if (!rle->res) { - int rid = rle->rid; - resource_list_alloc(rl, dev, child, - rle->type, - &rid, 0, ~0, 1, 0); - } - } - } + if (TAILQ_FIRST(&idev->id_configs)) + isa_claim_resources(dev, child); } static void @@ -900,20 +919,8 @@ isa_driver_added(device_t dev, driver_t device_probe_and_attach(child); - if (TAILQ_FIRST(&idev->id_configs)) { - /* - * Claim any unallocated resources to keep other - * devices from using them. - */ - STAILQ_FOREACH(rle, rl, link) { - if (!rle->res) { - int rid = rle->rid; - resource_list_alloc(rl, dev, child, - rle->type, - &rid, 0, ~0, 1, 0); - } - } - } + if (TAILQ_FIRST(&idev->id_configs)) + isa_claim_resources(dev, child); } free(children, M_TEMP); @@ -1077,6 +1084,8 @@ static device_method_t isa_methods[] = { DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_child_pnpinfo_str, isa_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, isa_child_location_str), + DEVMETHOD(bus_hinted_child, isa_hinted_child), + DEVMETHOD(bus_hint_device_unit, isa_hint_device_unit), /* ISA interface */ DEVMETHOD(isa_add_config, isa_add_config), @@ -1086,11 +1095,7 @@ static device_method_t isa_methods[] = { { 0, 0 } }; -driver_t isa_driver = { - "isa", - isa_methods, - 1, /* no softc */ -}; +DEFINE_CLASS_0(isa, isa_driver, isa_methods, 0); devclass_t isa_devclass; Modified: head/sys/isa/isa_common.h ============================================================================== --- head/sys/isa/isa_common.h Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/isa/isa_common.h Tue Nov 18 21:01:54 2008 (r185059) @@ -59,6 +59,7 @@ struct isa_device { int id_pnpbios_handle; /* pnp handle, if any */ int id_pnp_csn; /* pnp Card Number */ int id_pnp_ldn; /* pnp Logical device on card */ + int id_order; }; #define DEVTOISA(dev) ((struct isa_device *) device_get_ivars(dev)) Modified: head/sys/isa/isahint.c ============================================================================== --- head/sys/isa/isahint.c Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/isa/isahint.c Tue Nov 18 21:01:54 2008 (r185059) @@ -33,10 +33,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include -static void -isahint_add_device(device_t parent, const char *name, int unit) +void +isa_hinted_child(device_t parent, const char *name, int unit) { device_t child; int sensitive, start, count; @@ -82,43 +83,79 @@ isahint_add_device(device_t parent, cons isa_set_configattr(child, (isa_get_configattr(child)|ISACFGATTR_HINTS)); } -static void -isahint_identify(driver_t *driver, device_t parent) +static int +isa_match_resource_hint(device_t dev, int type, long value) { - int i; - static char buf[] = "isaXXX"; - const char *dname; - int dunit; - - /* - * Add all devices configured to be attached to parent. - */ - sprintf(buf, "isa%d", device_get_unit(parent)); - i = 0; - while (resource_find_match(&i, &dname, &dunit, "at", buf) == 0) - isahint_add_device(parent, dname, dunit); - - /* - * and isa? - */ - i = 0; - while (resource_find_match(&i, &dname, &dunit, "at", "isa") == 0) - isahint_add_device(parent, dname, dunit); + struct isa_device* idev = DEVTOISA(dev); + struct resource_list *rl = &idev->id_resources; + struct resource_list_entry *rle; + + STAILQ_FOREACH(rle, rl, link) { + if (rle->type != type) + continue; + if (rle->start <= value && rle->end >= value) + return (1); + } + return (0); } -static device_method_t isahint_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, isahint_identify), - - { 0, 0 } -}; - -static driver_t isahint_driver = { - "hint", - isahint_methods, - 1, /* no softc */ -}; - -static devclass_t hint_devclass; - -DRIVER_MODULE(isahint, isa, isahint_driver, hint_devclass, 0, 0); +void +isa_hint_device_unit(device_t bus, device_t child, const char *name, int *unitp) +{ + const char *s; + long value; + int line, matches, unit; + + line = 0; + for (;;) { + if (resource_find_dev(&line, name, &unit, "at", NULL) != 0) + break; + + /* Must have an "at" for isa. */ + resource_string_value(name, unit, "at", &s); + if (!(strcmp(s, device_get_nameunit(bus)) == 0 || + strcmp(s, device_get_name(bus)) == 0)) + continue; + + /* + * Check for matching resources. We must have at least one, + * and all resources specified have to match. + * + * XXX: We may want to revisit this to be more lenient and wire + * as long as it gets one match. + */ + matches = 0; + if (resource_long_value(name, unit, "port", &value) == 0) { + if (isa_match_resource_hint(child, SYS_RES_IOPORT, + value)) + matches++; + else + continue; + } + if (resource_long_value(name, unit, "maddr", &value) == 0) { + if (isa_match_resource_hint(child, SYS_RES_MEMORY, + value)) + matches++; + else + continue; + } + if (resource_long_value(name, unit, "irq", &value) == 0) { + if (isa_match_resource_hint(child, SYS_RES_IRQ, value)) + matches++; + else + continue; + } + if (resource_long_value(name, unit, "drq", &value) == 0) { + if (isa_match_resource_hint(child, SYS_RES_DRQ, value)) + matches++; + else + continue; + } + + if (matches > 0) { + /* We have a winner! */ + *unitp = unit; + break; + } + } +} Modified: head/sys/isa/isavar.h ============================================================================== --- head/sys/isa/isavar.h Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/isa/isavar.h Tue Nov 18 21:01:54 2008 (r185059) @@ -181,6 +181,9 @@ int isa_dmatc(int chan); (int)(chan), (uintmax_t)(size)); \ } while (0) +void isa_hinted_child(device_t parent, const char *name, int unit); +void isa_hint_device_unit(device_t bus, device_t child, const char *name, + int *unitp); int isab_attach(device_t dev); #ifdef PC98 Modified: head/sys/kern/bus_if.m ============================================================================== --- head/sys/kern/bus_if.m Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/kern/bus_if.m Tue Nov 18 21:01:54 2008 (r185059) @@ -544,7 +544,7 @@ METHOD int config_intr { */ METHOD void hinted_child { device_t _dev; - const char * _dname; + const char *_dname; int _dunit; }; @@ -558,3 +558,19 @@ METHOD bus_dma_tag_t get_dma_tag { device_t _dev; device_t _child; } DEFAULT bus_generic_get_dma_tag; + +/** + * @brief Allow the bus to determine the unit number of a device. + * + * @param _dev the parent device of @p _child + * @param _child the device whose unit is to be wired + * @param _name the name of the device's new devclass + * @param _unitp a pointer to the device's new unit value + */ +METHOD void hint_device_unit { + device_t _dev; + device_t _child; + const char *_name; + int *_unitp; +}; + Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Tue Nov 18 20:41:14 2008 (r185058) +++ head/sys/kern/subr_bus.c Tue Nov 18 21:01:54 2008 (r185059) @@ -1315,12 +1315,18 @@ devclass_get_sysctl_tree(devclass_t dc) * @retval ENOMEM memory allocation failure */ static int -devclass_alloc_unit(devclass_t dc, int *unitp) +devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp) { + const char *s; int unit = *unitp; PDEBUG(("unit %d in devclass %s", unit, DEVCLANAME(dc))); + /* Ask the parent bus if it wants to wire this device. */ + if (unit == -1) + BUS_HINT_DEVICE_UNIT(device_get_parent(dev), dev, dc->name, + &unit); + /* If we were given a wired unit number, check for existing device */ /* XXX imp XXX */ if (unit != -1) { @@ -1334,8 +1340,18 @@ devclass_alloc_unit(devclass_t dc, int * } else { /* Unwired device, find the next available slot for it */ unit = 0; - while (unit < dc->maxunit && dc->devices[unit] != NULL) - unit++; + for (unit = 0;; unit++) { + /* If there is an "at" hint for a unit then skip it. */ + if (resource_string_value(dc->name, unit, "at", &s) == + 0) + continue; + + /* If this device slot is already in use, skip it. */ + if (unit < dc->maxunit && dc->devices[unit] != NULL) + continue; + + break; + } } /* @@ -1397,7 +1413,7 @@ devclass_add_device(devclass_t dc, devic if (!dev->nameunit) return (ENOMEM); - if ((error = devclass_alloc_unit(dc, &dev->unit)) != 0) { + if ((error = devclass_alloc_unit(dc, dev, &dev->unit)) != 0) { free(dev->nameunit, M_BUS); dev->nameunit = NULL; return (error); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 21:06:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A79541065674; Tue, 18 Nov 2008 21:06:49 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95D1C8FC08; Tue, 18 Nov 2008 21:06:49 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIL6nqS088981; Tue, 18 Nov 2008 21:06:49 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAIL6nx7088980; Tue, 18 Nov 2008 21:06:49 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200811182106.mAIL6nx7088980@svn.freebsd.org> From: Roman Divacky Date: Tue, 18 Nov 2008 21:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185060 - head/usr.bin/window X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 21:06:49 -0000 Author: rdivacky Date: Tue Nov 18 21:06:49 2008 New Revision: 185060 URL: http://svn.freebsd.org/changeset/base/185060 Log: ANSIfy the wwend function. Approved by: kib (mentor) Modified: head/usr.bin/window/wwend.c Modified: head/usr.bin/window/wwend.c ============================================================================== --- head/usr.bin/window/wwend.c Tue Nov 18 21:01:54 2008 (r185059) +++ head/usr.bin/window/wwend.c Tue Nov 18 21:06:49 2008 (r185060) @@ -45,7 +45,8 @@ static char rcsid[] = #include "tt.h" /*ARGSUSED*/ -wwend(exit) +int +wwend(int exit) { if (tt.tt_checkpoint) { (void) alarm(0); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 21:13:32 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 480951065679; Tue, 18 Nov 2008 21:13:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 834B18FC19; Tue, 18 Nov 2008 21:13:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAILDOi2042842; Tue, 18 Nov 2008 16:13:25 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: src-committers@freebsd.org Date: Tue, 18 Nov 2008 16:06:22 -0500 User-Agent: KMail/1.9.7 References: <200811182101.mAIL1sFK088852@svn.freebsd.org> In-Reply-To: <200811182101.mAIL1sFK088852@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811181606.23202.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 18 Nov 2008 16:13:25 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8647/Tue Nov 18 10:09:15 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185059 - in head/sys: dev/acpica dev/sio isa kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 21:13:32 -0000 On Tuesday 18 November 2008 04:01:54 pm John Baldwin wrote: > Author: jhb > Date: Tue Nov 18 21:01:54 2008 > New Revision: 185059 > URL: http://svn.freebsd.org/changeset/base/185059 > > Log: > Allow device hints to wire the unit numbers of devices. > - An "at" hint now reserves a device name. > - A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When > determining the unit number of a device, this method is invoked to > let the bus driver specify the unit of a device given a specific > devclass. This is the only way a device can be given a name reserved > via an "at" hint. > - Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers. > Both of these busses implement this by comparing the resources for a > given hint device with the resources enumerated by ACPI/PnPBIOS and > wire a unit if the hint resources are a subset of the "real" resources. > - Use bus_hinted_children() for adding hinted devices on isa(4) busses > now instead of doing it by hand. > - Remove the unit kludging from sio(4) as it is no longer necessary. Effectively this means that 'hint.uart.0.port=0x3f8' will wire 'uart0' to be the serial port with an I/O port address of '0x3f8', even if it is not the first serial port ACPI enumerates. This should mostly be a nop. However, it should help machines where ACPI enumerates COM2 before COM1. With the default hints, COM1 will now always be sio0/uart0, even if ACPI enumerates COM2 first. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 21:41:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A920106564A; Tue, 18 Nov 2008 21:41:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 178B58FC0A; Tue, 18 Nov 2008 21:41:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAILf9wZ089657; Tue, 18 Nov 2008 21:41:09 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAILf9l3089656; Tue, 18 Nov 2008 21:41:09 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811182141.mAILf9l3089656@svn.freebsd.org> From: Xin LI Date: Tue, 18 Nov 2008 21:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185061 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 21:41:10 -0000 Author: delphij Date: Tue Nov 18 21:41:09 2008 New Revision: 185061 URL: http://svn.freebsd.org/changeset/base/185061 Log: Mention that listsnapshots is disabled by default after latest ZFS import. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Nov 18 21:06:49 2008 (r185060) +++ head/UPDATING Tue Nov 18 21:41:09 2008 (r185061) @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20081117: + A new version of ZFS (version 13) has been merged to -HEAD. + This version would have zpool attribute "listsnapshots" off + by default, which means "zfs list" would not show snapshots, + and is the same as Solaris behavior. + 20081028: dummynet(4) ABI has changed. ipfw(8) needs to be recompiled. From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 23:13:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A24C31065673; Tue, 18 Nov 2008 23:13:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D9118FC17; Tue, 18 Nov 2008 23:13:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAINDeU1095525; Tue, 18 Nov 2008 23:13:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAINDeKJ095522; Tue, 18 Nov 2008 23:13:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811182313.mAINDeKJ095522@svn.freebsd.org> From: John Baldwin Date: Tue, 18 Nov 2008 23:13:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185068 - head/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 23:13:40 -0000 Author: jhb Date: Tue Nov 18 23:13:40 2008 New Revision: 185068 URL: http://svn.freebsd.org/changeset/base/185068 Log: Remove unused i_flags field and IN_ACCESS flag from cd9660 in-memory i-nodes. cd9660 doesn't support access times. Modified: head/sys/fs/cd9660/cd9660_node.c head/sys/fs/cd9660/cd9660_node.h head/sys/fs/cd9660/cd9660_vnops.c Modified: head/sys/fs/cd9660/cd9660_node.c ============================================================================== --- head/sys/fs/cd9660/cd9660_node.c Tue Nov 18 22:17:17 2008 (r185067) +++ head/sys/fs/cd9660/cd9660_node.c Tue Nov 18 23:13:40 2008 (r185068) @@ -72,7 +72,6 @@ cd9660_inactive(ap) if (prtactive && vrefcnt(vp) != 0) vprint("cd9660_inactive: pushing active", vp); - ip->i_flag = 0; /* * If we are done with the inode, reclaim it * so that it can be reused immediately. Modified: head/sys/fs/cd9660/cd9660_node.h ============================================================================== --- head/sys/fs/cd9660/cd9660_node.h Tue Nov 18 22:17:17 2008 (r185067) +++ head/sys/fs/cd9660/cd9660_node.h Tue Nov 18 23:13:40 2008 (r185068) @@ -58,7 +58,6 @@ typedef struct { struct iso_node { struct vnode *i_vnode; /* vnode associated with this inode */ - u_long i_flag; /* see below */ ino_t i_number; /* the identity of the inode */ /* we use the actual starting block of the file */ struct iso_mnt *i_mnt; /* filesystem associated with this inode */ @@ -78,9 +77,6 @@ struct iso_node { #define i_forw i_chain[0] #define i_back i_chain[1] -/* flags */ -#define IN_ACCESS 0x0020 /* inode access time to be updated */ - #define VTOI(vp) ((struct iso_node *)(vp)->v_data) #define ITOV(ip) ((ip)->i_vnode) Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Tue Nov 18 22:17:17 2008 (r185067) +++ head/sys/fs/cd9660/cd9660_vnops.c Tue Nov 18 23:13:40 2008 (r185068) @@ -295,7 +295,6 @@ cd9660_read(ap) return (0); if (uio->uio_offset < 0) return (EINVAL); - ip->i_flag |= IN_ACCESS; imp = ip->i_mnt; do { lbn = lblkno(imp, uio->uio_offset); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 23:15:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B11C1065741; Tue, 18 Nov 2008 23:15:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 369398FC1F; Tue, 18 Nov 2008 23:15:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAINFIA9095704; Tue, 18 Nov 2008 23:15:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAINFIoi095703; Tue, 18 Nov 2008 23:15:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811182315.mAINFIoi095703@svn.freebsd.org> From: John Baldwin Date: Tue, 18 Nov 2008 23:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185069 - head/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 23:15:18 -0000 Author: jhb Date: Tue Nov 18 23:15:17 2008 New Revision: 185069 URL: http://svn.freebsd.org/changeset/base/185069 Log: Remove copy/paste code from UFS to handle sparse blocks. While Rock Ridge does support sparse files, the cd9660 code does not currently support them. Modified: head/sys/fs/cd9660/cd9660_vnops.c Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Tue Nov 18 23:13:40 2008 (r185068) +++ head/sys/fs/cd9660/cd9660_vnops.c Tue Nov 18 23:15:17 2008 (r185069) @@ -743,12 +743,6 @@ cd9660_strategy(ap) if (bp->b_blkno == bp->b_lblkno) { bp->b_blkno = (ip->iso_start + bp->b_lblkno) << (ip->i_mnt->im_bshift - DEV_BSHIFT); - if ((long)bp->b_blkno == -1) /* XXX: cut&paste junk ? */ - clrbuf(bp); - } - if ((long)bp->b_blkno == -1) { /* XXX: cut&paste junk ? */ - bufdone(bp); - return (0); } bp->b_iooffset = dbtob(bp->b_blkno); bo = ip->i_mnt->im_bo; From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 23:18:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C7551065670; Tue, 18 Nov 2008 23:18:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 1856B8FC22; Tue, 18 Nov 2008 23:18:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 227882534; Wed, 19 Nov 2008 01:18:23 +0200 Message-ID: <49234D3C.5030605@FreeBSD.org> Date: Wed, 19 Nov 2008 01:18:20 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.17 (X11/20081029) MIME-Version: 1.0 To: Maxim Konovalov References: <200811181548.mAIFmNuL081972@svn.freebsd.org> <20081118234224.M56769@mp2.macomnet.net> In-Reply-To: <20081118234224.M56769@mp2.macomnet.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r185053 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 23:18:25 -0000 Maxim Konovalov wrote: >> Author: mav >> Date: Tue Nov 18 15:48:23 2008 >> New Revision: 185053 >> URL: http://svn.freebsd.org/changeset/base/185053 >> >> Log: >> Restore original frequency on exit. >> >> PR: bin/113813 >> > [ patch skipped ] > > Not sure this is a correct aproach. What happen if admin > changed (rose or lowered) the debug.cpufreq.lowest after he > run powerd? So imho at exit we need to take an account a > current value of debug.cpufreq.lowest. Then powerd may not restore original frequency. IMHO it is a bad idea to modify anything frequency related while powerd is running as it reads frequency set only once and them mostly writes. Every tool should have it's own task. powerd has no idea about debug.cpufreq.lowest, especially because of "debug.". It is kernel internal business, how to generate set of frequencies. If we need specify lowest frequency for adaptive mode, I would teach powerd to do it, not the kernel. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 23:18:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC3A21065797; Tue, 18 Nov 2008 23:18:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A77A88FC25; Tue, 18 Nov 2008 23:18:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAINIbZ4096011; Tue, 18 Nov 2008 23:18:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAINIbsM096010; Tue, 18 Nov 2008 23:18:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811182318.mAINIbsM096010@svn.freebsd.org> From: John Baldwin Date: Tue, 18 Nov 2008 23:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185070 - head/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 23:18:37 -0000 Author: jhb Date: Tue Nov 18 23:18:37 2008 New Revision: 185070 URL: http://svn.freebsd.org/changeset/base/185070 Log: When looking up the vnode for the device to mount the filesystem on, ask NDINIT to return a locked vnode instead of letting it drop the lock and return a referenced vnode and then relock the vnode a few lines down. This matches the behavior of other filesystem mount routines. Modified: head/sys/fs/cd9660/cd9660_vfsops.c Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Tue Nov 18 23:15:17 2008 (r185069) +++ head/sys/fs/cd9660/cd9660_vfsops.c Tue Nov 18 23:18:37 2008 (r185070) @@ -153,14 +153,14 @@ cd9660_mount(struct mount *mp, struct th * Not an update, or updating the name: look up the name * and verify that it refers to a sensible block device. */ - NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); if ((error = namei(&ndp))) return (error); NDFREE(&ndp, NDF_ONLY_PNBUF); devvp = ndp.ni_vp; if (!vn_isdisk(devvp, &error)) { - vrele(devvp); + vput(devvp); return (error); } @@ -169,7 +169,6 @@ cd9660_mount(struct mount *mp, struct th * or has superuser abilities */ accmode = VREAD; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); error = VOP_ACCESS(devvp, accmode, td->td_ucred, td); if (error) error = priv_check(td, PRIV_VFS_MOUNT_PERM); @@ -177,22 +176,20 @@ cd9660_mount(struct mount *mp, struct th vput(devvp); return (error); } - VOP_UNLOCK(devvp, 0); if ((mp->mnt_flag & MNT_UPDATE) == 0) { error = iso_mountfs(devvp, mp); + if (error) + vrele(devvp); } else { if (devvp != imp->im_devvp) error = EINVAL; /* needs translation */ - else - vrele(devvp); - } - if (error) { - vrele(devvp); - return error; + vput(devvp); } + if (error) + return (error); vfs_mountedfrom(mp, fspec); - return 0; + return (0); } /* @@ -222,7 +219,6 @@ iso_mountfs(devvp, mp) struct bufobj *bo; char *cs_local, *cs_disk; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); DROP_GIANT(); g_topology_lock(); error = g_vfs_open(devvp, &cp, "cd9660", 0); From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 23:19:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54B2C106564A; Tue, 18 Nov 2008 23:19:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 400028FC24; Tue, 18 Nov 2008 23:19:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAINJiVT096142; Tue, 18 Nov 2008 23:19:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAINJhdo096139; Tue, 18 Nov 2008 23:19:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811182319.mAINJhdo096139@svn.freebsd.org> From: John Baldwin Date: Tue, 18 Nov 2008 23:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185071 - head/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 23:19:44 -0000 Author: jhb Date: Tue Nov 18 23:19:43 2008 New Revision: 185071 URL: http://svn.freebsd.org/changeset/base/185071 Log: - Fix a typo in a comment. - Whitespace fix. - Remove #if 0'd BSD 4.x code for flushing busy buffers from a mountpoint during an unmount. FreeBSD uses vflush() for this. Modified: head/sys/fs/cd9660/cd9660_bmap.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/cd9660/cd9660_vnops.c Modified: head/sys/fs/cd9660/cd9660_bmap.c ============================================================================== --- head/sys/fs/cd9660/cd9660_bmap.c Tue Nov 18 23:18:37 2008 (r185070) +++ head/sys/fs/cd9660/cd9660_bmap.c Tue Nov 18 23:19:43 2008 (r185071) @@ -46,9 +46,10 @@ __FBSDID("$FreeBSD$"); #include /* - * Bmap converts a the logical block number of a file to its physical block - * number on the disk. The conversion is done by using the logical block - * number to index into the data block (extent) for the file. + * Bmap converts the logical block number of a file to its physical + * block number on the disk. The conversion is done by using the + * logical block number to index into the data block (extent) for the + * file. */ int cd9660_bmap(ap) Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Tue Nov 18 23:18:37 2008 (r185070) +++ head/sys/fs/cd9660/cd9660_vfsops.c Tue Nov 18 23:19:43 2008 (r185071) @@ -501,11 +501,6 @@ cd9660_unmount(mp, mntflags, td) if (mntflags & MNT_FORCE) flags |= FORCECLOSE; -#if 0 - mntflushbuf(mp, 0); - if (mntinvalbuf(mp)) - return EBUSY; -#endif if ((error = vflush(mp, 0, flags, td))) return (error); Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Tue Nov 18 23:18:37 2008 (r185070) +++ head/sys/fs/cd9660/cd9660_vnops.c Tue Nov 18 23:19:43 2008 (r185071) @@ -396,7 +396,7 @@ iso_shipdir(idp) cl = idp->current.d_namlen; cname = idp->current.d_name; -assoc = (cl > 1) && (*cname == ASSOCCHAR); + assoc = (cl > 1) && (*cname == ASSOCCHAR); if (assoc) { cl--; cname++; From owner-svn-src-all@FreeBSD.ORG Tue Nov 18 23:38:47 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E161F1065672; Tue, 18 Nov 2008 23:38:47 +0000 (UTC) (envelope-from danger@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC3828FC16; Tue, 18 Nov 2008 23:38:47 +0000 (UTC) (envelope-from danger@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAINcl3W097437; Tue, 18 Nov 2008 23:38:47 GMT (envelope-from danger@svn.freebsd.org) Received: (from danger@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAINclCI097436; Tue, 18 Nov 2008 23:38:47 GMT (envelope-from danger@svn.freebsd.org) Message-Id: <200811182338.mAINclCI097436@svn.freebsd.org> From: Daniel Gerzo Date: Tue, 18 Nov 2008 23:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185072 - head/usr.sbin/ntp/doc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 23:38:48 -0000 Author: danger (doc committer) Date: Tue Nov 18 23:38:47 2008 New Revision: 185072 URL: http://svn.freebsd.org/changeset/base/185072 Log: - fix typo PR: docs/128973 Submitted by: tabthorpe Modified: head/usr.sbin/ntp/doc/ntp-keygen.8 Modified: head/usr.sbin/ntp/doc/ntp-keygen.8 ============================================================================== --- head/usr.sbin/ntp/doc/ntp-keygen.8 Tue Nov 18 23:19:43 2008 (r185071) +++ head/usr.sbin/ntp/doc/ntp-keygen.8 Tue Nov 18 23:38:47 2008 (r185072) @@ -126,7 +126,7 @@ The safest way to run the program is logged in directly as root. The recommended procedure is change to the keys directory, usually -.Pa /ust/local/etc , +.Pa /usr/local/etc , then run the program. When run for the first time, or if all From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 00:09:01 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88D5E1065670; Wed, 19 Nov 2008 00:09:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 731BF8FC12; Wed, 19 Nov 2008 00:09:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ091aN098085; Wed, 19 Nov 2008 00:09:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ091Hj098084; Wed, 19 Nov 2008 00:09:01 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811190009.mAJ091Hj098084@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 00:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185073 - head/usr.sbin/ckdist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 00:09:01 -0000 Author: delphij Date: Wed Nov 19 00:09:01 2008 New Revision: 185073 URL: http://svn.freebsd.org/changeset/base/185073 Log: Constify return value of stripath and avoid unnecessary deconst casts. Modified: head/usr.sbin/ckdist/ckdist.c Modified: head/usr.sbin/ckdist/ckdist.c ============================================================================== --- head/usr.sbin/ckdist/ckdist.c Tue Nov 18 23:38:47 2008 (r185072) +++ head/usr.sbin/ckdist/ckdist.c Wed Nov 19 00:09:01 2008 (r185073) @@ -80,7 +80,7 @@ static int chkinf(FILE * fp, const char static int report(const char *path, const char *name, int error); static const char *distname(const char *path, const char *name, const char *ext); -static char *stripath(const char *path); +static const char *stripath(const char *path); static int distfile(const char *path); static int disttype(const char *name); static int fail(const char *path, const char *msg); @@ -247,7 +247,7 @@ chkmd5(FILE * fp, const char *path) error = E_ERRNO; else if (close(fd)) err(2, "%s", dname); - } else if (!MD5File((char *)dname, chk)) + } else if (!MD5File(dname, chk)) error = E_ERRNO; else if (strcmp(chk, sum)) error = E_CHKSUM; @@ -393,12 +393,12 @@ distname(const char *path, const char *n return buf; } -static char * +static const char * stripath(const char *path) { const char *s; - return (char *)((s = strrchr(path, '/')) != NULL && s[1] ? + return ((s = strrchr(path, '/')) != NULL && s[1] ? s + 1 : path); } From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 00:14:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76922106564A; Wed, 19 Nov 2008 00:14:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60DA88FC19; Wed, 19 Nov 2008 00:14:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ0EFfa098226; Wed, 19 Nov 2008 00:14:15 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ0EFh0098225; Wed, 19 Nov 2008 00:14:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811190014.mAJ0EFh0098225@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 00:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185074 - head/usr.bin/killall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 00:14:15 -0000 Author: delphij Date: Wed Nov 19 00:14:15 2008 New Revision: 185074 URL: http://svn.freebsd.org/changeset/base/185074 Log: Use strlcpy() where appropriate. Modified: head/usr.bin/killall/killall.c Modified: head/usr.bin/killall/killall.c ============================================================================== --- head/usr.bin/killall/killall.c Wed Nov 19 00:09:01 2008 (r185073) +++ head/usr.bin/killall/killall.c Wed Nov 19 00:14:15 2008 (r185074) @@ -64,8 +64,7 @@ upper(const char *str) static char buf[80]; char *s; - strncpy(buf, str, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; + strlcpy(buf, str, sizeof(buf)); for (s = buf; *s; s++) *s = toupper((unsigned char)*s); return buf; @@ -327,8 +326,7 @@ main(int ac, char **av) if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag) continue; thispid = procs[i].ki_pid; - strncpy(thiscmd, procs[i].ki_comm, MAXCOMLEN); - thiscmd[MAXCOMLEN] = '\0'; + strlcpy(thiscmd, procs[i].ki_comm, sizeof(thiscmd)); thistdev = procs[i].ki_tdev; if (eflag) thisuid = procs[i].ki_uid; /* effective uid */ From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 00:25:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73D8D1065672; Wed, 19 Nov 2008 00:25:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E8D48FC0A; Wed, 19 Nov 2008 00:25:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ0PGXh098460; Wed, 19 Nov 2008 00:25:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ0PGYQ098459; Wed, 19 Nov 2008 00:25:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811190025.mAJ0PGYQ098459@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 00:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185075 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 00:25:16 -0000 Author: delphij Date: Wed Nov 19 00:25:15 2008 New Revision: 185075 URL: http://svn.freebsd.org/changeset/base/185075 Log: Grammar. Submitted by: "bf" Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Nov 19 00:14:15 2008 (r185074) +++ head/UPDATING Wed Nov 19 00:25:15 2008 (r185075) @@ -24,8 +24,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. 20081117: A new version of ZFS (version 13) has been merged to -HEAD. - This version would have zpool attribute "listsnapshots" off - by default, which means "zfs list" would not show snapshots, + This version has zpool attribute "listsnapshots" off by + default, which means "zfs list" does not show snapshots, and is the same as Solaris behavior. 20081028: From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 02:22:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C384D1065673; Wed, 19 Nov 2008 02:22:34 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC5238FC08; Wed, 19 Nov 2008 02:22:34 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ2MYSk000981; Wed, 19 Nov 2008 02:22:34 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ2MYoL000980; Wed, 19 Nov 2008 02:22:34 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811190222.mAJ2MYoL000980@svn.freebsd.org> From: Joseph Koshy Date: Wed, 19 Nov 2008 02:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185079 - head/usr.sbin/pmcstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 02:22:34 -0000 Author: jkoshy Date: Wed Nov 19 02:22:34 2008 New Revision: 185079 URL: http://svn.freebsd.org/changeset/base/185079 Log: As a matter of good programming style, stop PMCs before releasing them. Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Wed Nov 19 01:52:28 2008 (r185078) +++ head/usr.sbin/pmcstat/pmcstat.c Wed Nov 19 02:22:34 2008 (r185079) @@ -145,6 +145,9 @@ pmcstat_cleanup(struct pmcstat_args *a) /* release allocated PMCs. */ STAILQ_FOREACH_SAFE(ev, &a->pa_events, ev_next, tmp) if (ev->ev_pmcid != PMC_ID_INVALID) { + if (pmc_stop(ev->ev_pmcid) < 0) + err(EX_OSERR, "ERROR: cannot stop pmc 0x%x " + "\"%s\"", ev->ev_pmcid, ev->ev_name); if (pmc_release(ev->ev_pmcid) < 0) err(EX_OSERR, "ERROR: cannot release pmc " "0x%x \"%s\"", ev->ev_pmcid, ev->ev_name); From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 03:24:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18749106564A; Wed, 19 Nov 2008 03:24:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 007EB8FC18; Wed, 19 Nov 2008 03:24:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ3OZYb002637; Wed, 19 Nov 2008 03:24:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ3OZ05002636; Wed, 19 Nov 2008 03:24:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811190324.mAJ3OZ05002636@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 03:24:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185082 - head/sys/dev/bce X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 03:24:36 -0000 Author: delphij Date: Wed Nov 19 03:24:35 2008 New Revision: 185082 URL: http://svn.freebsd.org/changeset/base/185082 Log: Correct a logic error when testing BCE_PHY_SERDES_FLAG. PR: kern/128801 Pointed out by: Adam Morrison Ok'ed by: davidch MFC after: 3 days Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Wed Nov 19 03:14:41 2008 (r185081) +++ head/sys/dev/bce/if_bce.c Wed Nov 19 03:24:35 2008 (r185082) @@ -2555,7 +2555,7 @@ bce_get_media(struct bce_softc *sc) } else if (BCE_CHIP_BOND_ID(sc) & BCE_CHIP_BOND_ID_SERDES_BIT) sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; - if (sc->bce_phy_flags && BCE_PHY_SERDES_FLAG) { + if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) { sc->bce_flags |= BCE_NO_WOL_FLAG; if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { sc->bce_phy_addr = 2; From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 03:28:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 232D11065675; Wed, 19 Nov 2008 03:28:44 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id DD1388FC13; Wed, 19 Nov 2008 03:28:43 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.2.57] (c-71-56-39-94.hsd1.ga.comcast.net [71.56.39.94]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id mAJ3D5Jg029592 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Nov 2008 22:13:05 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Alexander Motin In-Reply-To: <200811181324.mAIDOcOc079096@svn.freebsd.org> References: <200811181324.mAIDOcOc079096@svn.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-O4hl6nfA1j7x3X8DsYvl" Organization: FreeBSD Date: Tue, 18 Nov 2008 22:12:59 -0500 Message-Id: <1227064379.1979.3.camel@wombat.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 FreeBSD GNOME Team Port X-Spam-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185050 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 03:28:44 -0000 --=-O4hl6nfA1j7x3X8DsYvl Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2008-11-18 at 13:24 +0000, Alexander Motin wrote: > Author: mav > Date: Tue Nov 18 13:24:38 2008 > New Revision: 185050 > URL: http://svn.freebsd.org/changeset/base/185050 >=20 > Log: > Set of powerd enchancements: > =20 > 1. Make it more SMP polite. Previous version uses average CPU load that > often leads to load underestimation. It make powerd with default > configuration unusable on systems with more then 2 CPUs. I propose to u= se > summary load instead of average one. IMO this is the best we can do wit= hout > specially tuned scheduler. Also as soon as measuring total load on SMP > systems is more useful then total idle, I have switched to it. > =20 > 2. Make powerd's operation independent from number and size of frequenc= y > levels. I have added internal frequency counter which translated into r= eal > frequencies only on a last stage and only as good as gone. Some systems= may > have only several power levels, while others - many of them, so adaptat= ion > time with previous approach was completely different. > =20 > 3. As part of previous I have changed adaptive mode to rise frequency o= n > demand up to 2 times and fall on 1/8 per time internal. > =20 > 4. For desktop (AC-powered) systems I have added one more mode - "hiada= ptive". > It rises frequency twice faster, drops it 4 times slower, prefers twice > lower CPU load and has additional delay before leaving the highest freq= uency > after the period of maximum load. This mode was specially made to impro= ve > interactivity of the systems where operation capabilities are more > significant then power consumption, but keeping maximum frequency all t= he > time is not needed. > =20 > 5. I have reduced default polling interval from 1/2 to 1/4 of second. > It is not so important for algorithm math now, but gives better system > interactivity. > =20 > Discussed on: mobile@ Somehow this seems to be too sensitive. My laptop previously idled at 150Mhz... Occasionally bouncing up to maybe 450Mhz. With the new algo, it will sometimes drop to 900Mhz, but winds itself right back up to 1.8Ghz. robert. > Modified: > head/usr.sbin/powerd/powerd.8 > head/usr.sbin/powerd/powerd.c >=20 > Modified: head/usr.sbin/powerd/powerd.8 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/powerd/powerd.8 Tue Nov 18 12:42:59 2008 (r185049) > +++ head/usr.sbin/powerd/powerd.8 Tue Nov 18 13:24:38 2008 (r185050) > @@ -47,7 +47,8 @@ utility monitors the system state and se > accordingly. > It offers three modes (maximum, minimum, and adaptive) that can be > individually selected while on AC power or batteries. > -The modes maximum, minimum, and adaptive may be abbreviated max, min, ad= p. > +The modes maximum, minimum, adaptive and hiadaptive may be abbreviated > +max, min, adp, hadp. > .Pp > Maximum mode chooses the highest performance values. > Minimum mode selects the lowest performance values to get the most power > @@ -56,8 +57,10 @@ Adaptive mode attempts to strike a balan > the system appears idle and increasing it when the system is busy. > It offers a good balance between a small performance loss for greatly > increased power savings. > -The default mode is > -adaptive. > +Hiadaptive mode is alike adaptive mode, but tuned for systems where > +performance and interactivity are more important then power consumption. > +It rises frequency faster, drops slower and keeps twice lower CPU load. > +The default mode is adaptive for battery power and hiadaptive for the re= st. > .Pp > The > .Nm > @@ -72,10 +75,9 @@ Selects the > .Ar mode > to use while on battery power. > .It Fl i Ar percent > -Specifies the CPU idle percent level when > -adaptive > +Specifies the CPU load percent level when adaptive > mode should begin to degrade performance to save power. > -The default is 90% or higher. > +The default is 50% or lower. > .It Fl n Ar mode > Selects the > .Ar mode > @@ -83,16 +85,15 @@ to use normally when the AC line state i > .It Fl p Ar ival > Specifies a different polling interval (in milliseconds) for AC line sta= te > and system idle levels. > -The default is 500 ms. > +The default is 250 ms. > .It Fl P Ar pidfile > Specifies an alternative file in which the process ID should be stored. > The default is > .Pa /var/run/powerd.pid . > .It Fl r Ar percent > -Specifies the CPU idle percent level where > -adaptive > +Specifies the CPU load percent level where adaptive > mode should consider the CPU running and increase performance. > -The default is 65% or lower. > +The default is 75% or higther. > .It Fl v > Verbose mode. > Messages about power changes will be printed to stdout and >=20 > Modified: head/usr.sbin/powerd/powerd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/powerd/powerd.c Tue Nov 18 12:42:59 2008 (r185049) > +++ head/usr.sbin/powerd/powerd.c Tue Nov 18 13:24:38 2008 (r185050) > @@ -50,13 +50,14 @@ __FBSDID("$FreeBSD$"); > #include > #endif > =20 > -#define DEFAULT_ACTIVE_PERCENT 65 > -#define DEFAULT_IDLE_PERCENT 90 > -#define DEFAULT_POLL_INTERVAL 500 /* Poll interval in milliseconds */ > +#define DEFAULT_ACTIVE_PERCENT 75 > +#define DEFAULT_IDLE_PERCENT 50 > +#define DEFAULT_POLL_INTERVAL 250 /* Poll interval in milliseconds */ > =20 > typedef enum { > MODE_MIN, > MODE_ADAPTIVE, > + MODE_HIADAPTIVE, > MODE_MAX, > } modes_t; > =20 > @@ -77,7 +78,7 @@ const char *modes[] =3D { > #define DEVDPIPE "/var/run/devd.pipe" > #define DEVCTL_MAXBUF 1024 > =20 > -static int read_usage_times(long *idle, long *total); > +static int read_usage_times(int *load); > static int read_freqs(int *numfreqs, int **freqs, int **power); > static int set_freq(int freq); > static void acline_init(void); > @@ -89,7 +90,7 @@ static void parse_mode(char *arg, int *m > static void usage(void); > =20 > /* Sysctl data structures. */ > -static int cp_time_mib[2]; > +static int cp_times_mib[2]; > static int freq_mib[4]; > static int levels_mib[4]; > static int acline_mib[3]; > @@ -119,27 +120,49 @@ static int devd_pipe =3D -1; > static struct timeval tried_devd; > =20 > static int > -read_usage_times(long *idle, long *total) > +read_usage_times(int *load) > { > - static long idle_old, total_old; > - long cp_time[CPUSTATES], i, total_new; > - size_t cp_time_len; > - int error; > + static long *cp_times =3D NULL, *cp_times_old =3D NULL; > + static int ncpus =3D 0; > + size_t cp_times_len; > + int error, cpu, i, total; > + > + if (cp_times =3D=3D NULL) { > + cp_times_len =3D 0; > + error =3D sysctl(cp_times_mib, 2, NULL, &cp_times_len, NULL, 0); > + if (error) > + return (error); > + if ((cp_times =3D malloc(cp_times_len)) =3D=3D NULL) > + return (errno); > + if ((cp_times_old =3D malloc(cp_times_len)) =3D=3D NULL) { > + free(cp_times); > + cp_times =3D NULL; > + return (errno); > + } > + ncpus =3D cp_times_len / (sizeof(long) * CPUSTATES); > + } > =20 > - cp_time_len =3D sizeof(cp_time); > - error =3D sysctl(cp_time_mib, 2, cp_time, &cp_time_len, NULL, 0); > + cp_times_len =3D sizeof(long) * CPUSTATES * ncpus; > + error =3D sysctl(cp_times_mib, 2, cp_times, &cp_times_len, NULL, 0); > if (error) > return (error); > - for (total_new =3D 0, i =3D 0; i < CPUSTATES; i++) > - total_new +=3D cp_time[i]; > - > - if (idle) > - *idle =3D cp_time[CP_IDLE] - idle_old; > - if (total) > - *total =3D total_new - total_old; > + =09 > + if (load) { > + *load =3D 0; > + for (cpu =3D 0; cpu < ncpus; cpu++) { > + total =3D 0; > + for (i =3D 0; i < CPUSTATES; i++) { > + total +=3D cp_times[cpu * CPUSTATES + i] - > + cp_times_old[cpu * CPUSTATES + i]; > + } > + if (total =3D=3D 0) > + continue; > + *load +=3D 100 - (cp_times[cpu * CPUSTATES + CP_IDLE] -=20 > + cp_times_old[cpu * CPUSTATES + CP_IDLE]) * 100 / total; > + } > + } > =20 > - idle_old =3D cp_time[CP_IDLE]; > - total_old =3D total_new; > + memcpy(cp_times_old, cp_times, cp_times_len); > =20 > return (0); > } > @@ -190,6 +213,21 @@ read_freqs(int *numfreqs, int **freqs, i > } > =20 > static int > +get_freq(void) > +{ > + size_t len; > + int curfreq; > +=09 > + len =3D sizeof(curfreq); > + if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) !=3D 0) { > + if (vflag) > + warn("error reading current CPU frequency"); > + curfreq =3D 0; > + } > + return (curfreq); > +} > + > +static int > set_freq(int freq) > { > =20 > @@ -201,6 +239,19 @@ set_freq(int freq) > return (0); > } > =20 > +static int > +get_freq_id(int freq, int *freqs, int numfreqs) > +{ > + int i =3D 1; > +=09 > + while (i < numfreqs) { > + if (freqs[i] < freq) > + break; > + i++; > + } > + return (i - 1); > +} > + > /* > * Try to use ACPI to find the AC line status. If this fails, fall back > * to APM. If nothing succeeds, we'll just run in default mode. > @@ -341,6 +392,8 @@ parse_mode(char *arg, int *mode, int ch) > *mode =3D MODE_MAX; > else if (strcmp(arg, "adaptive") =3D=3D 0 || strcmp(arg, "adp") =3D=3D = 0) > *mode =3D MODE_ADAPTIVE; > + else if (strcmp(arg, "hiadaptive") =3D=3D 0 || strcmp(arg, "hadp") =3D= =3D 0) > + *mode =3D MODE_HIADAPTIVE; > else > errx(1, "bad option: -%c %s", (char)ch, optarg); > } > @@ -369,14 +422,14 @@ main(int argc, char * argv[]) > int nfds; > struct pidfh *pfh =3D NULL; > const char *pidfile =3D NULL; > - long idle, total; > - int curfreq, *freqs, i, *mwatts, numfreqs; > + int freq, curfreq, *freqs, i, j, *mwatts, numfreqs, load; > int ch, mode, mode_ac, mode_battery, mode_none; > uint64_t mjoules_used; > size_t len; > =20 > /* Default mode for all AC states is adaptive. */ > - mode_ac =3D mode_battery =3D mode_none =3D MODE_ADAPTIVE; > + mode_ac =3D mode_none =3D MODE_HIADAPTIVE; > + mode_battery =3D MODE_ADAPTIVE; > cpu_running_mark =3D DEFAULT_ACTIVE_PERCENT; > cpu_idle_mark =3D DEFAULT_IDLE_PERCENT; > poll_ival =3D DEFAULT_POLL_INTERVAL; > @@ -418,7 +471,7 @@ main(int argc, char * argv[]) > break; > case 'r': > cpu_running_mark =3D atoi(optarg); > - if (cpu_running_mark < 0 || cpu_running_mark > 100) { > + if (cpu_running_mark <=3D 0 || cpu_running_mark > 100) { > warnx("%d is not a valid percent", > cpu_running_mark); > usage(); > @@ -438,8 +491,8 @@ main(int argc, char * argv[]) > =20 > /* Look up various sysctl MIBs. */ > len =3D 2; > - if (sysctlnametomib("kern.cp_time", cp_time_mib, &len)) > - err(1, "lookup kern.cp_time"); > + if (sysctlnametomib("kern.cp_times", cp_times_mib, &len)) > + err(1, "lookup kern.cp_times"); > len =3D 4; > if (sysctlnametomib("dev.cpu.0.freq", freq_mib, &len)) > err(1, "lookup freq"); > @@ -447,8 +500,8 @@ main(int argc, char * argv[]) > if (sysctlnametomib("dev.cpu.0.freq_levels", levels_mib, &len)) > err(1, "lookup freq_levels"); > =20 > - /* Check if we can read the idle time and supported freqs. */ > - if (read_usage_times(NULL, NULL)) > + /* Check if we can read the load and supported freqs. */ > + if (read_usage_times(NULL)) > err(1, "read_usage_times"); > if (read_freqs(&numfreqs, &freqs, &mwatts)) > err(1, "error reading supported CPU frequencies"); > @@ -483,6 +536,9 @@ main(int argc, char * argv[]) > signal(SIGINT, handle_sigs); > signal(SIGTERM, handle_sigs); > =20 > + freq =3D get_freq(); > + if (freq < 1) > + freq =3D 1; > /* Main loop. */ > for (;;) { > FD_ZERO(&fdset); > @@ -522,37 +578,30 @@ main(int argc, char * argv[]) > } > =20 > /* Read the current frequency. */ > - len =3D sizeof(curfreq); > - if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) !=3D 0) { > - if (vflag) > - warn("error reading current CPU frequency"); > + if ((curfreq =3D get_freq()) =3D=3D 0) > continue; > - } > =20 > + i =3D get_freq_id(curfreq, freqs, numfreqs); > +=09 > if (vflag) { > - for (i =3D 0; i < numfreqs; i++) { > - if (freqs[i] =3D=3D curfreq) > - break; > - } > - > /* Keep a sum of all power actually used. */ > - if (i < numfreqs && mwatts[i] !=3D -1) > + if (mwatts[i] !=3D -1) > mjoules_used +=3D > (mwatts[i] * (poll_ival / 1000)) / 1000; > } > =20 > /* Always switch to the lowest frequency in min mode. */ > if (mode =3D=3D MODE_MIN) { > - if (curfreq !=3D freqs[numfreqs - 1]) { > + freq =3D freqs[numfreqs - 1]; > + if (curfreq !=3D freq) { > if (vflag) { > printf("now operating on %s power; " > "changing frequency to %d MHz\n", > - modes[acline_status], > - freqs[numfreqs - 1]); > + modes[acline_status], freq); > } > - if (set_freq(freqs[numfreqs - 1]) !=3D 0) { > + if (set_freq(freq) !=3D 0) { > warn("error setting CPU freq %d", > - freqs[numfreqs - 1]); > + freq); > continue; > } > } > @@ -561,16 +610,16 @@ main(int argc, char * argv[]) > =20 > /* Always switch to the highest frequency in max mode. */ > if (mode =3D=3D MODE_MAX) { > - if (curfreq !=3D freqs[0]) { > + freq =3D freqs[0]; > + if (curfreq !=3D freq) { > if (vflag) { > printf("now operating on %s power; " > "changing frequency to %d MHz\n", > - modes[acline_status], > - freqs[0]); > + modes[acline_status], freq); > } > - if (set_freq(freqs[0]) !=3D 0) { > + if (set_freq(freq) !=3D 0) { > warn("error setting CPU freq %d", > - freqs[0]); > + freq); > continue; > } > } > @@ -578,44 +627,59 @@ main(int argc, char * argv[]) > } > =20 > /* Adaptive mode; get the current CPU usage times. */ > - if (read_usage_times(&idle, &total)) { > + if (read_usage_times(&load)) { > if (vflag) > warn("read_usage_times() failed"); > continue; > } > - > - /* > - * If we're idle less than the active mark, bump up two levels. > - * If we're idle more than the idle mark, drop down one level. > - */ > - for (i =3D 0; i < numfreqs - 1; i++) { > - if (freqs[i] =3D=3D curfreq) > - break; > - } > - if (idle < (total * cpu_running_mark) / 100 && > - curfreq < freqs[0]) { > - i -=3D 2; > - if (i < 0) > - i =3D 0; > - if (vflag) { > - printf("idle time < %d%%, increasing clock" > - " speed from %d MHz to %d MHz\n", > - cpu_running_mark, curfreq, freqs[i]); > + =09 > + if (mode =3D=3D MODE_ADAPTIVE) { > + if (load > cpu_running_mark) { > + if (load > 95 || load > cpu_running_mark * 2) > + freq *=3D 2; > + else > + freq =3D freq * load / cpu_running_mark; > + if (freq > freqs[0]) > + freq =3D freqs[0]; > + } else if (load < cpu_idle_mark && > + curfreq * load < freqs[get_freq_id( > + freq * 7 / 8, freqs, numfreqs)] *=20 > + cpu_running_mark) { > + freq =3D freq * 7 / 8; > + if (freq < freqs[numfreqs - 1]) > + freq =3D freqs[numfreqs - 1]; > } > - if (set_freq(freqs[i])) > - warn("error setting CPU frequency %d", > - freqs[i]); > - } else if (idle > (total * cpu_idle_mark) / 100 && > - curfreq > freqs[numfreqs - 1]) { > - i++; > + } else { /* MODE_HIADAPTIVE */ > + if (load > cpu_running_mark / 2) { > + if (load > 95 || load > cpu_running_mark) > + freq *=3D 4; > + else > + freq =3D freq * load * 2 / cpu_running_mark; > + if (freq > freqs[0] * 2) > + freq =3D freqs[0] * 2; > + } else if (load < cpu_idle_mark / 2 && > + curfreq * load < freqs[get_freq_id( > + freq * 31 / 32, freqs, numfreqs)] *=20 > + cpu_running_mark / 2) { > + freq =3D freq * 31 / 32; > + if (freq < freqs[numfreqs - 1]) > + freq =3D freqs[numfreqs - 1]; > + } > + } > + if (vflag) { > + printf("load %3d%%, current freq %4d MHz (%2d), wanted freq %4d MH= z\n", > + load, curfreq, i, freq); > + } > + j =3D get_freq_id(freq, freqs, numfreqs); > + if (i !=3D j) { > if (vflag) { > - printf("idle time > %d%%, decreasing clock" > + printf("changing clock" > " speed from %d MHz to %d MHz\n", > - cpu_idle_mark, curfreq, freqs[i]); > + freqs[i], freqs[j]); > } > - if (set_freq(freqs[i]) !=3D 0) > + if (set_freq(freqs[j])) > warn("error setting CPU frequency %d", > - freqs[i]); > + freqs[j]); > } > } > free(freqs); --=-O4hl6nfA1j7x3X8DsYvl Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEABECAAYFAkkjhDsACgkQM4TrQ4qfROPLfwCfadZHZ+JFfiLlDVmXjqhel/ZK blkAn0mPLk9PnR7uEjaeRKJ4TGmHDSLL =Pr70 -----END PGP SIGNATURE----- --=-O4hl6nfA1j7x3X8DsYvl-- From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 06:58:52 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6949106564A; Wed, 19 Nov 2008 06:58:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A27E78FC16; Wed, 19 Nov 2008 06:58:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ6wq43008579; Wed, 19 Nov 2008 06:58:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ6wqAi008576; Wed, 19 Nov 2008 06:58:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811190658.mAJ6wqAi008576@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 06:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185086 - stable/7/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 06:58:52 -0000 Author: delphij Date: Wed Nov 19 06:58:52 2008 New Revision: 185086 URL: http://svn.freebsd.org/changeset/base/185086 Log: MFC revisions 183653 183654 183714 (simon), all recent em(4) and add igb(4). Approved by: re (hrs) Added: stable/7/share/man/man4/igb.4 (props changed) - copied unchanged from r183654, head/share/man/man4/igb.4 Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/Makefile stable/7/share/man/man4/em.4 Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Wed Nov 19 04:05:44 2008 (r185085) +++ stable/7/share/man/man4/Makefile Wed Nov 19 06:58:52 2008 (r185086) @@ -118,6 +118,7 @@ MAN= aac.4 \ ieee80211.4 \ if_bridge.4 \ ifmib.4 \ + igb.4 \ iic.4 \ iicbb.4 \ iicbus.4 \ Modified: stable/7/share/man/man4/em.4 ============================================================================== --- stable/7/share/man/man4/em.4 Wed Nov 19 04:05:44 2008 (r185085) +++ stable/7/share/man/man4/em.4 Wed Nov 19 06:58:52 2008 (r185086) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2006 +.Dd October 6, 2008 .Dt EM 4 .Os .Sh NAME @@ -56,7 +56,8 @@ The .Nm driver provides support for PCI Gigabit Ethernet adapters based on the Intel 82540, 82541ER, 82541PI, 82542, 82543, 82544, 82545, 82546, -82546EB, 82546GB, 82547, 82571, 81572 and 82573 Ethernet controller chips. +82546EB, 82546GB, 82547, 82571, 81572, 82573, and 82574 Ethernet +controller chips. The driver supports Transmit/Receive checksum offload and Jumbo Frames on all but 82542-based adapters. Furthermore it supports TCP segmentation offload (TSO) on all adapters but @@ -135,7 +136,7 @@ The .Nm driver supports Gigabit Ethernet adapters based on the Intel 82540, 82541ER, 82541PI, 82542, 82543, 82544, 82545, 82546, 82546EB, -82546GB, 82547, 82571, 82572 and 82573 controller chips: +82546GB, 82547, 82571, 82572, 82573, and 82574 controller chips: .Pp .Bl -bullet -compact .It @@ -163,6 +164,20 @@ Intel PRO/1000 MT Quad Port Server Adapt .It Intel PRO/1000 MT Server Adapter (82545) .It +Intel PRO/1000 PF Dual Port Server Adapter (82571) +.It +Intel PRO/1000 PF Quad Port Server Adapter (82571) +.It +Intel PRO/1000 PF Server Adapter (82572) +.It +Intel PRO/1000 PT Desktop Adapter (82572) +.It +Intel PRO/1000 PT Dual Port Server Adapter (82571) +.It +Intel PRO/1000 PT Quad Port Server Adapter (82571) +.It +Intel PRO/1000 PT Server Adapter (82572) +.It Intel PRO/1000 T Desktop Adapter (82544) .It Intel PRO/1000 T Server Adapter (82543) Copied: stable/7/share/man/man4/igb.4 (from r183654, head/share/man/man4/igb.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man4/igb.4 Wed Nov 19 06:58:52 2008 (r185086, copy of r183654, head/share/man/man4/igb.4) @@ -0,0 +1,196 @@ +.\" Copyright (c) 2001-2003, Intel Corporation +.\" 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. +.\" +.\" 3. Neither the name of the Intel Corporation nor the names of its +.\" contributors may be used to endorse or promote products derived from +.\" this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. +.\" +.\" * Other names and brands may be claimed as the property of others. +.\" +.\" $FreeBSD$ +.\" +.Dd October 6, 2008 +.Dt IGB 4 +.Os +.Sh NAME +.Nm igb +.Nd "Intel(R) PRO/1000 PCI Express Gigabit Ethernet adapter driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device igb" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_igb_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for PCI Express Gigabit Ethernet adapters +based on the Intel 82575 and 82576 Ethernet controller chips. +The driver supports Transmit/Receive checksum offload and Jumbo +Frames. +Furthermore it supports TCP segmentation offload (TSO) on all +adapters. +.Pp +For questions related to hardware requirements, refer to the +documentation supplied with your Intel PRO/1000 adapter. +All hardware requirements listed apply to use with +.Fx . +.Pp +Support for Jumbo Frames is provided via the interface MTU setting. +Selecting an MTU larger than 1500 bytes with the +.Xr ifconfig 8 +utility configures the adapter to receive and transmit Jumbo Frames. +The maximum MTU size for Jumbo Frames is 9216. +.Pp +This driver supports hardware assisted VLANs. +The +.Nm +driver supports the following media types: +.Bl -tag -width ".Cm 10baseT/UTP" +.It Cm autoselect +Enables auto-negotiation for speed and duplex. +.It Cm 10baseT/UTP +Sets 10Mbps operation. +Use the +.Cm mediaopt +option to select +.Cm full-duplex +mode. +.It Cm 100baseTX +Sets 100Mbps operation. +Use the +.Cm mediaopt +option to select +.Cm full-duplex +mode. +.It Cm 1000baseSX +Sets 1000Mbps operation. +Only +.Cm full-duplex +mode is supported at this speed. +.It Cm 1000baseTX +Sets 1000Mbps operation. +Only +.Cm full-duplex +mode is supported at this speed. +.El +.Pp +The +.Nm +driver supports the following media options: +.Bl -tag -width ".Cm full-duplex" +.It Cm full-duplex +Forces full-duplex operation +.It Cm half-duplex +Forces half-duplex operation. +.El +.Pp +Only use +.Cm mediaopt +to set the driver to +.Cm full-duplex . +If +.Cm mediaopt +is not specified, the driver defaults to +.Cm half-duplex . +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports Gigabit Ethernet adapters based on the Intel 82575 and +82576 controller chips: +.Pp +.Bl -bullet -compact +.It +Intel Gigabit ET Dual Port Server Adapter (82576) +.It +Intel Gigabit VT Quad Port Server Adapter (82575) +.El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va hw.igb.rxd +Number of receive descriptors allocated by the driver. +The default value is 256. +The minimum is 80, and the maximum is 4096. +.It Va hw.igb.txd +Number of transmit descriptors allocated by the driver. +The default value is 256. +The minimum is 80, and the maximum is 4096. +.It Va hw.igb.enable_aim +If set to 1, enable Adaptive Interrupt Moderation. +The default is to enable Adaptive Interrupt Moderation. +.El +.Sh DIAGNOSTICS +.Bl -diag +.It "igb%d: Unable to allocate bus resource: memory" +A fatal initialization error has occurred. +.It "igb%d: Unable to allocate bus resource: interrupt" +A fatal initialization error has occurred. +.It "igb%d: watchdog timeout -- resetting" +The device has stopped responding to the network, or there is a problem with +the network connection (cable). +.El +.Sh SUPPORT +For general information and support, +go to the Intel support website at: +.Pa http://support.intel.com . +.Pp +If an issue is identified with the released source code on the supported kernel +with a supported adapter, email the specific information related to the +issue to +.Aq freebsdnic@mailbox.intel.com . +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr em 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr polling 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 7.1 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Intel Corporation Aq freebsdnic@mailbox.intel.com . From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 08:56:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B35A3106568E; Wed, 19 Nov 2008 08:56:36 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C56A8FC0A; Wed, 19 Nov 2008 08:56:36 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ8uaoT012034; Wed, 19 Nov 2008 08:56:36 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ8uaC1012028; Wed, 19 Nov 2008 08:56:36 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200811190856.mAJ8uaC1012028@svn.freebsd.org> From: Alfred Perlstein Date: Wed, 19 Nov 2008 08:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185087 - in head: etc/mtree include lib lib/libusb20 share/man/man7 share/mk sys/dev/usb sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/image sys/dev/usb... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 08:56:36 -0000 Author: alfred Date: Wed Nov 19 08:56:35 2008 New Revision: 185087 URL: http://svn.freebsd.org/changeset/base/185087 Log: src/sys/dev/usb2/controller/uss820dci_pccard.c src/sys/dev/usb2/core/usbdevs src/sys/dev/usb2/include/urio2_ioctl.h src/sys/dev/usb2/storage/ustorage2_fs.h These files are not used any more. src/usr.sbin/Makefile src/etc/mtree/BSD.include.dist src/include/Makefile src/lib/Makefile src/share/man/man7/hier.7 src/share/mk/bsd.libnames.mk src/etc/mtree/BSD.include.dist Make "usbconfig" and "libusb20" a part of the default build. src/sys/dev/usb/rio500_usb.h src/sys/dev/usb2/storage/urio2.c Use common include file. src/sys/dev/usb2/bluetooth/ng_ubt2.c Make USB bluetooth depend on "ng_hci" module. src/sys/dev/usb2/controller/ehci2.c src/sys/dev/usb2/controller/ehci2.h Patches for Marvell EHCI. src/sys/dev/usb2/core/usb2_busdma.c Bugfix for 64-bit platforms. Need to unload the previously loaded DMA map and some cleanup regarding some corner cases. src/sys/dev/usb2/core/usb2_core.h src/sys/dev/usb2/core/usb2_dev.c src/sys/dev/usb2/core/usb2_dev.h Bugfix for libusb filesystem interface. New feature: Add support for filtering device data at the expense of the userland process. Add some more comments. Some minor code styling. Remove unused function, usb2_fifo_get_data_next(). Fix an issue about "fifo_index" being used instead of "ep_index". src/sys/dev/usb2/core/usb2_device.c src/sys/dev/usb2/core/usb2_generic.c Bugfix for Linux USB compat layer. Do not free non-generic FIFOs when doing an alternate setting. Cleanup USB IOCTL and USB reference handling. Fix a corner case where USB-FS was left initialised after setting a new configuration or alternate setting. src/sys/dev/usb2/core/usb2_hub.c Improvement: Check all USB HUB ports by default at least one time. src/sys/dev/usb2/core/usb2_request.c Bugfix: Make sure destination ASCII string is properly zero terminated in all cases. Improvement: Skip invalid characters instead of replacing with a dot. src/sys/dev/usb2/core/usb2_util.c src/sys/dev/usb2/image/uscanner2.c Spelling. src/sys/dev/usb2/include/Makefile Share "usbdevs" with the old USB stack. src/sys/dev/usb2/include/usb2_devid.h src/sys/dev/usb2/include/usb2_devtable.h Regenerate files. Alfred: Please fix the RCS tag at the top. src/sys/dev/usb2/include/usb2_ioctl.h Fix compilation of "kdump". src/sys/dev/usb2/serial/ubsa2.c src/sys/dev/usb2/serial/ugensa2.c Remove device ID's which will end up in a new 3G driver. src/sys/dev/usb2/sound/uaudio2.c Correct a debug printout. src/sys/dev/usb2/storage/umass2.c Sync with old USB stack. src/lib/libusb20/libusb20.3 Add more documentation. src/lib/libusb20/libusb20.c Various bugfixes and improvements. src/usr.sbin/usbconfig/dump.c src/usr.sbin/usbconfig/usbconfig.c New commands for dumping strings and doing custom USB requests from the command line. Remove keyword requirements from generated files: "head/sys/dev/usb2/include/usb2_devid.h" "head/sys/dev/usb2/include/usb2_devtable.h" Deleted: head/sys/dev/usb2/controller/uss820dci_pccard.c head/sys/dev/usb2/core/usbdevs head/sys/dev/usb2/include/urio2_ioctl.h Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/lib/Makefile head/lib/libusb20/libusb20.3 head/lib/libusb20/libusb20.c head/lib/libusb20/libusb20.h head/lib/libusb20/libusb20_compat01.c head/lib/libusb20/libusb20_compat01.h head/lib/libusb20/libusb20_desc.c head/lib/libusb20/libusb20_desc.h head/lib/libusb20/libusb20_ugen20.c head/share/man/man7/hier.7 head/share/mk/bsd.libnames.mk head/sys/dev/usb/rio500_usb.h head/sys/dev/usb2/bluetooth/ng_ubt2.c head/sys/dev/usb2/controller/ehci2.c head/sys/dev/usb2/controller/ehci2.h head/sys/dev/usb2/core/usb2_busdma.c head/sys/dev/usb2/core/usb2_core.h head/sys/dev/usb2/core/usb2_dev.c head/sys/dev/usb2/core/usb2_dev.h head/sys/dev/usb2/core/usb2_device.c head/sys/dev/usb2/core/usb2_generic.c head/sys/dev/usb2/core/usb2_generic.h head/sys/dev/usb2/core/usb2_hub.c head/sys/dev/usb2/core/usb2_request.c head/sys/dev/usb2/core/usb2_util.c head/sys/dev/usb2/image/uscanner2.c head/sys/dev/usb2/include/Makefile head/sys/dev/usb2/include/usb2_devid.h (contents, props changed) head/sys/dev/usb2/include/usb2_devtable.h (contents, props changed) head/sys/dev/usb2/include/usb2_ioctl.h head/sys/dev/usb2/serial/ubsa2.c head/sys/dev/usb2/serial/ugensa2.c head/sys/dev/usb2/sound/uaudio2.c head/sys/dev/usb2/storage/umass2.c head/sys/dev/usb2/storage/urio2.c head/usr.sbin/Makefile head/usr.sbin/usbconfig/dump.c head/usr.sbin/usbconfig/usbconfig.c Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Wed Nov 19 06:58:52 2008 (r185086) +++ head/etc/mtree/BSD.include.dist Wed Nov 19 08:56:35 2008 (r185087) @@ -120,6 +120,10 @@ .. usb .. + usb2 + include + .. + .. utopia .. vkbd Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Wed Nov 19 06:58:52 2008 (r185086) +++ head/include/Makefile Wed Nov 19 08:56:35 2008 (r185087) @@ -54,7 +54,7 @@ LSUBDIRS= cam/scsi \ security/mac_mls security/mac_partition \ ufs/ffs ufs/ufs -LSUBSUBDIRS= dev/mpt/mpilib +LSUBSUBDIRS= dev/mpt/mpilib dev/usb2/include .if ${MACHINE_ARCH} == "powerpc" _dev_powermac_nvram= dev/powermac_nvram Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/Makefile Wed Nov 19 08:56:35 2008 (r185087) @@ -38,7 +38,8 @@ SUBDIR= ${_csu} libc libbsm libcom_err l ${_libpmc} libproc librt ${_libsdp} ${_libsm} ${_libsmb} \ ${_libsmdb} \ ${_libsmutil} libstand ${_libtelnet} ${_libthr} libthread_db libufs \ - libugidfw ${_libusbhid} ${_libvgl} libwrap liby libz ${_bind} + libugidfw ${_libusbhid} ${_libusb20} ${_libvgl} libwrap liby libz \ + ${_bind} .if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) _csu=csu/${MACHINE_ARCH}-elf @@ -136,6 +137,7 @@ _libtelnet= libtelnet .if ${MK_USB} != "no" _libusbhid= libusbhid +_libusb20= libusb20 .endif .include Modified: head/lib/libusb20/libusb20.3 ============================================================================== --- head/lib/libusb20/libusb20.3 Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/libusb20/libusb20.3 Wed Nov 19 08:56:35 2008 (r185087) @@ -60,9 +60,9 @@ USB through the USB file system interfac . .Pp . -.Fn libusb20_tr_close +.Fn libusb20_tr_close pxfer This function will release all kernel resources associated with an USB -.Fa xfer . +.Fa pxfer . . This function returns zero upon success. . @@ -70,13 +70,13 @@ Non-zero return values indicate a LIBUSB . .Pp . -.Fn libusb20_tr_open +.Fn libusb20_tr_open pxfer max_buf_size max_frame_count ep_no This function will allocate kernel resources like -.Fa MaxBufSize +.Fa max_buf_size and -.Fa MaxFrameCount +.Fa max_frame_count associated with an USB -.Fa xfer +.Fa pxfer and bind the transfer to the specified .Fa ep_no . . @@ -86,7 +86,7 @@ Non-zero return values indicate a LIBUSB . .Pp . -.Fn libusb20_tr_get_pointer +.Fn libusb20_tr_get_pointer pdev tr_index This function will return a pointer to the allocated USB transfer according to the .Fa pdev and @@ -97,32 +97,32 @@ This function returns NULL in case of fa . .Pp . -.Fn libusb20_tr_get_time_complete +.Fn libusb20_tr_get_time_complete pxfer This function will return the completion time of an USB transfer in millisecond units. This function is most useful for isochronous USB transfers when doing echo cancelling. . .Pp . -.Fn libusb20_tr_get_actual_frames +.Fn libusb20_tr_get_actual_frames pxfer This function will return the actual number of USB frames after an USB transfer completed. A value of zero means that no data was transferred. . .Pp . -.Fn libusb20_tr_get_actual_length +.Fn libusb20_tr_get_actual_length pxfer This function will return the sum of the actual length for all transferred USB frames for the given USB transfer. . .Pp . -.Fn libusb20_tr_get_max_frames +.Fn libusb20_tr_get_max_frames pxfer This function will return the maximum number of USB frames that were allocated when an USB transfer was setup for the given USB transfer. . .Pp . -.Fn libusb20_tr_get_max_packet_length +.Fn libusb20_tr_get_max_packet_length pxfer This function will return the maximum packet length in bytes associated with the given USB transfer. . @@ -132,20 +132,20 @@ packets are avoided for proxy buffers. . .Pp . -.Fn libusb20_tr_get_max_total_length +.Fn libusb20_tr_get_max_total_length pxfer This function will return the maximum value for the length sum of all USB frames associated with an USB transfer. . .Pp . -.Fn libusb20_tr_get_status +.Fn libusb20_tr_get_status pxfer This function will return the status of an USB transfer. . Status values are defined by a set of LIBUSB20_TRANSFER_XXX enums. . .Pp . -.Fn libusb20_tr_pending +.Fn libusb20_tr_pending pxfer This function will return non-zero if the given USB transfer is pending for completion. . @@ -153,12 +153,12 @@ Else this function returns zero. . .Pp . -.Fn libusb20_tr_callback_wrapper +.Fn libusb20_tr_callback_wrapper pxfer This is an internal function used to wrap asynchronous USB callbacks. . .Pp . -.Fn libusb20_tr_clear_stall_sync +.Fn libusb20_tr_clear_stall_sync pxfer This is an internal function used to synchronously clear the stall on the given USB transfer. . @@ -171,13 +171,13 @@ been called. . .Pp . -.Fn libusb20_tr_drain +.Fn libusb20_tr_drain pxfer This function will stop the given USB transfer and will not return until the USB transfer has been stopped in hardware. . .Pp . -.Fn libusb20_tr_set_buffer +.Fn libusb20_tr_set_buffer pxfer pbuf fr_index This function is used to set the .Fa buffer pointer for the given USB transfer and @@ -188,7 +188,7 @@ Typically the frame index is zero. . .Pp . -.Fn libusb20_tr_set_callback +.Fn libusb20_tr_set_callback pxfer pcallback This function is used to set the USB callback for asynchronous USB transfers. . @@ -196,7 +196,7 @@ The callback type is defined by libusb20 . .Pp . -.Fn libusb20_tr_set_flags +.Fn libusb20_tr_set_flags pxfer flags This function is used to set various USB flags for the given USB transfer. .Bl -tag .It LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK @@ -211,22 +211,22 @@ Will do a clear-stall before starting th . .Pp . -.Fn libusb20_tr_set_length +.Fn libusb20_tr_set_length pxfer length fr_index This function sets the length of a given USB transfer and frame index. . .Pp . -.Fn libusb20_tr_set_priv_sc0 +.Fn libusb20_tr_set_priv_sc0 pxfer psc0 This function sets private driver pointer number zero. . .Pp . -.Fn libusb20_tr_set_priv_sc1 +.Fn libusb20_tr_set_priv_sc1 pxfer psc1 This function sets private driver pointer number one. . .Pp . -.Fn libusb20_tr_set_timeout +.Fn libusb20_tr_set_timeout pxfer timeout This function sets the timeout for the given USB transfer. . A timeout value of zero means no timeout. @@ -235,35 +235,35 @@ The timeout is given in milliseconds. . .Pp . -.Fn libusb20_tr_set_total_frames +.Fn libusb20_tr_set_total_frames pxfer nframes This function sets the total number of frames that should be executed when the USB transfer is submitted. . The total number of USB frames must be less than the maximum number of USB frames associated with the given USB transfer. . .Pp . -.Fn libusb20_tr_setup_bulk +.Fn libusb20_tr_setup_bulk pxfer pbuf length timeout This function is a helper function for setting up a single frame USB BULK transfer. . .Pp . -.Fn libusb20_tr_setup_control +.Fn libusb20_tr_setup_control pxfer psetup pbuf timeout This function is a helper function for setting up a single or dual frame USB CONTROL transfer depending on the control transfer length. . .Pp . -.Fn libusb20_tr_setup_intr +.Fn libusb20_tr_setup_intr pxfer pbuf length timeout This function is a helper function for setting up a single frame USB INTERRUPT transfer. . .Pp . -.Fn libusb20_tr_setup_isoc +.Fn libusb20_tr_setup_isoc pxfer pbuf length fr_index This function is a helper function for setting up a multi frame USB ISOCHRONOUS transfer. . .Pp . -.Fn libusb20_tr_start +.Fn libusb20_tr_start pxfer This function will get the USB transfer started, if not already started. . @@ -273,7 +273,7 @@ This function is non-blocking. . .Pp . -.Fn libusb20_tr_stop +.Fn libusb20_tr_stop pxfer This function will get the USB transfer stopped, if not already stopped. . This function is non-blocking, which means that the actual stop can @@ -281,20 +281,20 @@ happen after the return of this function . .Pp . -.Fn libusb20_tr_submit +.Fn libusb20_tr_submit pxfer This function will get the USB transfer queued in hardware. . . .Pp . -.Fn libusb20_tr_get_priv_sc0 +.Fn libusb20_tr_get_priv_sc0 pxfer This function returns private driver pointer number zero associated with an USB transfer. . . .Pp . -.Fn libusb20_tr_get_priv_sc1 +.Fn libusb20_tr_get_priv_sc1 pxfer This function returns private driver pointer number one associated with an USB transfer. . @@ -303,17 +303,17 @@ with an USB transfer. . .Pp . -.Fn libusb20_dev_get_backend_name +.Fn libusb20_dev_get_backend_name pdev This function returns a zero terminated string describing the backend used. . .Pp . -.Fn libusb20_dev_get_desc +.Fn libusb20_dev_get_desc pdev This function returns a zero terminated string describing the given USB device. . .Pp . -.Fn libusb20_dev_claim_interface +.Fn libusb20_dev_claim_interface pdev iface_index This function will try to claim the given USB interface given by .Fa iface_index . This function returns zero on success else a LIBUSB20_ERROR value is @@ -321,7 +321,7 @@ returned. . .Pp . -.Fn libusb20_dev_close +.Fn libusb20_dev_close pdev This function will close the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -329,7 +329,7 @@ returned. . .Pp . -.Fn libusb20_dev_detach_kernel_driver +.Fn libusb20_dev_detach_kernel_driver pdev iface_index This function will try to detach the kernel driver for the USB interface given by .Fa iface_index . . @@ -338,7 +338,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_config_index +.Fn libusb20_dev_set_config_index pdev config_index This function will try to set the configuration index on an USB device. . @@ -350,12 +350,12 @@ This function returns zero on success el . .Pp . -.Fn libusb20_dev_get_debug +.Fn libusb20_dev_get_debug pdev This function returns the debug level of an USB device. . .Pp . -.Fn libusb20_dev_get_fd +.Fn libusb20_dev_get_fd pdev This function returns the file descriptor of the given USB device. . A negative value is returned when no file descriptor is present. @@ -364,7 +364,7 @@ The file descriptor can be used for poll . .Pp . -.Fn libusb20_dev_kernel_driver_active +.Fn libusb20_dev_kernel_driver_active pdev iface_index This function returns a non-zero value if a kernel driver is active on the given USB interface. . @@ -372,7 +372,7 @@ Else zero is returned. . .Pp . -.Fn libusb20_dev_open +.Fn libusb20_dev_open pdev transfer_max This function opens an USB device so that setting up USB transfers becomes possible. . @@ -387,7 +387,7 @@ opened. . .Pp . -.Fn libusb20_dev_process +.Fn libusb20_dev_process pdev This function is called to sync kernel USB transfers with userland USB transfers. . @@ -397,7 +397,7 @@ detached. . .Pp . -.Fn libusb20_dev_release_interface +.Fn libusb20_dev_release_interface pdev iface_index This function will try to release a claimed USB interface for the specified USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -405,7 +405,7 @@ returned. . .Pp . -.Fn libusb20_dev_request_sync +.Fn libusb20_dev_request_sync pdev psetup pdata pactlen timeout flags This function will perform a synchronous control request on the given USB device. . @@ -428,7 +428,7 @@ returned. . .Pp . -.Fn libusb20_dev_req_string_sync +.Fn libusb20_dev_req_string_sync pdev index lang_id pbuf len This function will synchronously request an USB string by language ID and string index into the given buffer limited by a maximum length. . @@ -437,7 +437,7 @@ returned. . .Pp . -.Fn libusb20_dev_req_string_simple_sync +.Fn libusb20_dev_req_string_simple_sync pdev index pbuf len This function will synchronously request an USB string using the default language ID and convert the string into ASCII before storing the string into the given buffer limited by a maximum length which @@ -449,7 +449,7 @@ returned. . .Pp . -.Fn libusb20_dev_reset +.Fn libusb20_dev_reset pdev This function will try to BUS reset the given USB device and restore the last set USB configuration. . @@ -458,7 +458,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_power_mode +.Fn libusb20_dev_set_power_mode pdev power_mode This function sets the power mode of the USB device. . Valid power modes: @@ -475,13 +475,13 @@ returned. . .Pp . -.Fn libusb20_dev_get_power_mode +.Fn libusb20_dev_get_power_mode pdev This function returns the currently selected power mode for the given USB device. . .Pp . -.Fn libusb20_dev_set_alt_index +.Fn libusb20_dev_set_alt_index pdev iface_index alt_index This function will try to set the given alternate index for the given USB interface index. . @@ -490,7 +490,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_owner +.Fn libusb20_dev_set_owner pdev uid gid This function will set the ownership of the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -498,7 +498,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_perm +.Fn libusb20_dev_set_perm pdev mode This function will set the permissions of the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -506,7 +506,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_iface_owner +.Fn libusb20_dev_set_iface_owner pdev iface_index uid gid This function will set the ownership of the given USB interface. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -514,7 +514,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_iface_perm +.Fn libusb20_dev_set_iface_perm pdev iface_index mode This function will set the permissions of the given USB interface. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -522,7 +522,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_owner +.Fn libusb20_dev_get_owner pdev puid pgid This function will retrieve the current USB device ownership. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -530,7 +530,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_perm +.Fn libusb20_dev_get_perm pdev pmode This function will retrieve the current USB device permissions. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -538,7 +538,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_iface_owner +.Fn libusb20_dev_get_iface_owner pdev iface_index puid pgid This function will retrieve the current USB interface ownership for the given USB interface. . @@ -547,7 +547,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_iface_perm +.Fn libusb20_dev_get_iface_perm pdev iface_index pmode This function will retrieve the current USB interface permissions for the given USB interface. . @@ -556,7 +556,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_device_desc +.Fn libusb20_dev_get_device_desc pdev This function returns a pointer to the decoded and host endian version of the device descriptor. . @@ -564,7 +564,7 @@ The USB device need not be opened when c . .Pp . -.Fn libusb20_dev_alloc_config +.Fn libusb20_dev_alloc_config pdev config_index This function will read out and decode the USB config descriptor for the given USB device and config index. This function returns a pointer to the decoded configuration which must eventually be passed to @@ -572,24 +572,24 @@ free(). NULL is returned in case of fail . .Pp . -.Fn libusb20_dev_alloc(void) +.Fn libusb20_dev_alloc void This is an internal function to allocate a new USB device. . .Pp . -.Fn libusb20_dev_get_address +.Fn libusb20_dev_get_address pdev This function returns the internal and not necessarily the real hardware address of the given USB device. . .Pp . -.Fn libusb20_dev_get_bus_number +.Fn libusb20_dev_get_bus_number pdev This function return the internal bus number which the given USB device belongs to. . .Pp . -.Fn libusb20_dev_get_mode +.Fn libusb20_dev_get_mode pdev This function returns the current operation mode of the USB entity. . Valid return values are: @@ -600,7 +600,7 @@ Valid return values are: . .Pp . -.Fn libusb20_dev_get_speed +.Fn libusb20_dev_get_speed pdev This function returns the current speed of the given USB device. . .Bl -tag @@ -614,24 +614,24 @@ This function returns the current speed . .Pp . -.Fn libusb20_dev_get_config_index +.Fn libusb20_dev_get_config_index pdev This function returns the currently select config index for the given USB device. . .Pp . -.Fn libusb20_dev_free +.Fn libusb20_dev_free pdev This function will free the given USB device and all associated USB transfers. . .Pp . -.Fn libusb20_dev_set_debug +.Fn libusb20_dev_set_debug pdev debug_level This function will set the debug level for the given USB device. . .Pp . -.Fn libusb20_dev_wait_process +.Fn libusb20_dev_wait_process pdev timeout This function will wait until a pending USB transfer has completed on the given USB device. . @@ -641,7 +641,7 @@ function. . .Sh USB BUS OPERATIONS . -.Fn libusb20_bus_set_owner +.Fn libusb20_bus_set_owner pbackend bus_index uid gid This function will set the ownership for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -649,7 +649,7 @@ returned. . .Pp . -.Fn libusb20_bus_set_perm +.Fn libusb20_bus_set_perm pbackend bus_index mode This function will set the permissions for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -657,7 +657,7 @@ returned. . .Pp . -.Fn libusb20_bus_get_owner +.Fn libusb20_bus_get_owner pbackend bus_index puid pgid This function will retrieve the ownership for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -665,7 +665,7 @@ returned. . .Pp . -.Fn libusb20_bus_get_perm +.Fn libusb20_bus_get_perm pbackend bus_index pmode This function will retrieve the permissions for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -674,7 +674,7 @@ returned. . .Sh USB BACKEND OPERATIONS . -.Fn libusb20_be_get_dev_quirk +.Fn libusb20_be_get_dev_quirk pbackend index pquirk This function will return the device quirk according to .Fa index into the libusb20_quirk structure pointed to by @@ -687,7 +687,7 @@ returned. . .Pp . -.Fn libusb20_be_get_quirk_name +.Fn libusb20_be_get_quirk_name pbackend index pquirk This function will return the quirk name according to .Fa index into the libusb20_quirk structure pointed to by @@ -700,7 +700,7 @@ returned. . .Pp . -.Fn libusb20_be_add_dev_quirk +.Fn libusb20_be_add_dev_quirk pbackend pquirk This function will add the libusb20_quirk structure pointed to by the .Fa pq argument into the device quirk list. @@ -713,7 +713,7 @@ returned. . .Pp . -.Fn libusb20_be_remove_dev_quirk +.Fn libusb20_be_remove_dev_quirk pbackend pquirk This function will remove the quirk matching the libusb20_quirk structure pointed to by the .Fa pq argument from the device quirk list. @@ -726,7 +726,7 @@ returned. . .Pp . -.Fn libusb20_be_set_owner +.Fn libusb20_be_set_owner pbackend uid gid This function will set the ownership for the given backend. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -734,7 +734,7 @@ returned. . .Pp . -.Fn libusb20_be_set_perm +.Fn libusb20_be_set_perm pbackend mode This function will set the permissions for the given backend. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -742,7 +742,7 @@ returned. . .Pp . -.Fn libusb20_be_get_owner +.Fn libusb20_be_get_owner pbackend puid pgid This function will retrieve the ownership of the given backend. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -750,7 +750,7 @@ returned. . .Pp . -.Fn libusb20_be_get_perm +.Fn libusb20_be_get_perm pbackend pmode This function will retrieve the permissions of the given backend. . . @@ -759,20 +759,20 @@ returned. . .Pp . -.Fn libusb20_be_alloc +.Fn libusb20_be_alloc pmethods This is an internal function to allocate a USB backend. . .Pp -.Fn libusb20_be_alloc_default -.Fn libusb20_be_alloc_freebsd -.Fn libusb20_be_alloc_linux +.Fn libusb20_be_alloc_default void +.Fn libusb20_be_alloc_freebsd void +.Fn libusb20_be_alloc_linux void These functions are used to allocate a specific USB backend or the operating system default USB backend. Allocating a backend is a way to scan for currently present USB devices. . .Pp . -.Fn libusb20_be_device_foreach +.Fn libusb20_be_device_foreach pbackend pdev This function is used to iterate USB devices present in a USB backend. . The starting value of @@ -785,7 +785,7 @@ If NULL is returned the end of the USB d . .Pp . -.Fn libusb20_be_dequeue_device +.Fn libusb20_be_dequeue_device pbackend pdev This function will dequeue the given USB device pointer from the backend USB device list. . @@ -793,20 +793,20 @@ Dequeued USB devices will not be freed w . .Pp . -.Fn libusb20_be_enqueue_device +.Fn libusb20_be_enqueue_device pbackend pdev This function will enqueue the given USB device pointer in the backend USB device list. . Enqueued USB devices will get freed when the backend is freed. . .Pp . -.Fn libusb20_be_free +.Fn libusb20_be_free pbackend This function will free the given backend and all USB devices in its device list. . . .Sh USB DESCRIPTOR PARSING . -.Fn libusb20_me_get_1 +.Fn libusb20_me_get_1 pie offset This function will return a byte at the given byte offset of a message entity. . @@ -814,7 +814,7 @@ This function is safe against invalid of . .Pp . -.Fn libusb20_me_get_2 +.Fn libusb20_me_get_2 pie offset This function will return a little endian 16-bit value at the given byte offset of a message entity. . @@ -822,7 +822,7 @@ This function is safe against invalid of . .Pp . -.Fn libusb20_me_encode +.Fn libusb20_me_encode pbuf len pdecoded This function will encode a so-called *DECODED structure into binary format. . @@ -834,7 +834,7 @@ location. . .Pp . -.Fn libusb20_me_decode +.Fn libusb20_me_decode pbuf len pdecoded This function will decode a binary structure into a so-called *DECODED structure. . Modified: head/lib/libusb20/libusb20.c ============================================================================== --- head/lib/libusb20/libusb20.c Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/libusb20/libusb20.c Wed Nov 19 08:56:35 2008 (r185087) @@ -550,6 +550,9 @@ libusb20_dev_open(struct libusb20_device xfer->callback = &dummy_callback; } + /* set "nTransfer" early */ + pdev->nTransfer = nTransferMax; + error = (pdev->beMethods->open_device) (pdev, nTransferMax); if (error) { @@ -562,7 +565,6 @@ libusb20_dev_open(struct libusb20_device pdev->nTransfer = 0; } else { pdev->is_opened = 1; - pdev->nTransfer = nTransferMax; } return (error); } @@ -647,7 +649,7 @@ libusb20_dev_request_sync(struct libusb2 int libusb20_dev_req_string_sync(struct libusb20_device *pdev, - uint8_t index, uint16_t langid, void *ptr, uint16_t len) + uint8_t str_index, uint16_t langid, void *ptr, uint16_t len) { struct LIBUSB20_CONTROL_SETUP_DECODED req; int error; @@ -667,7 +669,7 @@ libusb20_dev_req_string_sync(struct libu LIBUSB20_RECIPIENT_DEVICE | LIBUSB20_ENDPOINT_IN; req.bRequest = LIBUSB20_REQUEST_GET_DESCRIPTOR; - req.wValue = (LIBUSB20_DT_STRING << 8) | index; + req.wValue = (LIBUSB20_DT_STRING << 8) | str_index; req.wIndex = langid; req.wLength = 4; /* bytes */ @@ -695,7 +697,7 @@ libusb20_dev_req_string_sync(struct libu int libusb20_dev_req_string_simple_sync(struct libusb20_device *pdev, - uint8_t index, void *ptr, uint16_t len) + uint8_t str_index, void *ptr, uint16_t len) { char *buf; int error; @@ -712,26 +714,23 @@ libusb20_dev_req_string_simple_sync(stru /* too short buffer */ return (LIBUSB20_ERROR_INVALID_PARAM); } - /* - * Make sure that there is sensible contents in the buffer in case - * of an error: - */ - *(uint8_t *)ptr = 0; - error = libusb20_dev_req_string_sync(pdev, 0, 0, temp, sizeof(temp)); - if (error < 0) + if (error < 0) { + *(uint8_t *)ptr = 0; /* zero terminate */ return (error); - + } langid = temp[2] | (temp[3] << 8); - error = libusb20_dev_req_string_sync(pdev, index, + error = libusb20_dev_req_string_sync(pdev, str_index, langid, temp, sizeof(temp)); - if (error < 0) + if (error < 0) { + *(uint8_t *)ptr = 0; /* zero terminate */ return (error); - + } if (temp[0] < 2) { /* string length is too short */ + *(uint8_t *)ptr = 0; /* zero terminate */ return (LIBUSB20_ERROR_OTHER); } /* reserve one byte for terminating zero */ @@ -762,14 +761,16 @@ libusb20_dev_req_string_simple_sync(stru *buf = c >> 8; swap = 2; } else { - *buf = '.'; + /* skip invalid character */ + continue; } /* * Filter by default - we don't allow greater and less than * signs because they might confuse the dmesg printouts! */ if ((*buf == '<') || (*buf == '>') || (!isprint(*buf))) { - *buf = '.'; + /* skip invalid character */ + continue; } buf++; } @@ -836,7 +837,7 @@ uint8_t libusb20_dev_get_config_index(struct libusb20_device *pdev) { int error; - uint8_t index; + uint8_t cfg_index; uint8_t do_close; if (!pdev->is_opened) { @@ -850,16 +851,16 @@ libusb20_dev_get_config_index(struct lib do_close = 0; } - error = (pdev->methods->get_config_index) (pdev, &index); + error = (pdev->methods->get_config_index) (pdev, &cfg_index); if (error) { - index = 0 - 1; /* current config index */ + cfg_index = 0 - 1; /* current config index */ } if (do_close) { if (libusb20_dev_close(pdev)) { /* ignore */ } } - return (index); + return (cfg_index); } uint8_t @@ -887,7 +888,7 @@ libusb20_dev_process(struct libusb20_dev void libusb20_dev_wait_process(struct libusb20_device *pdev, int timeout) { - struct pollfd pfd[2]; + struct pollfd pfd[1]; if (!pdev->is_opened) { return; @@ -895,11 +896,8 @@ libusb20_dev_wait_process(struct libusb2 pfd[0].fd = pdev->file; pfd[0].events = (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM); pfd[0].revents = 0; - pfd[1].fd = 0; /* standard input */ - pfd[1].events = (POLLIN | POLLRDNORM); - pfd[1].revents = 0; - if (poll(pfd, 2, timeout)) { + if (poll(pfd, 1, timeout)) { /* ignore any error */ } return; @@ -1071,16 +1069,16 @@ libusb20_bus_get_perm(struct libusb20_ba int libusb20_be_get_dev_quirk(struct libusb20_backend *pbe, - uint16_t index, struct libusb20_quirk *pq) + uint16_t quirk_index, struct libusb20_quirk *pq) { - return ((pbe->methods->root_get_dev_quirk) (pbe, index, pq)); + return ((pbe->methods->root_get_dev_quirk) (pbe, quirk_index, pq)); } int libusb20_be_get_quirk_name(struct libusb20_backend *pbe, - uint16_t index, struct libusb20_quirk *pq) + uint16_t quirk_index, struct libusb20_quirk *pq) { - return ((pbe->methods->root_get_quirk_name) (pbe, index, pq)); + return ((pbe->methods->root_get_quirk_name) (pbe, quirk_index, pq)); } int Modified: head/lib/libusb20/libusb20.h ============================================================================== --- head/lib/libusb20/libusb20.h Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/libusb20/libusb20.h Wed Nov 19 08:56:35 2008 (r185087) @@ -199,7 +199,7 @@ struct libusb20_quirk { /* USB transfer operations */ int libusb20_tr_close(struct libusb20_transfer *xfer); -int libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t pMaxBufSize, uint32_t MaxFrameCount, uint8_t ep_no); +int libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no); struct libusb20_transfer *libusb20_tr_get_pointer(struct libusb20_device *pdev, uint16_t tr_index); uint16_t libusb20_tr_get_time_complete(struct libusb20_transfer *xfer); uint32_t libusb20_tr_get_actual_frames(struct libusb20_transfer *xfer); @@ -297,6 +297,7 @@ struct libusb20_backend *libusb20_be_all struct libusb20_backend *libusb20_be_alloc_default(void); struct libusb20_backend *libusb20_be_alloc_freebsd(void); struct libusb20_backend *libusb20_be_alloc_linux(void); +struct libusb20_backend *libusb20_be_alloc_ugen20(void); struct libusb20_device *libusb20_be_device_foreach(struct libusb20_backend *pbe, struct libusb20_device *pdev); void libusb20_be_dequeue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 09:17:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A53C1065674; Wed, 19 Nov 2008 09:17:57 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 744898FC1E; Wed, 19 Nov 2008 09:17:57 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id B858C1A3C3C; Wed, 19 Nov 2008 00:58:52 -0800 (PST) Date: Wed, 19 Nov 2008 00:58:52 -0800 From: Alfred Perlstein To: Andrew Thompson Message-ID: <20081119085852.GK28578@elvis.mu.org> References: <200811102054.mAAKsVAQ082218@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200811102054.mAAKsVAQ082218@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184824 - in head/sys/dev/usb2: controller core serial storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 09:17:57 -0000 Cool, thank you, sorry I've been slow to pick up these deltas. I think we may be at a point where we can take some more of those changes you have. Can you resend them? I think you had two deltas? -Alfred * Andrew Thompson [081110 12:54] wrote: > Author: thompsa > Date: Mon Nov 10 20:54:31 2008 > New Revision: 184824 > URL: http://svn.freebsd.org/changeset/base/184824 > > Log: > Convert the two main locking areas into macros to make it clear on what we are > grabbing and why. These are now: > > USB_BUS_LOCK/USB_BUS_UNLOCK > USB_XFER_LOCK/USB_XFER_UNLOCK > > Reviewed by: alfred > > Modified: > head/sys/dev/usb2/controller/at91dci.c > head/sys/dev/usb2/controller/at91dci_atmelarm.c > head/sys/dev/usb2/controller/ehci2.c > head/sys/dev/usb2/controller/ehci2_pci.c > head/sys/dev/usb2/controller/musb2_otg.c > head/sys/dev/usb2/controller/musb2_otg_atmelarm.c > head/sys/dev/usb2/controller/ohci2.c > head/sys/dev/usb2/controller/ohci2_atmelarm.c > head/sys/dev/usb2/controller/ohci2_pci.c > head/sys/dev/usb2/controller/uhci2.c > head/sys/dev/usb2/controller/uhci2_pci.c > head/sys/dev/usb2/controller/usb2_bus.h > head/sys/dev/usb2/controller/usb2_controller.c > head/sys/dev/usb2/controller/uss820dci.c > head/sys/dev/usb2/controller/uss820dci_atmelarm.c > head/sys/dev/usb2/controller/uss820dci_pccard.c > head/sys/dev/usb2/core/usb2_busdma.c > head/sys/dev/usb2/core/usb2_core.h > head/sys/dev/usb2/core/usb2_device.c > head/sys/dev/usb2/core/usb2_handle_request.c > head/sys/dev/usb2/core/usb2_hub.c > head/sys/dev/usb2/core/usb2_request.c > head/sys/dev/usb2/core/usb2_sw_transfer.c > head/sys/dev/usb2/core/usb2_transfer.c > head/sys/dev/usb2/core/usb2_transfer.h > head/sys/dev/usb2/serial/uvscom2.c > head/sys/dev/usb2/storage/ata-usb2.c > > Modified: head/sys/dev/usb2/controller/at91dci.c > ============================================================================== > --- head/sys/dev/usb2/controller/at91dci.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/at91dci.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -291,7 +291,7 @@ at91dci_rem_wakeup_set(struct usb2_devic > > DPRINTFN(5, "is_on=%u\n", is_on); > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > sc = AT9100_DCI_BUS2SC(udev->bus); > > @@ -766,7 +766,7 @@ at91dci_vbus_interrupt(struct usb2_bus * > > DPRINTFN(5, "vbus = %u\n", is_on); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > if (is_on) { > if (!sc->sc_flags.status_vbus) { > sc->sc_flags.status_vbus = 1; > @@ -791,7 +791,7 @@ at91dci_vbus_interrupt(struct usb2_bus * > } > } > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -801,13 +801,13 @@ at91dci_interrupt(struct at91dci_softc * > { > uint32_t status; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > status = AT91_UDP_READ_4(sc, AT91_UDP_ISR); > status &= AT91_UDP_INT_DEFAULT; > > if (!status) { > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > /* acknowledge interrupts */ > @@ -879,7 +879,7 @@ at91dci_interrupt(struct at91dci_softc * > > at91dci_interrupt_poll(sc); > } > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1065,12 +1065,12 @@ at91dci_timeout(void *arg) > > DPRINTF("xfer=%p\n", xfer); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > /* transfer is transferred */ > at91dci_device_done(xfer, USB_ERR_TIMEOUT); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1115,7 +1115,7 @@ at91dci_root_intr_done(struct usb2_xfer > > DPRINTFN(9, "\n"); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_PRE_DATA) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -1255,7 +1255,7 @@ at91dci_device_done(struct usb2_xfer *xf > struct at91dci_softc *sc = xfer->usb2_sc; > uint8_t ep_no; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", > xfer, xfer->pipe, error); > @@ -1281,7 +1281,7 @@ at91dci_set_stall(struct usb2_device *ud > uint32_t csr_val; > uint8_t csr_reg; > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > DPRINTFN(5, "pipe=%p\n", pipe); > > @@ -1405,7 +1405,7 @@ at91dci_clear_stall(struct usb2_device * > > DPRINTFN(5, "pipe=%p\n", pipe); > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > /* check mode */ > if (udev->flags.usb2_mode != USB_MODE_DEVICE) { > @@ -1438,7 +1438,7 @@ at91dci_init(struct at91dci_softc *sc) > sc->sc_bus.usbrev = USB_REV_1_1; > sc->sc_bus.methods = &at91dci_bus_methods; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > /* turn on clocks */ > > @@ -1446,7 +1446,7 @@ at91dci_init(struct at91dci_softc *sc) > (sc->sc_clocks_on) (sc->sc_clocks_arg); > } > /* wait a little for things to stabilise */ > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > /* disable and clear all interrupts */ > > @@ -1483,7 +1483,7 @@ at91dci_init(struct at91dci_softc *sc) > > at91dci_clocks_off(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > /* catch any lost interrupts */ > > @@ -1495,7 +1495,7 @@ at91dci_init(struct at91dci_softc *sc) > void > at91dci_uninit(struct at91dci_softc *sc) > { > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > /* disable and clear all interrupts */ > AT91_UDP_WRITE_4(sc, AT91_UDP_IDR, 0xFFFFFFFF); > @@ -1510,7 +1510,7 @@ at91dci_uninit(struct at91dci_softc *sc) > > at91dci_pull_down(sc); > at91dci_clocks_off(sc); > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1532,10 +1532,10 @@ at91dci_do_poll(struct usb2_bus *bus) > { > struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > at91dci_interrupt_poll(sc); > at91dci_root_ctrl_poll(sc); > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1897,7 +1897,7 @@ at91dci_root_ctrl_done(struct usb2_xfer > uint16_t index; > uint8_t use_polling; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_SETUP) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -1913,7 +1913,7 @@ at91dci_root_ctrl_done(struct usb2_xfer > value = UGETW(std->req.wValue); > index = UGETW(std->req.wIndex); > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > /* demultiplex the control request */ > > > Modified: head/sys/dev/usb2/controller/at91dci_atmelarm.c > ============================================================================== > --- head/sys/dev/usb2/controller/at91dci_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/at91dci_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -210,7 +210,7 @@ at91_udp_attach(device_t dev) > device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); > > err = usb2_config_td_setup(&sc->sc_dci.sc_config_td, sc, > - &sc->sc_dci.sc_bus.mtx, NULL, 0, 4); > + &sc->sc_dci.sc_bus.bus_mtx, NULL, 0, 4); > if (err) { > device_printf(dev, "could not setup config thread!\n"); > goto error; > > Modified: head/sys/dev/usb2/controller/ehci2.c > ============================================================================== > --- head/sys/dev/usb2/controller/ehci2.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/ehci2.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -164,7 +164,7 @@ ehci_hc_reset(ehci_softc_t *sc) > EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ > > for (n = 0; n != 100; n++) { > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > hcr = EOREAD4(sc, EHCI_USBSTS); > if (hcr & EHCI_STS_HCH) { > hcr = 0; > @@ -180,7 +180,7 @@ ehci_hc_reset(ehci_softc_t *sc) > > EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); > for (n = 0; n != 100; n++) { > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > hcr = EOREAD4(sc, EHCI_USBCMD); > if (!(hcr & EHCI_CMD_HCRESET)) { > hcr = 0; > @@ -208,11 +208,11 @@ ehci_init(ehci_softc_t *sc) > uint16_t bit; > usb2_error_t err = 0; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > DPRINTF("start\n"); > > - usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.mtx, > + usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, > CALLOUT_RETURNUNLOCKED); > > #if USB_DEBUG > @@ -465,7 +465,7 @@ ehci_init(ehci_softc_t *sc) > EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); > > for (i = 0; i < 100; i++) { > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; > if (!hcr) { > break; > @@ -477,7 +477,7 @@ ehci_init(ehci_softc_t *sc) > goto done; > } > done: > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > if (!err) { > /* catch any lost interrupts */ > @@ -492,7 +492,7 @@ done: > void > ehci_detach(struct ehci_softc *sc) > { > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > usb2_callout_stop(&sc->sc_tmo_pcd); > > @@ -502,9 +502,9 @@ ehci_detach(struct ehci_softc *sc) > DPRINTF("reset failed!\n"); > } > /* XXX let stray task complete */ > - usb2_pause_mtx(&sc->sc_bus.mtx, 50); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 50); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > usb2_callout_drain(&sc->sc_tmo_pcd); > > @@ -518,7 +518,7 @@ ehci_suspend(struct ehci_softc *sc) > uint32_t hcr; > uint8_t i; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > for (i = 1; i <= sc->sc_noport; i++) { > cmd = EOREAD4(sc, EHCI_PORTSC(i)); > @@ -541,7 +541,7 @@ ehci_suspend(struct ehci_softc *sc) > if (hcr == 0) { > break; > } > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > } > > if (hcr != 0) { > @@ -555,14 +555,14 @@ ehci_suspend(struct ehci_softc *sc) > if (hcr == EHCI_STS_HCH) { > break; > } > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > } > > if (hcr != EHCI_STS_HCH) { > device_printf(sc->sc_bus.bdev, > "config timeout\n"); > } > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -574,7 +574,7 @@ ehci_resume(struct ehci_softc *sc) > uint32_t hcr; > uint8_t i; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > /* restore things in case the bios doesn't */ > EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); > @@ -599,7 +599,7 @@ ehci_resume(struct ehci_softc *sc) > } > > if (hcr) { > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_RESUME_WAIT); > > for (i = 1; i <= sc->sc_noport; i++) { > @@ -618,15 +618,15 @@ ehci_resume(struct ehci_softc *sc) > if (hcr != EHCI_STS_HCH) { > break; > } > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > } > if (hcr == EHCI_STS_HCH) { > device_printf(sc->sc_bus.bdev, "config timeout\n"); > } > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_RESUME_WAIT); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > /* catch any lost interrupts */ > ehci_do_poll(&sc->sc_bus); > @@ -639,12 +639,12 @@ ehci_shutdown(ehci_softc_t *sc) > { > DPRINTF("stopping the HC\n"); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > if (ehci_hc_reset(sc)) { > DPRINTF("reset failed!\n"); > } > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > } > > #if USB_DEBUG > @@ -1415,7 +1415,7 @@ transferred: > static void > ehci_pcd_enable(ehci_softc_t *sc) > { > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > sc->sc_eintrs |= EHCI_STS_PCD; > EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); > @@ -1426,7 +1426,7 @@ ehci_pcd_enable(ehci_softc_t *sc) > usb2_sw_transfer(&sc->sc_root_intr, > &ehci_root_intr_done); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1460,7 +1460,7 @@ ehci_interrupt(ehci_softc_t *sc) > { > uint32_t status; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > DPRINTFN(16, "real interrupt\n"); > > @@ -1517,7 +1517,7 @@ ehci_interrupt(ehci_softc_t *sc) > ehci_interrupt_poll(sc); > > done: > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1532,12 +1532,12 @@ ehci_timeout(void *arg) > > DPRINTF("xfer=%p\n", xfer); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > /* transfer is transferred */ > ehci_device_done(xfer, USB_ERR_TIMEOUT); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1547,10 +1547,10 @@ ehci_do_poll(struct usb2_bus *bus) > { > struct ehci_softc *sc = EHCI_BUS2SC(bus); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > ehci_interrupt_poll(sc); > ehci_root_ctrl_poll(sc); > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1965,7 +1965,7 @@ ehci_root_intr_done(struct usb2_xfer *xf > uint16_t i; > uint16_t m; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_PRE_DATA) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -2124,7 +2124,7 @@ ehci_device_done(struct usb2_xfer *xfer, > struct usb2_pipe_methods *methods = xfer->pipe->methods; > ehci_softc_t *sc = xfer->usb2_sc; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", > xfer, xfer->pipe, error); > @@ -3076,7 +3076,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > uint8_t l; > uint8_t use_polling; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_SETUP) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -3092,7 +3092,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > value = UGETW(std->req.wValue); > index = UGETW(std->req.wIndex); > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " > "wValue=0x%04x wIndex=0x%04x\n", > @@ -3373,7 +3373,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > DELAY(USB_PORT_ROOT_RESET_DELAY * 1000); > } else { > /* Wait for reset to complete. */ > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_PORT_ROOT_RESET_DELAY); > } > > @@ -3385,7 +3385,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > DELAY(EHCI_PORT_RESET_COMPLETE * 1000); > } else { > /* Wait for HC to complete reset. */ > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > EHCI_PORT_RESET_COMPLETE); > } > > > Modified: head/sys/dev/usb2/controller/ehci2_pci.c > ============================================================================== > --- head/sys/dev/usb2/controller/ehci2_pci.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/ehci2_pci.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -337,7 +337,7 @@ ehci_pci_attach(device_t self) > sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); > } > > - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.mtx, > + err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, > NULL, 0, 4); > if (err) { > device_printf(self, "could not setup config thread!\n"); > > Modified: head/sys/dev/usb2/controller/musb2_otg.c > ============================================================================== > --- head/sys/dev/usb2/controller/musb2_otg.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/musb2_otg.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -221,7 +221,7 @@ musbotg_wakeup_peer(struct usb2_xfer *xf > if (!(sc->sc_flags.status_suspend)) { > return; > } > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); > temp |= MUSB2_MASK_RESUME; > @@ -233,7 +233,7 @@ musbotg_wakeup_peer(struct usb2_xfer *xf > DELAY(8000); > } else { > /* Wait for reset to complete. */ > - usb2_pause_mtx(&sc->sc_bus.mtx, 8); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 8); > } > > temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); > @@ -982,7 +982,7 @@ musbotg_vbus_interrupt(struct usb2_bus * > > DPRINTFN(4, "vbus = %u\n", is_on); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > if (is_on) { > if (!sc->sc_flags.status_vbus) { > sc->sc_flags.status_vbus = 1; > @@ -1007,7 +1007,7 @@ musbotg_vbus_interrupt(struct usb2_bus * > } > } > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1021,7 +1021,7 @@ musbotg_interrupt(struct musbotg_softc * > uint8_t temp; > uint8_t to = 2; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > repeat: > > @@ -1116,7 +1116,7 @@ repeat: > if (--to) > goto repeat; > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1273,12 +1273,12 @@ musbotg_timeout(void *arg) > > DPRINTFN(1, "xfer=%p\n", xfer); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > /* transfer is transferred */ > musbotg_device_done(xfer, USB_ERR_TIMEOUT); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1356,7 +1356,7 @@ musbotg_root_intr_done(struct usb2_xfer > > DPRINTFN(8, "\n"); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_PRE_DATA) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -1516,7 +1516,7 @@ musbotg_set_stall(struct usb2_device *ud > struct musbotg_softc *sc; > uint8_t ep_no; > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > DPRINTFN(4, "pipe=%p\n", pipe); > > @@ -1702,7 +1702,7 @@ musbotg_clear_stall(struct usb2_device * > > DPRINTFN(4, "pipe=%p\n", pipe); > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > /* check mode */ > if (udev->flags.usb2_mode != USB_MODE_DEVICE) { > @@ -1741,7 +1741,7 @@ musbotg_init(struct musbotg_softc *sc) > sc->sc_bus.usbrev = USB_REV_2_0; > sc->sc_bus.methods = &musbotg_bus_methods; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > /* turn on clocks */ > > @@ -1749,7 +1749,7 @@ musbotg_init(struct musbotg_softc *sc) > (sc->sc_clocks_on) (sc->sc_clocks_arg); > } > /* wait a little for things to stabilise */ > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > /* disable all interrupts */ > > @@ -1762,7 +1762,7 @@ musbotg_init(struct musbotg_softc *sc) > musbotg_pull_common(sc, 0); > > /* wait a little bit (10ms) */ > - usb2_pause_mtx(&sc->sc_bus.mtx, 10); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 10); > > /* disable double packet buffering */ > MUSB2_WRITE_2(sc, MUSB2_REG_RXDBDIS, 0xFFFF); > @@ -1871,7 +1871,7 @@ musbotg_init(struct musbotg_softc *sc) > > musbotg_clocks_off(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > /* catch any lost interrupts */ > > @@ -1883,7 +1883,7 @@ musbotg_init(struct musbotg_softc *sc) > void > musbotg_uninit(struct musbotg_softc *sc) > { > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > /* disable all interrupts */ > MUSB2_WRITE_1(sc, MUSB2_REG_INTUSBE, 0); > @@ -1899,7 +1899,7 @@ musbotg_uninit(struct musbotg_softc *sc) > > musbotg_pull_down(sc); > musbotg_clocks_off(sc); > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1921,10 +1921,10 @@ musbotg_do_poll(struct usb2_bus *bus) > { > struct musbotg_softc *sc = MUSBOTG_BUS2SC(bus); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > musbotg_interrupt_poll(sc); > musbotg_root_ctrl_poll(sc); > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -2293,7 +2293,7 @@ musbotg_root_ctrl_done(struct usb2_xfer > uint16_t index; > uint8_t use_polling; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_SETUP) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -2309,7 +2309,7 @@ musbotg_root_ctrl_done(struct usb2_xfer > value = UGETW(std->req.wValue); > index = UGETW(std->req.wIndex); > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > /* demultiplex the control request */ > > > Modified: head/sys/dev/usb2/controller/musb2_otg_atmelarm.c > ============================================================================== > --- head/sys/dev/usb2/controller/musb2_otg_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/musb2_otg_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -138,7 +138,7 @@ musbotg_attach(device_t dev) > device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); > > err = usb2_config_td_setup(&sc->sc_otg.sc_config_td, sc, > - &sc->sc_otg.sc_bus.mtx, NULL, 0, 4); > + &sc->sc_otg.sc_bus.bus_mtx, NULL, 0, 4); > if (err) { > device_printf(dev, "could not setup config thread!\n"); > goto error; > > Modified: head/sys/dev/usb2/controller/ohci2.c > ============================================================================== > --- head/sys/dev/usb2/controller/ohci2.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/ohci2.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -173,7 +173,7 @@ ohci_controller_init(ohci_softc_t *sc) > DPRINTF("SMM active, request owner change\n"); > OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR); > for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) { > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > ctl = OREAD4(sc, OHCI_CONTROL); > } > if (ctl & OHCI_IR) { > @@ -186,7 +186,7 @@ ohci_controller_init(ohci_softc_t *sc) > DPRINTF("cold started\n"); > reset: > /* controller was cold started */ > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_BUS_RESET_DELAY); > } > > @@ -197,7 +197,7 @@ reset: > DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev)); > OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); > > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_BUS_RESET_DELAY); > > /* we now own the host controller and the bus has been reset */ > @@ -260,7 +260,7 @@ reset: > desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A); > OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP); > OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */ > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > OHCI_ENABLE_POWER_DELAY); > OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca); > > @@ -270,7 +270,7 @@ reset: > */ > sc->sc_noport = 0; > for (i = 0; (i < 10) && (sc->sc_noport == 0); i++) { > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > OHCI_READ_DESC_DELAY); > sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A)); > } > @@ -309,7 +309,7 @@ ohci_init(ohci_softc_t *sc) > uint16_t x; > uint16_t y; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > DPRINTF("start\n"); > > @@ -391,7 +391,7 @@ ohci_init(ohci_softc_t *sc) > /* set up the bus struct */ > sc->sc_bus.methods = &ohci_bus_methods; > > - usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.mtx, > + usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, > CALLOUT_RETURNUNLOCKED); > > #if USB_DEBUG > @@ -408,10 +408,10 @@ ohci_init(ohci_softc_t *sc) > sc->sc_bus.usbrev = USB_REV_1_0; > > if (ohci_controller_init(sc)) { > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return (USB_ERR_INVAL); > } else { > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > /* catch any lost interrupts */ > ohci_do_poll(&sc->sc_bus); > return (USB_ERR_NORMAL_COMPLETION); > @@ -424,7 +424,7 @@ ohci_init(ohci_softc_t *sc) > void > ohci_detach(struct ohci_softc *sc) > { > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > usb2_callout_stop(&sc->sc_tmo_rhsc); > > @@ -432,9 +432,9 @@ ohci_detach(struct ohci_softc *sc) > OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); > > /* XXX let stray task complete */ > - usb2_pause_mtx(&sc->sc_bus.mtx, 50); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 50); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > usb2_callout_drain(&sc->sc_tmo_rhsc); > > @@ -449,7 +449,7 @@ ohci_suspend(ohci_softc_t *sc) > { > uint32_t ctl; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > #if USB_DEBUG > DPRINTF("\n"); > @@ -470,10 +470,10 @@ ohci_suspend(ohci_softc_t *sc) > ctl |= OHCI_HCFS_SUSPEND; > OWRITE4(sc, OHCI_CONTROL, ctl); > > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_RESUME_WAIT); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -482,7 +482,7 @@ ohci_resume(ohci_softc_t *sc) > { > uint32_t ctl; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > #if USB_DEBUG > DPRINTF("\n"); > @@ -503,13 +503,13 @@ ohci_resume(ohci_softc_t *sc) > ctl = OREAD4(sc, OHCI_CONTROL); > ctl |= OHCI_HCFS_RESUME; > OWRITE4(sc, OHCI_CONTROL, ctl); > - usb2_pause_mtx(&sc->sc_bus.mtx, USB_RESUME_DELAY); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_DELAY); > ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_OPERATIONAL; > OWRITE4(sc, OHCI_CONTROL, ctl); > - usb2_pause_mtx(&sc->sc_bus.mtx, USB_RESUME_RECOVERY); > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_RECOVERY); > sc->sc_control = sc->sc_intre = 0; > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > /* catch any lost interrupts */ > ohci_do_poll(&sc->sc_bus); > @@ -699,7 +699,7 @@ _ohci_append_qh(ohci_ed_t *sed, uint32_t > { > DPRINTFN(11, "%p to %p\n", sed, last); > > - /* (sc->sc_bus.mtx) must be locked */ > + /* (sc->sc_bus.bus_mtx) must be locked */ > > sed->next = last->next; > sed->ed_next = last->ed_next; > @@ -728,7 +728,7 @@ _ohci_remove_qh(ohci_ed_t *sed, ohci_ed_ > { > DPRINTFN(11, "%p from %p\n", sed, last); > > - /* (sc->sc_bus.mtx) must be locked */ > + /* (sc->sc_bus.bus_mtx) must be locked */ > > /* only remove if not removed from a queue */ > if (sed->prev) { > @@ -1099,7 +1099,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) > { > DPRINTFN(5, "\n"); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > sc->sc_eintrs |= OHCI_RHSC; > OWRITE4(sc, OHCI_INTERRUPT_ENABLE, OHCI_RHSC); > @@ -1110,7 +1110,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) > usb2_sw_transfer(&sc->sc_root_intr, > &ohci_root_intr_done); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1146,7 +1146,7 @@ ohci_interrupt(ohci_softc_t *sc) > uint32_t status; > uint32_t done; > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > > hcca = ohci_get_hcca(sc); > > @@ -1246,7 +1246,7 @@ ohci_interrupt(ohci_softc_t *sc) > ohci_interrupt_poll(sc); > > done: > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1261,12 +1261,12 @@ ohci_timeout(void *arg) > > DPRINTF("xfer=%p\n", xfer); > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > /* transfer is transferred */ > ohci_device_done(xfer, USB_ERR_TIMEOUT); > > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > } > @@ -1276,10 +1276,10 @@ ohci_do_poll(struct usb2_bus *bus) > { > struct ohci_softc *sc = OHCI_BUS2SC(bus); > > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > ohci_interrupt_poll(sc); > ohci_root_ctrl_poll(sc); > - mtx_unlock(&sc->sc_bus.mtx); > + USB_BUS_UNLOCK(&sc->sc_bus); > return; > } > > @@ -1617,7 +1617,7 @@ ohci_root_intr_done(struct usb2_xfer *xf > uint16_t i; > uint16_t m; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_PRE_DATA) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -1663,7 +1663,7 @@ ohci_device_done(struct usb2_xfer *xfer, > ohci_softc_t *sc = xfer->usb2_sc; > ohci_ed_t *ed; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", > @@ -2198,7 +2198,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > uint8_t l; > uint8_t use_polling; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > if (std->state != USB_SW_TR_SETUP) { > if (std->state == USB_SW_TR_PRE_CALLBACK) { > @@ -2214,7 +2214,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > value = UGETW(std->req.wValue); > index = UGETW(std->req.wIndex); > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " > "wValue=0x%04x wIndex=0x%04x\n", > @@ -2375,7 +2375,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > /* enable RHSC interrupt if condition is cleared. */ > if ((OREAD4(sc, port) >> 16) == 0) { > ohci_rhsc_enable(sc); > - mtx_lock(&sc->sc_bus.mtx); > + USB_BUS_LOCK(&sc->sc_bus); > } > break; > default: > @@ -2456,7 +2456,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > /* polling */ > DELAY(USB_PORT_ROOT_RESET_DELAY * 1000); > } else { > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_PORT_ROOT_RESET_DELAY); > } > > > Modified: head/sys/dev/usb2/controller/ohci2_atmelarm.c > ============================================================================== > --- head/sys/dev/usb2/controller/ohci2_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/ohci2_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -111,7 +111,7 @@ ohci_atmelarm_attach(device_t dev) > strlcpy(sc->sc_ohci.sc_vendor, "Atmel", sizeof(sc->sc_ohci.sc_vendor)); > > err = usb2_config_td_setup(&sc->sc_ohci.sc_config_td, sc, > - &sc->sc_ohci.sc_bus.mtx, NULL, 0, 4); > + &sc->sc_ohci.sc_bus.bus_mtx, NULL, 0, 4); > if (err) { > device_printf(dev, "could not setup config thread!\n"); > goto error; > > Modified: head/sys/dev/usb2/controller/ohci2_pci.c > ============================================================================== > --- head/sys/dev/usb2/controller/ohci2_pci.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/ohci2_pci.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -280,7 +280,7 @@ ohci_pci_attach(device_t self) > sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); > } > > - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.mtx, > + err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, > NULL, 0, 4); > if (err) { > device_printf(self, "could not setup config thread!\n"); > > Modified: head/sys/dev/usb2/controller/uhci2.c > ============================================================================== > --- head/sys/dev/usb2/controller/uhci2.c Mon Nov 10 18:24:11 2008 (r184823) > +++ head/sys/dev/usb2/controller/uhci2.c Mon Nov 10 20:54:31 2008 (r184824) > @@ -265,7 +265,7 @@ uhci_reset(uhci_softc_t *sc) > struct usb2_page_search buf_res; > uint16_t n; > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > DPRINTF("resetting the HC\n"); > > @@ -279,7 +279,7 @@ uhci_reset(uhci_softc_t *sc) > > /* wait */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > USB_BUS_RESET_DELAY); > > /* terminate all transfers */ > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** -- - Alfred Perlstein From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 09:39:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E3041065675; Wed, 19 Nov 2008 09:39:36 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC48E8FC08; Wed, 19 Nov 2008 09:39:35 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ9dZ77013004; Wed, 19 Nov 2008 09:39:35 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ9dYf9012974; Wed, 19 Nov 2008 09:39:34 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200811190939.mAJ9dYf9012974@svn.freebsd.org> From: Marko Zec Date: Wed, 19 Nov 2008 09:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185088 - in head/sys: dev/cxgb/ulp/tom net netinet netinet6 netipsec sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 09:39:36 -0000 Author: zec Date: Wed Nov 19 09:39:34 2008 New Revision: 185088 URL: http://svn.freebsd.org/changeset/base/185088 Log: Change the initialization methodology for global variables scheduled for virtualization. Instead of initializing the affected global variables at instatiation, assign initial values to them in initializer functions. As a rule, initialization at instatiation for such variables should never be introduced again from now on. Furthermore, enclose all instantiations of such global variables in #ifdef VIMAGE_GLOBALS blocks. Essentialy, this change should have zero functional impact. In the next phase of merging network stack virtualization infrastructure from p4/vimage branch, the new initialization methology will allow us to switch between using global variables and their counterparts residing in virtualization containers with minimum code churn, and in the long run allow us to intialize multiple instances of such container structures. Discussed at: devsummit Strassburg Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c head/sys/net/if.c head/sys/net/if_ethersubr.c head/sys/net/if_gif.c head/sys/net/if_loop.c head/sys/net/raw_cb.c head/sys/net/route.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_gif.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/in_proto.c head/sys/netinet/in_rmx.c head/sys/netinet/in_var.h head/sys/netinet/ip_divert.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_icmp.h head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_var.h head/sys/netinet/udp_usrreq.c head/sys/netinet/vinet.h head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/scope6.c head/sys/netinet6/vinet6.h head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c head/sys/netipsec/xform_ipip.c head/sys/sys/vimage.h Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Wed Nov 19 09:39:34 2008 (r185088) @@ -154,11 +154,6 @@ static unsigned int mbuf_wrs[TX_MAX_SEGS #define TCP_CLOSE 2 #define TCP_DROP 3 -extern int tcp_do_autorcvbuf; -extern int tcp_do_autosndbuf; -extern int tcp_autorcvbuf_max; -extern int tcp_autosndbuf_max; - static void t3_send_reset(struct toepcb *toep); static void send_abort_rpl(struct mbuf *m, struct toedev *tdev, int rst_status); static inline void free_atid(struct t3cdev *cdev, unsigned int tid); Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/net/if.c Wed Nov 19 09:39:34 2008 (r185088) @@ -134,22 +134,21 @@ static int if_getgroupmembers(struct ifg extern void nd6_setmtu(struct ifnet *); #endif -int if_index = 0; -int ifqmaxlen = IFQ_MAXLEN; +#ifdef VIMAGE_GLOBALS struct ifnethead ifnet; /* depend on static init XXX */ struct ifgrouphead ifg_head; +int if_index; +static int if_indexlim; +/* Table of ifnet/cdev by index. Locked with ifnet_lock. */ +static struct ifindex_entry *ifindex_table; +static struct knlist ifklist; +#endif + +int ifqmaxlen = IFQ_MAXLEN; struct mtx ifnet_lock; static if_com_alloc_t *if_com_alloc[256]; static if_com_free_t *if_com_free[256]; -static int if_indexlim = 8; -static struct knlist ifklist; - -/* - * Table of ifnet/cdev by index. Locked with ifnet_lock. - */ -static struct ifindex_entry *ifindex_table = NULL; - static void filt_netdetach(struct knote *kn); static int filt_netdev(struct knote *kn, long hint); @@ -357,6 +356,10 @@ if_init(void *dummy __unused) { INIT_VNET_NET(curvnet); + V_if_index = 0; + V_ifindex_table = NULL; + V_if_indexlim = 8; + IFNET_LOCK_INIT(); TAILQ_INIT(&V_ifnet); TAILQ_INIT(&V_ifg_head); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/net/if_ethersubr.c Wed Nov 19 09:39:34 2008 (r185088) @@ -142,8 +142,10 @@ MALLOC_DEFINE(M_ARPCOM, "arpcom", "802.* int ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, struct ip_fw **rule, int shared); +#ifdef VIMAGE_GLOBALS static int ether_ipfw; #endif +#endif /* * Ethernet output routine. Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/net/if_gif.c Wed Nov 19 09:39:34 2008 (r185088) @@ -94,7 +94,18 @@ */ static struct mtx gif_mtx; static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface"); + +#ifdef VIMAGE_GLOBALS static LIST_HEAD(, gif_softc) gif_softc_list; +static int max_gif_nesting; +static int parallel_tunnels; +#ifdef INET +int ip_gif_ttl; +#endif +#ifdef INET6 +int ip6_gif_hlim; +#endif +#endif void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af); void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af); @@ -123,9 +134,6 @@ SYSCTL_NODE(_net_link, IFT_GIF, gif, CTL */ #define MAX_GIF_NEST 1 #endif -#ifndef VIMAGE -static int max_gif_nesting = MAX_GIF_NEST; -#endif SYSCTL_V_INT(V_NET, vnet_gif, _net_link_gif, OID_AUTO, max_nesting, CTLFLAG_RW, max_gif_nesting, 0, "Max nested tunnels"); @@ -140,11 +148,6 @@ SYSCTL_V_INT(V_NET, vnet_gif, _net_inet6 * pair of addresses. Some applications require this functionality so * we allow control over this check here. */ -#ifdef XBONEHACK -static int parallel_tunnels = 1; -#else -static int parallel_tunnels = 0; -#endif SYSCTL_V_INT(V_NET, vnet_gif, _net_link_gif, OID_AUTO, parallel_tunnels, CTLFLAG_RW, parallel_tunnels, 0, "Allow parallel tunnels?"); @@ -251,12 +254,21 @@ gifmodevent(mod, type, data) switch (type) { case MOD_LOAD: mtx_init(&gif_mtx, "gif_mtx", NULL, MTX_DEF); - LIST_INIT(&V_gif_softc_list); - if_clone_attach(&gif_cloner); + LIST_INIT(&V_gif_softc_list); + V_max_gif_nesting = MAX_GIF_NEST; +#ifdef XBONEHACK + V_parallel_tunnels = 1; +#else + V_parallel_tunnels = 0; +#endif +#ifdef INET + V_ip_gif_ttl = GIF_TTL; +#endif #ifdef INET6 V_ip6_gif_hlim = GIF_HLIM; #endif + if_clone_attach(&gif_cloner); break; case MOD_UNLOAD: Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/net/if_loop.c Wed Nov 19 09:39:34 2008 (r185088) @@ -96,7 +96,9 @@ int looutput(struct ifnet *ifp, struct static int lo_clone_create(struct if_clone *, int, caddr_t); static void lo_clone_destroy(struct ifnet *); -struct ifnet *loif = NULL; /* Used externally */ +#ifdef VIMAGE_GLOBALS +struct ifnet *loif; /* Used externally */ +#endif IFC_SIMPLE_DECLARE(lo, 1); @@ -142,6 +144,7 @@ loop_modevent(module_t mod, int type, vo switch (type) { case MOD_LOAD: + V_loif = NULL; if_clone_attach(&lo_cloner); break; Modified: head/sys/net/raw_cb.c ============================================================================== --- head/sys/net/raw_cb.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/net/raw_cb.c Wed Nov 19 09:39:34 2008 (r185088) @@ -57,7 +57,9 @@ */ struct mtx rawcb_mtx; +#ifdef VIMAGE_GLOBALS struct rawcb_list_head rawcb_list; +#endif SYSCTL_NODE(_net, OID_AUTO, raw, CTLFLAG_RW, 0, "Raw socket infrastructure"); Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/net/route.c Wed Nov 19 09:39:34 2008 (r185088) @@ -84,6 +84,7 @@ SYSCTL_INT(_net, OID_AUTO, add_addr_allf &rt_add_addr_allfibs, 0, ""); TUNABLE_INT("net.add_addr_allfibs", &rt_add_addr_allfibs); +#ifdef VIMAGE_GLOBALS static struct rtstat rtstat; /* by default only the first 'row' of tables will be accessed. */ @@ -96,6 +97,7 @@ static struct rtstat rtstat; struct radix_node_head *rt_tables[RT_MAXFIBS][AF_MAX+1]; static int rttrash; /* routes not in table but not freed */ +#endif static void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/if_ether.c Wed Nov 19 09:39:34 2008 (r185088) @@ -82,7 +82,12 @@ SYSCTL_DECL(_net_link_ether); SYSCTL_NODE(_net_link_ether, PF_INET, inet, CTLFLAG_RW, 0, ""); /* timer values */ -static int arpt_keep = (20*60); /* once resolved, good for 20 more minutes */ +#ifdef VIMAGE_GLOBALS +static int arpt_keep; /* once resolved, good for 20 more minutes */ +static int arp_maxtries; +static int useloopback; /* use loopback interface for local traffic */ +static int arp_proxyall; +#endif SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW, &arpt_keep, 0, "ARP entry lifetime in seconds"); @@ -99,10 +104,6 @@ struct llinfo_arp { static struct ifqueue arpintrq; -static int arp_maxtries = 5; -static int useloopback = 1; /* use loopback interface for local traffic */ -static int arp_proxyall = 0; - SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, maxtries, CTLFLAG_RW, arp_maxtries, 0, "ARP resolution attempts before returning error"); @@ -1076,6 +1077,12 @@ arp_ifinit2(struct ifnet *ifp, struct if static void arp_init(void) { + INIT_VNET_INET(curvnet); + + V_arpt_keep = (20*60); /* once resolved, good for 20 more minutes */ + V_arp_maxtries = 5; + V_useloopback = 1; /* use loopback interface for local traffic */ + V_arp_proxyall = 0; arpintrq.ifq_maxlen = 50; mtx_init(&arpintrq.ifq_mtx, "arp_inq", NULL, MTX_DEF); Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/igmp.c Wed Nov 19 09:39:34 2008 (r185088) @@ -80,7 +80,9 @@ static MALLOC_DEFINE(M_IGMP, "igmp", "ig static struct router_info *find_rti(struct ifnet *ifp); static void igmp_sendpkt(struct in_multi *, int, unsigned long); +#ifdef VIMAGE_GLOBALS static struct igmpstat igmpstat; +#endif SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_igmp, IGMPCTL_STATS, stats, CTLFLAG_RW, igmpstat, igmpstat, ""); @@ -92,8 +94,10 @@ SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_i * reference counting is used. We allow unlocked reads of router_info data * when accessed via an in_multi read-only. */ -static struct mtx igmp_mtx; +#ifdef VIMAGE_GLOBALS static SLIST_HEAD(, router_info) router_info_head; +#endif +static struct mtx igmp_mtx; static int igmp_timers_are_running; /* Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in.c Wed Nov 19 09:39:34 2008 (r185088) @@ -66,18 +66,20 @@ static int in_ifinit(struct ifnet *, struct in_ifaddr *, struct sockaddr_in *, int); static void in_purgemaddrs(struct ifnet *); -static int subnetsarelocal = 0; +#ifdef VIMAGE_GLOBALS +static int subnetsarelocal; +static int sameprefixcarponly; +extern struct inpcbinfo ripcbinfo; +extern struct inpcbinfo udbinfo; +#endif + SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, subnets_are_local, CTLFLAG_RW, subnetsarelocal, 0, "Treat all subnets as directly connected"); -static int sameprefixcarponly = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, same_prefix_carp_only, CTLFLAG_RW, sameprefixcarponly, 0, "Refuse to create same prefixes on different interfaces"); -extern struct inpcbinfo ripcbinfo; -extern struct inpcbinfo udbinfo; - /* * Return 1 if an internet address is for a ``local'' host * (one to which we have a connection). If subnetsarelocal Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_gif.c Wed Nov 19 09:39:34 2008 (r185088) @@ -85,7 +85,9 @@ struct protosw in_gif_protosw = { .pr_usrreqs = &rip_usrreqs }; -static int ip_gif_ttl = GIF_TTL; +#ifdef VIMAGE_GLOBALS +extern int ip_gif_ttl; +#endif SYSCTL_V_INT(V_NET, vnet_gif, _net_inet_ip, IPCTL_GIF_TTL, gifttl, CTLFLAG_RW, ip_gif_ttl, 0, ""); Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_mcast.c Wed Nov 19 09:39:34 2008 (r185088) @@ -86,7 +86,9 @@ static MALLOC_DEFINE(M_IPMSOURCE, "in_ms * ip_output() to send IGMP packets while holding the lock; this probably is * not quite desirable. */ +#ifdef VIMAGE_GLOBALS struct in_multihead in_multihead; /* XXX BSS initialization */ +#endif struct mtx in_multi_mtx; MTX_SYSINIT(in_multi_mtx, &in_multi_mtx, "in_multi_mtx", MTX_DEF | MTX_RECURSE); Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_pcb.c Wed Nov 19 09:39:34 2008 (r185088) @@ -84,32 +84,34 @@ __FBSDID("$FreeBSD$"); #include +#ifdef VIMAGE_GLOBALS /* * These configure the range of local port addresses assigned to * "unspecified" outgoing connections/packets/whatever. */ -int ipport_lowfirstauto = IPPORT_RESERVED - 1; /* 1023 */ -int ipport_lowlastauto = IPPORT_RESERVEDSTART; /* 600 */ -int ipport_firstauto = IPPORT_EPHEMERALFIRST; /* 10000 */ -int ipport_lastauto = IPPORT_EPHEMERALLAST; /* 65535 */ -int ipport_hifirstauto = IPPORT_HIFIRSTAUTO; /* 49152 */ -int ipport_hilastauto = IPPORT_HILASTAUTO; /* 65535 */ +int ipport_lowfirstauto; +int ipport_lowlastauto; +int ipport_firstauto; +int ipport_lastauto; +int ipport_hifirstauto; +int ipport_hilastauto; /* * Reserved ports accessible only to root. There are significant * security considerations that must be accounted for when changing these, * but the security benefits can be great. Please be careful. */ -int ipport_reservedhigh = IPPORT_RESERVED - 1; /* 1023 */ -int ipport_reservedlow = 0; +int ipport_reservedhigh; +int ipport_reservedlow; /* Variables dealing with random ephemeral port allocation. */ -int ipport_randomized = 1; /* user controlled via sysctl */ -int ipport_randomcps = 10; /* user controlled via sysctl */ -int ipport_randomtime = 45; /* user controlled via sysctl */ -int ipport_stoprandom = 0; /* toggled by ipport_tick */ +int ipport_randomized; +int ipport_randomcps; +int ipport_randomtime; +int ipport_stoprandom; int ipport_tcpallocs; int ipport_tcplastcount; +#endif #define RANGECHK(var, min, max) \ if ((var) < (min)) { (var) = (min); } \ Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_pcb.h Wed Nov 19 09:39:34 2008 (r185088) @@ -450,6 +450,8 @@ extern int ipport_lastauto; extern int ipport_hifirstauto; extern int ipport_hilastauto; extern int ipport_randomized; +extern int ipport_randomcps; +extern int ipport_randomtime; extern int ipport_stoprandom; extern int ipport_tcpallocs; extern struct callout ipport_tick_callout; Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_proto.c Wed Nov 19 09:39:34 2008 (r185088) @@ -193,6 +193,7 @@ struct protosw inetsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = icmp_input, .pr_ctloutput = rip_ctloutput, + .pr_init = icmp_init, .pr_usrreqs = &rip_usrreqs }, { Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_rmx.c Wed Nov 19 09:39:34 2008 (r185088) @@ -151,17 +151,20 @@ in_matroute(void *v_arg, struct radix_no return rn; } -static int rtq_reallyold = 60*60; /* one hour is "really old" */ +#ifdef VIMAGE_GLOBALS +static int rtq_reallyold; +static int rtq_minreallyold; +static int rtq_toomany; +#endif + SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_RTEXPIRE, rtexpire, CTLFLAG_RW, rtq_reallyold, 0, "Default expiration time on dynamically learned routes"); -static int rtq_minreallyold = 10; /* never automatically crank down to less */ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, rtq_minreallyold, 0, "Minimum time to attempt to hold onto dynamically learned routes"); -static int rtq_toomany = 128; /* 128 cached routes is "too many" */ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, rtq_toomany, 0, "Upper limit on dynamically learned routes"); @@ -256,8 +259,10 @@ in_rtqkill(struct radix_node *rn, void * } #define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ -static int rtq_timeout = RTQ_TIMEOUT; +#ifdef VIMAGE_GLOBALS +static int rtq_timeout; static struct callout rtq_timer; +#endif static void in_rtqtimo_one(void *rock); @@ -376,6 +381,11 @@ in_inithead(void **head, int off) if (off == 0) /* XXX MRT see above */ return 1; /* only do the rest for a real routing table */ + V_rtq_reallyold = 60*60; /* one hour is "really old" */ + V_rtq_minreallyold = 10; /* never automatically crank down to less */ + V_rtq_toomany = 128; /* 128 cached routes is "too many" */ + V_rtq_timeout = RTQ_TIMEOUT; + rnh = *head; rnh->rnh_addaddr = in_addroute; rnh->rnh_matchaddr = in_matroute; Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/in_var.h Wed Nov 19 09:39:34 2008 (r185088) @@ -138,6 +138,15 @@ do { \ #endif /* + * IP datagram reassembly. + */ +#define IPREASS_NHASH_LOG2 6 +#define IPREASS_NHASH (1 << IPREASS_NHASH_LOG2) +#define IPREASS_HMASK (IPREASS_NHASH - 1) +#define IPREASS_HASH(x,y) \ + (((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK) + +/* * This information should be part of the ifnet structure but we don't wish * to change that - as it might break a number of things */ Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/ip_divert.c Wed Nov 19 09:39:34 2008 (r185088) @@ -112,8 +112,10 @@ __FBSDID("$FreeBSD$"); */ /* Internal variables. */ +#ifdef VIMAGE_GLOBALS static struct inpcbhead divcb; static struct inpcbinfo divcbinfo; +#endif static u_long div_sendspace = DIVSNDQ; /* XXX sysctl ? */ static u_long div_recvspace = DIVRCVQ; /* XXX sysctl ? */ Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/ip_fastfwd.c Wed Nov 19 09:39:34 2008 (r185088) @@ -106,7 +106,9 @@ __FBSDID("$FreeBSD$"); #include -static int ipfastforward_active = 0; +#ifdef VIMAGE_GLOBALS +static int ipfastforward_active; +#endif SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, fastforwarding, CTLFLAG_RW, ipfastforward_active, 0, "Enable fast IP forwarding"); Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/ip_icmp.c Wed Nov 19 09:39:34 2008 (r185088) @@ -77,47 +77,51 @@ __FBSDID("$FreeBSD$"); * host table maintenance routines. */ -struct icmpstat icmpstat; +#ifdef VIMAGE_GLOBALS +struct icmpstat icmpstat; +static int icmpmaskrepl; +static u_int icmpmaskfake; +static int drop_redirect; +static int log_redirect; +static int icmplim; +static int icmplim_output; +static char reply_src[IFNAMSIZ]; +static int icmp_rfi; +static int icmp_quotelen; +static int icmpbmcastecho; +#endif + SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_icmp, ICMPCTL_STATS, stats, CTLFLAG_RW, icmpstat, icmpstat, ""); -static int icmpmaskrepl = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, ICMPCTL_MASKREPL, maskrepl, CTLFLAG_RW, icmpmaskrepl, 0, "Reply to ICMP Address Mask Request packets."); -static u_int icmpmaskfake = 0; SYSCTL_V_UINT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, maskfake, CTLFLAG_RW, icmpmaskfake, 0, "Fake reply to ICMP Address Mask Request packets."); -static int drop_redirect = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, drop_redirect, CTLFLAG_RW, drop_redirect, 0, "Ignore ICMP redirects"); -static int log_redirect = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_RW, log_redirect, 0, "Log ICMP redirects to the console"); -static int icmplim = 200; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, ICMPCTL_ICMPLIM, icmplim, CTLFLAG_RW, icmplim, 0, "Maximum number of ICMP responses per second"); -static int icmplim_output = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, icmplim_output, CTLFLAG_RW, icmplim_output, 0, "Enable rate limiting of ICMP responses"); -static char reply_src[IFNAMSIZ]; SYSCTL_V_STRING(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, reply_src, CTLFLAG_RW, reply_src, IFNAMSIZ, "icmp reply source for non-local packets."); -static int icmp_rfi = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, reply_from_interface, CTLFLAG_RW, icmp_rfi, 0, "ICMP reply from incoming interface for " "non-local packets"); -static int icmp_quotelen = 8; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, quotelen, CTLFLAG_RW, icmp_quotelen, 0, "Number of bytes from original packet to " "quote in ICMP reply"); @@ -126,7 +130,6 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet * ICMP broadcast echo sysctl */ -static int icmpbmcastecho = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_icmp, OID_AUTO, bmcastecho, CTLFLAG_RW, icmpbmcastecho, 0, ""); @@ -140,6 +143,22 @@ static void icmp_send(struct mbuf *, str extern struct protosw inetsw[]; +void +icmp_init(void) +{ + INIT_VNET_INET(curvnet); + + V_icmpmaskrepl = 0; + V_icmpmaskfake = 0; + V_drop_redirect = 0; + V_log_redirect = 0; + V_icmplim = 200; + V_icmplim_output = 1; + V_icmp_rfi = 0; + V_icmp_quotelen = 8; + V_icmpbmcastecho = 0; +} + /* * Generate an error packet of type error * in response to bad packet ip. Modified: head/sys/netinet/ip_icmp.h ============================================================================== --- head/sys/netinet/ip_icmp.h Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/ip_icmp.h Wed Nov 19 09:39:34 2008 (r185088) @@ -204,6 +204,7 @@ struct icmp { #ifdef _KERNEL void icmp_error(struct mbuf *, int, int, n_long, int); void icmp_input(struct mbuf *, int); +void icmp_init(void); int ip_next_mtu(int, int); #endif Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/ip_input.c Wed Nov 19 09:39:34 2008 (r185088) @@ -89,33 +89,47 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct ip) == 20); #endif -int rsvp_on = 0; +#ifdef VIMAGE_GLOBALS +static int ipsendredirects; +static int ip_checkinterface; +static int ip_keepfaith; +static int ip_sendsourcequench; +int ip_defttl; +int ip_do_randomid; +int ipforwarding; +struct in_ifaddrhead in_ifaddrhead; /* first inet address */ +struct in_ifaddrhashhead *in_ifaddrhashtbl; /* inet addr hash table */ +u_long in_ifaddrhmask; /* mask for hash table */ +struct ipstat ipstat; +static int ip_rsvp_on; +struct socket *ip_rsvpd; +int rsvp_on; +static TAILQ_HEAD(ipqhead, ipq) ipq[IPREASS_NHASH]; +static int maxnipq; /* Administrative limit on # reass queues. */ +static int maxfragsperpacket; +int ipstealth; +static int nipq; /* Total # of reass queues */ +#endif -int ipforwarding = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_FORWARDING, forwarding, CTLFLAG_RW, ipforwarding, 0, "Enable IP forwarding between interfaces"); -static int ipsendredirects = 1; /* XXX */ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_RW, ipsendredirects, 0, "Enable sending IP redirects"); -int ip_defttl = IPDEFTTL; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_DEFTTL, ttl, CTLFLAG_RW, ip_defttl, 0, "Maximum TTL on IP packets"); -static int ip_keepfaith = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_KEEPFAITH, keepfaith, CTLFLAG_RW, ip_keepfaith, 0, "Enable packet capture for FAITH IPv4->IPv6 translater daemon"); -static int ip_sendsourcequench = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, sendsourcequench, CTLFLAG_RW, ip_sendsourcequench, 0, "Enable the transmission of source quench packets"); -int ip_do_randomid = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, random_id, CTLFLAG_RW, ip_do_randomid, 0, "Assign random ip_id values"); @@ -132,7 +146,6 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet * to the loopback interface instead of the interface where the * packets for those addresses are received. */ -static int ip_checkinterface = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, check_interface, CTLFLAG_RW, ip_checkinterface, 0, "Verify packet arrives on correct interface"); @@ -145,9 +158,6 @@ static int ipqmaxlen = IFQ_MAXLEN; extern struct domain inetdomain; extern struct protosw inetsw[]; u_char ip_protox[IPPROTO_MAX]; -struct in_ifaddrhead in_ifaddrhead; /* first inet address */ -struct in_ifaddrhashhead *in_ifaddrhashtbl; /* inet addr hash table */ -u_long in_ifaddrhmask; /* mask for hash table */ SYSCTL_INT(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_queue_maxlen, CTLFLAG_RW, &ipintrq.ifq_maxlen, 0, "Maximum size of the IP input queue"); @@ -155,21 +165,10 @@ SYSCTL_INT(_net_inet_ip, IPCTL_INTRQDROP &ipintrq.ifq_drops, 0, "Number of packets dropped from the IP input queue"); -struct ipstat ipstat; SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW, ipstat, ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)"); -/* - * IP datagram reassembly. - */ -#define IPREASS_NHASH_LOG2 6 -#define IPREASS_NHASH (1 << IPREASS_NHASH_LOG2) -#define IPREASS_HMASK (IPREASS_NHASH - 1) -#define IPREASS_HASH(x,y) \ - (((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK) - static uma_zone_t ipq_zone; -static TAILQ_HEAD(ipqhead, ipq) ipq[IPREASS_NHASH]; static struct mtx ipqlock; #define IPQ_LOCK() mtx_lock(&ipqlock) @@ -180,13 +179,10 @@ static struct mtx ipqlock; static void maxnipq_update(void); static void ipq_zone_change(void *); -static int maxnipq; /* Administrative limit on # reass queues. */ -static int nipq = 0; /* Total # of reass queues */ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD, nipq, 0, "Current number of IPv4 fragment reassembly queue entries"); -static int maxfragsperpacket; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, maxfragsperpacket, CTLFLAG_RW, maxfragsperpacket, 0, "Maximum number of IPv4 fragments allowed per packet"); @@ -199,7 +195,6 @@ SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, m #endif #ifdef IPSTEALTH -int ipstealth = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, stealth, CTLFLAG_RW, ipstealth, 0, "IP stealth mode, no TTL decrementation on forwarding"); #endif @@ -225,6 +220,37 @@ ip_init(void) struct protosw *pr; int i; + V_ipsendredirects = 1; /* XXX */ + V_ip_checkinterface = 0; + V_ip_keepfaith = 0; + V_ip_sendsourcequench = 0; + V_rsvp_on = 0; + V_ip_defttl = IPDEFTTL; + V_ip_do_randomid = 0; + V_ipforwarding = 0; + V_ipstealth = 0; + V_nipq = 0; /* Total # of reass queues */ + + V_ipport_lowfirstauto = IPPORT_RESERVED - 1; /* 1023 */ + V_ipport_lowlastauto = IPPORT_RESERVEDSTART; /* 600 */ + V_ipport_firstauto = IPPORT_EPHEMERALFIRST; /* 10000 */ + V_ipport_lastauto = IPPORT_EPHEMERALLAST; /* 65535 */ + V_ipport_hifirstauto = IPPORT_HIFIRSTAUTO; /* 49152 */ + V_ipport_hilastauto = IPPORT_HILASTAUTO; /* 65535 */ + V_ipport_reservedhigh = IPPORT_RESERVED - 1; /* 1023 */ + V_ipport_reservedlow = 0; + V_ipport_randomized = 1; /* user controlled via sysctl */ + V_ipport_randomcps = 10; /* user controlled via sysctl */ + V_ipport_randomtime = 45; /* user controlled via sysctl */ + V_ipport_stoprandom = 0; /* toggled by ipport_tick */ + +#ifdef NOTYET + /* XXX global static but not instantiated in this file */ + V_ipfastforward_active = 0; + V_subnetsarelocal = 0; + V_sameprefixcarponly = 0; +#endif + TAILQ_INIT(&V_in_ifaddrhead); V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask); pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); @@ -1591,8 +1617,6 @@ makedummy: * locking. This code remains in ip_input.c as ip_mroute.c is optionally * compiled. */ -static int ip_rsvp_on; -struct socket *ip_rsvpd; int ip_rsvp_init(struct socket *so) { Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/ip_output.c Wed Nov 19 09:39:34 2008 (r185088) @@ -83,7 +83,9 @@ __FBSDID("$FreeBSD$"); (ntohl(a.s_addr)>>8)&0xFF,\ (ntohl(a.s_addr))&0xFF, y); +#ifdef VIMAGE_GLOBALS u_short ip_id; +#endif #ifdef MBUF_STRESS_TEST int mbuf_frag_size = 0; Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/raw_ip.c Wed Nov 19 09:39:34 2008 (r185088) @@ -76,8 +76,10 @@ __FBSDID("$FreeBSD$"); #include +#ifdef VIMAGE_GLOBALS struct inpcbhead ripcb; struct inpcbinfo ripcbinfo; +#endif /* control hooks for ipfw and dummynet */ ip_fw_ctl_t *ip_fw_ctl_ptr = NULL; @@ -91,7 +93,9 @@ ip_dn_ctl_t *ip_dn_ctl_ptr = NULL; /* * The socket used to communicate with the multicast routing daemon. */ +#ifdef VIMAGE_GLOBALS struct socket *ip_mrouter; +#endif /* * The various mrouter and rsvp functions. Modified: head/sys/netinet/tcp_hostcache.c ============================================================================== --- head/sys/netinet/tcp_hostcache.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/tcp_hostcache.c Wed Nov 19 09:39:34 2008 (r185088) @@ -146,9 +146,11 @@ struct tcp_hostcache { int prune; int purgeall; }; -static struct tcp_hostcache tcp_hostcache; +#ifdef VIMAGE_GLOBALS +static struct tcp_hostcache tcp_hostcache; static struct callout tcp_hc_callout; +#endif static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *); static struct hc_metrics *tcp_hc_insert(struct in_conninfo *); Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/tcp_input.c Wed Nov 19 09:39:34 2008 (r185088) @@ -99,7 +99,21 @@ __FBSDID("$FreeBSD$"); static const int tcprexmtthresh = 3; +#ifdef VIMAGE_GLOBALS struct tcpstat tcpstat; +int blackhole; +int tcp_delack_enabled; +int drop_synfin; +int tcp_do_rfc3042; +int tcp_do_rfc3390; +int tcp_do_ecn; +int tcp_ecn_maxretries; +int tcp_insecure_rst; +int tcp_do_autorcvbuf; +int tcp_autorcvbuf_inc; +int tcp_autorcvbuf_max; +#endif + SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RW, tcpstat , tcpstat, "TCP statistics (struct tcpstat, netinet/tcp_var.h)"); @@ -108,59 +122,50 @@ int tcp_log_in_vain = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW, &tcp_log_in_vain, 0, "Log all incoming TCP segments to closed ports"); -static int blackhole = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, blackhole, CTLFLAG_RW, blackhole, 0, "Do not send RST on segments to closed ports"); -int tcp_delack_enabled = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, delayed_ack, CTLFLAG_RW, tcp_delack_enabled, 0, "Delay ACK to try and piggyback it onto a data packet"); -static int drop_synfin = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_RW, drop_synfin, 0, "Drop TCP packets with SYN+FIN set"); -static int tcp_do_rfc3042 = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_RW, tcp_do_rfc3042, 0, "Enable RFC 3042 (Limited Transmit)"); -static int tcp_do_rfc3390 = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, rfc3390, CTLFLAG_RW, tcp_do_rfc3390, 0, "Enable RFC 3390 (Increasing TCP's Initial Congestion Window)"); -int tcp_do_ecn = 0; -int tcp_ecn_maxretries = 1; SYSCTL_NODE(_net_inet_tcp, OID_AUTO, ecn, CTLFLAG_RW, 0, "TCP ECN"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_ecn, OID_AUTO, enable, CTLFLAG_RW, tcp_do_ecn, 0, "TCP ECN support"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_ecn, OID_AUTO, maxretries, CTLFLAG_RW, tcp_ecn_maxretries, 0, "Max retries before giving up on ECN"); -static int tcp_insecure_rst = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, insecure_rst, CTLFLAG_RW, tcp_insecure_rst, 0, "Follow the old (insecure) criteria for accepting RST packets"); -int tcp_do_autorcvbuf = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, recvbuf_auto, CTLFLAG_RW, tcp_do_autorcvbuf, 0, "Enable automatic receive buffer sizing"); -int tcp_autorcvbuf_inc = 16*1024; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, recvbuf_inc, CTLFLAG_RW, tcp_autorcvbuf_inc, 0, "Incrementor step size of automatic receive buffer"); -int tcp_autorcvbuf_max = 256*1024; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, recvbuf_max, CTLFLAG_RW, tcp_autorcvbuf_max, 0, "Max size of automatic receive buffer"); +#ifdef VIMAGE_GLOBALS struct inpcbhead tcb; -#define tcb6 tcb /* for KAME src sync over BSD*'s */ struct inpcbinfo tcbinfo; +#endif +#define tcb6 tcb /* for KAME src sync over BSD*'s */ static void tcp_dooptions(struct tcpopt *, u_char *, int, int); static void tcp_do_segment(struct mbuf *, struct tcphdr *, Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/tcp_output.c Wed Nov 19 09:39:34 2008 (r185088) @@ -87,39 +87,42 @@ __FBSDID("$FreeBSD$"); extern struct mbuf *m_copypack(); #endif -int path_mtu_discovery = 1; +#ifdef VIMAGE_GLOBALS +int path_mtu_discovery; +int ss_fltsz; +int ss_fltsz_local; +int tcp_do_newreno; +int tcp_do_tso; +int tcp_do_autosndbuf; +int tcp_autosndbuf_inc; +int tcp_autosndbuf_max; +#endif + SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, path_mtu_discovery, CTLFLAG_RW, path_mtu_discovery, 1, "Enable Path MTU Discovery"); -int ss_fltsz = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, slowstart_flightsize, CTLFLAG_RW, ss_fltsz, 1, "Slow start flight size"); -int ss_fltsz_local = 4; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, local_slowstart_flightsize, CTLFLAG_RW, ss_fltsz_local, 1, "Slow start flight size for local networks"); -int tcp_do_newreno = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, newreno, CTLFLAG_RW, tcp_do_newreno, 0, "Enable NewReno Algorithms"); -int tcp_do_tso = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, tso, CTLFLAG_RW, tcp_do_tso, 0, "Enable TCP Segmentation Offload"); -int tcp_do_autosndbuf = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, sendbuf_auto, CTLFLAG_RW, tcp_do_autosndbuf, 0, "Enable automatic send buffer sizing"); -int tcp_autosndbuf_inc = 8*1024; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, sendbuf_inc, CTLFLAG_RW, tcp_autosndbuf_inc, 0, "Incrementor step size of automatic send buffer"); -int tcp_autosndbuf_max = 256*1024; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, sendbuf_max, CTLFLAG_RW, tcp_autosndbuf_max, 0, "Max size of automatic send buffer"); Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/tcp_reass.c Wed Nov 19 09:39:34 2008 (r185088) @@ -74,25 +74,28 @@ __FBSDID("$FreeBSD$"); #include #endif /* TCPDEBUG */ +#ifdef VIMAGE_GLOBALS +static int tcp_reass_maxseg; +int tcp_reass_qsize; +static int tcp_reass_maxqlen; +static int tcp_reass_overflows; +#endif + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static int tcp_reass_maxseg = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -int tcp_reass_qsize = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, tcp_reass_qsize, 0, "Global number of TCP Segments currently in Reassembly Queue"); -static int tcp_reass_maxqlen = 48; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW, tcp_reass_maxqlen, 0, "Maximum number of TCP Segments per individual Reassembly Queue"); -static int tcp_reass_overflows = 0; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); @@ -114,6 +117,11 @@ tcp_reass_init(void) { INIT_VNET_INET(curvnet); + V_tcp_reass_maxseg = 0; + V_tcp_reass_qsize = 0; + V_tcp_reass_maxqlen = 48; + V_tcp_reass_overflows = 0; + V_tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", &V_tcp_reass_maxseg); Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Wed Nov 19 08:56:35 2008 (r185087) +++ head/sys/netinet/tcp_sack.c Wed Nov 19 09:39:34 2008 (r185088) @@ -124,23 +124,26 @@ __FBSDID("$FreeBSD$"); extern struct uma_zone *sack_hole_zone; +#ifdef VIMAGE_GLOBALS +int tcp_do_sack; +int tcp_sack_maxholes; +int tcp_sack_globalmaxholes; +int tcp_sack_globalholes; +#endif + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, sack, CTLFLAG_RW, 0, "TCP SACK"); -int tcp_do_sack = 1; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_sack, OID_AUTO, enable, CTLFLAG_RW, tcp_do_sack, 0, "Enable/Disable TCP SACK support"); TUNABLE_INT("net.inet.tcp.sack.enable", &tcp_do_sack); -static int tcp_sack_maxholes = 128; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_sack, OID_AUTO, maxholes, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 11:30:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B3B41065673; Wed, 19 Nov 2008 11:30:45 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E88178FC12; Wed, 19 Nov 2008 11:30:44 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJBUin4016034; Wed, 19 Nov 2008 11:30:44 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJBUieo016026; Wed, 19 Nov 2008 11:30:44 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811191130.mAJBUieo016026@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Nov 2008 11:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185089 - in head/sys/arm/mv: . discovery kirkwood orion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 11:30:45 -0000 Author: raj Date: Wed Nov 19 11:30:44 2008 New Revision: 185089 URL: http://svn.freebsd.org/changeset/base/185089 Log: PCI/PCI-Express support for Marvell systems. Obtained from: Marvell, Semihalf Added: head/sys/arm/mv/mv_pci.c (contents, props changed) Modified: head/sys/arm/mv/common.c head/sys/arm/mv/discovery/db78xxx.c head/sys/arm/mv/discovery/discovery.c head/sys/arm/mv/files.mv head/sys/arm/mv/kirkwood/db88f6xxx.c head/sys/arm/mv/kirkwood/kirkwood.c head/sys/arm/mv/mvreg.h head/sys/arm/mv/mvvar.h head/sys/arm/mv/obio.c head/sys/arm/mv/orion/db88f5xxx.c head/sys/arm/mv/orion/orion.c Modified: head/sys/arm/mv/common.c ============================================================================== --- head/sys/arm/mv/common.c Wed Nov 19 09:39:34 2008 (r185088) +++ head/sys/arm/mv/common.c Wed Nov 19 11:30:44 2008 (r185089) @@ -53,6 +53,7 @@ static void decode_win_eth_setup(uint32_ static void decode_win_pcie_setup(uint32_t base); static uint32_t dev, rev; +static uint32_t used_cpu_wins; uint32_t read_cpu_ctrl(uint32_t reg) @@ -198,8 +199,20 @@ soc_decode_win(void) decode_win_eth_setup(MV_ETH0_BASE); if (dev == MV_DEV_MV78100) decode_win_eth_setup(MV_ETH1_BASE); + decode_win_idma_setup(); - decode_win_pcie_setup(MV_PCIE_BASE); + + if (dev == MV_DEV_MV78100) { + decode_win_pcie_setup(MV_PCIE00_BASE); + decode_win_pcie_setup(MV_PCIE01_BASE); + decode_win_pcie_setup(MV_PCIE02_BASE); + decode_win_pcie_setup(MV_PCIE03_BASE); + decode_win_pcie_setup(MV_PCIE10_BASE); + decode_win_pcie_setup(MV_PCIE11_BASE); + decode_win_pcie_setup(MV_PCIE12_BASE); + decode_win_pcie_setup(MV_PCIE13_BASE); + } else + decode_win_pcie_setup(MV_PCIE_BASE); /* TODO set up decode wins for SATA */ @@ -405,12 +418,49 @@ decode_win_cpu_valid(void) return (rv); } +int +decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, + int remap) +{ + uint32_t br, cr; + int win; + + if (used_cpu_wins >= MV_WIN_CPU_MAX) + return (-1); + + win = used_cpu_wins++; + + br = base & 0xffff0000; + win_cpu_br_write(win, br); + + if (win_cpu_can_remap(win)) { + if (remap >= 0) { + win_cpu_remap_l_write(win, remap & 0xffff0000); + win_cpu_remap_h_write(win, 0); + } else { + /* + * Remap function is not used for a given window + * (capable of remapping) - set remap field with the + * same value as base. + */ + win_cpu_remap_l_write(win, base & 0xffff0000); + win_cpu_remap_h_write(win, 0); + } + } + + cr = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1; + win_cpu_cr_write(win, cr); + + return (0); +} + static void decode_win_cpu_setup(void) { - uint32_t br, cr; int i; + used_cpu_wins = 0; + /* Disable all CPU windows */ for (i = 0; i < MV_WIN_CPU_MAX; i++) { win_cpu_cr_write(i, 0); @@ -422,35 +472,11 @@ decode_win_cpu_setup(void) } for (i = 0; i < cpu_wins_no; i++) - if (cpu_wins[i].target > 0) { + if (cpu_wins[i].target > 0) + decode_win_cpu_set(cpu_wins[i].target, + cpu_wins[i].attr, cpu_wins[i].base, + cpu_wins[i].size, cpu_wins[i].remap); - br = cpu_wins[i].base & 0xffff0000; - win_cpu_br_write(i, br); - - if (win_cpu_can_remap(i)) { - if (cpu_wins[i].remap >= 0) { - win_cpu_remap_l_write(i, - cpu_wins[i].remap & 0xffff0000); - win_cpu_remap_h_write(i, 0); - } else { - /* - * Remap function is not used for - * a given window (capable of - * remapping) - set remap field with the - * same value as base. - */ - win_cpu_remap_l_write(i, - cpu_wins[i].base & 0xffff0000); - win_cpu_remap_h_write(i, 0); - } - } - - cr = ((cpu_wins[i].size - 1) & 0xffff0000) | - (cpu_wins[i].attr << 8) | - (cpu_wins[i].target << 4) | 1; - - win_cpu_cr_write(i, cr); - } } /* Modified: head/sys/arm/mv/discovery/db78xxx.c ============================================================================== --- head/sys/arm/mv/discovery/db78xxx.c Wed Nov 19 09:39:34 2008 (r185088) +++ head/sys/arm/mv/discovery/db78xxx.c Wed Nov 19 11:30:44 2008 (r185089) @@ -57,7 +57,10 @@ __FBSDID("$FreeBSD$"); * virtual_avail - 0xefff_ffff : KVA (virtual_avail is typically < 0xc0a0_0000) * 0xf000_0000 - 0xf0ff_ffff : no-cache allocation area (16MB) * 0xf100_0000 - 0xf10f_ffff : SoC integrated devices registers range (1MB) - * 0xf110_0000 - 0xfffe_ffff : PCIE (MEM+IO) outbound windows (~238MB) + * 0xf110_0000 - 0xf11f_ffff : PCI-Express I/O space (1MB) + * 0xf120_0000 - 0xf12f_ffff : unused (1MB) + * 0xf130_0000 - 0xf52f_ffff : PCI-Express memory space (64MB) + * 0xf930_0000 - 0xfffe_ffff : unused (~172MB) * 0xffff_0000 - 0xffff_0fff : 'high' vectors page (4KB) * 0xffff_1000 - 0xffff_1fff : ARM_TP_ADDRESS/RAS page (4KB) * 0xffff_2000 - 0xffff_ffff : unused (~55KB) @@ -79,6 +82,20 @@ static const struct pmap_devmap pmap_dev VM_PROT_READ | VM_PROT_WRITE, PTE_NOCACHE, }, + { /* PCIE I/O */ + MV_PCIE_IO_BASE, + MV_PCIE_IO_PHYS_BASE, + MV_PCIE_IO_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { /* PCIE Memory */ + MV_PCIE_MEM_BASE, + MV_PCIE_MEM_PHYS_BASE, + MV_PCIE_MEM_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, { 0, 0, 0, 0, 0, } }; Modified: head/sys/arm/mv/discovery/discovery.c ============================================================================== --- head/sys/arm/mv/discovery/discovery.c Wed Nov 19 09:39:34 2008 (r185088) +++ head/sys/arm/mv/discovery/discovery.c Wed Nov 19 11:30:44 2008 (r185089) @@ -41,6 +41,24 @@ __FBSDID("$FreeBSD$"); #include #include +#define _MV_PCIE_MAX_PORT 8 + +#define _MV_PCIE_IO_SIZE (MV_PCIE_IO_SIZE / _MV_PCIE_MAX_PORT) +#define _MV_PCIE_MEM_SIZE (MV_PCIE_MEM_SIZE / _MV_PCIE_MAX_PORT) + +#define _MV_PCIE_IO(n) (MV_PCIE_IO_BASE + ((n) * _MV_PCIE_IO_SIZE)) +#define _MV_PCIE_MEM(n) (MV_PCIE_MEM_BASE + ((n) * _MV_PCIE_MEM_SIZE)) + +#define _MV_PCIE_IO_PHYS(n) (MV_PCIE_IO_PHYS_BASE + ((n) * _MV_PCIE_IO_SIZE)) +#define _MV_PCIE_MEM_PHYS(n) (MV_PCIE_MEM_PHYS_BASE + ((n) * _MV_PCIE_MEM_SIZE)) + +/* + * Note the 'pcib' devices are not declared in the obio_devices[]: due to the + * much more complex configuration schemes allowed, specifically of the + * PCI-Express (multiple lanes width per port configured dynamically etc.) it + * is better and flexible to instantiate the number of PCI bridge devices + * (known in run-time) in the pcib_mbus_identify() method. + */ struct obio_device obio_devices[] = { { "ic", MV_IC_BASE, MV_IC_SIZE, { -1 }, @@ -104,6 +122,61 @@ struct obio_device obio_devices[] = { { NULL, 0, 0, { 0 }, { 0 }, 0 } }; +const struct obio_pci mv_pci_info[] = { + { MV_TYPE_PCIE, + MV_PCIE00_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(0), _MV_PCIE_IO_SIZE, 4, 0xE0, + _MV_PCIE_MEM(0), _MV_PCIE_MEM_SIZE, 4, 0xE8, + NULL, MV_INT_PEX00 }, + + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE01_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(1), _MV_PCIE_IO_SIZE, 4, 0xD0, + _MV_PCIE_MEM(1), _MV_PCIE_MEM_SIZE, 4, 0xD8, + NULL, MV_INT_PEX01 }, +#if 0 + /* + * XXX Access to devices on this interface (PCIE 0.2) crashes the + * system. Could be a silicon defect as Marvell U-Boot has a 'Do not + * touch' precaution comment... + */ + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE02_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(2), _MV_PCIE_IO_SIZE(2), 4, 0xB0, + _MV_PCIE_MEM(2), _MV_PCIE_MEM_SIZE(2), 4, 0xB8, + NULL, MV_INT_PEX02 }, +#endif + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE03_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(3), _MV_PCIE_IO_SIZE, 4, 0x70, + _MV_PCIE_MEM(3), _MV_PCIE_MEM_SIZE, 4, 0x78, + NULL, MV_INT_PEX03 }, + + { MV_TYPE_PCIE, + MV_PCIE10_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(4), _MV_PCIE_IO_SIZE, 8, 0xE0, + _MV_PCIE_MEM(4), _MV_PCIE_MEM_SIZE, 8, 0xE8, + NULL, MV_INT_PEX10 }, + + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE11_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(5), _MV_PCIE_IO_SIZE, 8, 0xD0, + _MV_PCIE_MEM(5), _MV_PCIE_MEM_SIZE, 8, 0xD8, + NULL, MV_INT_PEX11 }, + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE12_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(6), _MV_PCIE_IO_SIZE, 8, 0xB0, + _MV_PCIE_MEM(6), _MV_PCIE_MEM_SIZE, 8, 0xB8, + NULL, MV_INT_PEX12 }, + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE13_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(7), _MV_PCIE_IO_SIZE, 8, 0x70, + _MV_PCIE_MEM(7), _MV_PCIE_MEM_SIZE, 8, 0x78, + NULL, MV_INT_PEX13 }, + + { 0, 0, 0 } +}; + struct resource_spec mv_gpio_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, @@ -122,12 +195,6 @@ struct resource_spec mv_xor_spec[] = { }; const struct decode_win cpu_win_tbl[] = { - /* PCIE IO */ - { 4, 0x51, MV_PCIE_IO_PHYS_BASE, MV_PCIE_IO_SIZE, -1 }, - - /* PCIE MEM */ - { 4, 0x59, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 }, - /* Device bus BOOT */ { 1, 0x2f, MV_DEV_BOOT_PHYS_BASE, MV_DEV_BOOT_SIZE, -1 }, @@ -154,7 +221,8 @@ int cpu_wins_no = sizeof(cpu_win_tbl) / */ const struct decode_win idma_win_tbl[] = { /* PCIE MEM */ - { 4, 0x59, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 }, + { 4, 0xE8, _MV_PCIE_MEM_PHYS(0), _MV_PCIE_MEM_SIZE, -1 }, + { 4, 0xD8, _MV_PCIE_MEM_PHYS(1), _MV_PCIE_MEM_SIZE, -1 }, }; const struct decode_win *idma_wins = idma_win_tbl; int idma_wins_no = sizeof(idma_win_tbl) / sizeof(struct decode_win); Modified: head/sys/arm/mv/files.mv ============================================================================== --- head/sys/arm/mv/files.mv Wed Nov 19 09:39:34 2008 (r185088) +++ head/sys/arm/mv/files.mv Wed Nov 19 11:30:44 2008 (r185089) @@ -23,6 +23,7 @@ arm/mv/common.c standard arm/mv/gpio.c standard arm/mv/ic.c standard arm/mv/mv_machdep.c standard +arm/mv/mv_pci.c optional pci arm/mv/obio.c standard arm/mv/timer.c standard arm/mv/twsi.c optional iicbus Modified: head/sys/arm/mv/kirkwood/db88f6xxx.c ============================================================================== --- head/sys/arm/mv/kirkwood/db88f6xxx.c Wed Nov 19 09:39:34 2008 (r185088) +++ head/sys/arm/mv/kirkwood/db88f6xxx.c Wed Nov 19 11:30:44 2008 (r185089) @@ -57,7 +57,10 @@ __FBSDID("$FreeBSD$"); * virtual_avail - 0xefff_ffff : KVA (virtual_avail is typically < 0xc0a0_0000) * 0xf000_0000 - 0xf0ff_ffff : no-cache allocation area (16MB) * 0xf100_0000 - 0xf10f_ffff : SoC integrated devices registers range (1MB) - * 0xf110_0000 - 0xfffe_ffff : PCIE (MEM+IO) outbound windows (~238MB) + * 0xf110_0000 - 0xf11f_ffff : PCI-Express I/O space (1MB) + * 0xf120_0000 - 0xf12f_ffff : unused (1MB) + * 0xf130_0000 - 0xf52f_ffff : PCI-Express memory space (64MB) + * 0xf930_0000 - 0xfffe_ffff : unused (~172MB) * 0xffff_0000 - 0xffff_0fff : 'high' vectors page (4KB) * 0xffff_1000 - 0xffff_1fff : ARM_TP_ADDRESS/RAS page (4KB) * 0xffff_2000 - 0xffff_ffff : unused (~55KB) @@ -120,5 +123,5 @@ platform_identify(void *dummy) SYSINIT(platform_identify, SI_SUB_CPU, SI_ORDER_SECOND, platform_identify, NULL); /* - * TODO routine setting GPIO/MPP pins + * TODO routine setting GPIO/MPP pins */ Modified: head/sys/arm/mv/kirkwood/kirkwood.c ============================================================================== --- head/sys/arm/mv/kirkwood/kirkwood.c Wed Nov 19 09:39:34 2008 (r185088) +++ head/sys/arm/mv/kirkwood/kirkwood.c Wed Nov 19 11:30:44 2008 (r185089) @@ -98,22 +98,19 @@ struct obio_device obio_devices[] = { { -1 }, { -1 }, CPU_PM_CTRL_NONE }, - { "pcib", MV_PCIE_BASE, MV_PCIE_SIZE, - { MV_INT_PEX0_ERR, -1 }, - { -1 }, - CPU_PM_CTRL_PEX0 - }, { NULL, 0, 0, { 0 }, { 0 }, 0 } }; -#if 0 -const struct mv_pci_info pci_info[] = { - { 1, MV_PCIE_IO_BASE, MV_PCIE_IO_SIZE, - MV_PCIE_MEM_BASE, MV_PCIE_MEM_SIZE, +const struct obio_pci mv_pci_info[] = { + { MV_TYPE_PCIE, + MV_PCIE_BASE, MV_PCIE_SIZE, + MV_PCIE_IO_BASE, MV_PCIE_IO_SIZE, 4, 0xE0, + MV_PCIE_MEM_BASE, MV_PCIE_MEM_SIZE, 4, 0xE8, NULL, MV_INT_PEX0 - } + }, + + { 0, 0, 0 } }; -#endif struct resource_spec mv_gpio_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -139,12 +136,6 @@ struct resource_spec mv_xor_spec[] = { }; const struct decode_win cpu_win_tbl[] = { - /* PCIE IO */ - { 4, 0xE0, MV_PCIE_IO_PHYS_BASE, MV_PCIE_IO_SIZE, -1 }, - - /* PCIE MEM */ - { 4, 0xE8, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 }, - /* Device bus BOOT */ { 1, 0x0f, MV_DEV_BOOT_PHYS_BASE, MV_DEV_BOOT_SIZE, -1 }, Added: head/sys/arm/mv/mv_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_pci.c Wed Nov 19 11:30:44 2008 (r185089) @@ -0,0 +1,768 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * All rights reserved. + * + * Developed by Semihalf. + * + * 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. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + */ + +/* + * Marvell integrated PCI/PCI-Express controller driver. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "pcib_if.h" + +#include +#include + +#include +#include + +#define PCI_CFG_ENA (1 << 31) +#define PCI_CFG_BUS(bus) (((bus) & 0xff) << 16) +#define PCI_CFG_DEV(dev) (((dev) & 0x1f) << 11) +#define PCI_CFG_FUN(fun) (((fun) & 0x7) << 8) +#define PCI_CFG_PCIE_REG(reg) ((reg) & 0xfc) + +#define PCI_REG_CFG_ADDR 0x0C78 +#define PCI_REG_CFG_DATA 0x0C7C +#define PCI_REG_P2P_CONF 0x1D14 + +#define PCIE_REG_CFG_ADDR 0x18F8 +#define PCIE_REG_CFG_DATA 0x18FC +#define PCIE_REG_CONTROL 0x1A00 +#define PCIE_CTRL_LINK1X 0x00000001 +#define PCIE_REG_STATUS 0x1A04 +#define PCIE_REG_IRQ_MASK 0x1910 + +#define STATUS_BUS_OFFS 8 +#define STATUS_BUS_MASK (0xFF << STATUS_BUS_OFFS) +#define STATUS_DEV_OFFS 16 +#define STATUS_DEV_MASK (0x1F << STATUS_DEV_OFFS) + +#define P2P_CONF_BUS_OFFS 16 +#define P2P_CONF_BUS_MASK (0xFF << P2P_CONF_BUS_OFFS) +#define P2P_CONF_DEV_OFFS 24 +#define P2P_CONF_DEV_MASK (0x1F << P2P_CONF_DEV_OFFS) + +#define PCI_VENDORID_MRVL 0x11AB + +struct pcib_mbus_softc { + device_t sc_dev; + + bus_addr_t sc_iomem_base; + bus_addr_t sc_iomem_size; + bus_addr_t sc_iomem_alloc; /* Next allocation. */ + + bus_addr_t sc_ioport_base; + bus_addr_t sc_ioport_size; + bus_addr_t sc_ioport_alloc; /* Next allocation. */ + + struct resource *sc_res; + bus_space_handle_t sc_bsh; + bus_space_tag_t sc_bst; + int sc_rid; + + int sc_busnr; /* Host bridge bus number */ + int sc_devnr; /* Host bridge device number */ + + const struct obio_pci *sc_info; +}; + +static void pcib_mbus_identify(driver_t *driver, device_t parent); +static int pcib_mbus_probe(device_t); +static int pcib_mbus_attach(device_t); + +static struct resource *pcib_mbus_alloc_resource(device_t, device_t, int, int *, + u_long, u_long, u_long, u_int); +static int pcib_mbus_release_resource(device_t, device_t, int, int, + struct resource *); +static int pcib_mbus_read_ivar(device_t, device_t, int, uintptr_t *); +static int pcib_mbus_write_ivar(device_t, device_t, int, uintptr_t); + +static int pcib_mbus_maxslots(device_t); +static uint32_t pcib_mbus_read_config(device_t, u_int, u_int, u_int, u_int, + int); +static void pcib_mbus_write_config(device_t, u_int, u_int, u_int, u_int, + uint32_t, int); +static int pcib_mbus_init(struct pcib_mbus_softc *sc, int bus, int maxslot); +static int pcib_mbus_init_bar(struct pcib_mbus_softc *sc, int bus, int slot, + int func, int barno); +static void pcib_mbus_init_bridge(struct pcib_mbus_softc *sc, int bus, int slot, + int func); +static int pcib_mbus_init_resources(struct pcib_mbus_softc *sc, int bus, + int slot, int func, int hdrtype); + +/* + * Bus interface definitions. + */ +static device_method_t pcib_mbus_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, pcib_mbus_identify), + DEVMETHOD(device_probe, pcib_mbus_probe), + DEVMETHOD(device_attach, pcib_mbus_attach), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_read_ivar, pcib_mbus_read_ivar), + DEVMETHOD(bus_write_ivar, pcib_mbus_write_ivar), + DEVMETHOD(bus_alloc_resource, pcib_mbus_alloc_resource), + DEVMETHOD(bus_release_resource, pcib_mbus_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + /* pcib interface */ + DEVMETHOD(pcib_maxslots, pcib_mbus_maxslots), + DEVMETHOD(pcib_read_config, pcib_mbus_read_config), + DEVMETHOD(pcib_write_config, pcib_mbus_write_config), + DEVMETHOD(pcib_route_interrupt, pcib_route_interrupt), + + { 0, 0 } +}; + +static driver_t pcib_mbus_driver = { + "pcib", + pcib_mbus_methods, + sizeof(struct pcib_mbus_softc), +}; + +devclass_t pcib_devclass; + +DRIVER_MODULE(pcib, mbus, pcib_mbus_driver, pcib_devclass, 0, 0); + +static struct mtx pcicfg_mtx; + +static inline void +pcib_write_irq_mask(struct pcib_mbus_softc *sc, uint32_t mask) +{ + + if (!sc->sc_info->op_type != MV_TYPE_PCI) + return; + + bus_space_write_4(sc->sc_bst, sc->sc_bsh, + PCIE_REG_IRQ_MASK, mask); +} + +static void +pcib_mbus_hw_cfginit(void) +{ + static int opened = 0; + + if (opened) + return; + + mtx_init(&pcicfg_mtx, "pcicfg", NULL, MTX_SPIN); + opened = 1; +} + +static uint32_t +pcib_mbus_hw_cfgread(struct pcib_mbus_softc *sc, u_int bus, u_int slot, + u_int func, u_int reg, int bytes) +{ + uint32_t addr, data, ca, cd; + + ca = (sc->sc_info->op_type != MV_TYPE_PCI) ? + PCIE_REG_CFG_ADDR : PCI_REG_CFG_ADDR; + cd = (sc->sc_info->op_type != MV_TYPE_PCI) ? + PCIE_REG_CFG_DATA : PCI_REG_CFG_DATA; + addr = PCI_CFG_ENA | PCI_CFG_BUS(bus) | PCI_CFG_DEV(slot) | + PCI_CFG_FUN(func) | PCI_CFG_PCIE_REG(reg); + + mtx_lock_spin(&pcicfg_mtx); + bus_space_write_4(sc->sc_bst, sc->sc_bsh, ca, addr); + + data = ~0; + switch (bytes) { + case 1: + data = bus_space_read_1(sc->sc_bst, sc->sc_bsh, + cd + (reg & 3)); + break; + case 2: + data = le16toh(bus_space_read_2(sc->sc_bst, sc->sc_bsh, + cd + (reg & 2))); + break; + case 4: + data = le32toh(bus_space_read_4(sc->sc_bst, sc->sc_bsh, + cd)); + break; + } + mtx_unlock_spin(&pcicfg_mtx); + return (data); +} + +static void +pcib_mbus_hw_cfgwrite(struct pcib_mbus_softc *sc, u_int bus, u_int slot, + u_int func, u_int reg, uint32_t data, int bytes) +{ + uint32_t addr, ca, cd; + + ca = (sc->sc_info->op_type != MV_TYPE_PCI) ? + PCIE_REG_CFG_ADDR : PCI_REG_CFG_ADDR; + cd = (sc->sc_info->op_type != MV_TYPE_PCI) ? + PCIE_REG_CFG_DATA : PCI_REG_CFG_DATA; + addr = PCI_CFG_ENA | PCI_CFG_BUS(bus) | PCI_CFG_DEV(slot) | + PCI_CFG_FUN(func) | PCI_CFG_PCIE_REG(reg); + + mtx_lock_spin(&pcicfg_mtx); + bus_space_write_4(sc->sc_bst, sc->sc_bsh, ca, addr); + + switch (bytes) { + case 1: + bus_space_write_1(sc->sc_bst, sc->sc_bsh, + cd + (reg & 3), data); + break; + case 2: + bus_space_write_2(sc->sc_bst, sc->sc_bsh, + cd + (reg & 2), htole16(data)); + break; + case 4: + bus_space_write_4(sc->sc_bst, sc->sc_bsh, + cd, htole32(data)); + break; + } + mtx_unlock_spin(&pcicfg_mtx); +} + +static int +pcib_mbus_maxslots(device_t dev) +{ + struct pcib_mbus_softc *sc = device_get_softc(dev); + + return ((sc->sc_info->op_type != MV_TYPE_PCI) ? 1 : PCI_SLOTMAX); +} + +static uint32_t +pcib_mbus_read_config(device_t dev, u_int bus, u_int slot, u_int func, + u_int reg, int bytes) +{ + struct pcib_mbus_softc *sc = device_get_softc(dev); + + /* Skip self */ + if (bus == sc->sc_busnr && slot == sc->sc_devnr) + return (~0U); + + return (pcib_mbus_hw_cfgread(sc, bus, slot, func, reg, bytes)); +} + +static void +pcib_mbus_write_config(device_t dev, u_int bus, u_int slot, u_int func, + u_int reg, uint32_t val, int bytes) +{ + struct pcib_mbus_softc *sc = device_get_softc(dev); + + /* Skip self */ + if (bus == sc->sc_busnr && slot == sc->sc_devnr) + return; + + pcib_mbus_hw_cfgwrite(sc, bus, slot, func, reg, val, bytes); +} + +static void +pcib_mbus_add_child(driver_t *driver, device_t parent, struct pcib_mbus_softc *sc) +{ + device_t child; + int error; + + /* Configure CPU decoding windows */ + error = decode_win_cpu_set(sc->sc_info->op_io_win_target, + sc->sc_info->op_io_win_attr, sc->sc_info->op_io_base, + sc->sc_info->op_io_size, -1); + if (error < 0) { + device_printf(parent, "Could not set up CPU decode " + "window for PCI IO\n"); + return; + } + error = decode_win_cpu_set(sc->sc_info->op_mem_win_target, + sc->sc_info->op_mem_win_attr, sc->sc_info->op_mem_base, + sc->sc_info->op_mem_size, -1); + if (error < 0) { + device_printf(parent, "Could not set up CPU decode " + "windows for PCI MEM\n"); + return; + } + + /* Create driver instance */ + child = BUS_ADD_CHILD(parent, 0, driver->name, -1); + bus_set_resource(child, SYS_RES_MEMORY, 0, + sc->sc_info->op_base, sc->sc_info->op_size); + device_set_softc(child, sc); +} + +static void +pcib_mbus_identify(driver_t *driver, device_t parent) +{ + const struct obio_pci *info = mv_pci_info; + struct pcib_mbus_softc *sc; + uint32_t control; + + while (info->op_base) { + sc = malloc(driver->size, M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc == NULL) { + device_printf(parent, "Could not allocate pcib " + "memory\n"); + break; + } + sc->sc_info = info++; + + /* + * PCI bridge objects are instantiated immediately. PCI-Express + * bridges require more complicated handling depending on + * platform configuration. + */ + if (sc->sc_info->op_type == MV_TYPE_PCI) { + pcib_mbus_add_child(driver, parent, sc); + continue; + } + + /* + * Read link configuration + */ + sc->sc_rid = 0; + sc->sc_res = BUS_ALLOC_RESOURCE(parent, parent, SYS_RES_MEMORY, + &sc->sc_rid, sc->sc_info->op_base, sc->sc_info->op_base + + sc->sc_info->op_size - 1, sc->sc_info->op_size, + RF_ACTIVE); + if (sc->sc_res == NULL) + device_printf(parent, "Could not map pcib memory\n"); + + sc->sc_bst = rman_get_bustag(sc->sc_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_res); + + control = bus_space_read_4(sc->sc_bst, sc->sc_bsh, + PCIE_REG_CONTROL); + + BUS_RELEASE_RESOURCE(parent, parent, SYS_RES_MEMORY, sc->sc_rid, + sc->sc_res); + + /* + * If this PCI-E port (controller) is configured (by the + * underlying firmware) with lane width other than 1x, there + * are auxiliary resources defined for aggregating more width + * on our lane. Skip all such entries as they are not + * standalone ports and must not have a device object + * instantiated. + */ + if ((control & PCIE_CTRL_LINK1X) == 0) + while (info->op_base && + info->op_type == MV_TYPE_PCIE_AGGR_LANE) + info++; + + pcib_mbus_add_child(driver, parent, sc); + } +} + +static int +pcib_mbus_probe(device_t self) +{ + char buf[128]; + struct pcib_mbus_softc *sc; + const char *id, *type; + uint32_t val; + int rv = ENOENT, bus, dev; + + sc = device_get_softc(self); + + sc->sc_rid = 0; + sc->sc_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &sc->sc_rid, + RF_ACTIVE); + if (sc->sc_res == NULL) { + device_printf(self, "Could not map memory\n"); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->sc_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_res); + + pcib_mbus_hw_cfginit(); + + /* Retrieve configuration of the bridge */ + if (sc->sc_info->op_type == MV_TYPE_PCI) { + val = bus_space_read_4(sc->sc_bst, sc->sc_bsh, + PCI_REG_P2P_CONF); + bus = sc->sc_busnr = (val & P2P_CONF_BUS_MASK) >> + P2P_CONF_BUS_OFFS; + dev = sc->sc_devnr = (val & P2P_CONF_DEV_MASK) >> + P2P_CONF_DEV_OFFS; + } else { + val = bus_space_read_4(sc->sc_bst, sc->sc_bsh, PCIE_REG_STATUS); + bus = sc->sc_busnr = (val & STATUS_BUS_MASK) >> STATUS_BUS_OFFS; + dev = sc->sc_devnr = (val & STATUS_DEV_MASK) >> STATUS_DEV_OFFS; + } + + val = pcib_mbus_hw_cfgread(sc, bus, dev, 0, PCIR_VENDOR, 2); + if (val != PCI_VENDORID_MRVL) + goto out; + + val = pcib_mbus_hw_cfgread(sc, bus, dev, 0, PCIR_DEVICE, 2); + switch (val) { + case 0x5281: + id = "88F5281"; + break; + case 0x5182: + id = "88F5182"; + break; + case 0x6281: + id = "88F6281"; + break; + case 0x6381: + id = "MV78100"; + break; + default: + device_printf(self, "unknown Marvell PCI bridge: %x\n", val); + goto out; + } + + type = "PCI"; + val = pcib_mbus_hw_cfgread(sc, bus, dev, 0, PCIR_CAP_PTR, 1); + while (val != 0) { + val = pcib_mbus_hw_cfgread(sc, bus, dev, 0, val, 2); + switch (val & 0xff) { + case PCIY_PCIX: + type = "PCI-X"; + break; + case PCIY_EXPRESS: + type = "PCI-Express"; + break; + } + val = (val >> 8) & 0xff; + } + + snprintf(buf, sizeof(buf), "Marvell %s %s host controller", id, + type); + device_set_desc_copy(self, buf); + rv = BUS_PROBE_DEFAULT; +out: + bus_release_resource(self, SYS_RES_MEMORY, sc->sc_rid, sc->sc_res); + return (rv); +} + +static int +pcib_mbus_attach(device_t self) +{ + struct pcib_mbus_softc *sc; + uint32_t val; + int err; + + sc = device_get_softc(self); + sc->sc_dev = self; + + sc->sc_rid = 0; + sc->sc_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &sc->sc_rid, + RF_ACTIVE); + if (sc->sc_res == NULL) { + device_printf(self, "Could not map memory\n"); + return (ENXIO); + } + sc->sc_bst = rman_get_bustag(sc->sc_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_res); + + /* Enable PCI bridge */ + val = pcib_mbus_hw_cfgread(sc, sc->sc_busnr, sc->sc_devnr, 0, + PCIR_COMMAND, 2); + val |= PCIM_CMD_SERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN | + PCIM_CMD_PORTEN; + pcib_mbus_hw_cfgwrite(sc, sc->sc_busnr, sc->sc_devnr, 0, + PCIR_COMMAND, val, 2); + + sc->sc_iomem_base = sc->sc_info->op_mem_base; + sc->sc_iomem_size = sc->sc_info->op_mem_size; + sc->sc_iomem_alloc = sc->sc_info->op_mem_base; + + sc->sc_ioport_base = sc->sc_info->op_io_base; + sc->sc_ioport_size = sc->sc_info->op_io_size; + sc->sc_ioport_alloc = sc->sc_info->op_io_base; + + err = pcib_mbus_init(sc, sc->sc_busnr, pcib_mbus_maxslots(sc->sc_dev)); + if (err) + return(err); + + device_add_child(self, "pci", -1); + return (bus_generic_attach(self)); +} + +static int +pcib_mbus_init_bar(struct pcib_mbus_softc *sc, int bus, int slot, int func, + int barno) +{ + bus_addr_t *allocp, limit; + uint32_t addr, bar, mask, size; + int reg, width; + + reg = PCIR_BAR(barno); + bar = pcib_mbus_read_config(sc->sc_dev, bus, slot, func, reg, 4); + if (bar == 0) + return (1); + + /* Calculate BAR size: 64 or 32 bit (in 32-bit units) */ + width = ((bar & 7) == 4) ? 2 : 1; + + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, reg, ~0, 4); + size = pcib_mbus_read_config(sc->sc_dev, bus, slot, func, reg, 4); + + /* Get BAR type and size */ + if (bar & 1) { + /* I/O port */ + allocp = &sc->sc_ioport_alloc; + limit = sc->sc_ioport_base + sc->sc_ioport_size; + size &= ~0x3; + if ((size & 0xffff0000) == 0) + size |= 0xffff0000; + } else { + /* Memory */ + allocp = &sc->sc_iomem_alloc; + limit = sc->sc_iomem_base + sc->sc_iomem_size; + size &= ~0xF; + } + mask = ~size; + size = mask + 1; + + /* Sanity check (must be a power of 2) */ + if (size & mask) + return (width); + + addr = (*allocp + mask) & ~mask; + if ((*allocp = addr + size) >= limit) + return (-1); + + if (bootverbose) + printf("PCI %u:%u:%u: reg %x: size=%08x: addr=%08x\n", + bus, slot, func, reg, size, addr); + + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, reg, addr, 4); + if (width == 2) + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, reg + 4, + 0, 4); + + return (width); +} + +static void +pcib_mbus_init_bridge(struct pcib_mbus_softc *sc, int bus, int slot, int func) +{ + bus_addr_t io_base, mem_base; + uint32_t io_limit, mem_limit; + int secbus; + + io_base = sc->sc_info->op_io_base; + io_limit = io_base + sc->sc_info->op_io_size - 1; + mem_base = sc->sc_info->op_mem_base; + mem_limit = mem_base + sc->sc_info->op_mem_size - 1; + + /* Configure I/O decode registers */ + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_IOLIMITL_1, + io_limit >> 8, 1); + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_IOLIMITH_1, + io_limit >> 16, 2); + + /* Configure memory decode registers */ + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_MEMBASE_1, + mem_base >> 16, 2); + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_MEMLIMIT_1, + mem_limit >> 16, 2); + + /* Disable memory prefetch decode */ + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_PMBASEL_1, + 0x10, 2); + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_PMBASEH_1, + 0x0, 4); + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_PMLIMITL_1, + 0xF, 2); + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_PMLIMITH_1, + 0x0, 4); + + secbus = pcib_mbus_read_config(sc->sc_dev, bus, slot, func, + PCIR_SECBUS_1, 1); + + /* Configure buses behind the bridge */ + pcib_mbus_init(sc, secbus, PCI_SLOTMAX); +} + +static int +pcib_mbus_init_resources(struct pcib_mbus_softc *sc, int bus, int slot, + int func, int hdrtype) +{ + int maxbar = (hdrtype & PCIM_HDRTYPE) ? 0 : 6; + int bar = 0, irq, pin, i; + + /* Program the base address registers */ + while (bar < maxbar) { + i = pcib_mbus_init_bar(sc, bus, slot, func, bar); + bar += i; + if (i < 0) { + device_printf(sc->sc_dev, + "PCI IO/Memory space exhausted\n"); + return (ENOMEM); + } + } + + /* Perform interrupt routing */ + pin = pcib_mbus_read_config(sc->sc_dev, bus, slot, func, + PCIR_INTPIN, 1); + + if (sc->sc_info->op_get_irq != NULL) + irq = sc->sc_info->op_get_irq(bus, slot, func, pin); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 11:47:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B899F106564A; Wed, 19 Nov 2008 11:47:23 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3FCA8FC1B; Wed, 19 Nov 2008 11:47:23 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJBlNHr016353; Wed, 19 Nov 2008 11:47:23 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJBlNvj016350; Wed, 19 Nov 2008 11:47:23 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811191147.mAJBlNvj016350@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Nov 2008 11:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185090 - head/sys/arm/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 11:47:23 -0000 Author: raj Date: Wed Nov 19 11:47:23 2008 New Revision: 185090 URL: http://svn.freebsd.org/changeset/base/185090 Log: Enable PCI in Marvell kernel configs. Modified: head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Wed Nov 19 11:30:44 2008 (r185089) +++ head/sys/arm/conf/DB-78XXX Wed Nov 19 11:47:23 2008 (r185090) @@ -46,6 +46,8 @@ options WITNESS #Enable checks to det options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options WITNESS_KDB +device pci + # Pseudo devices device loop device md Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Wed Nov 19 11:30:44 2008 (r185089) +++ head/sys/arm/conf/DB-88F5XXX Wed Nov 19 11:47:23 2008 (r185090) @@ -46,6 +46,8 @@ options WITNESS #Enable checks to det options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options WITNESS_KDB +device pci + # Pseudo devices device md device loop Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Wed Nov 19 11:30:44 2008 (r185089) +++ head/sys/arm/conf/DB-88F6XXX Wed Nov 19 11:47:23 2008 (r185090) @@ -46,6 +46,8 @@ options WITNESS #Enable checks to det options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options WITNESS_KDB +device pci + # Pseudo devices device loop device md From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 11:49:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B527E1065670; Wed, 19 Nov 2008 11:49:35 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A102C8FC21; Wed, 19 Nov 2008 11:49:35 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJBnZg7016440; Wed, 19 Nov 2008 11:49:35 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJBnZL9016439; Wed, 19 Nov 2008 11:49:35 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811191149.mAJBnZL9016439@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Nov 2008 11:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185091 - head/sys/arm/mv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 11:49:35 -0000 Author: raj Date: Wed Nov 19 11:49:35 2008 New Revision: 185091 URL: http://svn.freebsd.org/changeset/base/185091 Log: Fix off-by-one error in mbus_attach(). Modified: head/sys/arm/mv/obio.c Modified: head/sys/arm/mv/obio.c ============================================================================== --- head/sys/arm/mv/obio.c Wed Nov 19 11:47:23 2008 (r185090) +++ head/sys/arm/mv/obio.c Wed Nov 19 11:49:35 2008 (r185091) @@ -99,7 +99,7 @@ mbus_attach(device_t dev) resource_list_init(&od->od_resources); resource_list_add(&od->od_resources, SYS_RES_MEMORY, 0, - od->od_base, od->od_base + od->od_size, od->od_size); + od->od_base, od->od_base + od->od_size - 1, od->od_size); for (i = 0; od->od_irqs[i] != -1; i++) { resource_list_add(&od->od_resources, SYS_RES_IRQ, i, From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 11:57:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08825106564A; Wed, 19 Nov 2008 11:57:17 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E73188FC08; Wed, 19 Nov 2008 11:57:16 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJBvGZ4016605; Wed, 19 Nov 2008 11:57:16 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJBvGXL016601; Wed, 19 Nov 2008 11:57:16 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811191157.mAJBvGXL016601@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Nov 2008 11:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185092 - head/sys/arm/mv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 11:57:17 -0000 Author: raj Date: Wed Nov 19 11:57:16 2008 New Revision: 185092 URL: http://svn.freebsd.org/changeset/base/185092 Log: Improve style(9) and other cosmetics in Marvell SOCs code. Modified: head/sys/arm/mv/common.c head/sys/arm/mv/mvvar.h head/sys/arm/mv/obio.c Modified: head/sys/arm/mv/common.c ============================================================================== --- head/sys/arm/mv/common.c Wed Nov 19 11:49:35 2008 (r185091) +++ head/sys/arm/mv/common.c Wed Nov 19 11:57:16 2008 (r185092) @@ -580,7 +580,7 @@ decode_win_usb_setup(uint32_t ctrl) * field in the ctrl reg */ cr = (((ddr_size(i) - 1) & 0xffff0000) | - (ddr_attr(i) << 8) | (ddr_target(i) << 4) | 1); + (ddr_attr(i) << 8) | (ddr_target(i) << 4) | 1); /* Set the first free USB window */ for (j = 0; j < MV_WIN_USB_MAX; j++) { @@ -663,7 +663,7 @@ decode_win_eth_setup(uint32_t base) for (i = 0; i < MV_WIN_DDR_MAX; i++) if (ddr_is_active(i)) { - br = ddr_base(i) | (ddr_attr(i) << 8) | ddr_target(i); + br = ddr_base(i) | (ddr_attr(i) << 8) | ddr_target(i); sz = ((ddr_size(i) - 1) & 0xffff0000); /* Set the first free ETH window */ @@ -808,7 +808,7 @@ win_idma_can_remap(int i) /* IDMA decode windows 0-3 have remap capability */ if (i < 4) return (1); - + return (0); } @@ -837,7 +837,7 @@ decode_win_idma_setup(void) */ for (i = 0; i < MV_WIN_DDR_MAX; i++) if (ddr_is_active(i)) { - br = ddr_base(i) | (ddr_attr(i) << 8) | ddr_target(i); + br = ddr_base(i) | (ddr_attr(i) << 8) | ddr_target(i); sz = ((ddr_size(i) - 1) & 0xffff0000); /* Place DDR entries in non-remapped windows */ @@ -864,7 +864,7 @@ decode_win_idma_setup(void) for (i = 0; i < idma_wins_no; i++) if (idma_wins[i].target > 0) { br = (idma_wins[i].base & 0xffff0000) | - (idma_wins[i].attr << 8) | idma_wins[i].target; + (idma_wins[i].attr << 8) | idma_wins[i].target; sz = ((idma_wins[i].size - 1) & 0xffff0000); /* Set the first free IDMA window */ @@ -875,7 +875,8 @@ decode_win_idma_setup(void) /* Configure window */ win_idma_br_write(j, br); win_idma_sz_write(j, sz); - if (win_idma_can_remap(j) && idma_wins[j].remap >= 0) + if (win_idma_can_remap(j) && + idma_wins[j].remap >= 0) win_idma_har_write(j, idma_wins[j].remap); /* Set protection RW on all channels */ @@ -914,8 +915,8 @@ decode_win_idma_valid(void) for (i = 0; i < idma_wins_no; i++, wintab++) { if (wintab->target == 0) { - printf("IDMA window#%d: DDR target window is not supposed " - "to be reprogrammed!\n", i); + printf("IDMA window#%d: DDR target window is not " + "supposed to be reprogrammed!\n", i); rv = 0; } @@ -929,7 +930,7 @@ decode_win_idma_valid(void) b = wintab->base; e = b + s - 1; if (s > (0xFFFFFFFF - b + 1)) { - /* XXX this boundary check should accont for 64bit and + /* XXX this boundary check should account for 64bit and * remapping.. */ printf("IDMA window#%d: no space for size 0x%08x at " "0x%08x\n", i, s, b); @@ -939,8 +940,8 @@ decode_win_idma_valid(void) j = decode_win_overlap(i, idma_wins_no, &idma_wins[0]); if (j >= 0) { - printf("IDMA window#%d: (0x%08x - 0x%08x) overlaps with " - "#%d (0x%08x - 0x%08x)\n", i, b, e, j, + printf("IDMA window#%d: (0x%08x - 0x%08x) overlaps " + "with " "#%d (0x%08x - 0x%08x)\n", i, b, e, j, idma_wins[j].base, idma_wins[j].base + idma_wins[j].size - 1); rv = 0; Modified: head/sys/arm/mv/mvvar.h ============================================================================== --- head/sys/arm/mv/mvvar.h Wed Nov 19 11:49:35 2008 (r185091) +++ head/sys/arm/mv/mvvar.h Wed Nov 19 11:57:16 2008 (r185092) @@ -95,27 +95,27 @@ struct decode_win { }; extern const struct obio_pci mv_pci_info[]; -extern bus_space_tag_t obio_tag; -extern struct obio_device obio_devices[]; -extern const struct decode_win *cpu_wins; -extern const struct decode_win *idma_wins; -extern int cpu_wins_no; -extern int idma_wins_no; +extern bus_space_tag_t obio_tag; +extern struct obio_device obio_devices[]; +extern const struct decode_win *cpu_wins; +extern const struct decode_win *idma_wins; +extern int cpu_wins_no; +extern int idma_wins_no; /* Function prototypes */ -int mv_gpio_setup_intrhandler(const char *name, driver_filter_t *filt, +int mv_gpio_setup_intrhandler(const char *name, driver_filter_t *filt, void (*hand)(void *), void *arg, int pin, int flags, void **cookiep); -void mv_gpio_intr_mask(int pin); -void mv_gpio_intr_unmask(int pin); -int mv_gpio_configure(uint32_t pin, uint32_t flags, uint32_t mask); -void mv_gpio_out(uint32_t pin, uint8_t val, uint8_t enable); -uint8_t mv_gpio_in(uint32_t pin); - -int platform_pmap_init(void); -int soc_decode_win(void); -void soc_id(uint32_t *dev, uint32_t *rev); -void soc_identify(void); -void soc_dump_decode_win(void); +void mv_gpio_intr_mask(int pin); +void mv_gpio_intr_unmask(int pin); +int mv_gpio_configure(uint32_t pin, uint32_t flags, uint32_t mask); +void mv_gpio_out(uint32_t pin, uint8_t val, uint8_t enable); +uint8_t mv_gpio_in(uint32_t pin); + +int platform_pmap_init(void); +int soc_decode_win(void); +void soc_id(uint32_t *dev, uint32_t *rev); +void soc_identify(void); +void soc_dump_decode_win(void); uint32_t soc_power_ctrl_get(uint32_t mask); int decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, @@ -123,20 +123,20 @@ int decode_win_cpu_set(int target, int a int decode_win_overlap(int, int, const struct decode_win *); int win_cpu_can_remap(int); -void decode_win_idma_dump(void); -void decode_win_idma_setup(void); -int decode_win_idma_valid(void); - -int ddr_is_active(int i); -uint32_t ddr_base(int i); -uint32_t ddr_size(int i); -uint32_t ddr_attr(int i); -uint32_t ddr_target(int i); - -uint32_t cpu_extra_feat(void); -uint32_t get_tclk(void); -uint32_t read_cpu_ctrl(uint32_t); -void write_cpu_ctrl(uint32_t, uint32_t); +void decode_win_idma_dump(void); +void decode_win_idma_setup(void); +int decode_win_idma_valid(void); + +int ddr_is_active(int i); +uint32_t ddr_base(int i); +uint32_t ddr_size(int i); +uint32_t ddr_attr(int i); +uint32_t ddr_target(int i); + +uint32_t cpu_extra_feat(void); +uint32_t get_tclk(void); +uint32_t read_cpu_ctrl(uint32_t); +void write_cpu_ctrl(uint32_t, uint32_t); enum mbus_device_ivars { MBUS_IVAR_BASE, Modified: head/sys/arm/mv/obio.c ============================================================================== --- head/sys/arm/mv/obio.c Wed Nov 19 11:49:35 2008 (r185091) +++ head/sys/arm/mv/obio.c Wed Nov 19 11:57:16 2008 (r185092) @@ -40,9 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include -static void mbus_identify(driver_t *, device_t); -static int mbus_probe(device_t); -static int mbus_attach(device_t); +static void mbus_identify(driver_t *, device_t); +static int mbus_probe(device_t); +static int mbus_attach(device_t); static void mbus_identify(driver_t *driver, device_t parent) @@ -62,10 +62,10 @@ mbus_probe(device_t dev) static int mbus_attach(device_t dev) { - struct obio_softc *sc; - struct obio_device *od; - int i; - device_t child; + struct obio_softc *sc; + struct obio_device *od; + int i; + device_t child; sc = device_get_softc(dev); @@ -124,15 +124,14 @@ mbus_attach(device_t dev) static int mbus_print_child(device_t dev, device_t child) { - struct obio_device *od; - int rv; + struct obio_device *od; + int rv; od = (struct obio_device *)device_get_ivars(child); if (od == NULL) panic("Unknown device on %s", device_get_nameunit(dev)); rv = 0; - rv += bus_print_child_header(dev, child); rv += resource_list_print_type(&od->od_resources, "at mem", @@ -153,7 +152,7 @@ static int mbus_setup_intr(device_t dev, device_t child, struct resource *ires, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - struct obio_softc *sc; + struct obio_softc *sc; int error; sc = (struct obio_softc *)device_get_softc(dev); @@ -186,7 +185,7 @@ mbus_teardown_intr(device_t dev, device_ static int mbus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { - struct obio_device *od; + struct obio_device *od; od = (struct obio_device *)device_get_ivars(child); @@ -205,7 +204,7 @@ mbus_read_ivar(device_t dev, device_t ch static struct resource_list * mbus_get_resource_list(device_t dev, device_t child) { - struct obio_device *od; + struct obio_device *od; od = (struct obio_device *)device_get_ivars(child); @@ -219,13 +218,13 @@ static struct resource * mbus_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { - struct obio_softc *sc; - struct obio_device *od; - struct resource *rv; - struct resource_list *rl; - struct resource_list_entry *rle = NULL; - struct rman *rm; - int needactivate; + struct obio_softc *sc; + struct obio_device *od; + struct resource *rv; + struct resource_list *rl; + struct resource_list_entry *rle = NULL; + struct rman *rm; + int needactivate; sc = (struct obio_softc *)device_get_softc(dev); @@ -293,9 +292,9 @@ static int mbus_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - struct obio_device *od; - struct resource_list *rl; - struct resource_list_entry *rle; + struct obio_device *od; + struct resource_list *rl; + struct resource_list_entry *rle; if (device_get_parent(child) == dev) { od = (struct obio_device *)device_get_ivars(child); From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 08:07:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B815106564A; Wed, 19 Nov 2008 08:07:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id A43098FC19; Wed, 19 Nov 2008 08:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from orphanage.alkar.net (account mav@alkar.net [212.86.226.11] verified) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPA id 227893051; Wed, 19 Nov 2008 10:07:21 +0200 Message-ID: <4923C939.2090003@FreeBSD.org> Date: Wed, 19 Nov 2008 10:07:21 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.14 (X11/20080612) MIME-Version: 1.0 To: Robert Noland References: <200811181324.mAIDOcOc079096@svn.freebsd.org> <1227064379.1979.3.camel@wombat.2hip.net> In-Reply-To: <1227064379.1979.3.camel@wombat.2hip.net> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 19 Nov 2008 12:30:35 +0000 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185050 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 08:07:23 -0000 Robert Noland wrote: > On Tue, 2008-11-18 at 13:24 +0000, Alexander Motin wrote: >> Log: >> Set of powerd enchancements: >> > Somehow this seems to be too sensitive. My laptop previously idled at > 150Mhz... Occasionally bouncing up to maybe 450Mhz. With the new algo, > it will sometimes drop to 900Mhz, but winds itself right back up to > 1.8Ghz. Can you give me any details? How many CPUs do you have, which set of frequencies does it have? Are there any powerd options specified? Does powerd detects battery power? With AC or unknown power it will run in hiadaptive mode which keeps much higher frequencies. Can you run `powerd -v` and look what happens there? powerd now drops/rises frequency exponentially, so lower frequency will be reached only after some period of idle. Rising is much faster to quickly restore system interactivity. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 15:11:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72FB71065677 for ; Wed, 19 Nov 2008 15:11:50 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mx1.freebsd.org (Postfix) with ESMTP id 1B67A8FC1D for ; Wed, 19 Nov 2008 15:11:49 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so1450530yxb.13 for ; Wed, 19 Nov 2008 07:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=/RV+ml8INp7qknSikjXZoWxcolJ3F10bbeLEFx38UIE=; b=Y5yPrbRsOvCtPPe5nIToFbmmlf2bCG6FoM1UviZ/rIg9YVwlaJE2dXInqwc7HvlR0N gpFj3xjRDh2NkpsLnAJWAE2TsZvFhQ1vK6FOz8vGNOjWmP3zHHWoKZvfyZ4XNkMGzC9b 2LR/ocdM8IZ2A7ko6+3g2qaosnFBzEG/qsJ0s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=qiV2KB42g6gcH7/pTIpaHljb/r69Y6y95k0ShwxPDc6/zdjp/8L/+O94zkbaLQMZ0P YirqNowvA//qqFIXVKb0Y/fM+E6dqLTZRL5ZwYIaAeR/jWJaHOTGQ1q0CJxYUvMrVJBN 3hQKx4FOaOxIDHgLppVE9KqXwHpIJSn9P8H14= Received: by 10.142.52.9 with SMTP id z9mr577932wfz.233.1227107508706; Wed, 19 Nov 2008 07:11:48 -0800 (PST) Received: by 10.142.83.5 with HTTP; Wed, 19 Nov 2008 07:11:48 -0800 (PST) Message-ID: <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> Date: Wed, 19 Nov 2008 13:11:48 -0200 From: "Renato Botelho" To: "Pawel Jakub Dawidek" In-Reply-To: <200811172049.mAHKnUDw092510@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811172049.mAHKnUDw092510@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 15:11:50 -0000 On Mon, Nov 17, 2008 at 6:49 PM, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Nov 17 20:49:29 2008 > New Revision: 185029 > URL: http://svn.freebsd.org/changeset/base/185029 > > Log: > Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. After this revision I've started to got this: root@botelhor:/usr/src/usr.bin/fstat# make all make: don't know how to make /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. Stop *** Error code 2 -- Renato Botelho From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 15:41:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7622106564A for ; Wed, 19 Nov 2008 15:41:02 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from hercules.mthelicon.com (hercules.mthelicon.com [IPv6:2001:49f0:2023::2]) by mx1.freebsd.org (Postfix) with ESMTP id AD06C8FC0C for ; Wed, 19 Nov 2008 15:41:02 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from feathers.peganest.com ([IPv6:2001:4d48:ad51:32:21b:21ff:fe1c:3ce]) (authenticated bits=0) by hercules.mthelicon.com (8.14.3/8.14.2) with ESMTP id mAJFf0hR029721 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Wed, 19 Nov 2008 15:41:02 GMT (envelope-from ken@mthelicon.com) From: Pegasus Mc Cleaft Organization: Feathers To: svn-src-all@freebsd.org Date: Wed, 19 Nov 2008 15:41:00 +0000 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; amd64; ; ) References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> In-Reply-To: <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811191541.00088.ken@mthelicon.com> Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 15:41:03 -0000 On Wednesday 19 November 2008 15:11:48 Renato Botelho wrote: > On Mon, Nov 17, 2008 at 6:49 PM, Pawel Jakub Dawidek wrote: > > Author: pjd > > Date: Mon Nov 17 20:49:29 2008 > > New Revision: 185029 > > URL: http://svn.freebsd.org/changeset/base/185029 > > > > Log: > > Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. > > After this revision I've started to got this: > > root@botelhor:/usr/src/usr.bin/fstat# make all > make: don't know how to make > /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. > Stop > *** Error code 2 Renato, I cant say that I have had this problem. The new updates to ZFS are working quite well for myself. (AMD64 system) Perhaps you got only a partial update from the CVS server? Peg From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 15:44:31 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 535B5106564A; Wed, 19 Nov 2008 15:44:31 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8248FC16; Wed, 19 Nov 2008 15:44:30 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.166.46] ([68.0.14.34]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id mAJFiTwS033241 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Nov 2008 10:44:29 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Alexander Motin In-Reply-To: <4923C939.2090003@FreeBSD.org> References: <200811181324.mAIDOcOc079096@svn.freebsd.org> <1227064379.1979.3.camel@wombat.2hip.net> <4923C939.2090003@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-BNVZO///OrJ41GgU8U3J" Organization: FreeBSD Date: Wed, 19 Nov 2008 10:44:23 -0500 Message-Id: <1227109463.16692.9.camel@squirrel.corp.cox.com> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 FreeBSD GNOME Team Port X-Spam-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00, RCVD_IN_SORBS_DUL,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185050 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 15:44:31 -0000 --=-BNVZO///OrJ41GgU8U3J Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2008-11-19 at 10:07 +0200, Alexander Motin wrote: > Robert Noland wrote: > > On Tue, 2008-11-18 at 13:24 +0000, Alexander Motin wrote: > >> Log: > >> Set of powerd enchancements: > >> =20 > > Somehow this seems to be too sensitive. My laptop previously idled at > > 150Mhz... Occasionally bouncing up to maybe 450Mhz. With the new algo, > > it will sometimes drop to 900Mhz, but winds itself right back up to > > 1.8Ghz. >=20 > Can you give me any details? How many CPUs do you have, which set of > frequencies does it have? Are there any powerd options specified? Does > powerd detects battery power? With AC or unknown power it will run in > hiadaptive mode which keeps much higher frequencies. Can you run `powerd > -v` and look what happens there? >=20 > powerd now drops/rises frequency exponentially, so lower frequency will > be reached only after some period of idle. Rising is much faster to > quickly restore system interactivity. Right, what I expected, was a quicker ramp-up and a slower decay, leading to more stable frequency while idling. This is a Dell D630, Core2duo. ACPI, line detection works and I was testing with AC attached. With AC attached, my concern isn't power, as much as potential thermal impacts. Idling at high frequency isn't enough to kick my fans on high on this laptop, but I've had some that would. FreeBSD 8.0-CURRENT #1: Tue Nov 18 20:01:48 EST 2008 root@wombat.2hip.net:/usr/obj/usr/src/sys/D630 Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Intel(R) Core(TM)2 Duo CPU T7100 @ 1.80GHz (1795.00-MHz 686-class CPU) Origin =3D "GenuineIntel" Id =3D 0x6fd Stepping =3D 13 Features=3D0xbfebfbff Features2=3D0xe3bd AMD Features=3D0x20100000 AMD Features2=3D0x1 Cores per package: 2 dev.cpu.0.freq: 1800 dev.cpu.0.freq_levels: 1800/31000 1575/27125 1350/23250 1200/13000 1050/11375 900/9750 750/8125 600/6500 450/4875 300/3250 150/1625 dev.est.0.freq_settings: 1800/31000 1200/13000 dev.est.1.freq_settings: 1800/31000 1200/13000 dev.p4tcc.0.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 2500/-1 1250/-1 dev.p4tcc.1.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 2500/-1 1250/-1 robert. --=-BNVZO///OrJ41GgU8U3J Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEABECAAYFAkkkNFcACgkQM4TrQ4qfRON4egCfaFNd1wl2zhPwiUFa6xcmJXn+ txkAoIXNv6d+nQy/pwlqXUeRmrihF8XG =KVbr -----END PGP SIGNATURE----- --=-BNVZO///OrJ41GgU8U3J-- From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 15:52:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B5FC1065673 for ; Wed, 19 Nov 2008 15:52:18 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.29]) by mx1.freebsd.org (Postfix) with ESMTP id 124D48FC12 for ; Wed, 19 Nov 2008 15:52:17 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so8143yxb.13 for ; Wed, 19 Nov 2008 07:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=8BO9gSBmXDp8aGv9crFbftPCFqaDDssSx4bggmQYJvg=; b=YG3IXGPAqQe40zklAKXdfg4povfzt79PnywZNc5tXFbAZDptnbWpTAL+y6QDKE8GWK KmxLSxgdrvXlIVQmCRJeS/1vimdYhYbgKfCt/13QX3Xzj0t0mbaelLBt1Tp+3SWAyKu/ P0+tQXndEfeAkvEJmn9PzgqfTTjA+J62ZKCac= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=sVFPJ3HCTahdxzETxZPfStTpetf598fc7BBX645LLi5yjZCwaPf/R5nFFHPbRJqWca QBMraBa0qr9B3eX2r2T+aZDVUKwd3y6kFmG7sT2c5ItVsTg2ZyuMr4U7KFB6J2nBeqk4 SW9Hle/xlrQ3ejo1SjUZsiz/Mh2MyMyM1x5cQ= Received: by 10.142.237.19 with SMTP id k19mr598589wfh.209.1227109936474; Wed, 19 Nov 2008 07:52:16 -0800 (PST) Received: by 10.142.83.5 with HTTP; Wed, 19 Nov 2008 07:52:16 -0800 (PST) Message-ID: <747dc8f30811190752x7aefa5a8pb00bf3c8099c560a@mail.gmail.com> Date: Wed, 19 Nov 2008 13:52:16 -0200 From: "Renato Botelho" To: "Pegasus Mc Cleaft" In-Reply-To: <200811191541.00088.ken@mthelicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> <200811191541.00088.ken@mthelicon.com> Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 15:52:18 -0000 On Wed, Nov 19, 2008 at 1:41 PM, Pegasus Mc Cleaft wrote: > On Wednesday 19 November 2008 15:11:48 Renato Botelho wrote: >> On Mon, Nov 17, 2008 at 6:49 PM, Pawel Jakub Dawidek > wrote: >> > Author: pjd >> > Date: Mon Nov 17 20:49:29 2008 >> > New Revision: 185029 >> > URL: http://svn.freebsd.org/changeset/base/185029 >> > >> > Log: >> > Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. >> >> After this revision I've started to got this: >> >> root@botelhor:/usr/src/usr.bin/fstat# make all >> make: don't know how to make >> /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. >> Stop >> *** Error code 2 > > Renato, > > I cant say that I have had this problem. The new updates to ZFS are working > quite well for myself. (AMD64 system) > > Perhaps you got only a partial update from the CVS server? Not really root@botelhor:/usr/src# svn info Path: . URL: http://svn.freebsd.org/base/head Repository Root: http://svn.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 185092 Node Kind: directory Schedule: normal Last Changed Author: raj Last Changed Rev: 185092 Last Changed Date: 2008-11-19 09:57:16 -0200 (Wed, 19 Nov 2008) I got the problem when i was trying to update, after that I ran a make clean and now i'm trying to build again. -- Renato Botelho From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 16:04:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FED21065670; Wed, 19 Nov 2008 16:04:08 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F18748FC0C; Wed, 19 Nov 2008 16:04:07 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJG47iC021657; Wed, 19 Nov 2008 16:04:07 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJG47fv021656; Wed, 19 Nov 2008 16:04:07 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811191604.mAJG47fv021656@svn.freebsd.org> From: Doug Rabson Date: Wed, 19 Nov 2008 16:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185095 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 16:04:08 -0000 Author: dfr Date: Wed Nov 19 16:04:07 2008 New Revision: 185095 URL: http://svn.freebsd.org/changeset/base/185095 Log: If we free the GPT partition list in bd_open_gpt() because of an error, don't try to free it again in bd_closedisk(). While I'm here, fix a DEBUG print. Modified: head/sys/boot/i386/libi386/biosdisk.c Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Wed Nov 19 14:57:00 2008 (r185094) +++ head/sys/boot/i386/libi386/biosdisk.c Wed Nov 19 16:04:07 2008 (r185095) @@ -969,8 +969,10 @@ bd_open_gpt(struct open_disk *od, struct od->od_boff = gp->gp_start; out: - if (error) + if (error) { free(od->od_partitions); + od->od_flags &= ~BD_GPTOK; + } return (error); } @@ -1058,7 +1060,7 @@ bd_realstrategy(void *devdata, int rw, d switch(rw){ case F_READ: - DEBUG("read %d from %d to %p", blks, dblk, buf); + DEBUG("read %d from %lld to %p", blks, dblk, buf); if (blks && bd_read(od, dblk, blks, buf)) { DEBUG("read error"); From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 16:39:01 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C327D1065670; Wed, 19 Nov 2008 16:39:01 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFD868FC16; Wed, 19 Nov 2008 16:39:01 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJGd1DJ022331; Wed, 19 Nov 2008 16:39:01 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJGd1A0022327; Wed, 19 Nov 2008 16:39:01 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811191639.mAJGd1A0022327@svn.freebsd.org> From: Doug Rabson Date: Wed, 19 Nov 2008 16:39:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185096 - in head/sys/boot: i386 i386/gptzfsboot i386/zfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 16:39:02 -0000 Author: dfr Date: Wed Nov 19 16:39:01 2008 New Revision: 185096 URL: http://svn.freebsd.org/changeset/base/185096 Log: Add a GPT-aware variant of zfsboot which should be used in a similar manner to gptboot, i.e. installed in a freebsd-boot partition using /sbin/gpart or /sbin/gpt. Tweak the /boot/loader ZFS support so that it can find ZFS pools that are contained in GPT partitions. Added: head/sys/boot/i386/gptzfsboot/ head/sys/boot/i386/gptzfsboot/Makefile (contents, props changed) Modified: head/sys/boot/i386/Makefile head/sys/boot/i386/zfsboot/zfsboot.c head/sys/boot/zfs/zfs.c Modified: head/sys/boot/i386/Makefile ============================================================================== --- head/sys/boot/i386/Makefile Wed Nov 19 16:04:07 2008 (r185095) +++ head/sys/boot/i386/Makefile Wed Nov 19 16:39:01 2008 (r185096) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot zfsboot \ - kgzldr libi386 libfirewire loader + gptzfsboot kgzldr libi386 libfirewire loader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr Added: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/i386/gptzfsboot/Makefile Wed Nov 19 16:39:01 2008 (r185096) @@ -0,0 +1,74 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot ${.CURDIR}/../zfsboot + +FILES= gptzfsboot + +NM?= nm + +BOOT_COMCONSOLE_PORT?= 0x3f8 +BOOT_COMCONSOLE_SPEED?= 9600 +B2SIOFMT?= 0x3 + +REL1= 0x700 +ORG1= 0x7c00 +ORG2= 0x0 + +CFLAGS= -Os \ + -fno-guess-branch-probability \ + -fomit-frame-pointer \ + -fno-unit-at-a-time \ + -mno-align-long-strings \ + -mrtd \ + -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ + -DGPT -DBOOT2 \ + -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ + -DSIOFMT=${B2SIOFMT} \ + -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ + -I${.CURDIR}/../../common \ + -I${.CURDIR}/../../zfs \ + -I${.CURDIR}/../../../cddl/boot/zfs \ + -I${.CURDIR}/../btx/lib -I. \ + -I${.CURDIR}/../boot2 \ + -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ + -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ + -Winline --param max-inline-insns-single=100 + +LDFLAGS=-static -N --gc-sections + +# Pick up ../Makefile.inc early. +.include + +CLEANFILES= gptzfsboot + +gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN} + btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ + -o ${.TARGET} gptzfsboot.bin + +CLEANFILES+= gptldr.bin gptldr.out gptldr.o + +gptldr.bin: gptldr.out + objcopy -S -O binary gptldr.out ${.TARGET} + +gptldr.out: gptldr.o + ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o + +CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o + +gptzfsboot.bin: gptzfsboot.out + objcopy -S -O binary gptzfsboot.out ${.TARGET} + +gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o + ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} + +zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c + +.if ${MACHINE_ARCH} == "amd64" +beforedepend gptzfsboot.o: machine +CLEANFILES+= machine +machine: + ln -sf ${.CURDIR}/../../../i386/include machine +.endif + +.include Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Wed Nov 19 16:04:07 2008 (r185095) +++ head/sys/boot/i386/zfsboot/zfsboot.c Wed Nov 19 16:39:01 2008 (r185096) @@ -19,6 +19,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef GPT +#include +#endif #include #include @@ -32,7 +35,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef GPT #include "zfsboot.h" +#endif #include "lib.h" #define IO_KEYBOARD 1 @@ -103,6 +108,9 @@ __FBSDID("$FreeBSD$"); extern uint32_t _end; +#ifdef GPT +static const uuid_t freebsd_zfs_uuid = GPT_ENT_TYPE_FREEBSD_ZFS; +#endif static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ static const unsigned char flags[NOPT] = { RBX_DUAL, @@ -408,6 +416,12 @@ int13probe(int drive) static void probe_drive(struct dsk *dsk, spa_t **spap) { +#ifdef GPT + struct gpt_hdr hdr; + struct gpt_ent *ent; + daddr_t slba, elba; + unsigned part, entries_per_sec; +#endif struct dos_partition *dp; char *sec; unsigned i; @@ -424,6 +438,63 @@ probe_drive(struct dsk *dsk, spa_t **spa sec = dmadat->secbuf; dsk->start = 0; + +#ifdef GPT + /* + * First check for GPT. + */ + if (drvread(dsk, sec, 1, 1)) { + return; + } + memcpy(&hdr, sec, sizeof(hdr)); + if (memcmp(hdr.hdr_sig, GPT_HDR_SIG, sizeof(hdr.hdr_sig)) != 0 || + hdr.hdr_lba_self != 1 || hdr.hdr_revision < 0x00010000 || + hdr.hdr_entsz < sizeof(*ent) || DEV_BSIZE % hdr.hdr_entsz != 0) { + goto trymbr; + } + + /* + * Probe all GPT partitions for the presense of ZFS pools. We + * return the spa_t for the first we find (if requested). This + * will have the effect of booting from the first pool on the + * disk. + */ + entries_per_sec = DEV_BSIZE / hdr.hdr_entsz; + slba = hdr.hdr_lba_table; + elba = slba + hdr.hdr_entries / entries_per_sec; + while (slba < elba) { + if (drvread(dsk, sec, slba, 1)) + return; + for (part = 0; part < entries_per_sec; part++) { + ent = (struct gpt_ent *)(sec + part * hdr.hdr_entsz); + if (memcmp(&ent->ent_type, &freebsd_zfs_uuid, + sizeof(uuid_t)) == 0) { + dsk->start = ent->ent_lba_start; + if (vdev_probe(vdev_read, dsk, spap) == 0) { + /* + * We record the first pool we find (we will try + * to boot from that one. + */ + spap = 0; + + /* + * This slice had a vdev. We need a new dsk + * structure now since the vdev now owns this one. + */ + struct dsk *newdsk; + newdsk = malloc(sizeof(struct dsk)); + *newdsk = *dsk; + dsk = newdsk; + } + break; + } + } + slba++; + } + return; +trymbr: +#endif + if (drvread(dsk, sec, DOSBBSECTOR, 1)) return; dp = (void *)(sec + DOSPARTOFF); @@ -441,7 +512,7 @@ probe_drive(struct dsk *dsk, spa_t **spa /* * This slice had a vdev. We need a new dsk structure now - * sice the vdev now owns this one. + * since the vdev now owns this one. */ struct dsk *newdsk; newdsk = malloc(sizeof(struct dsk)); @@ -859,9 +930,42 @@ putchar(int c) xputc(c); } +#ifdef GPT +static struct { + uint16_t len; + uint16_t count; + uint16_t seg; + uint16_t off; + uint64_t lba; +} packet; +#endif + static int drvread(struct dsk *dsk, void *buf, unsigned lba, unsigned nblk) { +#ifdef GPT + static unsigned c = 0x2d5c7c2f; + + if (!OPT_CHECK(RBX_QUIET)) + printf("%c\b", c = c << 8 | c >> 24); + packet.len = 0x10; + packet.count = nblk; + packet.seg = VTOPOFF(buf); + packet.off = VTOPSEG(buf); + packet.lba = lba + dsk->start; + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4200; + v86.edx = dsk->drive; + v86.ds = VTOPSEG(&packet); + v86.esi = VTOPOFF(&packet); + v86int(); + if (V86_CY(v86.efl)) { + printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); + return -1; + } + return 0; +#else static unsigned c = 0x2d5c7c2f; lba += dsk->start; @@ -881,6 +985,7 @@ drvread(struct dsk *dsk, void *buf, unsi return -1; } return 0; +#endif } static int Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Wed Nov 19 16:04:07 2008 (r185095) +++ head/sys/boot/zfs/zfs.c Wed Nov 19 16:39:01 2008 (r185096) @@ -414,10 +414,14 @@ zfs_dev_init(void) close(fd); for (slice = 1; slice <= 4; slice++) { - sprintf(devname, "disk%ds%d:", unit, slice); + sprintf(devname, "disk%dp%d:", unit, slice); fd = open(devname, O_RDONLY); - if (fd == -1) - continue; + if (fd == -1) { + sprintf(devname, "disk%ds%d:", unit, slice); + fd = open(devname, O_RDONLY); + if (fd == -1) + continue; + } if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0)) close(fd); } From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 16:59:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2046F1065672; Wed, 19 Nov 2008 16:59:20 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EDBA8FC18; Wed, 19 Nov 2008 16:59:20 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJGxJ69022808; Wed, 19 Nov 2008 16:59:20 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJGxJO1022805; Wed, 19 Nov 2008 16:59:19 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811191659.mAJGxJO1022805@svn.freebsd.org> From: Doug Rabson Date: Wed, 19 Nov 2008 16:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185097 - in head/sys: boot/zfs cddl/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 16:59:20 -0000 Author: dfr Date: Wed Nov 19 16:59:19 2008 New Revision: 185097 URL: http://svn.freebsd.org/changeset/base/185097 Log: Some zfsboot fixes from Norikatsu Shigemura: 1. zfsboot2 (boot2) doesn't %d (printf), so change %d to %u. 2. chase new zpool versioning as SPA_VERSION. Obtained from: sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Submitted by: nork Modified: head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/boot/zfs/zfssubr.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Wed Nov 19 16:39:01 2008 (r185096) +++ head/sys/boot/zfs/zfsimpl.c Wed Nov 19 16:59:19 2008 (r185097) @@ -656,8 +656,9 @@ vdev_probe(vdev_read_t *read, void *read return (EIO); } - if (val != ZFS_VERSION) { - printf("ZFS: unsupported ZFS version %d\n", (int) val); + if (val > SPA_VERSION) { + printf("ZFS: unsupported ZFS version %u (should be %u)\n", + (unsigned) val, (unsigned) SPA_VERSION); return (EIO); } Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Wed Nov 19 16:39:01 2008 (r185096) +++ head/sys/cddl/boot/zfs/zfsimpl.h Wed Nov 19 16:59:19 2008 (r185097) @@ -448,41 +448,46 @@ typedef enum { /* * On-disk version number. */ -#define ZFS_VERSION_1 1ULL -#define ZFS_VERSION_2 2ULL -#define ZFS_VERSION_3 3ULL -#define ZFS_VERSION_4 4ULL -#define ZFS_VERSION_5 5ULL -#define ZFS_VERSION_6 6ULL +#define SPA_VERSION_1 1ULL +#define SPA_VERSION_2 2ULL +#define SPA_VERSION_3 3ULL +#define SPA_VERSION_4 4ULL +#define SPA_VERSION_5 5ULL +#define SPA_VERSION_6 6ULL +#define SPA_VERSION_7 7ULL +#define SPA_VERSION_8 8ULL +#define SPA_VERSION_9 9ULL +#define SPA_VERSION_10 10ULL +#define SPA_VERSION_11 11ULL /* - * When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk + * When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, * and do the appropriate changes. */ -#define ZFS_VERSION ZFS_VERSION_6 -#define ZFS_VERSION_STRING "6" +#define SPA_VERSION SPA_VERSION_11 +#define SPA_VERSION_STRING "11" /* - * Symbolic names for the changes that caused a ZFS_VERSION switch. + * Symbolic names for the changes that caused a SPA_VERSION switch. * Used in the code when checking for presence or absence of a feature. * Feel free to define multiple symbolic names for each version if there * were multiple changes to on-disk structures during that version. * - * NOTE: When checking the current ZFS_VERSION in your code, be sure + * NOTE: When checking the current SPA_VERSION in your code, be sure * to use spa_version() since it reports the version of the * last synced uberblock. Checking the in-flight version can * be dangerous in some cases. */ -#define ZFS_VERSION_INITIAL ZFS_VERSION_1 -#define ZFS_VERSION_DITTO_BLOCKS ZFS_VERSION_2 -#define ZFS_VERSION_SPARES ZFS_VERSION_3 -#define ZFS_VERSION_RAID6 ZFS_VERSION_3 -#define ZFS_VERSION_BPLIST_ACCOUNT ZFS_VERSION_3 -#define ZFS_VERSION_RAIDZ_DEFLATE ZFS_VERSION_3 -#define ZFS_VERSION_DNODE_BYTES ZFS_VERSION_3 -#define ZFS_VERSION_ZPOOL_HISTORY ZFS_VERSION_4 -#define ZFS_VERSION_GZIP_COMPRESSION ZFS_VERSION_5 -#define ZFS_VERSION_BOOTFS ZFS_VERSION_6 +#define SPA_VERSION_INITIAL SPA_VERSION_1 +#define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2 +#define SPA_VERSION_SPARES SPA_VERSION_3 +#define SPA_VERSION_RAID6 SPA_VERSION_3 +#define SPA_VERSION_BPLIST_ACCOUNT SPA_VERSION_3 +#define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3 +#define SPA_VERSION_DNODE_BYTES SPA_VERSION_3 +#define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 +#define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 +#define SPA_VERSION_BOOTFS SPA_VERSION_6 /* * The following are configuration names used in the nvlist describing a pool's @@ -603,7 +608,7 @@ typedef enum pool_state { struct uberblock { uint64_t ub_magic; /* UBERBLOCK_MAGIC */ - uint64_t ub_version; /* ZFS_VERSION */ + uint64_t ub_version; /* SPA_VERSION */ uint64_t ub_txg; /* txg of last sync */ uint64_t ub_guid_sum; /* sum of all vdev guids */ uint64_t ub_timestamp; /* UTC time of last sync */ Modified: head/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- head/sys/cddl/boot/zfs/zfssubr.c Wed Nov 19 16:39:01 2008 (r185096) +++ head/sys/cddl/boot/zfs/zfssubr.c Wed Nov 19 16:59:19 2008 (r185097) @@ -162,7 +162,7 @@ zio_decompress_data(int cpfunc, void *sr /* ASSERT((uint_t)cpfunc < ZIO_COMPRESS_FUNCTIONS); */ if (!ci->ci_decompress) { - printf("ZFS: unsupported compression algorithm %d\n", cpfunc); + printf("ZFS: unsupported compression algorithm %u\n", cpfunc); return (EIO); } From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 17:07:01 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F28F2106564A; Wed, 19 Nov 2008 17:07:01 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1F7B8FC1D; Wed, 19 Nov 2008 17:07:01 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJH71JG022989; Wed, 19 Nov 2008 17:07:01 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJH71U9022988; Wed, 19 Nov 2008 17:07:01 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811191707.mAJH71U9022988@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Nov 2008 17:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185098 - head/sys/arm/mv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 17:07:02 -0000 Author: raj Date: Wed Nov 19 17:07:01 2008 New Revision: 185098 URL: http://svn.freebsd.org/changeset/base/185098 Log: Improve error handling in pcib_mbus_identify(). Modified: head/sys/arm/mv/mv_pci.c Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Wed Nov 19 16:59:19 2008 (r185097) +++ head/sys/arm/mv/mv_pci.c Wed Nov 19 17:07:01 2008 (r185098) @@ -369,8 +369,10 @@ pcib_mbus_identify(driver_t *driver, dev &sc->sc_rid, sc->sc_info->op_base, sc->sc_info->op_base + sc->sc_info->op_size - 1, sc->sc_info->op_size, RF_ACTIVE); - if (sc->sc_res == NULL) + if (sc->sc_res == NULL) { device_printf(parent, "Could not map pcib memory\n"); + break; + } sc->sc_bst = rman_get_bustag(sc->sc_res); sc->sc_bsh = rman_get_bushandle(sc->sc_res); From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 17:34:28 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEEDB1065672; Wed, 19 Nov 2008 17:34:28 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCB668FC1B; Wed, 19 Nov 2008 17:34:28 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJHYSUe023573; Wed, 19 Nov 2008 17:34:28 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJHYSCw023563; Wed, 19 Nov 2008 17:34:28 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811191734.mAJHYSCw023563@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Nov 2008 17:34:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185099 - in head/sys: boot/arm/uboot boot/uboot/lib sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 17:34:28 -0000 Author: raj Date: Wed Nov 19 17:34:28 2008 New Revision: 185099 URL: http://svn.freebsd.org/changeset/base/185099 Log: Initial storage functionality for U-Boot support library. - Only non-sliced bsdlabel style partitioning is currently supported (but provisions are made towards GPT support, which should follow soon) - Enable storage support in loader on ARM Obtained from: Semihalf Modified: head/sys/boot/arm/uboot/Makefile head/sys/boot/arm/uboot/conf.c head/sys/boot/arm/uboot/version head/sys/boot/uboot/lib/devicename.c head/sys/boot/uboot/lib/disk.c head/sys/boot/uboot/lib/glue.c head/sys/boot/uboot/lib/glue.h head/sys/boot/uboot/lib/libuboot.h head/sys/boot/uboot/lib/net.c head/sys/sys/disklabel.h Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/arm/uboot/Makefile Wed Nov 19 17:34:28 2008 (r185099) @@ -10,8 +10,8 @@ WARNS?= 1 # Architecture-specific loader code SRCS= start.S conf.c vers.c -LOADER_DISK_SUPPORT?= no -LOADER_UFS_SUPPORT?= no +LOADER_DISK_SUPPORT?= yes +LOADER_UFS_SUPPORT?= yes LOADER_CD9660_SUPPORT?= no LOADER_EXT2FS_SUPPORT?= no LOADER_NET_SUPPORT?= yes Modified: head/sys/boot/arm/uboot/conf.c ============================================================================== --- head/sys/boot/arm/uboot/conf.c Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/arm/uboot/conf.c Wed Nov 19 17:34:28 2008 (r185099) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); struct devsw *devsw[] = { #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) - &uboot_disk, + &uboot_storage, #endif #if defined(LOADER_NET_SUPPORT) &netdev, Modified: head/sys/boot/arm/uboot/version ============================================================================== --- head/sys/boot/arm/uboot/version Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/arm/uboot/version Wed Nov 19 17:34:28 2008 (r185099) @@ -3,4 +3,5 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +1.0: Added storage support. Booting from HDD, USB, etc. is now possible. 0.5: Initial U-Boot/arm version (netbooting only). Modified: head/sys/boot/uboot/lib/devicename.c ============================================================================== --- head/sys/boot/uboot/lib/devicename.c Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/uboot/lib/devicename.c Wed Nov 19 17:34:28 2008 (r185099) @@ -64,7 +64,7 @@ uboot_getdev(void **vdev, const char *de /* * Try to parse the device name off the beginning of the devspec. */ - return(uboot_parsedev(dev, devspec, path)); + return (uboot_parsedev(dev, devspec, path)); } /* @@ -78,7 +78,7 @@ uboot_getdev(void **vdev, const char *de * * For disk-type devices, the syntax is: * - * disk[s][]: + * disk[]: * */ static int @@ -86,10 +86,10 @@ uboot_parsedev(struct uboot_devdesc **de const char **path) { struct uboot_devdesc *idev; - struct devsw *dv; - char *cp; - const char *np; - int i, unit, slice, partition, err; + struct devsw *dv; + char *cp; + const char *np; + int i, unit, partition, err; /* minimum length check */ if (strlen(devspec) < 2) @@ -110,12 +110,11 @@ uboot_parsedev(struct uboot_devdesc **de np = (devspec + strlen(dv->dv_name)); switch(dv->dv_type) { - case DEVT_NONE: /* XXX what to do here? Do we care? */ + case DEVT_NONE: break; case DEVT_DISK: unit = -1; - slice = -1; partition = -1; if (*np && (*np != ':')) { /* next comes the unit number */ @@ -124,16 +123,8 @@ uboot_parsedev(struct uboot_devdesc **de err = EUNIT; goto fail; } - if (*cp == 's') { /* got a slice number */ - np = cp + 1; - slice = strtol(np, &cp, 10); - if (cp == np) { - err = ESLICE; - goto fail; - } - } if (*cp && (*cp != ':')) { - /* get a partition number */ + /* get partition */ partition = *cp - 'a'; if ((partition < 0) || (partition >= MAXPARTITIONS)) { @@ -145,12 +136,12 @@ uboot_parsedev(struct uboot_devdesc **de } if (*cp && (*cp != ':')) { err = EINVAL; - goto fail; + goto fail; } idev->d_unit = unit; - idev->d_kind.disk.slice = slice; - idev->d_kind.disk.partition = partition; + idev->d_disk.partition = partition; + idev->d_disk.data = NULL; if (path != NULL) *path = (*cp == 0) ? cp : cp + 1; break; @@ -170,9 +161,7 @@ uboot_parsedev(struct uboot_devdesc **de err = EINVAL; goto fail; } - - if (dv->dv_type == DEVT_NET) - idev->d_unit = unit; + idev->d_unit = unit; if (path != NULL) *path = (*cp == 0) ? cp : cp + 1; @@ -212,8 +201,6 @@ uboot_fmtdev(void *vdev) case DEVT_DISK: cp = buf; cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit); - if (dev->d_kind.disk.slice > 0) - cp += sprintf(cp, "s%d", dev->d_kind.disk.slice); if (dev->d_kind.disk.partition >= 0) cp += sprintf(cp, "%c", dev->d_kind.disk.partition + 'a'); Modified: head/sys/boot/uboot/lib/disk.c ============================================================================== --- head/sys/boot/uboot/lib/disk.c Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/uboot/lib/disk.c Wed Nov 19 17:34:28 2008 (r185099) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2000 Benno Rice. + * Copyright (c) 2008 Semihalf, Rafal Jaworowski * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,99 +11,453 @@ * 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 Benno Rice ``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 TOOLS GMBH 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. + * 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. + * */ -#include -__FBSDID("$FreeBSD$"); - /* - * Disk I/O routines using U-Boot - TODO + * Block storage I/O routines for U-Boot */ +#include +__FBSDID("$FreeBSD$"); + #include #include - #include #include #include +#include + +#define FSTYPENAMES +#include +#include "api_public.h" #include "bootstrap.h" +#include "glue.h" +#include "libuboot.h" -static int d_init(void); -static int d_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int d_open(struct open_file *f, ...); -static int d_close(struct open_file *f); -static int d_ioctl(struct open_file *f, u_long cmd, void *data); -static void d_print(int verbose); +#define DEBUG +#undef DEBUG -struct devsw uboot_disk = { - "block", - DEVT_DISK, - d_init, - d_strategy, - d_open, - d_close, - d_ioctl, - d_print +#define stor_printf(fmt, args...) do { \ + printf("%s%d: ", dev->d_dev->dv_name, dev->d_unit); \ + printf(fmt, ##args); \ +} while (0) + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +struct gpt_part { + int gp_index; + uuid_t gp_type; + uint64_t gp_start; + uint64_t gp_end; }; -struct opened_dev { - u_int count; - SLIST_ENTRY(opened_dev) link; +struct open_dev { + int od_bsize; /* block size */ + int od_bstart; /* start block offset from beginning of disk */ + int od_type; +#define OD_BSDLABEL 0x0001 +#define OD_GPT 0x0002 + union { + struct { + struct disklabel bsdlabel; + } _bsd; + struct { + struct gpt_part *gpt_partitions; + int gpt_nparts; + } _gpt; + } _data; }; -SLIST_HEAD(, opened_dev) opened_devs = SLIST_HEAD_INITIALIZER(opened_dev); +#define od_bsdlabel _data._bsd.bsdlabel +#define od_nparts _data._gpt.gpt_nparts +#define od_partitions _data._gpt.gpt_partitions + +static int stor_info[UB_MAX_DEV]; +static int stor_info_no = 0; +static int stor_opendev(struct open_dev **, struct uboot_devdesc *); +static int stor_closedev(struct uboot_devdesc *); +static int stor_readdev(struct uboot_devdesc *, daddr_t, size_t, char *); +static int stor_open_count = 0; + +/* devsw I/F */ +static int stor_init(void); +static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *); +static int stor_open(struct open_file *, ...); +static int stor_close(struct open_file *); +static void stor_print(int); + +struct devsw uboot_storage = { + "disk", + DEVT_DISK, + stor_init, + stor_strategy, + stor_open, + stor_close, + noioctl, + stor_print +}; static int -d_init(void) +stor_init(void) { + struct device_info *di; + int i, found = 0; + + if (devs_no == 0) { + printf("No U-Boot devices! Really enumerated?\n"); + return (-1); + } + + for (i = 0; i < devs_no; i++) { + di = ub_dev_get(i); + if ((di != NULL) && (di->type & DEV_TYP_STOR)) { + if (stor_info_no >= UB_MAX_DEV) { + printf("Too many storage devices: %d\n", + stor_info_no); + return (-1); + } + stor_info[stor_info_no++] = i; + found = 1; + } + } + + if (!found) { + printf("No storage devices\n"); + return (-1); + } - return 0; + debugf("storage devices found: %d\n", stor_info_no); + return (0); } static int -d_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, +stor_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { + struct uboot_devdesc *dev = (struct uboot_devdesc *)devdata; + struct open_dev *od = (struct open_dev *)dev->d_disk.data; + int bcount, err; + + debugf("od=%p, size=%d, bsize=%d\n", od, size, od->od_bsize); + + if (rw != F_READ) { + stor_printf("write attempt, operation not supported!\n"); + return (EROFS); + } + + if (size % od->od_bsize) { + stor_printf("size=%d not multiple of device block size=%d\n", + size, od->od_bsize); + return (EIO); + } + bcount = size / od->od_bsize; + + if (rsize) + *rsize = 0; + + err = stor_readdev(dev, blk + od->od_bstart, bcount, buf); + if (!err && rsize) + *rsize = size; - return (EINVAL); + return (err); } static int -d_open(struct open_file *f, ...) +stor_open(struct open_file *f, ...) { + va_list ap; + struct open_dev *od; + struct uboot_devdesc *dev; + int err; - return (EINVAL); + va_start(ap, f); + dev = va_arg(ap, struct uboot_devdesc *); + va_end(ap); + + if ((err = stor_opendev(&od, dev)) != 0) + return (err); + + ((struct uboot_devdesc *)(f->f_devdata))->d_disk.data = od; + + return (0); +} + +static int +stor_close(struct open_file *f) +{ + struct uboot_devdesc *dev; + + dev = (struct uboot_devdesc *)(f->f_devdata); + + return (stor_closedev(dev)); } static int -d_close(struct open_file *f) +stor_open_gpt(struct open_dev *od, struct uboot_devdesc *dev) { - return (EINVAL); + /* TODO */ + return (ENXIO); } static int -d_ioctl(struct open_file *f, u_long cmd, void *data) +stor_open_bsdlabel(struct open_dev *od, struct uboot_devdesc *dev) +{ + char *buf; + struct disklabel *dl; + int err = 0; + + /* Allocate 1 block */ + buf = malloc(od->od_bsize); + if (!buf) { + stor_printf("could not allocate memory for disklabel\n"); + return (ENOMEM); + } + + /* Read disklabel */ + err = stor_readdev(dev, LABELSECTOR, 1, buf); + if (err) { + stor_printf("disklabel read error=%d\n", err); + err = ERDLAB; + goto out; + } + bcopy(buf + LABELOFFSET, &od->od_bsdlabel, sizeof(struct disklabel)); + dl = &od->od_bsdlabel; + + if (dl->d_magic != DISKMAGIC) { + stor_printf("no disklabel magic!\n"); + err = EUNLAB; + goto out; + } + od->od_type = OD_BSDLABEL; + od->od_bstart = dl->d_partitions[dev->d_disk.partition].p_offset; + + debugf("bstart=%d\n", od->od_bstart); + +out: + free(buf); + return (err); +} + +static int +stor_readdev(struct uboot_devdesc *dev, daddr_t blk, size_t size, char *buf) +{ + lbasize_t real_size; + int err, handle; + + debugf("reading size=%d @ 0x%08x\n", size, (uint32_t)buf); + + handle = stor_info[dev->d_unit]; + err = ub_dev_read(handle, buf, size, blk, &real_size); + if (err != 0) { + stor_printf("read failed, error=%d\n", err); + return (EIO); + } + + if (real_size != size) { + stor_printf("real size != size\n"); + err = EIO; + } + + return (err); +} + + +static int +stor_opendev(struct open_dev **odp, struct uboot_devdesc *dev) +{ + struct device_info *di; + struct open_dev *od; + int err, h; + + h = stor_info[dev->d_unit]; + + debugf("refcount=%d\n", stor_open_count); + + /* + * There can be recursive open calls from the infrastructure, but at + * U-Boot level open the device only the first time. + */ + if (stor_open_count > 0) + stor_open_count++; + else if ((err = ub_dev_open(h)) != 0) { + stor_printf("device open failed with error=%d, handle=%d\n", + err, h); + *odp = NULL; + return (ENXIO); + } + + if ((di = ub_dev_get(h)) == NULL) + panic("could not retrieve U-Boot device_info, handle=%d", h); + + if ((od = malloc(sizeof(struct open_dev))) == NULL) { + stor_printf("could not allocate memory for open_dev\n"); + return (ENOMEM); + } + od->od_bsize = di->di_stor.block_size; + od->od_bstart = 0; + od->od_type = 0; + + if ((err = stor_open_gpt(od, dev)) != 0) + err = stor_open_bsdlabel(od, dev); + + if (err != 0) + free(od); + else { + stor_open_count = 1; + *odp = od; + } + + return (err); +} + +static int +stor_closedev(struct uboot_devdesc *dev) +{ + int err, h; + + free((struct open_dev *)dev->d_disk.data); + dev->d_disk.data = NULL; + + if (--stor_open_count == 0) { + h = stor_info[dev->d_unit]; + if ((err = ub_dev_close(h)) != 0) { + stor_printf("device close failed with error=%d, " + "handle=%d\n", err, h); + return (ENXIO); + } + } + + return (0); +} + +/* Given a size in 512 byte sectors, convert it to a human-readable number. */ +/* XXX stolen from sys/boot/i386/libi386/biosdisk.c, should really be shared */ +static char * +display_size(uint64_t size) +{ + static char buf[80]; + char unit; + + size /= 2; + unit = 'K'; + if (size >= 10485760000LL) { + size /= 1073741824; + unit = 'T'; + } else if (size >= 10240000) { + size /= 1048576; + unit = 'G'; + } else if (size >= 10000) { + size /= 1024; + unit = 'M'; + } + sprintf(buf, "%.6ld%cB", (long)size, unit); + return (buf); +} + +static void +stor_print_bsdlabel(struct uboot_devdesc *dev, char *prefix, int verbose) +{ + char buf[512], line[80]; + struct disklabel *dl; + uint32_t off, size; + int err, i, t; + + /* Read disklabel */ + err = stor_readdev(dev, LABELSECTOR, 1, buf); + if (err) { + sprintf(line, "%s%d: disklabel read error=%d\n", + dev->d_dev->dv_name, dev->d_unit, err); + pager_output(line); + return; + } + dl = (struct disklabel *)buf; + + if (dl->d_magic != DISKMAGIC) { + sprintf(line, "%s%d: no disklabel magic!\n", + dev->d_dev->dv_name, dev->d_unit); + pager_output(line); + return; + } + + /* Print partitions info */ + for (i = 0; i < dl->d_npartitions; i++) { + if ((t = dl->d_partitions[i].p_fstype) < FSMAXTYPES) { + + off = dl->d_partitions[i].p_offset; + size = dl->d_partitions[i].p_size; + if (fstypenames[t] == NULL || size == 0) + continue; + + if ((('a' + i) == 'c') && (!verbose)) + continue; + + sprintf(line, " %s%c: %s %s (%d - %d)\n", prefix, + 'a' + i, fstypenames[t], display_size(size), + off, off + size); + + pager_output(line); + } + } +} + +static void +stor_print_one(int i, struct device_info *di, int verbose) { + struct uboot_devdesc dev; + struct open_dev *od; + char line[80]; + + sprintf(line, "\tdisk%d (%s)\n", i, ub_stor_type(di->type)); + pager_output(line); + + dev.d_dev = &uboot_storage; + dev.d_unit = i; + dev.d_disk.partition = -1; + dev.d_disk.data = NULL; + + if (stor_opendev(&od, &dev) == 0) { + dev.d_disk.data = od; + + if (od->od_type == OD_GPT) { + /* TODO */ + + } else if (od->od_type == OD_BSDLABEL) { + sprintf(line, "\t\tdisk%d", i); + stor_print_bsdlabel(&dev, line, verbose); + } - return (EINVAL); + stor_closedev(&dev); + } } static void -d_print(int verbose) +stor_print(int verbose) { + struct device_info *di; + int i; - return; + for (i = 0; i < stor_info_no; i++) { + di = ub_dev_get(stor_info[i]); + if (di != NULL) + stor_print_one(i, di, verbose); + } } Modified: head/sys/boot/uboot/lib/glue.c ============================================================================== --- head/sys/boot/uboot/lib/glue.c Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/uboot/lib/glue.c Wed Nov 19 17:34:28 2008 (r185099) @@ -454,7 +454,7 @@ ub_dev_send(int handle, void *buf, int l return (err); } -static char * +char * ub_stor_type(int type) { Modified: head/sys/boot/uboot/lib/glue.h ============================================================================== --- head/sys/boot/uboot/lib/glue.h Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/uboot/lib/glue.h Wed Nov 19 17:34:28 2008 (r185099) @@ -81,5 +81,6 @@ struct device_info *ub_dev_get(int); void ub_dump_di(int); void ub_dump_si(struct sys_info *); char *ub_mem_type(int); +char *ub_stor_type(int); #endif /* _API_GLUE_H_ */ Modified: head/sys/boot/uboot/lib/libuboot.h ============================================================================== --- head/sys/boot/uboot/lib/libuboot.h Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/uboot/lib/libuboot.h Wed Nov 19 17:34:28 2008 (r185099) @@ -27,11 +27,6 @@ * $FreeBSD$ */ -/* - * Fully-qualified device descriptor. - * Note, this must match the 'struct devdesc' declaration - * in bootstrap.h. - */ struct uboot_devdesc { struct devsw *d_dev; @@ -40,28 +35,29 @@ struct uboot_devdesc union { struct { void *data; - int slice; int partition; } disk; } d_kind; }; +#define d_disk d_kind.disk + /* * Default network packet alignment in memory */ #define PKTALIGN 32 -int uboot_getdev(void **vdev, const char *devspec, const char **path); -char *uboot_fmtdev(void *vdev); -int uboot_setcurrdev(struct env_var *ev, int flags, const void *value); +int uboot_getdev(void **vdev, const char *devspec, const char **path); +char *uboot_fmtdev(void *vdev); +int uboot_setcurrdev(struct env_var *ev, int flags, const void *value); +extern int devs_no; extern struct netif_driver uboot_net; -extern struct devsw uboot_disk; +extern struct devsw uboot_storage; ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len); ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len); ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len); - extern int uboot_autoload(void); struct preloaded_file; @@ -69,4 +65,4 @@ struct file_format; extern struct file_format uboot_elf; -void reboot(void); +void reboot(void); Modified: head/sys/boot/uboot/lib/net.c ============================================================================== --- head/sys/boot/uboot/lib/net.c Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/boot/uboot/lib/net.c Wed Nov 19 17:34:28 2008 (r185099) @@ -59,7 +59,6 @@ static int net_get(struct iodesc *, void static int net_put(struct iodesc *, void *, size_t); static void net_end(struct netif *); -extern int devs_no; extern struct netif_stats net_stats[]; struct netif_dif net_ifs[] = { Modified: head/sys/sys/disklabel.h ============================================================================== --- head/sys/sys/disklabel.h Wed Nov 19 17:07:01 2008 (r185098) +++ head/sys/sys/disklabel.h Wed Nov 19 17:34:28 2008 (r185099) @@ -52,7 +52,7 @@ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ - defined(__ia64__) + defined(__ia64__) || defined(__powerpc__) #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 17:41:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E66BF1065688 for ; Wed, 19 Nov 2008 17:41:02 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.169]) by mx1.freebsd.org (Postfix) with ESMTP id B5F9A8FC22 for ; Wed, 19 Nov 2008 17:41:02 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so53214wfg.7 for ; Wed, 19 Nov 2008 09:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=2gMoxUnn211x9chYtFQqlXW+H63z4o+8LDpixPuvjeE=; b=V+6yfEVIC/tRoXGARbewlR61f8kB8D8rxFByxVj3Odg3QHJ2Iv8DaOsqvKWmtEKpCv N9nXNkQOQhqbiPAoZMAWVR31mEP9xxR9DwLJrqGs4CQp5RipI0fwokwtfmp/VYJzpZ5U iSCj3qZPbeaN+4dRuZ/yPLT/RDU/MTCTkrKcY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=q4SvJ5kIl/jAzMngO7wZK9gvJeCa4yj9RMlh91zvUfAr0DwcURsGY/8E7mMKyglPAH ygr0/P0UZtHYpR8qKmr0FcNbrVXmWAjgMON/PRS0/eQKquBU5cZ0zaF3rJ2BBmXD4+ep YA1Si3HoGWA7ONjiFR13IhVlqqSNIaf+GFIKY= Received: by 10.142.140.14 with SMTP id n14mr645306wfd.201.1227116462455; Wed, 19 Nov 2008 09:41:02 -0800 (PST) Received: by 10.142.83.5 with HTTP; Wed, 19 Nov 2008 09:41:02 -0800 (PST) Message-ID: <747dc8f30811190941g4b1b7ddet62eed0f84d154999@mail.gmail.com> Date: Wed, 19 Nov 2008 15:41:02 -0200 From: "Renato Botelho" To: "Florian Smeets" In-Reply-To: <4924380E.9050204@kasimir.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> <4924380E.9050204@kasimir.com> Cc: svn-src-all@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 17:41:03 -0000 On Wed, Nov 19, 2008 at 2:00 PM, Florian Smeets wrote: > On 19.11.2008 16:11 Uhr, Renato Botelho wrote: >> >> On Mon, Nov 17, 2008 at 6:49 PM, Pawel Jakub Dawidek >> wrote: >>> >>> Author: pjd >>> Date: Mon Nov 17 20:49:29 2008 >>> New Revision: 185029 >>> URL: http://svn.freebsd.org/changeset/base/185029 >>> >>> Log: >>> Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. >> >> After this revision I've started to got this: >> >> root@botelhor:/usr/src/usr.bin/fstat# make all >> make: don't know how to make >> /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. >> Stop >> *** Error code 2 >> > Hi Renato, > > the acl.h header file moved. A make clean && make all is not sufficient. I > didn't bother to find another solution than make buildworld ;-) that should > work. Perhaps a make includes would also have worked, but the ZFS commit was > big enough to warrant a full buildworld. I tried a make clean and a full make buildworld and it stopped at the same point: ===> usr.bin/file2c (all) ===> usr.bin/find (all) ===> usr.bin/finger (all) ===> usr.bin/fmt (all) ===> usr.bin/fold (all) ===> usr.bin/from (all) ===> usr.bin/fstat (all) make: don't know how to make /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. Stop *** Error code 2 Stop in /usr/src/usr.bin/fstat. *** Error code 1 Stop in /usr/src/usr.bin. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. *** Error code 1 -- Renato Botelho From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 18:06:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5B9E1065672; Wed, 19 Nov 2008 18:06:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D51F78FC08; Wed, 19 Nov 2008 18:06:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJI6T9g024285; Wed, 19 Nov 2008 18:06:29 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJI6TfN024284; Wed, 19 Nov 2008 18:06:29 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200811191806.mAJI6TfN024284@svn.freebsd.org> From: Hiroki Sato Date: Wed, 19 Nov 2008 18:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185100 - stable/7/usr.bin/sed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 18:06:30 -0000 Author: hrs Date: Wed Nov 19 18:06:29 2008 New Revision: 185100 URL: http://svn.freebsd.org/changeset/base/185100 Log: MFC: Add workaround for a back reference when no corresponding parenthesized subexpression is defined. For example, the following command line caused unexpected behavior like segmentation fault: % echo test | sed -e 's/test/\1/' Approved by: re (kib) PR: bin/126682 Modified: stable/7/usr.bin/sed/ (props changed) stable/7/usr.bin/sed/compile.c Modified: stable/7/usr.bin/sed/compile.c ============================================================================== --- stable/7/usr.bin/sed/compile.c Wed Nov 19 17:34:28 2008 (r185099) +++ stable/7/usr.bin/sed/compile.c Wed Nov 19 18:06:29 2008 (r185100) @@ -324,9 +324,17 @@ nonsel: /* Now parse the command */ if (p == NULL) errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); + + /* Compile RE with no case sensitivity temporarily */ + if (*re == '\0') + cmd->u.s->re = NULL; + else + cmd->u.s->re = compile_re(re, 0); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); + + /* Recompile RE with case sensitivity from "I" flag if any */ if (*re == '\0') cmd->u.s->re = NULL; else From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 18:23:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C169106564A; Wed, 19 Nov 2008 18:23:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id AA31C8FC18; Wed, 19 Nov 2008 18:23:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 227919568; Wed, 19 Nov 2008 20:23:15 +0200 Message-ID: <49245991.9040001@FreeBSD.org> Date: Wed, 19 Nov 2008 20:23:13 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.17 (X11/20081029) MIME-Version: 1.0 To: Robert Noland References: <200811181324.mAIDOcOc079096@svn.freebsd.org> <1227064379.1979.3.camel@wombat.2hip.net> <4923C939.2090003@FreeBSD.org> <1227109463.16692.9.camel@squirrel.corp.cox.com> In-Reply-To: <1227109463.16692.9.camel@squirrel.corp.cox.com> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185050 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 18:23:18 -0000 Robert Noland wrote: > On Wed, 2008-11-19 at 10:07 +0200, Alexander Motin wrote: >> Robert Noland wrote: >>> On Tue, 2008-11-18 at 13:24 +0000, Alexander Motin wrote: >>>> Log: >>>> Set of powerd enchancements: >>>> >>> Somehow this seems to be too sensitive. My laptop previously idled at >>> 150Mhz... Occasionally bouncing up to maybe 450Mhz. With the new algo, >>> it will sometimes drop to 900Mhz, but winds itself right back up to >>> 1.8Ghz. >> Can you give me any details? How many CPUs do you have, which set of >> frequencies does it have? Are there any powerd options specified? Does >> powerd detects battery power? With AC or unknown power it will run in >> hiadaptive mode which keeps much higher frequencies. Can you run `powerd >> -v` and look what happens there? >> >> powerd now drops/rises frequency exponentially, so lower frequency will >> be reached only after some period of idle. Rising is much faster to >> quickly restore system interactivity. > > Right, what I expected, was a quicker ramp-up and a slower decay, > leading to more stable frequency while idling. > > This is a Dell D630, Core2duo. ACPI, line detection works and I was > testing with AC attached. With AC attached, my concern isn't power, as > much as potential thermal impacts. Idling at high frequency isn't > enough to kick my fans on high on this laptop, but I've had some that > would. With AC attached powerd uses hiadaptive mode by default. It means that it is able to rise from 150 to 1800 in one second of full load. reverse path will take much more time, requiring somewhere about 30 seconds of idle. It allows system to be ready when you are using it interactively. If you don't need so aggressive approach, you can add `-a adp` option to use adaptive mode on AC power, which is more polite. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 18:54:55 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6186C1065679 for ; Wed, 19 Nov 2008 18:54:55 +0000 (UTC) (envelope-from mcdouga9@egr.msu.edu) Received: from mx.egr.msu.edu (surfnturf.egr.msu.edu [35.9.37.164]) by mx1.freebsd.org (Postfix) with ESMTP id 319848FC13 for ; Wed, 19 Nov 2008 18:54:54 +0000 (UTC) (envelope-from mcdouga9@egr.msu.edu) Received: from localhost (localhost [127.0.0.1]) by mx.egr.msu.edu (Postfix) with ESMTP id 4756271EDC0; Wed, 19 Nov 2008 13:35:15 -0500 (EST) X-Virus-Scanned: amavisd-new at egr.msu.edu Received: from mx.egr.msu.edu ([127.0.0.1]) by localhost (surfnturf.egr.msu.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pRrL62so3aTG; Wed, 19 Nov 2008 13:35:15 -0500 (EST) Received: from [35.9.44.65] (daemon.egr.msu.edu [35.9.44.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mcdouga9) by mx.egr.msu.edu (Postfix) with ESMTPSA id 105E471EDBC; Wed, 19 Nov 2008 13:35:15 -0500 (EST) Message-ID: <49245C62.5000002@egr.msu.edu> Date: Wed, 19 Nov 2008 13:35:14 -0500 From: Adam McDougall User-Agent: Thunderbird 2.0.0.17 (X11/20080926) MIME-Version: 1.0 To: Renato Botelho References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> <4924380E.9050204@kasimir.com> <747dc8f30811190941g4b1b7ddet62eed0f84d154999@mail.gmail.com> In-Reply-To: <747dc8f30811190941g4b1b7ddet62eed0f84d154999@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 18:54:55 -0000 Renato Botelho wrote: > On Wed, Nov 19, 2008 at 2:00 PM, Florian Smeets wrote: > >> On 19.11.2008 16:11 Uhr, Renato Botelho wrote: >> >>> On Mon, Nov 17, 2008 at 6:49 PM, Pawel Jakub Dawidek >>> wrote: >>> >>>> Author: pjd >>>> Date: Mon Nov 17 20:49:29 2008 >>>> New Revision: 185029 >>>> URL: http://svn.freebsd.org/changeset/base/185029 >>>> >>>> Log: >>>> Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. >>>> >>> After this revision I've started to got this: >>> >>> root@botelhor:/usr/src/usr.bin/fstat# make all >>> make: don't know how to make >>> /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. >>> Stop >>> *** Error code 2 >>> >>> >> Hi Renato, >> >> the acl.h header file moved. A make clean && make all is not sufficient. I >> didn't bother to find another solution than make buildworld ;-) that should >> work. Perhaps a make includes would also have worked, but the ZFS commit was >> big enough to warrant a full buildworld. >> > > I tried a make clean and a full make buildworld and it stopped > at the same point: > > ===> usr.bin/file2c (all) > ===> usr.bin/find (all) > ===> usr.bin/finger (all) > ===> usr.bin/fmt (all) > ===> usr.bin/fold (all) > ===> usr.bin/from (all) > ===> usr.bin/fstat (all) > make: don't know how to make > /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. > Stop > *** Error code 2 > > Stop in /usr/src/usr.bin/fstat. > *** Error code 1 > > Stop in /usr/src/usr.bin. > *** Error code 1 > > Stop in /usr/src. > *** Error code 1 > > Stop in /usr/src. > *** Error code 1 > > Is it empty? Delete any empty header files, they are probably left over from a patch. From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 19:19:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E690A106567E; Wed, 19 Nov 2008 19:19:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F608FC17; Wed, 19 Nov 2008 19:19:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJJJUte025838; Wed, 19 Nov 2008 19:19:30 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJJJUCk025834; Wed, 19 Nov 2008 19:19:30 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200811191919.mAJJJUCk025834@svn.freebsd.org> From: Julian Elischer Date: Wed, 19 Nov 2008 19:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185101 - in head/sys: kern netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 19:19:31 -0000 Author: julian Date: Wed Nov 19 19:19:30 2008 New Revision: 185101 URL: http://svn.freebsd.org/changeset/base/185101 Log: Fix a scope problem in the multiple routing table code that stopped the SO_SETFIB socket option from working correctly. Obtained from: Ironport MFC after: 3 days Modified: head/sys/kern/uipc_socket.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/kern/uipc_socket.c Wed Nov 19 19:19:30 2008 (r185101) @@ -2218,6 +2218,9 @@ sosetopt(struct socket *so, struct socko if ((so->so_proto->pr_domain->dom_family == PF_INET) || (so->so_proto->pr_domain->dom_family == PF_ROUTE)) { so->so_fibnum = optval; + /* Note: ignore error */ + if (so->so_proto && so->so_proto->pr_ctloutput) + (*so->so_proto->pr_ctloutput)(so, sopt); } else { so->so_fibnum = 0; } Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/netinet/ip_divert.c Wed Nov 19 19:19:30 2008 (r185101) @@ -322,6 +322,7 @@ div_output(struct socket *so, struct mbu */ m->m_pkthdr.rcvif = NULL; m->m_nextpkt = NULL; + M_SETFIB(m, so->so_fibnum); if (control) m_freem(control); /* XXX */ Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/netinet/ip_output.c Wed Nov 19 19:19:30 2008 (r185101) @@ -134,8 +134,10 @@ ip_output(struct mbuf *m, struct mbuf *o bzero(ro, sizeof (*ro)); } - if (inp != NULL) + if (inp != NULL) { + M_SETFIB(m, inp->inp_inc.inc_fibnum); INP_LOCK_ASSERT(inp); + } if (opt) { len = 0; @@ -824,6 +826,11 @@ ip_ctloutput(struct socket *so, struct s error = optval = 0; if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); } Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/netinet/raw_ip.c Wed Nov 19 19:19:30 2008 (r185101) @@ -450,8 +450,14 @@ rip_ctloutput(struct socket *so, struct struct inpcb *inp = sotoinpcb(so); int error, optval; - if (sopt->sopt_level != IPPROTO_IP) + if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); + } error = 0; switch (sopt->sopt_dir) { From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 20:07:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BACA1065677; Wed, 19 Nov 2008 20:07:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BF8E8FC21; Wed, 19 Nov 2008 20:07:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJK70CG026833; Wed, 19 Nov 2008 20:07:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJK70vO026832; Wed, 19 Nov 2008 20:07:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811192007.mAJK70vO026832@svn.freebsd.org> From: John Baldwin Date: Wed, 19 Nov 2008 20:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185102 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 20:07:00 -0000 Author: jhb Date: Wed Nov 19 20:06:59 2008 New Revision: 185102 URL: http://svn.freebsd.org/changeset/base/185102 Log: Fix typo. Modified: head/sys/ufs/ufs/ufs_dirhash.c Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Wed Nov 19 19:19:30 2008 (r185101) +++ head/sys/ufs/ufs/ufs_dirhash.c Wed Nov 19 20:06:59 2008 (r185102) @@ -174,7 +174,7 @@ ufsdirhash_create(struct inode *ip) ndh = dh = NULL; vp = ip->i_vnode; for (;;) { - /* Racy check for i_dirhash to prefetch an dirhash structure. */ + /* Racy check for i_dirhash to prefetch a dirhash structure. */ if (ip->i_dirhash == NULL && ndh == NULL) { ndh = malloc(sizeof *dh, M_DIRHASH, M_NOWAIT | M_ZERO); From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 20:11:22 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9F941065672; Wed, 19 Nov 2008 20:11:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7B09D8FC12; Wed, 19 Nov 2008 20:11:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAJKB3bE052213; Wed, 19 Nov 2008 15:11:16 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Doug Rabson Date: Wed, 19 Nov 2008 14:56:57 -0500 User-Agent: KMail/1.9.7 References: <200811191639.mAJGd1A0022327@svn.freebsd.org> In-Reply-To: <200811191639.mAJGd1A0022327@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811191456.57735.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Wed, 19 Nov 2008 15:11:16 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8650/Tue Nov 18 23:59:50 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185096 - in head/sys/boot: i386 i386/gptzfsboot i386/zfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 20:11:23 -0000 On Wednesday 19 November 2008 11:39:01 am Doug Rabson wrote: > Author: dfr > Date: Wed Nov 19 16:39:01 2008 > New Revision: 185096 > URL: http://svn.freebsd.org/changeset/base/185096 > > Log: > Add a GPT-aware variant of zfsboot which should be used in a similar manner > to gptboot, i.e. installed in a freebsd-boot partition using /sbin/gpart or > /sbin/gpt. > > Tweak the /boot/loader ZFS support so that it can find ZFS pools that are > contained in GPT partitions. This is very cool! What I would actually like to do if possible is to make /boot/gptboot handle both UFS and ZFS (it can key off the UUIDs) so we only need a single bootstrap for GPT for both filesystems. We have a relatively large amount of room for gptboot (we could easily do 128k if needbe) and I'd like to take advantage of that to make the user experience simpler. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 20:31:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8664106567F; Wed, 19 Nov 2008 20:31:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 982168FC1C; Wed, 19 Nov 2008 20:31:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJKVchP027485; Wed, 19 Nov 2008 20:31:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJKVcj7027484; Wed, 19 Nov 2008 20:31:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200811192031.mAJKVcj7027484@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 19 Nov 2008 20:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185103 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 20:31:38 -0000 Author: jkim Date: Wed Nov 19 20:31:38 2008 New Revision: 185103 URL: http://svn.freebsd.org/changeset/base/185103 Log: Make sure legacy replacement route is turned off when enbling HPET. Reviewed by: jhb Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Wed Nov 19 20:06:59 2008 (r185102) +++ head/sys/dev/acpica/acpi_hpet.c Wed Nov 19 20:31:38 2008 (r185103) @@ -83,7 +83,9 @@ hpet_enable(struct acpi_hpet_softc *sc) uint32_t val; val = bus_read_4(sc->mem_res, HPET_CONFIG); - bus_write_4(sc->mem_res, HPET_CONFIG, val | HPET_CNF_ENABLE); + val &= ~HPET_CNF_LEG_RT; + val |= HPET_CNF_ENABLE; + bus_write_4(sc->mem_res, HPET_CONFIG, val); } static void @@ -92,7 +94,8 @@ hpet_disable(struct acpi_hpet_softc *sc) uint32_t val; val = bus_read_4(sc->mem_res, HPET_CONFIG); - bus_write_4(sc->mem_res, HPET_CONFIG, val & ~HPET_CNF_ENABLE); + val &= ~HPET_CNF_ENABLE; + bus_write_4(sc->mem_res, HPET_CONFIG, val); } /* Discover the HPET via the ACPI table of the same name. */ From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 20:35:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E38E31065675; Wed, 19 Nov 2008 20:35:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D369C8FC13; Wed, 19 Nov 2008 20:35:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJKZb5a027635; Wed, 19 Nov 2008 20:35:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJKZbuP027634; Wed, 19 Nov 2008 20:35:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811192035.mAJKZbuP027634@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 20:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185104 - head/release/doc/en_US.ISO8859-1/relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 20:35:38 -0000 Author: delphij Date: Wed Nov 19 20:35:37 2008 New Revision: 185104 URL: http://svn.freebsd.org/changeset/base/185104 Log: Use igb(4) entry Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Nov 19 20:31:38 2008 (r185103) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Nov 19 20:35:37 2008 (r185104) @@ -228,7 +228,7 @@ The &man.em.4; driver has been split into two drivers with some common parts. The &man.em.4; driver will continue to support adapters up to the 82575, as well as new - client/desktop adapters. A new igb driver + client/desktop adapters. A new &man.igb.4; driver will support new server adapters. The &man.jme.4; driver has been added to provide support From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 20:38:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D598106567C; Wed, 19 Nov 2008 20:38:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F11BD8FC1C; Wed, 19 Nov 2008 20:38:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJKcAP4027723; Wed, 19 Nov 2008 20:38:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJKcAqf027722; Wed, 19 Nov 2008 20:38:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811192038.mAJKcAqf027722@svn.freebsd.org> From: Xin LI Date: Wed, 19 Nov 2008 20:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185105 - head/release/doc/en_US.ISO8859-1/relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 20:38:11 -0000 Author: delphij Date: Wed Nov 19 20:38:10 2008 New Revision: 185105 URL: http://svn.freebsd.org/changeset/base/185105 Log: Use "KSE" instead of "kse". Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Nov 19 20:35:37 2008 (r185104) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Nov 19 20:38:10 2008 (r185105) @@ -167,7 +167,7 @@ Kernel support for M:N threading has been removed. While the KSE (Kernel Scheduled Entities) project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the - kse library was never developed to its full potential. + KSE library was never developed to its full potential. Backwards compatibility for applications using KSE threading will be provided via &man.libmap.conf.5; for dynamically linked binaries. The &os; Project greatly appreciates the work of From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 21:07:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF4581065673; Wed, 19 Nov 2008 21:07:34 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF76B8FC26; Wed, 19 Nov 2008 21:07:34 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJL7YPQ028503; Wed, 19 Nov 2008 21:07:34 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJL7Ymt028502; Wed, 19 Nov 2008 21:07:34 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200811192107.mAJL7Ymt028502@svn.freebsd.org> From: Ed Schouten Date: Wed, 19 Nov 2008 21:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185106 - head/sys/dev/nmdm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 21:07:34 -0000 Author: ed Date: Wed Nov 19 21:07:33 2008 New Revision: 185106 URL: http://svn.freebsd.org/changeset/base/185106 Log: Make nmdm(4) use MPSAFE callouts. For some reason the nmdm(4) driver doesn't use CALLOUT_MPSAFE, even though we live in the MPSAFE TTY era. Add the CALLOUT_MPSAFE flags. System survives. Modified: head/sys/dev/nmdm/nmdm.c Modified: head/sys/dev/nmdm/nmdm.c ============================================================================== --- head/sys/dev/nmdm/nmdm.c Wed Nov 19 20:38:10 2008 (r185105) +++ head/sys/dev/nmdm/nmdm.c Wed Nov 19 21:07:33 2008 (r185106) @@ -109,12 +109,12 @@ nmdm_alloc(unsigned long unit) ns->ns_part1.np_pair = ns; ns->ns_part1.np_other = &ns->ns_part2; TASK_INIT(&ns->ns_part1.np_task, 0, nmdm_task_tty, &ns->ns_part1); - callout_init(&ns->ns_part1.np_callout, 0); + callout_init(&ns->ns_part1.np_callout, CALLOUT_MPSAFE); ns->ns_part2.np_pair = ns; ns->ns_part2.np_other = &ns->ns_part1; TASK_INIT(&ns->ns_part2.np_task, 0, nmdm_task_tty, &ns->ns_part2); - callout_init(&ns->ns_part2.np_callout, 0); + callout_init(&ns->ns_part2.np_callout, CALLOUT_MPSAFE); /* Create device nodes. */ tp = ns->ns_part1.np_tty = tty_alloc(&nmdm_class, &ns->ns_part1, From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 21:12:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 745BD1065674; Wed, 19 Nov 2008 21:12:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64E138FC1A; Wed, 19 Nov 2008 21:12:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJLCQKE028653; Wed, 19 Nov 2008 21:12:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJLCQiA028652; Wed, 19 Nov 2008 21:12:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200811192112.mAJLCQiA028652@svn.freebsd.org> From: Ed Schouten Date: Wed, 19 Nov 2008 21:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185107 - head/sys/dev/dcons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 21:12:26 -0000 Author: ed Date: Wed Nov 19 21:12:26 2008 New Revision: 185107 URL: http://svn.freebsd.org/changeset/base/185107 Log: Also make dcons(4) use MPSAFE callouts. The callout locks the TTY layer the way it should, so there is no reason why its callout shouldn't set this flag. Modified: head/sys/dev/dcons/dcons_os.c Modified: head/sys/dev/dcons/dcons_os.c ============================================================================== --- head/sys/dev/dcons/dcons_os.c Wed Nov 19 21:07:33 2008 (r185106) +++ head/sys/dev/dcons/dcons_os.c Wed Nov 19 21:12:26 2008 (r185107) @@ -369,7 +369,7 @@ dcons_attach(void) dcons_attach_port(DCONS_CON, "dcons", 0); dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB); - callout_init(&dcons_callout, 0); + callout_init(&dcons_callout, CALLOUT_MPSAFE); polltime = hz / poll_hz; if (polltime < 1) polltime = 1; From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 22:09:03 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E88CA1065670; Wed, 19 Nov 2008 22:09:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8DAD8FC14; Wed, 19 Nov 2008 22:09:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJM93sc029940; Wed, 19 Nov 2008 22:09:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJM933q029939; Wed, 19 Nov 2008 22:09:03 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811192209.mAJM933q029939@svn.freebsd.org> From: Marius Strobl Date: Wed, 19 Nov 2008 22:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185108 - head/sys/dev/dcons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 22:09:04 -0000 Author: marius Date: Wed Nov 19 22:09:03 2008 New Revision: 185108 URL: http://svn.freebsd.org/changeset/base/185108 Log: Given that the buffer dcons_crom(4) exposes is used for both input and output, set BUS_DMA_COHERENT when creating the DMA map used for loading the buffer. As a side-effect this solves locking issues on sparc64 when dcons(4) calls bus_dmamap_sync(9) while in an interrupt filter, which are executed in a critical section, and iommu(4) has to use a sleep lock when taking advantage of the streaming buffer. Reported and tested by: kensmith Approved by: simokawa Modified: head/sys/dev/dcons/dcons_crom.c Modified: head/sys/dev/dcons/dcons_crom.c ============================================================================== --- head/sys/dev/dcons/dcons_crom.c Wed Nov 19 21:12:26 2008 (r185107) +++ head/sys/dev/dcons/dcons_crom.c Wed Nov 19 22:09:03 2008 (r185108) @@ -229,7 +229,7 @@ dcons_crom_attach(device_t dev) /*lockarg*/&Giant, #endif &sc->dma_tag); - bus_dmamap_create(sc->dma_tag, 0, &sc->dma_map); + bus_dmamap_create(sc->dma_tag, BUS_DMA_COHERENT, &sc->dma_map); bus_dmamap_load(sc->dma_tag, sc->dma_map, (void *)dcons_conf->buf, dcons_conf->size, dmamap_cb, sc, 0); From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 22:12:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 015D41065674; Wed, 19 Nov 2008 22:12:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E53B48FC08; Wed, 19 Nov 2008 22:12:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJMCWc0030063; Wed, 19 Nov 2008 22:12:32 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJMCWH4030061; Wed, 19 Nov 2008 22:12:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811192212.mAJMCWH4030061@svn.freebsd.org> From: Marius Strobl Date: Wed, 19 Nov 2008 22:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185109 - in head/sys/sparc64: include sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 22:12:33 -0000 Author: marius Date: Wed Nov 19 22:12:32 2008 New Revision: 185109 URL: http://svn.freebsd.org/changeset/base/185109 Log: Use the interrupt level right below PIL_FAST for executing interrupt filters instead of PIL_FAST and allow special filters and handlers for interrupts which need to be able to interrupt even filters, f.e. bus error interrupts, to be registered with the revived INTR_FAST at PIL_FAST. Modified: head/sys/sparc64/include/intr_machdep.h head/sys/sparc64/sparc64/intr_machdep.c Modified: head/sys/sparc64/include/intr_machdep.h ============================================================================== --- head/sys/sparc64/include/intr_machdep.h Wed Nov 19 22:09:03 2008 (r185108) +++ head/sys/sparc64/include/intr_machdep.h Wed Nov 19 22:12:32 2008 (r185109) @@ -47,8 +47,9 @@ #define PIL_AST 4 /* ast ipi */ #define PIL_STOP 5 /* stop cpu ipi */ #define PIL_PREEMPT 6 /* preempt idle thread cpu ipi */ +#define PIL_FILTER 12 /* filter interrupts */ #define PIL_FAST 13 /* fast interrupts */ -#define PIL_TICK 14 +#define PIL_TICK 14 /* tick interrupts */ #ifndef LOCORE Modified: head/sys/sparc64/sparc64/intr_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/intr_machdep.c Wed Nov 19 22:09:03 2008 (r185108) +++ head/sys/sparc64/sparc64/intr_machdep.c Wed Nov 19 22:12:32 2008 (r185109) @@ -88,7 +88,7 @@ struct intr_vector intr_vectors[IV_MAX]; uint16_t intr_countp[IV_MAX]; static u_long intr_stray_count[IV_MAX]; -static const char *pil_names[] = { +static const char *const pil_names[] = { "stray", "low", /* PIL_LOW */ "ithrd", /* PIL_ITHREAD */ @@ -96,7 +96,8 @@ static const char *pil_names[] = { "ast", /* PIL_AST */ "stop", /* PIL_STOP */ "preempt", /* PIL_PREEMPT */ - "stray", "stray", "stray", "stray", "stray", "stray", + "stray", "stray", "stray", "stray", "stray", + "filter", /* PIL_FILTER */ "fast", /* PIL_FAST */ "tick", /* PIL_TICK */ }; @@ -321,10 +322,16 @@ inthand_add(const char *name, int vec, d struct intr_event *ie; struct intr_handler *ih; struct intr_vector *iv; - int error, fast; + int error, filter; if (vec < 0 || vec >= IV_MAX) return (EINVAL); + /* + * INTR_FAST filters/handlers are special purpose only, allowing + * them to be shared just would complicate things unnecessarily. + */ + if ((flags & INTR_FAST) != 0 && (flags & INTR_EXCL) == 0) + return (EINVAL); sx_xlock(&intr_table_lock); iv = &intr_vectors[vec]; ic = iv->iv_ic; @@ -341,24 +348,25 @@ inthand_add(const char *name, int vec, d ic->ic_disable(iv); iv->iv_refcnt++; if (iv->iv_refcnt == 1) - intr_setup(filt != NULL ? PIL_FAST : PIL_ITHREAD, intr_fast, + intr_setup((flags & INTR_FAST) != 0 ? PIL_FAST : + filt != NULL ? PIL_FILTER : PIL_ITHREAD, intr_fast, vec, intr_execute_handlers, iv); else if (filt != NULL) { /* - * Check if we need to upgrade from PIL_ITHREAD to PIL_FAST. + * Check if we need to upgrade from PIL_ITHREAD to PIL_FILTER. * Given that apart from the on-board SCCs and UARTs shared * interrupts are rather uncommon on sparc64 this sould be * pretty rare in practice. */ - fast = 0; + filter = 0; TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { if (ih->ih_filter != NULL && ih->ih_filter != filt) { - fast = 1; + filter = 1; break; } } - if (fast == 0) - intr_setup(PIL_FAST, intr_fast, vec, + if (filter == 0) + intr_setup(PIL_FILTER, intr_fast, vec, intr_execute_handlers, iv); } intr_stray_count[vec] = 0; From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 23:34:59 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18FD81065672; Wed, 19 Nov 2008 23:34:59 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from sakura.ninth-nine.com (unknown [IPv6:2001:2f0:104:80a0:230:48ff:fe41:2455]) by mx1.freebsd.org (Postfix) with ESMTP id A82278FC20; Wed, 19 Nov 2008 23:34:58 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from nadesico.ninth-nine.com (nadesico.ninth-nine.com [219.127.74.122]) by sakura.ninth-nine.com (8.14.1/8.14.1/NinthNine) with SMTP id mAJNYtH7070658; Thu, 20 Nov 2008 08:34:55 +0900 (JST) (envelope-from nork@FreeBSD.org) Date: Thu, 20 Nov 2008 08:34:49 +0900 From: Norikatsu Shigemura To: Doug Rabson Message-Id: <20081120083449.de17d061.nork@FreeBSD.org> In-Reply-To: <200811191659.mAJGxJO1022805@svn.freebsd.org> References: <200811191659.mAJGxJO1022805@svn.freebsd.org> X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.11; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (sakura.ninth-nine.com [219.127.74.121]); Thu, 20 Nov 2008 08:34:55 +0900 (JST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Norikatsu Shigemura Subject: Re: svn commit: r185097 - in head/sys: boot/zfs cddl/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 23:34:59 -0000 Hi Doug! On Wed, 19 Nov 2008 16:59:19 +0000 (UTC) Doug Rabson wrote: Author: dfr > Date: Wed Nov 19 16:59:19 2008 > New Revision: 185097 > URL: http://svn.freebsd.org/changeset/base/185097 > Log: > Some zfsboot fixes from Norikatsu Shigemura: > 1. zfsboot2 (boot2) doesn't %d (printf), so change %d to %u. Oops, my missed. "doesn't support %d". Sorry. > 2. chase new zpool versioning as SPA_VERSION. > Obtained from: sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > Submitted by: nork > Modified: > head/sys/boot/zfs/zfsimpl.c > head/sys/cddl/boot/zfs/zfsimpl.h > head/sys/cddl/boot/zfs/zfssubr.c Thank you! I'll try to zfsboot! :D From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 00:43:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6DC41065672; Thu, 20 Nov 2008 00:43:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5BE68FC08; Thu, 20 Nov 2008 00:43:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK0hf2s033235; Thu, 20 Nov 2008 00:43:41 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK0hfsh033233; Thu, 20 Nov 2008 00:43:41 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811200043.mAK0hfsh033233@svn.freebsd.org> From: Xin LI Date: Thu, 20 Nov 2008 00:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185110 - in stable/7/release/doc/en_US.ISO8859-1: hardware relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 00:43:41 -0000 Author: delphij Date: Thu Nov 20 00:43:41 2008 New Revision: 185110 URL: http://svn.freebsd.org/changeset/base/185110 Log: MFC: Document igb(4). Approved by: re (hrs) Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Nov 19 22:12:32 2008 (r185109) +++ stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Thu Nov 20 00:43:41 2008 (r185110) @@ -29,6 +29,7 @@ 2005 2006 2007 + 2008 The &os; Documentation Project @@ -657,6 +658,8 @@ &hwlist.ie; + &hwlist.igb; + &hwlist.ixgb; &hwlist.kue; Modified: stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Nov 19 22:12:32 2008 (r185109) +++ stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Thu Nov 20 00:43:41 2008 (r185110) @@ -198,6 +198,12 @@ Network Interface Support + The &man.em.4; driver has been split into two drivers + with some common parts. The &man.em.4; driver will continue + to support adapters up to the 82575, as well as new + client/desktop adapters. A new &man.igb.4; driver + will support new server adapters. + [&arch.amd64;, &arch.i386;] The &man.wpi.4; driver has been updated to include a number of stability fixes. From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 03:30:28 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AC2B1065675; Thu, 20 Nov 2008 03:30:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2B88FC16; Thu, 20 Nov 2008 03:30:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK3URXn037729; Thu, 20 Nov 2008 03:30:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK3UR95037726; Thu, 20 Nov 2008 03:30:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200330.mAK3UR95037726@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 03:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185114 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 03:30:28 -0000 Author: imp Date: Thu Nov 20 03:30:27 2008 New Revision: 185114 URL: http://svn.freebsd.org/changeset/base/185114 Log: Simplify: move dumpcis.c and dumpcisfile.c into main. Deleted: head/usr.sbin/dumpcis/dumpcis.c head/usr.sbin/dumpcis/dumpcisfile.c Modified: head/usr.sbin/dumpcis/Makefile head/usr.sbin/dumpcis/main.c head/usr.sbin/dumpcis/readcis.h Modified: head/usr.sbin/dumpcis/Makefile ============================================================================== --- head/usr.sbin/dumpcis/Makefile Thu Nov 20 02:06:05 2008 (r185113) +++ head/usr.sbin/dumpcis/Makefile Thu Nov 20 03:30:27 2008 (r185114) @@ -4,7 +4,7 @@ PROG= dumpcis MAN= dumpcis.8 -SRCS= main.c dumpcis.c dumpcisfile.c readcis.c printcis.c +SRCS= main.c readcis.c printcis.c WARNS?= 5 .include Modified: head/usr.sbin/dumpcis/main.c ============================================================================== --- head/usr.sbin/dumpcis/main.c Thu Nov 20 02:06:05 2008 (r185113) +++ head/usr.sbin/dumpcis/main.c Thu Nov 20 03:30:27 2008 (r185114) @@ -25,10 +25,50 @@ #include __FBSDID("$FreeBSD$"); -int dumpcisfile_main(int, char **); +#include +#include +#include +#include "readcis.h" + +void +dump(unsigned char *p, int sz) +{ + int ad = 0, i; + + while (sz > 0) { + printf("%03x: ", ad); + for (i = 0; i < ((sz < 16) ? sz : 16); i++) + printf(" %02x", p[i]); + printf("\n"); + sz -= 16; + p += 16; + ad += 16; + } +} + +static void +scanfile(char *name) +{ + int fd; + struct cis *cp; + + fd = open(name, O_RDONLY); + if (fd < 0) + return; + cp = readcis(fd); + if (cp) { + printf("Configuration data for file %s\n", + name); + dumpcis(cp); + freecis(cp); + } + close(fd); +} int main(int argc, char **argv) { - return dumpcisfile_main(argc, argv); + for (argc--, argv++; argc; argc--, argv++) + scanfile(*argv); + return 0; } Modified: head/usr.sbin/dumpcis/readcis.h ============================================================================== --- head/usr.sbin/dumpcis/readcis.h Thu Nov 20 02:06:05 2008 (r185113) +++ head/usr.sbin/dumpcis/readcis.h Thu Nov 20 03:30:27 2008 (r185114) @@ -144,5 +144,3 @@ struct cis *readcis(int); const char *tuple_name(unsigned char); u_int parse_num(int, u_char *, u_char **, int); - -int isdumpcisfile; From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 03:34:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B076106564A; Thu, 20 Nov 2008 03:34:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CD368FC0C; Thu, 20 Nov 2008 03:34:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK3Yarp037869; Thu, 20 Nov 2008 03:34:36 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK3Yam7037866; Thu, 20 Nov 2008 03:34:36 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200334.mAK3Yam7037866@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 03:34:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185115 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 03:34:36 -0000 Author: imp Date: Thu Nov 20 03:34:36 2008 New Revision: 185115 URL: http://svn.freebsd.org/changeset/base/185115 Log: dump() really is unused, so retire it. Modified: head/usr.sbin/dumpcis/main.c head/usr.sbin/dumpcis/readcis.c head/usr.sbin/dumpcis/readcis.h Modified: head/usr.sbin/dumpcis/main.c ============================================================================== --- head/usr.sbin/dumpcis/main.c Thu Nov 20 03:30:27 2008 (r185114) +++ head/usr.sbin/dumpcis/main.c Thu Nov 20 03:34:36 2008 (r185115) @@ -30,22 +30,6 @@ __FBSDID("$FreeBSD$"); #include #include "readcis.h" -void -dump(unsigned char *p, int sz) -{ - int ad = 0, i; - - while (sz > 0) { - printf("%03x: ", ad); - for (i = 0; i < ((sz < 16) ? sz : 16); i++) - printf(" %02x", p[i]); - printf("\n"); - sz -= 16; - p += 16; - ad += 16; - } -} - static void scanfile(char *name) { Modified: head/usr.sbin/dumpcis/readcis.c ============================================================================== --- head/usr.sbin/dumpcis/readcis.c Thu Nov 20 03:30:27 2008 (r185114) +++ head/usr.sbin/dumpcis/readcis.c Thu Nov 20 03:34:36 2008 (r185115) @@ -99,7 +99,6 @@ static struct tuple_info tuple_info[] = {0, 0, 0} }; - static void * xmalloc(int sz) { @@ -131,10 +130,6 @@ readcis(int fd) for (tl = cp->tlist; tl; tl = tl->next) for (tp = tl->tuples; tp; tp = tp->next) { -#if 0 - printf("tuple code = 0x%02x, data is\n", tp->code); - dump(tp->data, tp->length); -#endif switch (tp->code) { case CIS_MEM_COMMON: /* 0x01 */ device_desc(tp->data, tp->length, &cp->common_mem); Modified: head/usr.sbin/dumpcis/readcis.h ============================================================================== --- head/usr.sbin/dumpcis/readcis.h Thu Nov 20 03:30:27 2008 (r185114) +++ head/usr.sbin/dumpcis/readcis.h Thu Nov 20 03:34:36 2008 (r185115) @@ -136,8 +136,6 @@ struct cis { (*((tp) + 1) << 8) | *(tp)) #define tpl16(tp) ((*((tp) + 1) << 8) | *(tp)) -int dumpcisfile_main(int, char **); -void dump(unsigned char *, int); void dumpcis(struct cis *); void freecis(struct cis *); struct cis *readcis(int); From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 08:12:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FE55106564A; Thu, 20 Nov 2008 08:12:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8258FC17; Thu, 20 Nov 2008 08:12:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK8CQ3q044205; Thu, 20 Nov 2008 08:12:26 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK8CQhK044202; Thu, 20 Nov 2008 08:12:26 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200812.mAK8CQhK044202@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 08:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185121 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 08:12:27 -0000 Author: imp Date: Thu Nov 20 08:12:26 2008 New Revision: 185121 URL: http://svn.freebsd.org/changeset/base/185121 Log: The original programs that this code was lifted from (pccardd and pccardc) parsed data to make decisions about stuff related to card configuration. The purely CIS dumping aspect of this program obviates the need for such parsing. Save some space and don't parse the data anymore for configuration purposes. Just parse it to print an interpreatation of it. Modified: head/usr.sbin/dumpcis/printcis.c head/usr.sbin/dumpcis/readcis.c head/usr.sbin/dumpcis/readcis.h Modified: head/usr.sbin/dumpcis/printcis.c ============================================================================== --- head/usr.sbin/dumpcis/printcis.c Thu Nov 20 04:46:09 2008 (r185120) +++ head/usr.sbin/dumpcis/printcis.c Thu Nov 20 08:12:26 2008 (r185121) @@ -62,7 +62,7 @@ static void dump_info_v2(u_char *p, in static void dump_org(u_char *p, int len); void -dumpcis(struct cis *cp) +dumpcis(struct tuple_list *tlist) { struct tuple *tp; struct tuple_list *tl; @@ -70,7 +70,7 @@ dumpcis(struct cis *cp) u_char *p; int func = 0; - for (tl = cp->tlist; tl; tl = tl->next) + for (tl = tlist; tl; tl = tl->next) for (tp = tl->tuples; tp; tp = tp->next) { printf("Tuple #%d, code = 0x%x (%s), length = %d\n", ++count, tp->code, tuple_name(tp->code), tp->length); Modified: head/usr.sbin/dumpcis/readcis.c ============================================================================== --- head/usr.sbin/dumpcis/readcis.c Thu Nov 20 04:46:09 2008 (r185120) +++ head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:12:26 2008 (r185121) @@ -39,7 +39,6 @@ static const char rcsid[] = #include #include #include -#include #include #include @@ -47,13 +46,6 @@ static const char rcsid[] = #include "readcis.h" static int ck_linktarget(int, off_t, int); -static void cis_info(struct cis *, unsigned char *, int); -static void device_desc(unsigned char *, int, struct dev_mem *); -static void config_map(struct cis *, unsigned char *, int); -static void cis_config(struct cis *, unsigned char *, int); -static void cis_manuf_id(struct cis *, unsigned char *, int); -static void cis_func_id(struct cis *, unsigned char *, int); -static void cis_network_ext(struct cis *, unsigned char *, int); static struct tuple_list *read_one_tuplelist(int, int, off_t); static struct tuple_list *read_tuples(int); static struct tuple *find_tuple_in_list(struct tuple_list *, unsigned char); @@ -116,215 +108,31 @@ xmalloc(int sz) /* * After reading the tuples, decode the relevant ones. */ -struct cis * +struct tuple_list * readcis(int fd) { - struct tuple_list *tl; - struct tuple *tp; - struct cis *cp; - cp = xmalloc(sizeof(*cp)); - cp->tlist = read_tuples(fd); - if (cp->tlist == 0) - return (NULL); - - for (tl = cp->tlist; tl; tl = tl->next) - for (tp = tl->tuples; tp; tp = tp->next) { - switch (tp->code) { - case CIS_MEM_COMMON: /* 0x01 */ - device_desc(tp->data, tp->length, &cp->common_mem); - break; - case CIS_INFO_V1: /* 0x15 */ - cis_info(cp, tp->data, tp->length); - break; - case CIS_MEM_ATTR: /* 0x17 */ - device_desc(tp->data, tp->length, &cp->attr_mem); - break; - case CIS_CONF_MAP: /* 0x1A */ - config_map(cp, tp->data, tp->length); - break; - case CIS_CONFIG: /* 0x1B */ - cis_config(cp, tp->data, tp->length); - break; - case CIS_MANUF_ID: /* 0x20 */ - cis_manuf_id(cp, tp->data, tp->length); - break; - case CIS_FUNC_ID: /* 0x21 */ - cis_func_id(cp, tp->data, tp->length); - break; - case CIS_FUNC_EXT: /* 0x22 */ - if (cp->func_id1 == 6) /* LAN adaptor */ - cis_network_ext(cp, tp->data, tp->length); - break; - } - } - return (cp); + return (read_tuples(fd)); } /* * free_cis - delete cis entry. */ void -freecis(struct cis *cp) +freecis(struct tuple_list *tlist) { - struct cis_ioblk *io; - struct cis_memblk *mem; - struct cis_config *conf; - struct tuple *tp; struct tuple_list *tl; + struct tuple *tp; - while ((tl = cp->tlist) != 0) { - cp->tlist = tl->next; + while ((tl = tlist) != 0) { + tlist = tl->next; while ((tp = tl->tuples) != 0) { tl->tuples = tp->next; - if (tp->data) - free(tp->data); - } - } - - while ((conf = cp->conf) != 0) { - cp->conf = conf->next; - while ((io = conf->io) != 0) { - conf->io = io->next; - free(io); - } - while ((mem = conf->mem) != 0) { - conf->mem = mem->next; - free(mem); + free(tp->data); + free(tp); } - free(conf); - } - free(cp); -} - -/* - * Fills in CIS version data. - */ -static void -cis_info(struct cis *cp, unsigned char *p, int len) -{ - cp->maj_v = *p++; - cp->min_v = *p++; - len -= 2; - if (cp->manuf) { - free(cp->manuf); - cp->manuf = NULL; - } - if (len > 1 && *p != 0xff) { - cp->manuf = strdup(p); - len -= strlen(p) + 1; - p += strlen(p) + 1; - } - if (cp->vers) { - free(cp->vers); - cp->vers = NULL; - } - if (len > 1 && *p != 0xff) { - cp->vers = strdup(p); - len -= strlen(p) + 1; - p += strlen(p) + 1; - } else { - cp->vers = strdup("[none]"); - } - if (cp->add_info1) { - free(cp->add_info1); - cp->add_info1 = NULL; - } - if (len > 1 && *p != 0xff) { - cp->add_info1 = strdup(p); - len -= strlen(p) + 1; - p += strlen(p) + 1; - } else { - cp->add_info1 = strdup("[none]"); - } - if (cp->add_info2) { - free(cp->add_info2); - cp->add_info2 = NULL; + free(tl); } - if (len > 1 && *p != 0xff) - cp->add_info2 = strdup(p); - else - cp->add_info2 = strdup("[none]"); -} - -static void -cis_manuf_id(struct cis *cp, unsigned char *p, int len) -{ - if (len >= 4) { - cp->manufacturer = tpl16(p); - cp->product = tpl16(p+2); - if (len == 5) - cp->prodext = *(p+4); /* For xe driver */ - } else { - cp->manufacturer=0; - cp->product=0; - cp->prodext=0; - } -} -/* - * Fills in CIS function ID. - */ -static void -cis_func_id(struct cis *cp, unsigned char *p, int len __unused) -{ - cp->func_id1 = *p++; - cp->func_id2 = *p++; -} - -static void -cis_network_ext(struct cis *cp, unsigned char *p, int len __unused) -{ - int i; - - switch (p[0]) { - case 4: /* Node ID */ - if (len <= 2 || len < p[1] + 2) - return; - - if (cp->lan_nid) - free(cp->lan_nid); - cp->lan_nid = xmalloc(p[1]); - - for (i = 0; i <= p[1]; i++) - cp->lan_nid[i] = p[i + 1]; - break; - } -} - -/* - * device_desc - decode device descriptor. - */ -static void -device_desc(unsigned char *p, int len, struct dev_mem *dp) -{ - while (len > 0 && *p != 0xFF) { - dp->valid = 1; - dp->type = (*p & 0xF0) >> 4; - dp->wps = !!(*p & 0x8); - dp->speed = *p & 7; - p++; - if (*p != 0xFF) { - dp->addr = (*p >> 3) & 0xF; - dp->units = *p & 7; - } - p++; - len -= 2; - } -} - -/* - * configuration map of card control register. - */ -static void -config_map(struct cis *cp, unsigned char *p, int len __unused) -{ - unsigned char *p1; - int rlen = (*p & 3) + 1; - - p1 = p + 1; - cp->last_config = *p1++ & 0x3F; - cp->reg_addr = parse_num(rlen | 0x10, p1, &p1, 0); - cp->ccrs = *p1; } /* @@ -364,125 +172,6 @@ parse_num(int sz, u_char *p, u_char **q, } /* - * CIS config entry - Decode and build configuration entry. - */ -static void -cis_config(struct cis *cp, unsigned char *p, int len __unused) -{ - int x; - int i, j; - struct cis_config *conf, *last; - unsigned char feat; - - conf = xmalloc(sizeof(*conf)); - if ((last = cp->conf) != 0) { - while (last->next) - last = last->next; - last->next = conf; - } else - cp->conf = conf; - conf->id = *p & 0x3F; /* Config index */ - if (*p & 0x40) /* Default flag */ - cp->def_config = conf; - if (*p++ & 0x80) - p++; /* Interface byte skip */ - feat = *p++; /* Features byte */ - for (i = 0; i < CIS_FEAT_POWER(feat); i++) { - unsigned char parms = *p++; - - conf->pwr = 1; - for (j = 0; j < 8; j++) - if (parms & (1 << j)) - while (*p++ & 0x80); - } - if (feat & CIS_FEAT_TIMING) { - conf->timing = 1; - i = *p++; - if (CIS_WAIT_SCALE(i) != 3) - p++; - if (CIS_READY_SCALE(i) != 7) - p++; - if (CIS_RESERVED_SCALE(i) != 7) - p++; - } - if (feat & CIS_FEAT_I_O) { - conf->iospace = 1; - if (CIS_IO_RANGE & *p) - conf->io_blks = CIS_IO_BLKS(p[1]) + 1; - conf->io_addr = CIS_IO_ADDR(*p); - conf->io_bus = (*p >> 5) & 3; /* CIS_IO_8BIT | CIS_IO_16BIT */ - if (*p++ & CIS_IO_RANGE) { - struct cis_ioblk *io; - struct cis_ioblk *last_io = NULL; - - i = CIS_IO_ADSZ(*p); - j = CIS_IO_BLKSZ(*p++); - for (x = 0; x < conf->io_blks; x++) { - io = xmalloc(sizeof(*io)); - if (last_io) - last_io->next = io; - else - conf->io = io; - last_io = io; - io->addr = parse_num(i, p, &p, 0); - io->size = parse_num(j, p, &p, 1); - } - } - } - if (feat & CIS_FEAT_IRQ) { - conf->irq = 1; - conf->irqlevel = *p & 0xF; - conf->irq_flags = *p & 0xF0; - if (*p++ & CIS_IRQ_MASK) { - conf->irq_mask = tpl16(p); - p += 2; - } - } - switch (CIS_FEAT_MEMORY(feat)) { - case CIS_FEAT_MEM_NONE: - break; - case CIS_FEAT_MEM_LEN: - conf->memspace = 1; - conf->mem = xmalloc(sizeof(*conf->mem)); - conf->mem->length = tpl16(p) << 8; - break; - case CIS_FEAT_MEM_ADDR: - conf->memspace = 1; - conf->mem = xmalloc(sizeof(*conf->mem)); - conf->mem->length = tpl16(p) << 8; - conf->mem->address = tpl16(p + 2) << 8; - break; - case CIS_FEAT_MEM_WIN: { - struct cis_memblk *mem; - struct cis_memblk *last_mem = NULL; - - conf->memspace = 1; - x = *p++; - conf->memwins = CIS_MEM_WINS(x); - for (i = 0; i < conf->memwins; i++) { - mem = xmalloc(sizeof(*mem)); - if (last_mem) - last_mem->next = mem; - else - conf->mem = mem; - last_mem = mem; - mem->length = parse_num(CIS_MEM_LENSZ(x) | 0x10, p, &p, 0) << 8; - mem->address = parse_num(CIS_MEM_ADDRSZ(x) | 0x10, p, &p, 0) << 8; - if (x & CIS_MEM_HOST) { - mem->host_address = parse_num(CIS_MEM_ADDRSZ(x) | 0x10, - p, &p, 0) << 8; - } - } - break; - } - } - if (feat & CIS_FEAT_MISC) { - conf->misc_valid = 1; - conf->misc = *p++; - } -} - -/* * Read the tuples from the card. * The processing of tuples is as follows: * - Read tuples at attribute memory, offset 0. @@ -522,7 +211,7 @@ read_tuples(int fd) if (tp && tp->length == 4) { offs = tpl32(tp->data); #ifdef DEBUG - printf("Checking long link at %qd (%s memory)\n", + printf("Checking long link at %zd (%s memory)\n", offs, flag ? "Attribute" : "Common"); #endif /* If a link was found, read the tuple list from it. */ @@ -541,11 +230,12 @@ read_tuples(int fd) */ if (find_tuple_in_list(tlist, CIS_NOLINK) == 0 && tlist->next == 0 && ck_linktarget(fd, (off_t) 0, 0)) { + offs = 0; #ifdef DEBUG - printf("Reading long link at %qd (%s memory)\n", + printf("Reading long link at %zd (%s memory)\n", offs, flag ? "Attribute" : "Common"); #endif - tlist->next = read_one_tuplelist(fd, 0, (off_t) 0); + tlist->next = read_one_tuplelist(fd, 0, offs); } return (tlist); } @@ -573,7 +263,6 @@ read_one_tuplelist(int fd, int flags, of tl = xmalloc(sizeof(*tl)); tl->offs = offs; tl->flags = flags & MDF_ATTR; - ioctl(fd, PIOCRWFLAG, &flags); lseek(fd, offs, SEEK_SET); do { if (read(fd, &code, 1) != 1) { @@ -619,7 +308,7 @@ read_one_tuplelist(int fd, int flags, of */ tinfo = get_tuple_info(code); if (tinfo != NULL && (tinfo->length != 255 && tinfo->length > length)) { - printf("code %s ignored\n", tuple_name(code)); + printf("code %s (%d) ignored\n", tuple_name(code), code); tp->code = CIS_NULL; } if (tl->tuples == NULL) Modified: head/usr.sbin/dumpcis/readcis.h ============================================================================== --- head/usr.sbin/dumpcis/readcis.h Thu Nov 20 04:46:09 2008 (r185120) +++ head/usr.sbin/dumpcis/readcis.h Thu Nov 20 08:12:26 2008 (r185121) @@ -46,89 +46,6 @@ struct tuple_info { unsigned char length; /* 255 means variable length */ }; -/* - * Memory device descriptor. - */ -struct dev_mem { - unsigned char valid; - unsigned char type; - unsigned char speed; - unsigned char wps; - unsigned char addr; - unsigned char units; -}; - -/* - * One I/O structure describing a possible I/O map - * of the card. - */ -struct cis_ioblk { - struct cis_ioblk *next; - unsigned int addr; - unsigned int size; -}; - -/* - * A structure storing a memory map for the card. - */ -struct cis_memblk { - struct cis_memblk *next; - unsigned int address; - unsigned int length; - unsigned int host_address; -}; - -/* - * One configuration entry for the card. - */ -struct cis_config { - struct cis_config *next; - unsigned int pwr:1; /* Which values are defined. */ - unsigned int timing:1; - unsigned int iospace:1; - unsigned int irq:1; - unsigned int memspace:1; - unsigned int misc_valid:1; - unsigned char id; - unsigned char io_blks; - unsigned char io_addr; - unsigned char io_bus; - struct cis_ioblk *io; - unsigned char irqlevel; - unsigned char irq_flags; - unsigned irq_mask; - unsigned char memwins; - struct cis_memblk *mem; - unsigned char misc; -}; - -/* - * Structure holding all data retrieved from the - * CIS block on the card. - * The default configuration contains interface defaults - * not listed in each separate configuration. - */ -struct cis { - struct tuple_list *tlist; - char *manuf; - char *vers; - char *add_info1; - char *add_info2; - unsigned char maj_v, min_v; - unsigned char last_config; - unsigned char ccrs; - unsigned long reg_addr; - u_int manufacturer; - u_int product; - u_int prodext; - unsigned char func_id1, func_id2; - struct dev_mem attr_mem; - struct dev_mem common_mem; - struct cis_config *def_config; - struct cis_config *conf; - unsigned char *lan_nid; -}; - #define tpl32(tp) ((*((tp) + 3) << 24) | \ (*((tp) + 2) << 16) | \ (*((tp) + 1) << 8) | *(tp)) @@ -136,9 +53,9 @@ struct cis { (*((tp) + 1) << 8) | *(tp)) #define tpl16(tp) ((*((tp) + 1) << 8) | *(tp)) -void dumpcis(struct cis *); -void freecis(struct cis *); -struct cis *readcis(int); +void dumpcis(struct tuple_list *); +void freecis(struct tuple_list *); +struct tuple_list *readcis(int); const char *tuple_name(unsigned char); u_int parse_num(int, u_char *, u_char **, int); From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 08:14:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01E15106564A; Thu, 20 Nov 2008 08:14:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6CEB8FC16; Thu, 20 Nov 2008 08:14:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK8EEmw044281; Thu, 20 Nov 2008 08:14:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK8EE5V044280; Thu, 20 Nov 2008 08:14:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200814.mAK8EE5V044280@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 08:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185122 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 08:14:15 -0000 Author: imp Date: Thu Nov 20 08:14:14 2008 New Revision: 185122 URL: http://svn.freebsd.org/changeset/base/185122 Log: More dead code removal. Modified: head/usr.sbin/dumpcis/readcis.c Modified: head/usr.sbin/dumpcis/readcis.c ============================================================================== --- head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:12:26 2008 (r185121) +++ head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:14:14 2008 (r185122) @@ -251,10 +251,6 @@ read_one_tuplelist(int fd, int flags, of struct tuple_info *tinfo; int total = 0; unsigned char code, length; - int fmvj182 = 0; -#ifdef HSSYNTH - int hss = 0; -#endif /* HSSYNTH */ /* Check to see if this memory has already been scanned. */ for (tl = tlist; tl; tl = tl->next) @@ -282,8 +278,6 @@ read_one_tuplelist(int fd, int flags, of break; } total++; - if (fmvj182 && (code == 0x1b) && (length == 25)) - length = 31; } tp->length = length; #ifdef DEBUG From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 08:20:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC5651065670; Thu, 20 Nov 2008 08:20:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC9818FC12; Thu, 20 Nov 2008 08:20:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK8KrsK044618; Thu, 20 Nov 2008 08:20:53 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK8KrQl044617; Thu, 20 Nov 2008 08:20:53 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200820.mAK8KrQl044617@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 08:20:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185123 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 08:20:53 -0000 Author: imp Date: Thu Nov 20 08:20:53 2008 New Revision: 185123 URL: http://svn.freebsd.org/changeset/base/185123 Log: Restore now-useless ioctl as a roadmap. The original dumpcis code assumed it had to toggle between attribute and common memory in the cards. The kernel is supposed to cope with that automatically and give us a tuple list. However, there's a number of details of how that happens that's currently, ummm, magical and/or not implemented for 16-bit PC Cards that have CIS_LONGLINK_C tuples in them (eg, mix both attribute memory and common memory). Also, CIS_LOGNLINK_A entries might not be handled completely correctly either, since there can be gaps in the attribute vs common stuff. All this will need to be corrected in the kernel. Once it is corrected, dumpcis can be made even simpler in some ways, a little more complicated in others once an API for presentation of CIS to userland in these weird cases is settled upon. Modified: head/usr.sbin/dumpcis/readcis.c Modified: head/usr.sbin/dumpcis/readcis.c ============================================================================== --- head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:14:14 2008 (r185122) +++ head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:20:53 2008 (r185123) @@ -259,6 +259,7 @@ read_one_tuplelist(int fd, int flags, of tl = xmalloc(sizeof(*tl)); tl->offs = offs; tl->flags = flags & MDF_ATTR; + ioctl(fd, PIOCRWFLAG, &flags); lseek(fd, offs, SEEK_SET); do { if (read(fd, &code, 1) != 1) { From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 08:30:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFA3F106564A; Thu, 20 Nov 2008 08:30:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A509F8FC0A; Thu, 20 Nov 2008 08:30:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK8UFm4044846; Thu, 20 Nov 2008 08:30:15 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK8UF2Q044845; Thu, 20 Nov 2008 08:30:15 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200830.mAK8UF2Q044845@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 08:30:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185124 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 08:30:16 -0000 Author: imp Date: Thu Nov 20 08:30:15 2008 New Revision: 185124 URL: http://svn.freebsd.org/changeset/base/185124 Log: Fix check for link target so we don't print cardbus CIS information twice. Also, eliminate some magic constants and replace them with values from cis.h. Modified: head/usr.sbin/dumpcis/readcis.c Modified: head/usr.sbin/dumpcis/readcis.c ============================================================================== --- head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:20:53 2008 (r185123) +++ head/usr.sbin/dumpcis/readcis.c Thu Nov 20 08:30:15 2008 (r185124) @@ -52,42 +52,42 @@ static struct tuple *find_tuple_in_list( static struct tuple_info *get_tuple_info(unsigned char); static struct tuple_info tuple_info[] = { - {"Null tuple", 0x00, 0}, - {"Common memory descriptor", 0x01, 255}, - {"Long link to next chain for CardBus", 0x02, 255}, - {"Indirect access", 0x03, 255}, - {"Configuration map for CardBus", 0x04, 255}, - {"Configuration entry for CardBus", 0x05, 255}, - {"Long link to next chain for MFC", 0x06, 255}, - {"Base address register for CardBus", 0x07, 6}, - {"Checksum", 0x10, 5}, - {"Long link to attribute memory", 0x11, 4}, - {"Long link to common memory", 0x12, 4}, - {"Link target", 0x13, 3}, - {"No link", 0x14, 0}, - {"Version 1 info", 0x15, 255}, - {"Alternate language string", 0x16, 255}, - {"Attribute memory descriptor", 0x17, 255}, - {"JEDEC descr for common memory", 0x18, 255}, - {"JEDEC descr for attribute memory", 0x19, 255}, - {"Configuration map", 0x1A, 255}, - {"Configuration entry", 0x1B, 255}, - {"Other conditions for common memory", 0x1C, 255}, - {"Other conditions for attribute memory", 0x1D, 255}, - {"Geometry info for common memory", 0x1E, 255}, - {"Geometry info for attribute memory", 0x1F, 255}, - {"Manufacturer ID", 0x20, 4}, - {"Functional ID", 0x21, 2}, - {"Functional EXT", 0x22, 255}, - {"Software interleave", 0x23, 2}, - {"Version 2 Info", 0x40, 255}, - {"Data format", 0x41, 255}, - {"Geometry", 0x42, 4}, - {"Byte order", 0x43, 2}, - {"Card init date", 0x44, 4}, - {"Battery replacement", 0x45, 4}, - {"Organization", 0x46, 255}, - {"Terminator", 0xFF, 0}, + {"Null tuple", CIS_NULL, 0}, + {"Common memory descriptor", CIS_MEM_COMMON, 255}, + {"Long link to next chain for CardBus", CIS_LONGLINK_CB, 255}, + {"Indirect access", CIS_INDIRECT, 255}, + {"Configuration map for CardBus", CIS_CONF_MAP_CB, 255}, + {"Configuration entry for CardBus", CIS_CONFIG_CB, 255}, + {"Long link to next chain for MFC", CIS_LONGLINK_MFC, 255}, + {"Base address register for CardBus", CIS_BAR, 6}, + {"Checksum", CIS_CHECKSUM, 5}, + {"Long link to attribute memory", CIS_LONGLINK_A, 4}, + {"Long link to common memory", CIS_LONGLINK_C, 4}, + {"Link target", CIS_LINKTARGET, 3}, + {"No link", CIS_NOLINK, 0}, + {"Version 1 info", CIS_INFO_V1, 255}, + {"Alternate language string", CIS_ALTSTR, 255}, + {"Attribute memory descriptor", CIS_MEM_ATTR, 255}, + {"JEDEC descr for common memory", CIS_JEDEC_C, 255}, + {"JEDEC descr for attribute memory", CIS_JEDEC_A, 255}, + {"Configuration map", CIS_CONF_MAP, 255}, + {"Configuration entry", CIS_CONFIG, 255}, + {"Other conditions for common memory", CIS_DEVICE_OC, 255}, + {"Other conditions for attribute memory", CIS_DEVICE_OA, 255}, + {"Geometry info for common memory", CIS_DEVICEGEO, 255}, + {"Geometry info for attribute memory", CIS_DEVICEGEO_A, 255}, + {"Manufacturer ID", CIS_MANUF_ID, 4}, + {"Functional ID", CIS_FUNC_ID, 2}, + {"Functional EXT", CIS_FUNC_EXT, 255}, + {"Software interleave", CIS_SW_INTERLV, 2}, + {"Version 2 Info", CIS_VERS_2, 255}, + {"Data format", CIS_FORMAT, 255}, + {"Geometry", CIS_GEOMETRY, 4}, + {"Byte order", CIS_BYTEORDER, 2}, + {"Card init date", CIS_DATE, 4}, + {"Battery replacement", CIS_BATTERY, 4}, + {"Organization", CIS_ORG, 255}, + {"Terminator", CIS_END, 0}, {0, 0, 0} }; @@ -228,7 +228,8 @@ read_tuples(int fd) * If the primary list had no NOLINK tuple, and no LINKTARGET, * then try to read a tuple list at common memory (offset 0). */ - if (find_tuple_in_list(tlist, CIS_NOLINK) == 0 && tlist->next == 0 && + if (find_tuple_in_list(tlist, CIS_NOLINK) == 0 && + find_tuple_in_list(tlist, CIS_LINKTARGET) == 0 && ck_linktarget(fd, (off_t) 0, 0)) { offs = 0; #ifdef DEBUG @@ -327,7 +328,7 @@ ck_linktarget(int fd, off_t offs, int fl lseek(fd, offs, SEEK_SET); if (read(fd, blk, 5) != 5) return (0); - if (blk[0] == 0x13 && + if (blk[0] == CIS_LINKTARGET && blk[1] == 0x3 && blk[2] == 'C' && blk[3] == 'I' && From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 08:32:19 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B43EE1065670; Thu, 20 Nov 2008 08:32:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4EEF8FC14; Thu, 20 Nov 2008 08:32:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK8WJm9044924; Thu, 20 Nov 2008 08:32:19 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK8WJ6j044923; Thu, 20 Nov 2008 08:32:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200832.mAK8WJ6j044923@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 08:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185125 - head/usr.sbin/dumpcis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 08:32:19 -0000 Author: imp Date: Thu Nov 20 08:32:19 2008 New Revision: 185125 URL: http://svn.freebsd.org/changeset/base/185125 Log: damn. Always do make depend. Forgot to recompile main because of it, so the changes for the struct cis -> struct tuple_list didn't get made. They have been now. Modified: head/usr.sbin/dumpcis/main.c Modified: head/usr.sbin/dumpcis/main.c ============================================================================== --- head/usr.sbin/dumpcis/main.c Thu Nov 20 08:30:15 2008 (r185124) +++ head/usr.sbin/dumpcis/main.c Thu Nov 20 08:32:19 2008 (r185125) @@ -34,17 +34,17 @@ static void scanfile(char *name) { int fd; - struct cis *cp; + struct tuple_list *tl; fd = open(name, O_RDONLY); if (fd < 0) return; - cp = readcis(fd); - if (cp) { + tl = readcis(fd); + if (tl) { printf("Configuration data for file %s\n", name); - dumpcis(cp); - freecis(cp); + dumpcis(tl); + freecis(tl); } close(fd); } From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 09:14:34 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F8081065673; Thu, 20 Nov 2008 09:14:34 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (unknown [IPv6:2002:50b1:e8f2:1::143]) by mx1.freebsd.org (Postfix) with ESMTP id EC3918FC18; Thu, 20 Nov 2008 09:14:33 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:21b:63ff:feb8:5abc] (unknown [IPv6:2001:470:909f:1:21b:63ff:feb8:5abc]) by itchy.rabson.org (Postfix) with ESMTP id 704FA3F9C; Thu, 20 Nov 2008 09:13:18 +0000 (GMT) Message-Id: <3ED1CD56-4F9C-46BD-9EE1-401CB55F378A@rabson.org> From: Doug Rabson To: John Baldwin In-Reply-To: <200811191456.57735.jhb@freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Thu, 20 Nov 2008 09:14:28 +0000 References: <200811191639.mAJGd1A0022327@svn.freebsd.org> <200811191456.57735.jhb@freebsd.org> X-Mailer: Apple Mail (2.929.2) X-Virus-Scanned: ClamAV 0.92/8652/Thu Nov 20 04:26:16 2008 on itchy.rabson.org X-Virus-Status: Clean Cc: svn-src-head@FreeBSD.org, Doug Rabson , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r185096 - in head/sys/boot: i386 i386/gptzfsboot i386/zfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 09:14:34 -0000 On 19 Nov 2008, at 19:56, John Baldwin wrote: > On Wednesday 19 November 2008 11:39:01 am Doug Rabson wrote: >> Author: dfr >> Date: Wed Nov 19 16:39:01 2008 >> New Revision: 185096 >> URL: http://svn.freebsd.org/changeset/base/185096 >> >> Log: >> Add a GPT-aware variant of zfsboot which should be used in a similar > manner >> to gptboot, i.e. installed in a freebsd-boot partition using /sbin/ >> gpart > or >> /sbin/gpt. >> >> Tweak the /boot/loader ZFS support so that it can find ZFS pools >> that are >> contained in GPT partitions. > > This is very cool! What I would actually like to do if possible is to > make /boot/gptboot handle both UFS and ZFS (it can key off the > UUIDs) so we > only need a single bootstrap for GPT for both filesystems. We have a > relatively large amount of room for gptboot (we could easily do 128k > if > needbe) and I'd like to take advantage of that to make the user > experience > simpler. I was thinking about this possibility too. It wouldn't be hard to add the UFS reader and use that if there is a freebsd-ufs partition on the disk. From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 14:57:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DB141065675; Thu, 20 Nov 2008 14:57:10 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38CA98FC12; Thu, 20 Nov 2008 14:57:10 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAKEv9QD054682; Thu, 20 Nov 2008 14:57:09 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAKEv9re054681; Thu, 20 Nov 2008 14:57:09 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200811201457.mAKEv9re054681@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 20 Nov 2008 14:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185132 - head/sys/boot/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 14:57:10 -0000 Author: luigi Date: Thu Nov 20 14:57:09 2008 New Revision: 185132 URL: http://svn.freebsd.org/changeset/base/185132 Log: As reported in kern/118222, pxeboot in RELENG7 (and presumably above) exhibits some misbehaviours on machines with AMD64 CPUs, which at least in some cases I have tracked down to a heap overflow. It is unclear whether it depends on the CPU or on the pxe bios itself which may use more memory on AMD machines. Noticeably a pxeboot compiled from 6.x sources works fine on all machines I have tried so far, while a pxeboot compiled from 7.x sources does not. This patch is a first step in reducing the amount of memory used while processing the configuration files read by the loader at boot (some of them are quite large, 1700+ lines), and it does so by: + moving a buffer to static memory instead of allocating in the heap; + skipping empty lines; + reducing the amount of memory used for line descriptors; Unfortunately there are several changes between 6.x and above, affecting the compiler, the loader code itself, and libstand, and it is not so straightforward to These changes fix the behaviour on one motherboard with a single-core AMD cpu, but are still not enough e.g on an Asus M2N-VM (with a dual-core CPU). I need to investigate the problem a bit more before figuring out what should be committed to RELENG_7 PR: kern/118222 Modified: head/sys/boot/common/interp.c Modified: head/sys/boot/common/interp.c ============================================================================== --- head/sys/boot/common/interp.c Thu Nov 20 13:39:14 2008 (r185131) +++ head/sys/boot/common/interp.c Thu Nov 20 14:57:09 2008 (r185132) @@ -92,7 +92,7 @@ perform(int argc, char *argv[]) void interact(void) { - char input[256]; /* big enough? */ + static char input[256]; /* big enough? */ #ifndef BOOT_FORTH int argc; char **argv; @@ -178,14 +178,21 @@ command_include(int argc, char *argv[]) return(res); } +/* + * Header prepended to each line. The text immediately follows the header. + * We try to make this short in order to save memory -- the loader has + * limited memory available, and some of the forth files are very long. + */ struct includeline { - char *text; + struct includeline *next; +#ifndef BOOT_FORTH int flags; int line; #define SL_QUIET (1<<0) #define SL_IGNOREERR (1<<1) - struct includeline *next; +#endif + char text[0]; }; int @@ -236,13 +243,14 @@ include(const char *filename) } #endif /* Allocate script line structure and copy line, flags */ + if (*cp == '\0') + continue; /* ignore empty line, save memory */ sp = malloc(sizeof(struct includeline) + strlen(cp) + 1); - sp->text = (char *)sp + sizeof(struct includeline); strcpy(sp->text, cp); #ifndef BOOT_FORTH sp->flags = flags; -#endif sp->line = line; +#endif sp->next = NULL; if (script == NULL) { From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 18:44:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 600701065675; Thu, 20 Nov 2008 18:44:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 491278FC12; Thu, 20 Nov 2008 18:44:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAKIiARt059553; Thu, 20 Nov 2008 18:44:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAKIiAkR059549; Thu, 20 Nov 2008 18:44:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811201844.mAKIiAkR059549@svn.freebsd.org> From: Marius Strobl Date: Thu, 20 Nov 2008 18:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185133 - in head/sys/sparc64: pci sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 18:44:10 -0000 Author: marius Date: Thu Nov 20 18:44:09 2008 New Revision: 185133 URL: http://svn.freebsd.org/changeset/base/185133 Log: - According to OpenSolaris, CDMA flushing/syncing for Tomatillos and XMITS has to be basically done in the same manner as for the Sabres, i.e. only for devices behind PCI-PCI-bridges and after a PIO read on the far side of the farest PCI-PCI-bridge. Given that the Tomatillo documentation mentions no difference to the Schizo bridges in this regard and this is also still part of the procedure described Schizo documentation this seems about right so adjust accordingly (the unconditional CDMA flushing/syncing previously done was based on how Linux behaves). - Implement CDMA flushing/syncing for Schizo version >= 5, which requires the workaround described in Schizo Errata I-23. According to Schizo Errata I-13 it's just unusable with version < 5 though. [1] - Don't register the Schizo streaming buffer for now until it's usage is sorted out according to the erratas. - Register our interrupt filters with the revived INTR_FAST so they these interrupts can even interrupt filters of device drivers as necessary. - Remove the comment regarding lack of newbus'ified bus_dma(9) as being able to associate a DMA tag with a device would allow to implement CDMA flushing/syncing in bus_dmamap_sync(9) but that would totally kill performance. Given that for devices not behind a PCI-PCI bridge the host-to-PCI bridges also only do CDMA flushing/syncing based on interrupts there's no additional disadvantage for polling(4) callbacks in the case schizo(4) has to do the CDMA flushing/syncing but rather a general problem. Reported by: Michael Moll [1] Modified: head/sys/sparc64/pci/schizo.c head/sys/sparc64/pci/schizoreg.h head/sys/sparc64/pci/schizovar.h head/sys/sparc64/sparc64/nexus.c Modified: head/sys/sparc64/pci/schizo.c ============================================================================== --- head/sys/sparc64/pci/schizo.c Thu Nov 20 14:57:09 2008 (r185132) +++ head/sys/sparc64/pci/schizo.c Thu Nov 20 18:44:09 2008 (r185133) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,11 +80,13 @@ __FBSDID("$FreeBSD$"); static const struct schizo_desc *schizo_get_desc(device_t); static void schizo_set_intr(struct schizo_softc *, u_int, u_int, driver_filter_t); -static driver_filter_t schizo_dmasync; +static driver_filter_t schizo_dma_sync_stub; +static driver_filter_t ichip_dma_sync_stub; static void schizo_intr_enable(void *); static void schizo_intr_disable(void *); static void schizo_intr_assign(void *); static void schizo_intr_clear(void *); +static int schizo_intr_register(struct schizo_softc *sc, u_int ino); static int schizo_get_intrmap(struct schizo_softc *, u_int, bus_addr_t *, bus_addr_t *); static bus_space_tag_t schizo_alloc_bus_tag(struct schizo_softc *, int); @@ -94,6 +97,7 @@ static driver_filter_t schizo_pci_bus; static driver_filter_t schizo_ue; static driver_filter_t schizo_ce; static driver_filter_t schizo_host_bus; +static driver_filter_t schizo_cdma; /* IOMMU support */ static void schizo_iommu_init(struct schizo_softc *, int, uint32_t); @@ -170,13 +174,16 @@ struct schizo_icarg { bus_addr_t sica_clr; }; -struct schizo_dmasync { +struct schizo_dma_sync { struct schizo_softc *sds_sc; driver_filter_t *sds_handler; void *sds_arg; void *sds_cookie; uint64_t sds_syncval; - u_int sds_bswar; + device_t sds_ppb; /* farest PCI-PCI bridge */ + uint8_t sds_bus; /* bus of farest PCI device */ + uint8_t sds_slot; /* slot of farest PCI device */ + uint8_t sds_func; /* func. of farest PCI device */ }; #define SCHIZO_PERF_CNT_QLTY 100 @@ -211,7 +218,7 @@ struct schizo_desc { const char *sd_name; }; -static const struct schizo_desc schizo_compats[] = { +static const struct schizo_desc const schizo_compats[] = { { "pci108e,8001", SCHIZO_MODE_SCZ, "Schizo" }, { "pci108e,a801", SCHIZO_MODE_TOM, "Tomatillo" }, { NULL, 0, NULL } @@ -251,10 +258,8 @@ schizo_attach(device_t dev) { struct ofw_pci_ranges *range; const struct schizo_desc *desc; - struct schizo_icarg *sica; struct schizo_softc *asc, *sc, *osc; struct timecounter *tc; - bus_addr_t intrclr, intrmap; uint64_t ino_bitmap, reg; phandle_t node; uint32_t prop, prop_array[2]; @@ -268,6 +273,7 @@ schizo_attach(device_t dev) sc->sc_dev = dev; sc->sc_node = node; sc->sc_mode = mode; + sc->sc_flags = 0; /* * The Schizo has three register banks: @@ -321,6 +327,8 @@ schizo_attach(device_t dev) panic("%s: could not malloc mutex", __func__); mtx_init(sc->sc_mtx, "pcib_mtx", NULL, MTX_SPIN); } else { + if (sc->sc_mode != SCHIZO_MODE_SCZ) + panic("%s: no partner expected", __func__); if (mtx_initialized(osc->sc_mtx) == 0) panic("%s: mutex not initialized", __func__); sc->sc_mtx = osc->sc_mtx; @@ -402,24 +410,10 @@ schizo_attach(device_t dev) if (n == STX_FB0_INO || n == STX_FB1_INO) /* Leave for upa(4). */ continue; - if (schizo_get_intrmap(sc, n, &intrmap, &intrclr) == 0) - continue; - sica = malloc(sizeof(*sica), M_DEVBUF, M_NOWAIT); - if (sica == NULL) - panic("%s: could not allocate interrupt controller " - "argument", __func__); - sica->sica_sc = sc; - sica->sica_map = intrmap; - sica->sica_clr = intrclr; -#ifdef SCHIZO_DEBUG - device_printf(dev, "intr map (INO %d) %#lx: %#lx, clr: %#lx\n", - n, (u_long)intrmap, (u_long)SCHIZO_PCI_READ_8(sc, intrmap), - (u_long)intrclr); -#endif - if (intr_controller_register(INTMAP_VEC(sc->sc_ign, n), - &schizo_ic, sica) != 0) + i = schizo_intr_register(sc, n); + if (i != 0) panic("%s: could not register interrupt controller " - "for INO %d", __func__, n); + "for INO %d (%d)", __func__, n, i); } /* @@ -459,8 +453,10 @@ schizo_attach(device_t dev) sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(STX_IOMMU_BITS); sc->sc_is.is_sb[0] = 0; sc->sc_is.is_sb[1] = 0; +#ifdef notyet if (OF_getproplen(node, "no-streaming-cache") < 0) sc->sc_is.is_sb[0] = STX_PCI_STRBUF; +#endif #define TSBCASE(x) \ case (IOTSB_BASESZ << (x)) << (IO_PAGE_SHIFT - IOTTE_SHIFT): \ @@ -488,6 +484,7 @@ schizo_attach(device_t dev) } schizo_iommu_init(sc, tsbsize, prop_array[0]); } + #undef TSBCASE /* Initialize memory and I/O rmans. */ @@ -626,6 +623,39 @@ schizo_attach(device_t dev) schizo_set_intr(sc, 3, STX_BUS_INO, schizo_host_bus); /* + * According to the Schizo Errata I-13, consistent DMA flushing/ + * syncing is FUBAR in version < 5 (i.e. revision < 2.3) bridges, + * so we can't use it and need to live with the consequences. + * With Schizo version >= 5, CDMA flushing/syncing is usable + * but requires the the workaround described in Schizo Errata + * I-23. With Tomatillo and XMITS, CDMA flushing/syncing works + * as expected, Tomatillo version <= 4 (i.e. revision <= 2.3) + * bridges additionally require a block store after a write to + * TOMXMS_PCI_DMA_SYNC_PEND though. + */ + if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) || + sc->sc_mode == SCHIZO_MODE_TOM || sc->sc_mode == SCHIZO_MODE_XMS) { + sc->sc_flags |= SCHIZO_FLAGS_CDMA; + if (sc->sc_mode == SCHIZO_MODE_SCZ) { + n = STX_CDMA_A_INO + sc->sc_half; + if (bus_set_resource(dev, SYS_RES_IRQ, 5, + INTMAP_VEC(sc->sc_ign, n), 1) != 0) + panic("%s: failed to add CDMA interrupt", + __func__); + i = schizo_intr_register(sc, n); + if (i != 0) + panic("%s: could not register interrupt " + "controller for CDMA (%d)", __func__, i); + (void)schizo_get_intrmap(sc, n, NULL, + &sc->sc_cdma_clr); + sc->sc_cdma_state = SCHIZO_CDMA_STATE_DONE; + schizo_set_intr(sc, 5, n, schizo_cdma); + } + if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) + sc->sc_flags |= SCHIZO_FLAGS_BSWAR; + } + + /* * Set the latency timer register as this isn't always done by the * firmware. */ @@ -652,12 +682,40 @@ schizo_set_intr(struct schizo_softc *sc, INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) != sc->sc_ign || INTINO(vec) != ino || intr_vectors[vec].iv_ic != &schizo_ic || - bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], INTR_TYPE_MISC, - handler, NULL, sc, &sc->sc_ihand[index]) != 0) + bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], + INTR_TYPE_MISC | INTR_FAST, handler, NULL, sc, + &sc->sc_ihand[index]) != 0) panic("%s: failed to set up interrupt %d", __func__, index); } static int +schizo_intr_register(struct schizo_softc *sc, u_int ino) +{ + struct schizo_icarg *sica; + bus_addr_t intrclr, intrmap; + int error; + + if (schizo_get_intrmap(sc, ino, &intrmap, &intrclr) == 0) + return (ENXIO); + sica = malloc(sizeof(*sica), M_DEVBUF, M_NOWAIT); + if (sica == NULL) + return (ENOMEM); + sica->sica_sc = sc; + sica->sica_map = intrmap; + sica->sica_clr = intrclr; +#ifdef SCHIZO_DEBUG + device_printf(sc->sc_dev, "intr map (INO %d) %#lx: %#lx, clr: %#lx\n", + ino, (u_long)intrmap, (u_long)SCHIZO_PCI_READ_8(sc, intrmap), + (u_long)intrclr); +#endif + error = (intr_controller_register(INTMAP_VEC(sc->sc_ign, ino), + &schizo_ic, sica)); + if (error != 0) + free(sica, M_DEVBUF); + return (error); +} + +static int schizo_get_intrmap(struct schizo_softc *sc, u_int ino, bus_addr_t *intrmapptr, bus_addr_t *intrclrptr) { @@ -800,6 +858,15 @@ schizo_host_bus(void *arg) return (FILTER_HANDLED); } +static int +schizo_cdma(void *arg) +{ + struct schizo_softc *sc = arg; + + atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_DONE); + return (FILTER_HANDLED); +} + static void schizo_iommu_init(struct schizo_softc *sc, int tsbsize, uint32_t dvmabase) { @@ -946,25 +1013,57 @@ schizo_read_ivar(device_t dev, device_t return (ENOENT); } +static int +schizo_dma_sync_stub(void *arg) +{ + struct timeval cur, end; + struct schizo_dma_sync *sds = arg; + struct schizo_softc *sc = sds->sds_sc; + uint32_t state; + + (void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot, + sds->sds_func, PCIR_VENDOR, 2); + for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_DONE, + SCHIZO_CDMA_STATE_PENDING) == 0;) + ; + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, 1); + microuptime(&cur); + end.tv_sec = 1; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; (state = atomic_load_32(&sc->sc_cdma_state)) != + SCHIZO_CDMA_STATE_DONE && timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if (state != SCHIZO_CDMA_STATE_DONE) + panic("%s: DMA does not sync", __func__); + return (sds->sds_handler(sds->sds_arg)); +} + #define VIS_BLOCKSIZE 64 static int -schizo_dmasync(void *arg) +ichip_dma_sync_stub(void *arg) { static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); - struct schizo_dmasync *sds = arg; + struct timeval cur, end; + struct schizo_dma_sync *sds = arg; struct schizo_softc *sc = sds->sds_sc; register_t reg, s; - int timeout; + (void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot, + sds->sds_func, PCIR_VENDOR, 2); SCHIZO_PCI_WRITE_8(sc, TOMXMS_PCI_DMA_SYNC_PEND, sds->sds_syncval); - timeout = 1000000; - for (; (SCHIZO_PCI_READ_8(sc, TOMXMS_PCI_DMA_SYNC_PEND) & - sds->sds_syncval) != 0;) - if (--timeout < 0) - panic("%s: DMA does not sync", __func__); + microuptime(&cur); + end.tv_sec = 1; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; ((reg = SCHIZO_PCI_READ_8(sc, TOMXMS_PCI_DMA_SYNC_PEND)) & + sds->sds_syncval) != 0 && timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if ((reg & sds->sds_syncval) != 0) + panic("%s: DMA does not sync", __func__); - if (sds->sds_bswar != 0) { + if ((sc->sc_flags & SCHIZO_FLAGS_BSWAR) != 0) { s = intr_disable(); reg = rd(fprs); wr(fprs, reg | FPRS_FEF, 0); @@ -1020,10 +1119,12 @@ schizo_setup_intr(device_t dev, device_t int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - struct schizo_dmasync *sds; + devclass_t pci_devclass; + device_t cdev, pdev, pcidev; + struct schizo_dma_sync *sds; struct schizo_softc *sc; u_long vec; - int error; + int error, found; sc = device_get_softc(dev); /* @@ -1038,35 +1139,64 @@ schizo_setup_intr(device_t dev, device_t } /* - * Tomatillo and XMITS bridges need to be told to sync DMA writes - * based on the INO of the respective device. - * Tomatillo revision <= 2.3 (i.e. version <= 4) bridges additionally - * need a block store as a workaround for a hardware bug. - * XXX setup of the wrapper and the contents of schizo_dmasync() - * should be moved to schizo(4)-specific bus_dma_tag_create() and - * bus_dmamap_sync() methods, respectively, once DMA tag creation - * is newbus'ified, so the wrapper isn't only applied for interrupt - * handlers but also for polling(4) callbacks. + * Install a a wrapper for CDMA flushing/syncing for devices + * behind PCI-PCI bridges if possible. */ - if (sc->sc_mode == SCHIZO_MODE_TOM || sc->sc_mode == SCHIZO_MODE_XMS) { + pcidev = NULL; + found = 0; + pci_devclass = devclass_find("pci"); + for (cdev = child; cdev != dev; cdev = pdev) { + pdev = device_get_parent(cdev); + if (pcidev == NULL) { + if (device_get_devclass(pdev) != pci_devclass) + continue; + pcidev = cdev; + continue; + } + if (pci_get_class(cdev) == PCIC_BRIDGE && + pci_get_subclass(cdev) == PCIS_BRIDGE_PCI) + found = 1; + } + if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) { sds = malloc(sizeof(*sds), M_DEVBUF, M_NOWAIT | M_ZERO); if (sds == NULL) return (ENOMEM); - sds->sds_sc = sc; - sds->sds_arg = arg; - sds->sds_syncval = 1ULL << INTINO(vec); - if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) - sds->sds_bswar = 1; - if (intr == NULL) { - sds->sds_handler = filt; - error = bus_generic_setup_intr(dev, child, ires, - flags, schizo_dmasync, intr, sds, cookiep); - } else { - sds->sds_handler = (driver_filter_t *)intr; + if (found != 0 && pcidev != NULL) { + sds->sds_sc = sc; + sds->sds_arg = arg; + sds->sds_ppb = + device_get_parent(device_get_parent(pcidev)); + sds->sds_bus = pci_get_bus(pcidev); + sds->sds_slot = pci_get_slot(pcidev); + sds->sds_func = pci_get_function(pcidev); + sds->sds_syncval = 1ULL << INTINO(vec); + if (bootverbose) + device_printf(dev, "installed DMA sync " + "wrapper for device %d.%d on bus %d\n", + sds->sds_slot, sds->sds_func, + sds->sds_bus); + +#define DMA_SYNC_STUB \ + (sc->sc_mode == SCHIZO_MODE_SCZ ? schizo_dma_sync_stub : \ + ichip_dma_sync_stub) + + if (intr == NULL) { + sds->sds_handler = filt; + error = bus_generic_setup_intr(dev, child, + ires, flags, DMA_SYNC_STUB, intr, sds, + cookiep); + } else { + sds->sds_handler = (driver_filter_t *)intr; + error = bus_generic_setup_intr(dev, child, + ires, flags, filt, (driver_intr_t *) + DMA_SYNC_STUB, sds, cookiep); + } + +#undef DMA_SYNC_STUB + + } else error = bus_generic_setup_intr(dev, child, ires, - flags, filt, (driver_intr_t *)schizo_dmasync, - sds, cookiep); - } + flags, filt, intr, arg, cookiep); if (error != 0) { free(sds, M_DEVBUF); return (error); @@ -1074,7 +1204,9 @@ schizo_setup_intr(device_t dev, device_t sds->sds_cookie = *cookiep; *cookiep = sds; return (error); - } + } else if (found != 0) + device_printf(dev, "WARNING: using devices behind PCI-PCI " + "bridges may cause data corruption"); return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, arg, cookiep)); } @@ -1083,12 +1215,12 @@ static int schizo_teardown_intr(device_t dev, device_t child, struct resource *vec, void *cookie) { - struct schizo_dmasync *sds; + struct schizo_dma_sync *sds; struct schizo_softc *sc; int error; sc = device_get_softc(dev); - if (sc->sc_mode == SCHIZO_MODE_TOM) { + if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) { sds = cookie; error = bus_generic_teardown_intr(dev, child, vec, sds->sds_cookie); @@ -1172,8 +1304,8 @@ schizo_activate_resource(device_t bus, d type, rid, r)); if (type == SYS_RES_MEMORY) { /* - * Need to memory-map the device space, as some drivers depend - * on the virtual address being set and useable. + * Need to memory-map the device space, as some drivers + * depend on the virtual address being set and usable. */ error = sparc64_bus_mem_map(rman_get_bustag(r), rman_get_bushandle(r), rman_get_size(r), 0, 0, &p); Modified: head/sys/sparc64/pci/schizoreg.h ============================================================================== --- head/sys/sparc64/pci/schizoreg.h Thu Nov 20 14:57:09 2008 (r185132) +++ head/sys/sparc64/pci/schizoreg.h Thu Nov 20 18:44:09 2008 (r185133) @@ -31,7 +31,7 @@ #ifndef _SPARC64_PCI_SCHIZOREG_H_ #define _SPARC64_PCI_SCHIZOREG_H_ -#define STX_NINTR 4 +#define STX_NINTR 5 /* 4 via OFW + 1 CDMA */ #define STX_NRANGE 4 #define SCZ_NREG 3 #define TOM_NREG 4 @@ -276,6 +276,8 @@ #define STX_PCIERR_A_INO 0x32 /* PCI bus A error */ #define STX_PCIERR_B_INO 0x33 /* PCI bus B error */ #define STX_BUS_INO 0x34 /* Safari/JBus error */ +#define STX_CDMA_A_INO 0x35 /* PCI bus A CDMA */ +#define STX_CDMA_B_INO 0x36 /* PCI bus B CDMA */ #define STX_MAX_INO 0x37 /* Device space defines */ Modified: head/sys/sparc64/pci/schizovar.h ============================================================================== --- head/sys/sparc64/pci/schizovar.h Thu Nov 20 14:57:09 2008 (r185132) +++ head/sys/sparc64/pci/schizovar.h Thu Nov 20 18:44:09 2008 (r185133) @@ -39,9 +39,18 @@ struct schizo_softc { phandle_t sc_node; u_int sc_mode; -#define SCHIZO_MODE_SCZ 1 -#define SCHIZO_MODE_TOM 2 -#define SCHIZO_MODE_XMS 3 +#define SCHIZO_MODE_SCZ 0 +#define SCHIZO_MODE_TOM 1 +#define SCHIZO_MODE_XMS 2 + + u_int sc_flags; +#define SCHIZO_FLAGS_BSWAR (1 << 0) +#define SCHIZO_FLAGS_CDMA (1 << 1) + + bus_addr_t sc_cdma_clr; + uint32_t sc_cdma_state; +#define SCHIZO_CDMA_STATE_DONE (1 << 0) +#define SCHIZO_CDMA_STATE_PENDING (1 << 1) u_int sc_half; uint32_t sc_ign; Modified: head/sys/sparc64/sparc64/nexus.c ============================================================================== --- head/sys/sparc64/sparc64/nexus.c Thu Nov 20 14:57:09 2008 (r185132) +++ head/sys/sparc64/sparc64/nexus.c Thu Nov 20 18:44:09 2008 (r185133) @@ -96,7 +96,7 @@ static ofw_bus_get_devinfo_t nexus_get_d #ifdef SMP static int nexus_bind_intr(device_t, device_t, struct resource *, int); #endif -static int nexus_inlist(const char *, const char **); +static int nexus_inlist(const char *, const char *const *); static struct nexus_devinfo * nexus_setup_dinfo(device_t, phandle_t); static void nexus_destroy_dinfo(struct nexus_devinfo *); static int nexus_print_res(struct nexus_devinfo *); @@ -125,6 +125,7 @@ static device_method_t nexus_methods[] = #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_get_resource_list, nexus_get_resource_list), DEVMETHOD(bus_get_dma_tag, nexus_get_dma_tag), @@ -145,7 +146,7 @@ static devclass_t nexus_devclass; DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, sizeof(struct nexus_softc)); DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); -static const char *nexus_excl_name[] = { +static const char *const nexus_excl_name[] = { "aliases", "associations", "chosen", @@ -159,7 +160,7 @@ static const char *nexus_excl_name[] = { NULL }; -static const char *nexus_excl_type[] = { +static const char *const nexus_excl_type[] = { "cpu", NULL }; @@ -168,7 +169,7 @@ extern struct bus_space_tag nexus_bustag extern struct bus_dma_tag nexus_dmatag; static int -nexus_inlist(const char *name, const char **list) +nexus_inlist(const char *name, const char *const *list) { int i; From owner-svn-src-all@FreeBSD.ORG Thu Nov 20 23:42:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E01F1065674 for ; Thu, 20 Nov 2008 23:42:26 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.190]) by mx1.freebsd.org (Postfix) with ESMTP id 066AA8FC20 for ; Thu, 20 Nov 2008 23:42:25 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: by rn-out-0910.google.com with SMTP id j71so611656rne.12 for ; Thu, 20 Nov 2008 15:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=G75ek0DOt3i3nNYVl6GyclB3t8Eur5aK2C4BLpobxi8=; b=TIntYMmoNGCFyxi9KoSWY7omdmHjZFktwk/66qkKvXy+lK+Hu0vx+tD8viIhr4qhWp TlsZCFkigzkWquXpubJZimCs4nX/BFaJQRbhbtMlTjI2LaJVhx98X+Pjtah3pmi2YmNC Jy/86LCPt5OwiHBof0WOokSKSfJeAoEO5EDkg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=RJsFritAe0WPERma/KDIvR1A6H+qk5dm7KMh6W9Y8Os84LR+nKrRH9qg++5xZKGgZM B0KXQvzXBTg6w3MqpgmVDWvIqUGUM+u5lW3luAkI/UhXv5qR4rXi6A2PTMMOvQRDyqRM pMUpEP7Rh9fkLXLODocHl0fq6JWzzn86mNYmU= Received: by 10.142.214.11 with SMTP id m11mr1399451wfg.279.1227224544615; Thu, 20 Nov 2008 15:42:24 -0800 (PST) Received: by 10.142.83.5 with HTTP; Thu, 20 Nov 2008 15:42:24 -0800 (PST) Message-ID: <747dc8f30811201542m3b22196m3e7cd70b12ea3f6f@mail.gmail.com> Date: Thu, 20 Nov 2008 21:42:24 -0200 From: "Renato Botelho" To: "Wes Morgan" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <747dc8f30811190711w5335f3e3wc7ea21a20d04bac9@mail.gmail.com> <4924380E.9050204@kasimir.com> <747dc8f30811190941g4b1b7ddet62eed0f84d154999@mail.gmail.com> Cc: svn-src-all@freebsd.org, Florian Smeets , Pawel Jakub Dawidek Subject: Re: svn commit: in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 23:42:26 -0000 On Wed, Nov 19, 2008 at 10:02 PM, Wes Morgan wrote: > On Wed, 19 Nov 2008, Renato Botelho wrote: > >> On Wed, Nov 19, 2008 at 2:00 PM, Florian Smeets wrote: >>> >>> On 19.11.2008 16:11 Uhr, Renato Botelho wrote: >>>> >>>> On Mon, Nov 17, 2008 at 6:49 PM, Pawel Jakub Dawidek >>>> wrote: >>>>> >>>>> Author: pjd >>>>> Date: Mon Nov 17 20:49:29 2008 >>>>> New Revision: 185029 >>>>> URL: http://svn.freebsd.org/changeset/base/185029 >>>>> >>>>> Log: >>>>> Update ZFS from version 6 to 13 and bring some FreeBSD-specific >>>>> changes. >>>> >>>> After this revision I've started to got this: >>>> >>>> root@botelhor:/usr/src/usr.bin/fstat# make all >>>> make: don't know how to make >>>> >>>> /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. >>>> Stop >>>> *** Error code 2 >>>> >>> Hi Renato, >>> >>> the acl.h header file moved. A make clean && make all is not sufficient. >>> I >>> didn't bother to find another solution than make buildworld ;-) that >>> should >>> work. Perhaps a make includes would also have worked, but the ZFS commit >>> was >>> big enough to warrant a full buildworld. >> >> I tried a make clean and a full make buildworld and it stopped >> at the same point: >> >> ===> usr.bin/file2c (all) >> ===> usr.bin/find (all) >> ===> usr.bin/finger (all) >> ===> usr.bin/fmt (all) >> ===> usr.bin/fold (all) >> ===> usr.bin/from (all) >> ===> usr.bin/fstat (all) >> make: don't know how to make >> /usr/src/usr.bin/fstat/zfs/../../../sys/cddl/compat/opensolaris/sys/acl.h. >> Stop >> *** Error code 2 >> >> Stop in /usr/src/usr.bin/fstat. >> *** Error code 1 > > > Try running "make cleandir && make cleandir && make obj depend all". Worked fine, sorry for the noise Thanks -- Renato Botelho From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 00:48:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FBCE1065674; Fri, 21 Nov 2008 00:48:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4843C8FC12; Fri, 21 Nov 2008 00:48:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAL0mwkR068230; Fri, 21 Nov 2008 00:48:58 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAL0mwa8068228; Fri, 21 Nov 2008 00:48:58 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811210048.mAL0mwa8068228@svn.freebsd.org> From: Xin LI Date: Fri, 21 Nov 2008 00:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185135 - in stable/7/release/doc/zh_CN.GB2312: hardware relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 00:48:58 -0000 Author: delphij Date: Fri Nov 21 00:48:57 2008 New Revision: 185135 URL: http://svn.freebsd.org/changeset/base/185135 Log: MFen r185110: document igb(4) Approved by: re (kensmith) Modified: stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml stable/7/release/doc/zh_CN.GB2312/relnotes/article.sgml Modified: stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml ============================================================================== --- stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml Thu Nov 20 19:51:06 2008 (r185134) +++ stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml Fri Nov 21 00:48:57 2008 (r185135) @@ -392,7 +392,7 @@ - + @@ -183,6 +183,10 @@ ÍøÂç½Ó¿ÚÖ§³Ö + ½« &man.em.4; Çý¶¯³ÌÐò·Ö²ð³ÉÁËÁ½¸ö¹²Ïí²¿·Ö´úÂëµÄÇý¶¯³ÌÐò¡£ + &man.em.4; Çý¶¯³ÌÐò½«¼ÌÐøÖ§³Ö¸ßÖÁ 82575 µÄÍø¿¨ÒÔ¼°ÐµÄÕë¶Ô¿Í»§»ú/×ÀÃæµÄÍø¿¨¡£ + ÐÂÔöµÄ &man.igb.4; Çý¶¯³ÌÐòÔòÓÃÓÚÖ§³ÖеķþÎñÆ÷Íø¿¨¡£ + [&arch.amd64;¡¢ &arch.i386;] ¶Ô &man.wpi.4; Çý¶¯³ÌÐò½øÐÐÁ˸üУ¬ ÐÞÕýÁËһϵÁпɿ¿ÐÔÎÊÌâ¡£ From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 02:23:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84D43106564A; Fri, 21 Nov 2008 02:23:15 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 546708FC08; Fri, 21 Nov 2008 02:23:15 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAL2NFIw070504; Fri, 21 Nov 2008 02:23:15 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAL2NFVC070503; Fri, 21 Nov 2008 02:23:15 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200811210223.mAL2NFVC070503@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 21 Nov 2008 02:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185139 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 02:23:15 -0000 Author: lstewart Date: Fri Nov 21 02:23:14 2008 New Revision: 185139 URL: http://svn.freebsd.org/changeset/base/185139 Log: Increased limit no longer required. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Fri Nov 21 01:11:22 2008 (r185138) +++ svnadmin/conf/sizelimit.conf Fri Nov 21 02:23:14 2008 (r185139) @@ -17,5 +17,4 @@ #peter 3141592 #grog #kan -lstewart pjd 10485760 From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 03:03:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB05E106564A; Fri, 21 Nov 2008 03:03:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93E048FC18; Fri, 21 Nov 2008 03:03:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAL33vDA071621; Fri, 21 Nov 2008 03:03:57 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAL33vZD071619; Fri, 21 Nov 2008 03:03:57 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811210303.mAL33vZD071619@svn.freebsd.org> From: Warner Losh Date: Fri, 21 Nov 2008 03:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185140 - head/sys/dev/cardbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 03:03:57 -0000 Author: imp Date: Fri Nov 21 03:03:57 2008 New Revision: 185140 URL: http://svn.freebsd.org/changeset/base/185140 Log: Create a /dev/cardbus%d.cis, to be compatible with older versions of the software. This is a trivial amount of code to keep wireless monitoring software working... I plan on removing it in 9.0. Modified: head/sys/dev/cardbus/cardbus_device.c head/sys/dev/cardbus/cardbusvar.h Modified: head/sys/dev/cardbus/cardbus_device.c ============================================================================== --- head/sys/dev/cardbus/cardbus_device.c Fri Nov 21 02:23:14 2008 (r185139) +++ head/sys/dev/cardbus/cardbus_device.c Fri Nov 21 03:03:57 2008 (r185140) @@ -118,7 +118,9 @@ cardbus_device_create(struct cardbus_sof devi->sc_cisdev = make_dev(&cardbus_cdevsw, minor, 0, 0, 0666, "cardbus%d.%d.cis", device_get_unit(sc->sc_dev), devi->pci.cfg.func); - /* XXX need cardbus%d.cis compat layer here ? */ + if (devi->pci.cfg.func == 0) + devi->sc_cisdev_compat = make_dev_alias(devi->sc_cisdev, + "cardbus%d.cis", device_get_unit(sc->sc_dev)); devi->sc_cisdev->si_drv1 = devi; return (0); } @@ -128,6 +130,8 @@ cardbus_device_destroy(struct cardbus_de { if (devi->sc_cisdev) destroy_dev(devi->sc_cisdev); + if (devi->sc_cisdev_compat) + destroy_dev(devi->sc_cisdev_compat); return (0); } Modified: head/sys/dev/cardbus/cardbusvar.h ============================================================================== --- head/sys/dev/cardbus/cardbusvar.h Fri Nov 21 02:23:14 2008 (r185139) +++ head/sys/dev/cardbus/cardbusvar.h Fri Nov 21 03:03:57 2008 (r185140) @@ -60,6 +60,7 @@ struct cardbus_devinfo } funce; uint32_t fepresent; /* bit mask of funce values present */ struct cdev *sc_cisdev; + struct cdev *sc_cisdev_compat; struct cis_buffer sc_cis; }; From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 08:10:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158B0106567A; Fri, 21 Nov 2008 08:10:08 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 040A38FC1F; Fri, 21 Nov 2008 08:10:08 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAL8A7JR078722; Fri, 21 Nov 2008 08:10:07 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAL8A7cb078721; Fri, 21 Nov 2008 08:10:07 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200811210810.mAL8A7cb078721@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 21 Nov 2008 08:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185151 - head/sys/boot/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 08:10:08 -0000 Author: des Date: Fri Nov 21 08:10:07 2008 New Revision: 185151 URL: http://svn.freebsd.org/changeset/base/185151 Log: Disconnect gptzfsboot from the build until dfr@ gets his act together. Modified: head/sys/boot/i386/Makefile Modified: head/sys/boot/i386/Makefile ============================================================================== --- head/sys/boot/i386/Makefile Fri Nov 21 08:00:41 2008 (r185150) +++ head/sys/boot/i386/Makefile Fri Nov 21 08:10:07 2008 (r185151) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot zfsboot \ - gptzfsboot kgzldr libi386 libfirewire loader + kgzldr libi386 libfirewire loader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 09:01:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53040106564A; Fri, 21 Nov 2008 09:01:42 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 10B738FC13; Fri, 21 Nov 2008 09:01:42 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 2A47A6D43F; Fri, 21 Nov 2008 09:01:41 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 12F5084460; Fri, 21 Nov 2008 10:01:41 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Joseph Koshy References: <200811151111.mAFBBWnf019276@svn.freebsd.org> Date: Fri, 21 Nov 2008 10:01:41 +0100 In-Reply-To: <200811151111.mAFBBWnf019276@svn.freebsd.org> (Joseph Koshy's message of "Sat, 15 Nov 2008 11:11:32 +0000 (UTC)") Message-ID: <863ahlpi4q.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184994 - head/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 09:01:42 -0000 Joseph Koshy writes: > Modified: head/sys/dev/hwpmc/hwpmc_mod.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 15 11:07:54 2008 (r184993) > +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 15 11:11:32 2008 (r184994) > @@ -4656,6 +4656,9 @@ pmc_cleanup(void) > if (md->pmd_pcpu_fini) > md->pmd_pcpu_fini(cpu); > } > + > + pmc_md_finalize(md); > + > free(md, M_PMC); > md =3D NULL; > pmc_restore_cpu_binding(&pb); This breaks the ia64, powerpc and sparc64 builds; pmc_md_finalize() is only defined for i386 and amd64. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 09:10:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47343106564A; Fri, 21 Nov 2008 09:10:36 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 366828FC19; Fri, 21 Nov 2008 09:10:36 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAL9Aa5n080150; Fri, 21 Nov 2008 09:10:36 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAL9AaDX080149; Fri, 21 Nov 2008 09:10:36 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811210910.mAL9AaDX080149@svn.freebsd.org> From: Doug Rabson Date: Fri, 21 Nov 2008 09:10:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185154 - head/sys/cddl/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 09:10:36 -0000 Author: dfr Date: Fri Nov 21 09:10:35 2008 New Revision: 185154 URL: http://svn.freebsd.org/changeset/base/185154 Log: Add definitions for ZFS pool version 13. Modified: head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Fri Nov 21 08:20:28 2008 (r185153) +++ head/sys/cddl/boot/zfs/zfsimpl.h Fri Nov 21 09:10:35 2008 (r185154) @@ -459,13 +459,15 @@ typedef enum { #define SPA_VERSION_9 9ULL #define SPA_VERSION_10 10ULL #define SPA_VERSION_11 11ULL +#define SPA_VERSION_12 12ULL +#define SPA_VERSION_13 13ULL /* * When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, * and do the appropriate changes. */ -#define SPA_VERSION SPA_VERSION_11 -#define SPA_VERSION_STRING "11" +#define SPA_VERSION SPA_VERSION_13 +#define SPA_VERSION_STRING "13" /* * Symbolic names for the changes that caused a SPA_VERSION switch. @@ -488,6 +490,18 @@ typedef enum { #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 #define SPA_VERSION_BOOTFS SPA_VERSION_6 +#define SPA_VERSION_SLOGS SPA_VERSION_7 +#define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8 +#define SPA_VERSION_FUID SPA_VERSION_9 +#define SPA_VERSION_REFRESERVATION SPA_VERSION_9 +#define SPA_VERSION_REFQUOTA SPA_VERSION_9 +#define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9 +#define SPA_VERSION_L2CACHE SPA_VERSION_10 +#define SPA_VERSION_NEXT_CLONES SPA_VERSION_11 +#define SPA_VERSION_ORIGIN SPA_VERSION_11 +#define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 +#define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 +#define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 /* * The following are configuration names used in the nvlist describing a pool's From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 09:14:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096F31065673; Fri, 21 Nov 2008 09:14:30 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE7408FC1F; Fri, 21 Nov 2008 09:14:29 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAL9ET1q080276; Fri, 21 Nov 2008 09:14:29 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAL9ET1u080275; Fri, 21 Nov 2008 09:14:29 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200811210914.mAL9ET1u080275@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 21 Nov 2008 09:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185155 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 09:14:30 -0000 Author: luigi Date: Fri Nov 21 09:14:29 2008 New Revision: 185155 URL: http://svn.freebsd.org/changeset/base/185155 Log: use the correct variable in a debug message. Modified: head/lib/libstand/nfs.c Modified: head/lib/libstand/nfs.c ============================================================================== --- head/lib/libstand/nfs.c Fri Nov 21 09:10:35 2008 (r185154) +++ head/lib/libstand/nfs.c Fri Nov 21 09:14:29 2008 (r185155) @@ -405,7 +405,7 @@ nfs_open(upath, f) #ifdef NFS_DEBUG if (debug) - printf("nfs_open: %s (rootpath=%s)\n", path, rootpath); + printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); #endif if (!rootpath[0]) { printf("no rootpath, no nfs\n"); From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 18:15:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CBA01065673; Fri, 21 Nov 2008 18:15:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 109C88FC16; Fri, 21 Nov 2008 18:15:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mALIFd1r092561; Fri, 21 Nov 2008 18:15:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mALIFd5U092560; Fri, 21 Nov 2008 18:15:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811211815.mALIFd5U092560@svn.freebsd.org> From: Warner Losh Date: Fri, 21 Nov 2008 18:15:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185156 - head/usr.sbin/wpa/wpa_supplicant X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 18:15:40 -0000 Author: imp Date: Fri Nov 21 18:15:39 2008 New Revision: 185156 URL: http://svn.freebsd.org/changeset/base/185156 Log: 'Strict EAP conformance' makes more sense here than 'String EAP conformance.' Modified: head/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5 Modified: head/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5 ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5 Fri Nov 21 09:14:29 2008 (r185155) +++ head/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5 Fri Nov 21 18:15:39 2008 (r185156) @@ -403,7 +403,7 @@ PAC is being provisioned or refreshed. Enable/disable EAP workarounds for various interoperability issues with misbehaving authentication servers. By default these workarounds are enabled. -String EAP conformance can be configured by setting this to 0. +Strict EAP conformance can be configured by setting this to 0. .El .Sh CERTIFICATES Some EAP authentication methods require use of certificates. From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 19:22:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E0031065673; Fri, 21 Nov 2008 19:22:26 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 725408FC1A; Fri, 21 Nov 2008 19:22:26 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mALJMQMT093913; Fri, 21 Nov 2008 19:22:26 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mALJMPDM093909; Fri, 21 Nov 2008 19:22:25 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200811211922.mALJMPDM093909@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 21 Nov 2008 19:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185157 - in head/sys/dev/cxgb: . common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 19:22:26 -0000 Author: gnn Date: Fri Nov 21 19:22:25 2008 New Revision: 185157 URL: http://svn.freebsd.org/changeset/base/185157 Log: Several small additions to the Chelsio 10G driver. 1) Fix a bug in dealing with the Alerus 1006 PHY which prevented the device from ever coming back up once it had been set to down. 2) Add a kernel tunable (hw.cxgb.snd_queue_len) which makes it possible to give the device more than IFQ_MAXLEN entries in its send queue. The default remains 50. 3) Add code to place the card'd identification and serial number into its description (%desc) so that users can tell which card they have installed. Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c head/sys/dev/cxgb/common/cxgb_common.h head/sys/dev/cxgb/common/cxgb_t3_hw.c head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ael1002.c Fri Nov 21 18:15:39 2008 (r185156) +++ head/sys/dev/cxgb/common/cxgb_ael1002.c Fri Nov 21 19:22:25 2008 (r185157) @@ -191,7 +191,21 @@ int t3_ael1002_phy_prep(struct cphy *phy static int ael1006_reset(struct cphy *phy, int wait) { - return t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + u32 gpio_out; + t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + /* Hack to reset the phy correctly */ + /* Read out the current value */ + gpio_out = t3_read_reg(phy->adapter, A_T3DBG_GPIO_EN); + /* Reset the phy */ + gpio_out &= ~F_GPIO6_OUT_VAL; + t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); + msleep(125); + /* Take the phy out of reset */ + gpio_out |= F_GPIO6_OUT_VAL; + t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); + msleep(125); + t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + return 0; } static int ael1006_power_down(struct cphy *phy, int enable) Modified: head/sys/dev/cxgb/common/cxgb_common.h ============================================================================== --- head/sys/dev/cxgb/common/cxgb_common.h Fri Nov 21 18:15:39 2008 (r185156) +++ head/sys/dev/cxgb/common/cxgb_common.h Fri Nov 21 19:22:25 2008 (r185157) @@ -37,6 +37,7 @@ enum { MAX_FRAME_SIZE = 10240, /* max MAC frame size, includes header + FCS */ EEPROMSIZE = 8192, /* Serial EEPROM size */ SERNUM_LEN = 16, /* Serial # length */ + ECNUM_LEN = 16, /* EC # length */ RSS_TABLE_SIZE = 64, /* size of RSS lookup and mapping tables */ TCB_SIZE = 128, /* TCB size */ NMTUS = 16, /* size of MTU table */ @@ -338,6 +339,7 @@ struct vpd_params { unsigned int mdc; unsigned int mem_timing; u8 sn[SERNUM_LEN + 1]; + u8 ec[ECNUM_LEN + 1]; u8 eth_base[6]; u8 port_type[MAX_NPORTS]; unsigned short xauicfg[2]; Modified: head/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_t3_hw.c Fri Nov 21 18:15:39 2008 (r185156) +++ head/sys/dev/cxgb/common/cxgb_t3_hw.c Fri Nov 21 19:22:25 2008 (r185157) @@ -551,7 +551,7 @@ struct t3_vpd { u8 vpdr_tag; u8 vpdr_len[2]; VPD_ENTRY(pn, 16); /* part number */ - VPD_ENTRY(ec, 16); /* EC level */ + VPD_ENTRY(ec, ECNUM_LEN); /* EC level */ VPD_ENTRY(sn, SERNUM_LEN); /* serial number */ VPD_ENTRY(na, 12); /* MAC address base */ VPD_ENTRY(cclk, 6); /* core clock */ @@ -696,6 +696,7 @@ static int get_vpd_params(adapter_t *ada p->mdc = simple_strtoul(vpd.mdc_data, NULL, 10); p->mem_timing = simple_strtoul(vpd.mt_data, NULL, 10); memcpy(p->sn, vpd.sn_data, SERNUM_LEN); + memcpy(p->ec, vpd.ec_data, ECNUM_LEN); /* Old eeproms didn't have port information */ if (adapter->params.rev == 0 && !vpd.port0_data[0]) { Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Fri Nov 21 18:15:39 2008 (r185156) +++ head/sys/dev/cxgb/cxgb_main.c Fri Nov 21 19:22:25 2008 (r185157) @@ -228,6 +228,15 @@ TUNABLE_INT("hw.cxgb.use_16k_clusters", SYSCTL_UINT(_hw_cxgb, OID_AUTO, use_16k_clusters, CTLFLAG_RDTUN, &cxgb_use_16k_clusters, 0, "use 16kB clusters for the jumbo queue "); +/* + * Tune the size of the output queue. + */ +int cxgb_snd_queue_len = IFQ_MAXLEN; +TUNABLE_INT("hw.cxgb.snd_queue_len", &cxgb_snd_queue_len); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, snd_queue_len, CTLFLAG_RDTUN, + &cxgb_snd_queue_len, 0, "send queue size "); + + enum { MAX_TXQ_ENTRIES = 16384, MAX_CTRL_TXQ_ENTRIES = 1024, @@ -359,8 +368,8 @@ cxgb_controller_probe(device_t dev) ports = "ports"; snprintf(buf, sizeof(buf), "%s %sNIC, rev: %d nports: %d %s", - ai->desc, is_offload(sc) ? "R" : "", - sc->params.rev, nports, ports); + ai->desc, is_offload(sc) ? "R" : "", + sc->params.rev, nports, ports); device_set_desc_copy(dev, buf); return (BUS_PROBE_DEFAULT); } @@ -406,6 +415,8 @@ cxgb_controller_attach(device_t dev) int msi_needed, reg; #endif int must_load = 0; + char buf[80]; + sc = device_get_softc(dev); sc->dev = dev; sc->msi_count = 0; @@ -618,6 +629,11 @@ cxgb_controller_attach(device_t dev) G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers), G_FW_VERSION_MICRO(vers)); + snprintf(buf, sizeof(buf), "%s\t E/C: %s S/N: %s", + ai->desc, + sc->params.vpd.ec, sc->params.vpd.sn); + device_set_desc_copy(dev, buf); + device_printf(sc->dev, "Firmware Version %s\n", &sc->fw_version[0]); callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); t3_add_attach_sysctls(sc); @@ -934,7 +950,7 @@ cxgb_port_attach(device_t dev) ifp->if_timer = 0; /* Disable ifnet watchdog */ ifp->if_watchdog = NULL; - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_drv_maxlen = cxgb_snd_queue_len; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 01:48:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2A231065670; Sat, 22 Nov 2008 01:48:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C59CA8FC0C; Sat, 22 Nov 2008 01:48:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAM1mKjg002424; Sat, 22 Nov 2008 01:48:20 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAM1mKvg002423; Sat, 22 Nov 2008 01:48:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811220148.mAM1mKvg002423@svn.freebsd.org> From: Xin LI Date: Sat, 22 Nov 2008 01:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185161 - in stable/7/sys: . dev/bce modules/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 01:48:21 -0000 Author: delphij Date: Sat Nov 22 01:48:20 2008 New Revision: 185161 URL: http://svn.freebsd.org/changeset/base/185161 Log: MFC r185082: Correct a logic error when testing BCE_PHY_SERDES_FLAG. PR: kern/128801 Pointed out by: Adam Morrison Ok'ed by: davidch Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/bce/if_bce.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Sat Nov 22 01:35:59 2008 (r185160) +++ stable/7/sys/dev/bce/if_bce.c Sat Nov 22 01:48:20 2008 (r185161) @@ -2555,7 +2555,7 @@ bce_get_media(struct bce_softc *sc) } else if (BCE_CHIP_BOND_ID(sc) & BCE_CHIP_BOND_ID_SERDES_BIT) sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; - if (sc->bce_phy_flags && BCE_PHY_SERDES_FLAG) { + if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) { sc->bce_flags |= BCE_NO_WOL_FLAG; if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { sc->bce_phy_addr = 2; From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 05:55:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D522106564A; Sat, 22 Nov 2008 05:55:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AF1B8FC0C; Sat, 22 Nov 2008 05:55:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAM5tvIY007805; Sat, 22 Nov 2008 05:55:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAM5tuIJ007781; Sat, 22 Nov 2008 05:55:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811220555.mAM5tuIJ007781@svn.freebsd.org> From: Kip Macy Date: Sat, 22 Nov 2008 05:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 05:55:57 -0000 Author: kmacy Date: Sat Nov 22 05:55:56 2008 New Revision: 185162 URL: http://svn.freebsd.org/changeset/base/185162 Log: - bump __FreeBSD version to reflect added buf_ring, memory barriers, and ifnet functions - add memory barriers to - update drivers to only conditionally define their own - add lockless producer / consumer ring buffer - remove ring buffer implementation from cxgb and update its callers - add if_transmit(struct ifnet *ifp, struct mbuf *m) to ifnet to allow drivers to efficiently manage multiple hardware queues (i.e. not serialize all packets through one ifq) - expose if_qflush to allow drivers to flush any driver managed queues This work was supported by Bitgravity Inc. and Chelsio Inc. Added: head/sys/kern/subr_bufring.c (contents, props changed) head/sys/sys/buf_ring.h (contents, props changed) Modified: head/UPDATING head/sys/amd64/include/atomic.h head/sys/arm/include/atomic.h head/sys/conf/files head/sys/dev/bce/if_bcereg.h head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_multiq.c head/sys/dev/cxgb/cxgb_osdep.h head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgb/sys/cxgb_support.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c head/sys/dev/mxge/if_mxge_var.h head/sys/dev/nxge/xge-osdep.h head/sys/i386/include/atomic.h head/sys/i386/include/xen/xen-os.h head/sys/ia64/include/atomic.h head/sys/net/if.c head/sys/net/if_var.h head/sys/powerpc/include/atomic.h head/sys/sparc64/include/atomic.h head/sys/sun4v/include/atomic.h head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Nov 22 01:48:20 2008 (r185161) +++ head/UPDATING Sat Nov 22 05:55:56 2008 (r185162) @@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20081121: + __FreeBSD_version 800054 adds memory barriers to + , new interfaces to ifnet to facilitate + multiple hardware transmit queues for cards that support + them, and a lock-less ring-buffer implementation to + enable drivers to more efficiently manage queueing of + packets. + 20081117: A new version of ZFS (version 13) has been merged to -HEAD. This version has zpool attribute "listsnapshots" off by Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/amd64/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -32,6 +32,10 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#define mb() __asm__ __volatile__ ("mfence;": : :"memory") +#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") +#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") + /* * Various simple operations on memory, each of which is atomic in the * presence of interrupts and multiple processors. Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/arm/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -47,6 +47,10 @@ #include #endif +#define mb() +#define wmb() +#define rmb() + #ifndef I32_bit #define I32_bit (1 << 7) /* IRQ disable */ #endif Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/conf/files Sat Nov 22 05:55:56 2008 (r185162) @@ -1807,6 +1807,7 @@ kern/subr_acl_posix1e.c standard kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard +kern/subr_bufring.c standard kern/subr_clist.c standard kern/subr_clock.c standard kern/subr_devstat.c standard Modified: head/sys/dev/bce/if_bcereg.h ============================================================================== --- head/sys/dev/bce/if_bcereg.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/bce/if_bcereg.h Sat Nov 22 05:55:56 2008 (r185162) @@ -557,6 +557,8 @@ #endif /* BCE_DEBUG */ + +#if __FreeBSD_version < 800054 #if defined(__i386__) || defined(__amd64__) #define mb() __asm volatile("mfence" ::: "memory") #define wmb() __asm volatile("sfence" ::: "memory") @@ -566,6 +568,7 @@ #define rmb() #define wmb() #endif +#endif /****************************************************************************/ /* Device identification definitions. */ Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/cxgb/cxgb_adapter.h Sat Nov 22 05:55:56 2008 (r185162) @@ -41,6 +41,7 @@ $FreeBSD$ #include #include #include +#include #include #include @@ -258,7 +259,7 @@ struct sge_txq { * mbuf touches */ struct mbuf_head cleanq; - struct buf_ring txq_mr; + struct buf_ring *txq_mr; struct mbuf *immpkt; uint32_t txq_drops; uint32_t txq_skipped; Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/cxgb/cxgb_multiq.c Sat Nov 22 05:55:56 2008 (r185162) @@ -129,7 +129,7 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse return (ENXIO); } txq = &qs->txq[TXQ_ETH]; - err = buf_ring_enqueue(&txq->txq_mr, m); + err = buf_ring_enqueue(txq->txq_mr, m); if (err) { txq->txq_drops++; m_freem(m); @@ -194,14 +194,11 @@ cxgb_dequeue_packet(struct sge_txq *txq, } sc = qs->port->adapter; - m = buf_ring_dequeue(&txq->txq_mr); + m = buf_ring_dequeue_sc(txq->txq_mr); if (m == NULL) return (0); count = 1; - KASSERT(m->m_type == MT_DATA, - ("m=%p is bad mbuf type %d from ring cons=%d prod=%d", m, - m->m_type, txq->txq_mr.br_cons, txq->txq_mr.br_prod)); m_vec[0] = m; if (m->m_pkthdr.tso_segsz > 0 || m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL || (cxgb_pcpu_tx_coalesce == 0)) { @@ -209,14 +206,14 @@ cxgb_dequeue_packet(struct sge_txq *txq, } size = m->m_pkthdr.len; - for (m = buf_ring_peek(&txq->txq_mr); m != NULL; - m = buf_ring_peek(&txq->txq_mr)) { + for (m = buf_ring_peek(txq->txq_mr); m != NULL; + m = buf_ring_peek(txq->txq_mr)) { if (m->m_pkthdr.tso_segsz > 0 || size + m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL) break; - buf_ring_dequeue(&txq->txq_mr); + buf_ring_dequeue_sc(txq->txq_mr); size += m->m_pkthdr.len; m_vec[count++] = m; @@ -367,7 +364,7 @@ cxgb_pcpu_free(struct sge_qset *qs) mtx_lock(&txq->lock); while ((m = mbufq_dequeue(&txq->sendq)) != NULL) m_freem(m); - while ((m = buf_ring_dequeue(&txq->txq_mr)) != NULL) + while ((m = buf_ring_dequeue_sc(txq->txq_mr)) != NULL) m_freem(m); t3_free_tx_desc_all(txq); @@ -429,7 +426,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st initerr = ENXIO; else if (immpkt) { - if (!buf_ring_empty(&txq->txq_mr)) + if (!buf_ring_empty(txq->txq_mr)) initerr = cxgb_pcpu_enqueue_packet_(qs, immpkt); else txq->immpkt = immpkt; @@ -460,7 +457,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st } stopped = isset(&qs->txq_stopped, TXQ_ETH); - flush = (((!buf_ring_empty(&txq->txq_mr) || (!IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) && !stopped) || txq->immpkt); + flush = (((!buf_ring_empty(txq->txq_mr) || (!IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) && !stopped) || txq->immpkt); max_desc = tx_flush ? TX_ETH_Q_SIZE : TX_START_MAX_DESC; if (cxgb_debug) @@ -471,7 +468,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st if ((tx_flush && flush && err == 0) && - (!buf_ring_empty(&txq->txq_mr) || + (!buf_ring_empty(txq->txq_mr) || !IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) { struct thread *td = curthread; @@ -521,7 +518,7 @@ cxgb_pcpu_start(struct ifnet *ifp, struc txq = &qs->txq[TXQ_ETH]; if (((sc->tunq_coalesce == 0) || - (buf_ring_count(&txq->txq_mr) >= TX_WR_COUNT_MAX) || + (buf_ring_count(txq->txq_mr) >= TX_WR_COUNT_MAX) || (cxgb_pcpu_tx_coalesce == 0)) && mtx_trylock(&txq->lock)) { if (cxgb_debug) printf("doing immediate transmit\n"); @@ -529,12 +526,12 @@ cxgb_pcpu_start(struct ifnet *ifp, struc txq->flags |= TXQ_TRANSMITTING; err = cxgb_pcpu_start_(qs, immpkt, FALSE); txq->flags &= ~TXQ_TRANSMITTING; - resid = (buf_ring_count(&txq->txq_mr) > 64) || (desc_reclaimable(txq) > 64); + resid = (buf_ring_count(txq->txq_mr) > 64) || (desc_reclaimable(txq) > 64); mtx_unlock(&txq->lock); } else if (immpkt) { if (cxgb_debug) printf("deferred coalesce=%jx ring_count=%d mtx_owned=%d\n", - sc->tunq_coalesce, buf_ring_count(&txq->txq_mr), mtx_owned(&txq->lock)); + sc->tunq_coalesce, buf_ring_count(txq->txq_mr), mtx_owned(&txq->lock)); err = cxgb_pcpu_enqueue_packet_(qs, immpkt); } @@ -586,7 +583,7 @@ cxgb_pcpu_start_proc(void *arg) if ((qs->port->ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { idleticks = hz; - if (!buf_ring_empty(&txq->txq_mr) || + if (!buf_ring_empty(txq->txq_mr) || !mbufq_empty(&txq->sendq)) cxgb_pcpu_free(qs); goto done; @@ -611,11 +608,13 @@ cxgb_pcpu_start_proc(void *arg) mtx_unlock(&qs->rspq.lock); } #endif - if ((!buf_ring_empty(&txq->txq_mr)) && err == 0) { + if ((!buf_ring_empty(txq->txq_mr)) && err == 0) { +#if 0 if (cxgb_debug) printf("head=%p cons=%d prod=%d\n", txq->sendq.head, txq->txq_mr.br_cons, txq->txq_mr.br_prod); +#endif continue; } done: Modified: head/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- head/sys/dev/cxgb/cxgb_osdep.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/cxgb/cxgb_osdep.h Sat Nov 22 05:55:56 2008 (r185162) @@ -156,9 +156,6 @@ struct t3_mbuf_hdr { #if defined(__i386__) || defined(__amd64__) -#define mb() __asm volatile("mfence":::"memory") -#define rmb() __asm volatile("lfence":::"memory") -#define wmb() __asm volatile("sfence" ::: "memory") #define smp_mb() mb() #define L1_CACHE_BYTES 128 @@ -179,163 +176,11 @@ extern void kdb_backtrace(void); #else /* !i386 && !amd64 */ -#define mb() -#define rmb() -#define wmb() #define smp_mb() #define prefetch(x) #define L1_CACHE_BYTES 32 #endif -struct buf_ring { - caddr_t *br_ring; - volatile uint32_t br_cons; - volatile uint32_t br_prod; - int br_size; - struct mtx br_lock; -}; - -struct buf_ring *buf_ring_alloc(int count, int flags); -void buf_ring_free(struct buf_ring *); - -static __inline int -buf_ring_count(struct buf_ring *mr) -{ - int size = mr->br_size; - uint32_t mask = size - 1; - - return ((size + mr->br_prod - mr->br_cons) & mask); -} - -static __inline int -buf_ring_empty(struct buf_ring *mr) -{ - return (mr->br_cons == mr->br_prod); -} - -static __inline int -buf_ring_full(struct buf_ring *mr) -{ - uint32_t mask; - - mask = mr->br_size - 1; - return (mr->br_cons == ((mr->br_prod + 1) & mask)); -} - -/* - * The producer and consumer are independently locked - * this relies on the consumer providing his own serialization - * - */ -static __inline void * -buf_ring_dequeue(struct buf_ring *mr) -{ - uint32_t prod, cons, mask; - caddr_t *ring, m; - - ring = (caddr_t *)mr->br_ring; - mask = mr->br_size - 1; - cons = mr->br_cons; - mb(); - prod = mr->br_prod; - m = NULL; - if (cons != prod) { - m = ring[cons]; - ring[cons] = NULL; - mr->br_cons = (cons + 1) & mask; - mb(); - } - return (m); -} - -#ifdef DEBUG_BUFRING -static __inline void -__buf_ring_scan(struct buf_ring *mr, void *m, char *file, int line) -{ - int i; - - for (i = 0; i < mr->br_size; i++) - if (m == mr->br_ring[i]) - panic("%s:%d m=%p present prod=%d cons=%d idx=%d", file, - line, m, mr->br_prod, mr->br_cons, i); -} - -static __inline void -buf_ring_scan(struct buf_ring *mr, void *m, char *file, int line) -{ - mtx_lock(&mr->br_lock); - __buf_ring_scan(mr, m, file, line); - mtx_unlock(&mr->br_lock); -} - -#else -static __inline void -__buf_ring_scan(struct buf_ring *mr, void *m, char *file, int line) -{ -} - -static __inline void -buf_ring_scan(struct buf_ring *mr, void *m, char *file, int line) -{ -} -#endif - -static __inline int -__buf_ring_enqueue(struct buf_ring *mr, void *m, char *file, int line) -{ - - uint32_t prod, cons, mask; - int err; - - mask = mr->br_size - 1; - prod = mr->br_prod; - mb(); - cons = mr->br_cons; - __buf_ring_scan(mr, m, file, line); - if (((prod + 1) & mask) != cons) { - KASSERT(mr->br_ring[prod] == NULL, ("overwriting entry")); - mr->br_ring[prod] = m; - mb(); - mr->br_prod = (prod + 1) & mask; - err = 0; - } else - err = ENOBUFS; - - return (err); -} - -static __inline int -buf_ring_enqueue_(struct buf_ring *mr, void *m, char *file, int line) -{ - int err; - - mtx_lock(&mr->br_lock); - err = __buf_ring_enqueue(mr, m, file, line); - mtx_unlock(&mr->br_lock); - - return (err); -} - -#define buf_ring_enqueue(mr, m) buf_ring_enqueue_((mr), (m), __FILE__, __LINE__) - - -static __inline void * -buf_ring_peek(struct buf_ring *mr) -{ - int prod, cons, mask; - caddr_t *ring, m; - - ring = (caddr_t *)mr->br_ring; - mask = mr->br_size - 1; - cons = mr->br_cons; - prod = mr->br_prod; - m = NULL; - if (cons != prod) - m = ring[cons]; - - return (m); -} - #define DBG_RX (1 << 0) static const int debug_flags = DBG_RX; Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/cxgb/cxgb_sge.c Sat Nov 22 05:55:56 2008 (r185162) @@ -1719,10 +1719,8 @@ t3_free_qset(adapter_t *sc, struct sge_q t3_free_tx_desc_all(&q->txq[TXQ_ETH]); for (i = 0; i < SGE_TXQ_PER_SET; i++) - if (q->txq[i].txq_mr.br_ring != NULL) { - free(q->txq[i].txq_mr.br_ring, M_DEVBUF); - mtx_destroy(&q->txq[i].txq_mr.br_lock); - } + if (q->txq[i].txq_mr != NULL) + buf_ring_free(q->txq[i].txq_mr, M_DEVBUF); for (i = 0; i < SGE_RXQ_PER_SET; ++i) { if (q->fl[i].desc) { mtx_lock_spin(&sc->sge.reg_lock); @@ -1885,7 +1883,6 @@ t3_free_tx_desc(struct sge_txq *q, int r txsd->flags &= ~TX_SW_DESC_MAPPED; } m_freem_iovec(&txsd->mi); - buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__); txsd->mi.mi_base = NULL; /* * XXX check for cache hit rate here @@ -2285,14 +2282,12 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i int i, header_size, ret = 0; for (i = 0; i < SGE_TXQ_PER_SET; i++) { - if ((q->txq[i].txq_mr.br_ring = malloc(cxgb_txq_buf_ring_size*sizeof(struct mbuf *), - M_DEVBUF, M_WAITOK|M_ZERO)) == NULL) { + + if ((q->txq[i].txq_mr = buf_ring_alloc(cxgb_txq_buf_ring_size, + M_DEVBUF, M_WAITOK, &q->txq[i].lock)) == NULL) { device_printf(sc->dev, "failed to allocate mbuf ring\n"); goto err; } - q->txq[i].txq_mr.br_prod = q->txq[i].txq_mr.br_cons = 0; - q->txq[i].txq_mr.br_size = cxgb_txq_buf_ring_size; - mtx_init(&q->txq[i].txq_mr.br_lock, "txq mbuf ring", NULL, MTX_DEF); } init_qset_cntxt(q, id); @@ -3509,12 +3504,14 @@ t3_add_configured_sysctls(adapter_t *sc) SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "sendqlen", CTLFLAG_RD, &qs->txq[TXQ_ETH].sendq.qlen, 0, "#tunneled packets waiting to be sent"); +#if 0 SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "queue_pidx", CTLFLAG_RD, (uint32_t *)(uintptr_t)&qs->txq[TXQ_ETH].txq_mr.br_prod, 0, "#tunneled packets queue producer index"); SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "queue_cidx", CTLFLAG_RD, (uint32_t *)(uintptr_t)&qs->txq[TXQ_ETH].txq_mr.br_cons, 0, "#tunneled packets queue consumer index"); +#endif SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "processed", CTLFLAG_RD, &qs->txq[TXQ_ETH].processed, 0, "#tunneled packets processed by the card"); Modified: head/sys/dev/cxgb/sys/cxgb_support.c ============================================================================== --- head/sys/dev/cxgb/sys/cxgb_support.c Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/cxgb/sys/cxgb_support.c Sat Nov 22 05:55:56 2008 (r185162) @@ -303,33 +303,3 @@ free: uma_zfree(zone, vec[i]); } -struct buf_ring * -buf_ring_alloc(int count, int flags) -{ - struct buf_ring *br; - - KASSERT(powerof2(count), ("buf ring must be size power of 2")); - - br = malloc(sizeof(struct buf_ring), M_DEVBUF, flags|M_ZERO); - if (br == NULL) - return (NULL); - - br->br_ring = malloc(sizeof(caddr_t)*count, M_DEVBUF, flags|M_ZERO); - if (br->br_ring == NULL) { - free(br, M_DEVBUF); - return (NULL); - } - - mtx_init(&br->br_lock, "buf ring", NULL, MTX_DUPOK|MTX_DEF); - br->br_size = count; - br->br_prod = br->br_cons = 0; - - return (br); -} - -void -buf_ring_free(struct buf_ring *br) -{ - free(br->br_ring, M_DEVBUF); - free(br, M_DEVBUF); -} Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c Sat Nov 22 05:55:56 2008 (r185162) @@ -90,7 +90,7 @@ static int __cxio_init_resource_fifo(str u32 rarray[16]; mtx_init(fifo_lock, "cxio fifo", NULL, MTX_DEF|MTX_DUPOK); - *fifo = buf_ring_alloc(nr, M_NOWAIT); + *fifo = buf_ring_alloc(nr, M_DEVBUF, M_NOWAIT, fifo_lock); if (*fifo == NULL) return (-ENOMEM); #if 0 @@ -122,7 +122,7 @@ static int __cxio_init_resource_fifo(str buf_ring_enqueue(*fifo, (void *) (uintptr_t)i); #if 0 for (i = 0; i < skip_low + skip_high; i++) - buf_ring_dequeue(*fifo); + buf_ring_dequeue_sc(*fifo); #endif return 0; } @@ -149,7 +149,8 @@ static int cxio_init_qpid_fifo(struct cx mtx_init(&rdev_p->rscp->qpid_fifo_lock, "qpid fifo", NULL, MTX_DEF); - rdev_p->rscp->qpid_fifo = buf_ring_alloc(T3_MAX_NUM_QP, M_NOWAIT); + rdev_p->rscp->qpid_fifo = buf_ring_alloc(T3_MAX_NUM_QP, M_DEVBUF, + M_NOWAIT, &rdev_p->rscp->qpid_fifo_lock); if (rdev_p->rscp->qpid_fifo == NULL) return (-ENOMEM); @@ -168,7 +169,7 @@ int cxio_hal_init_rhdl_resource(u32 nr_r void cxio_hal_destroy_rhdl_resource(void) { - buf_ring_free(rhdl_fifo); + buf_ring_free(rhdl_fifo, M_DEVBUF); } #endif @@ -202,11 +203,11 @@ int cxio_hal_init_resource(struct cxio_r goto pdid_err; return 0; pdid_err: - buf_ring_free(rscp->cqid_fifo); + buf_ring_free(rscp->cqid_fifo, M_DEVBUF); cqid_err: - buf_ring_free(rscp->qpid_fifo); + buf_ring_free(rscp->qpid_fifo, M_DEVBUF); qpid_err: - buf_ring_free(rscp->tpt_fifo); + buf_ring_free(rscp->tpt_fifo, M_DEVBUF); tpt_err: return (-ENOMEM); } @@ -219,7 +220,7 @@ static u32 cxio_hal_get_resource(struct u32 entry; mtx_lock(lock); - entry = (u32)(uintptr_t)buf_ring_dequeue(fifo); + entry = (u32)(uintptr_t)buf_ring_dequeue_sc(fifo); mtx_unlock(lock); return entry; } @@ -276,10 +277,10 @@ void cxio_hal_put_pdid(struct cxio_hal_r void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp) { - buf_ring_free(rscp->tpt_fifo); - buf_ring_free(rscp->cqid_fifo); - buf_ring_free(rscp->qpid_fifo); - buf_ring_free(rscp->pdid_fifo); + buf_ring_free(rscp->tpt_fifo, M_DEVBUF); + buf_ring_free(rscp->cqid_fifo, M_DEVBUF); + buf_ring_free(rscp->qpid_fifo, M_DEVBUF); + buf_ring_free(rscp->pdid_fifo, M_DEVBUF); free(rscp, M_DEVBUF); } Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/mxge/if_mxge_var.h Sat Nov 22 05:55:56 2008 (r185162) @@ -279,6 +279,8 @@ struct mxge_media_type /* implement our own memory barriers, since bus_space_barrier cannot handle write-combining regions */ +#if __FreeBSD_version < 800053 + #if defined (__GNUC__) #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ #define mb() __asm__ __volatile__ ("sfence;": : :"memory") @@ -293,6 +295,8 @@ struct mxge_media_type #error "unknown compiler" #endif +#endif + static inline void mxge_pio_copy(volatile void *to_v, void *from_v, size_t size) { Modified: head/sys/dev/nxge/xge-osdep.h ============================================================================== --- head/sys/dev/nxge/xge-osdep.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/dev/nxge/xge-osdep.h Sat Nov 22 05:55:56 2008 (r185162) @@ -242,8 +242,12 @@ typedef xge_pci_info_t *pci_ mtx_unlock_flags(lockp, flags); \ } +#if __FreeBSD_version > 800053 /* Write memory barrier */ +#define xge_os_wmb() wmb() +#else #define xge_os_wmb() +#endif /* Delay (in micro seconds) */ #define xge_os_udelay(us) DELAY(us) Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/i386/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -32,6 +32,21 @@ #error this file needs sys/cdefs.h as a prerequisite #endif + +#if defined(I686_CPU) +#define mb() __asm__ __volatile__ ("mfence;": : :"memory") +#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") +#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") +#else +/* + * do we need a serializing instruction? + */ +#define mb() +#define wmb() +#define rmb() +#endif + + /* * Various simple operations on memory, each of which is atomic in the * presence of interrupts and multiple processors. Modified: head/sys/i386/include/xen/xen-os.h ============================================================================== --- head/sys/i386/include/xen/xen-os.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/i386/include/xen/xen-os.h Sat Nov 22 05:55:56 2008 (r185162) @@ -165,15 +165,6 @@ do { #define spin_unlock_irqrestore mtx_unlock_irqrestore -#ifndef mb -#define mb() __asm__ __volatile__("lock; addl $0, 0(%%esp)": : :"memory") -#endif -#ifndef rmb -#define rmb() mb() -#endif -#ifndef wmb -#define wmb() barrier() -#endif #ifdef SMP #define smp_mb() mb() #define smp_rmb() rmb() Modified: head/sys/ia64/include/atomic.h ============================================================================== --- head/sys/ia64/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/ia64/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -29,6 +29,10 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ +#define mb() +#define wmb() +#define rmb() + /* * Various simple arithmetic on memory which is atomic in the presence * of interrupts and SMP safe. Added: head/sys/kern/subr_bufring.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_bufring.c Sat Nov 22 05:55:56 2008 (r185162) @@ -0,0 +1,68 @@ +/************************************************************************** + * + * Copyright (c) 2007,2008 Kip Macy kmacy@freebsd.org + * 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. The name of Kip Macy nor the names of other + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + * + * + ***************************************************************************/ +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#include +#include +#include +#include + + +struct buf_ring * +buf_ring_alloc(int count, struct malloc_type *type, int flags, struct mtx *lock) +{ + struct buf_ring *br; + + KASSERT(powerof2(count), ("buf ring must be size power of 2")); + + br = malloc(sizeof(struct buf_ring) + count*sizeof(caddr_t), + type, flags|M_ZERO); + if (br == NULL) + return (NULL); +#ifdef DEBUG_BUFRING + br->br_lock = lock; +#endif + br->br_prod_size = br->br_cons_size = count; + br->br_prod_mask = br->br_cons_mask = count-1; + br->br_prod_head = br->br_cons_head = 0; + br->br_prod_tail = br->br_cons_tail = 0; + + return (br); +} + +void +buf_ring_free(struct buf_ring *br, struct malloc_type *type) +{ + free(br, type); +} Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/net/if.c Sat Nov 22 05:55:56 2008 (r185162) @@ -113,10 +113,11 @@ static int ifconf(u_long, caddr_t); static void if_freemulti(struct ifmultiaddr *); static void if_grow(void); static void if_init(void *); -static void if_qflush(struct ifaltq *); +static void if_qflush(struct ifnet *); static void if_route(struct ifnet *, int flag, int fam); static int if_setflag(struct ifnet *, int, int, int *, int); static void if_slowtimo(void *); +static int if_transmit(struct ifnet *ifp, struct mbuf *m); static void if_unroute(struct ifnet *, int flag, int fam); static void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *); static int if_rtdel(struct radix_node *, void *); @@ -126,6 +127,7 @@ static void if_start_deferred(void *cont static void do_link_state_change(void *, int); static int if_getgroup(struct ifgroupreq *, struct ifnet *); static int if_getgroupmembers(struct ifgroupreq *); + #ifdef INET6 /* * XXX: declare here to avoid to include many inet6 related files.. @@ -481,6 +483,28 @@ if_free_type(struct ifnet *ifp, u_char t free(ifp, M_IFNET); }; +void +ifq_attach(struct ifaltq *ifq, struct ifnet *ifp) +{ + + mtx_init(&ifq->ifq_mtx, ifp->if_xname, "if send queue", MTX_DEF); + + if (ifq->ifq_maxlen == 0) + ifq->ifq_maxlen = ifqmaxlen; + + ifq->altq_type = 0; + ifq->altq_disc = NULL; + ifq->altq_flags &= ALTQF_CANTCHANGE; + ifq->altq_tbr = NULL; + ifq->altq_ifp = ifp; +} + +void +ifq_detach(struct ifaltq *ifq) +{ + mtx_destroy(&ifq->ifq_mtx); +} + /* * Perform generic interface initalization tasks and attach the interface * to the list of "active" interfaces. @@ -522,7 +546,8 @@ if_attach(struct ifnet *ifp) getmicrotime(&ifp->if_lastchange); ifp->if_data.ifi_epoch = time_uptime; ifp->if_data.ifi_datalen = sizeof(struct if_data); - + ifp->if_transmit = if_transmit; + ifp->if_qflush = if_qflush; #ifdef MAC mac_ifnet_init(ifp); mac_ifnet_create(ifp); @@ -534,7 +559,7 @@ if_attach(struct ifnet *ifp) make_dev_alias(ifdev_byindex(ifp->if_index), "%s%d", net_cdevsw.d_name, ifp->if_index); - mtx_init(&ifp->if_snd.ifq_mtx, ifp->if_xname, "if send queue", MTX_DEF); + ifq_attach(&ifp->if_snd, ifp); /* * create a Link Level name for this device @@ -572,19 +597,6 @@ if_attach(struct ifnet *ifp) TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); ifp->if_broadcastaddr = NULL; /* reliably crash if used uninitialized */ - /* - * XXX: why do we warn about this? We're correcting it and most - * drivers just set the value the way we do. - */ - if (ifp->if_snd.ifq_maxlen == 0) { - if_printf(ifp, "XXX: driver didn't set ifq_maxlen\n"); - ifp->if_snd.ifq_maxlen = ifqmaxlen; - } - ifp->if_snd.altq_type = 0; - ifp->if_snd.altq_disc = NULL; - ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE; - ifp->if_snd.altq_tbr = NULL; - ifp->if_snd.altq_ifp = ifp; IFNET_WLOCK(); TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link); @@ -826,7 +838,7 @@ if_detach(struct ifnet *ifp) KNOTE_UNLOCKED(&ifp->if_klist, NOTE_EXIT); knlist_clear(&ifp->if_klist, 0); knlist_destroy(&ifp->if_klist); - mtx_destroy(&ifp->if_snd.ifq_mtx); + ifq_detach(&ifp->if_snd); IF_AFDATA_DESTROY(ifp); splx(s); } @@ -1377,7 +1389,8 @@ if_unroute(struct ifnet *ifp, int flag, TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); - if_qflush(&ifp->if_snd); + ifp->if_qflush(ifp); + #ifdef DEV_CARP if (ifp->if_carp) carp_carpdev_state(ifp->if_carp); @@ -1507,10 +1520,12 @@ if_up(struct ifnet *ifp) * Flush an interface queue. */ static void -if_qflush(struct ifaltq *ifq) +if_qflush(struct ifnet *ifp) { struct mbuf *m, *n; - + struct ifaltq *ifq; + + ifq = &ifp->if_snd; IFQ_LOCK(ifq); #ifdef ALTQ if (ALTQ_IS_ENABLED(ifq)) @@ -2801,6 +2816,19 @@ if_start_deferred(void *context, int pen (ifp->if_start)(ifp); } +/* + * Backwards compatibility interface for drivers + * that have not implemented it + */ +static int +if_transmit(struct ifnet *ifp, struct mbuf *m) +{ + int error; + + IFQ_HANDOFF(ifp, m, error); + return (error); +} + int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust) { Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/net/if_var.h Sat Nov 22 05:55:56 2008 (r185162) @@ -186,7 +186,11 @@ struct ifnet { /* protected by if_addr_mtx */ void *if_pf_kif; void *if_lagg; /* lagg glue */ - void *if_pspare[10]; /* multiq/TOE 3; vimage 3; general use 4 */ + void *if_pspare[8]; /* multiq/TOE 3; vimage 3; general use 4 */ + void (*if_qflush) /* flush any queues */ + (struct ifnet *); + int (*if_transmit) /* initiate output routine */ + (struct ifnet *, struct mbuf *); int if_ispare[2]; /* general use 2 */ }; @@ -686,6 +690,9 @@ int ifioctl(struct socket *, u_long, cad int ifpromisc(struct ifnet *, int); struct ifnet *ifunit(const char *); +void ifq_attach(struct ifaltq *, struct ifnet *ifp); +void ifq_detach(struct ifaltq *); + struct ifaddr *ifa_ifwithaddr(struct sockaddr *); struct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *); struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *); Modified: head/sys/powerpc/include/atomic.h ============================================================================== --- head/sys/powerpc/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/powerpc/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -39,6 +39,10 @@ #define __ATOMIC_BARRIER \ __asm __volatile("sync" : : : "memory") +#define mb() __ATOMIC_BARRIER +#define wmb() mb() +#define rmb() mb() + /* * atomic_add(p, v) * { *p += v; } Modified: head/sys/sparc64/include/atomic.h ============================================================================== --- head/sys/sparc64/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/sparc64/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -40,6 +40,10 @@ #define __ASI_ATOMIC ASI_P #endif +#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") +#define wmb() mb() +#define rmb() mb() + /* * Various simple arithmetic on memory which is atomic in the presence * of interrupts and multiple processors. See atomic(9) for details. Modified: head/sys/sun4v/include/atomic.h ============================================================================== --- head/sys/sun4v/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) +++ head/sys/sun4v/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) @@ -33,6 +33,10 @@ #include +#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") +#define wmb() mb() +#define rmb() mb() + /* Userland needs different ASI's. */ #ifdef _KERNEL #define __ASI_ATOMIC ASI_N Added: head/sys/sys/buf_ring.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/buf_ring.h Sat Nov 22 05:55:56 2008 (r185162) @@ -0,0 +1,250 @@ +/************************************************************************** + * + * Copyright (c) 2007,2008 Kip Macy kmacy@freebsd.org + * 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. The name of Kip Macy nor the names of other + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + * + * $FreeBSD$ + * + ***************************************************************************/ + +#ifndef _SYS_BUF_RING_H_ +#define _SYS_BUF_RING_H_ + +#include + +#if defined(INVARIANTS) && !defined(DEBUG_BUFRING) +#define DEBUG_BUFRING 1 +#endif + +#ifdef DEBUG_BUFRING +#include +#include +#endif + +struct buf_ring { + volatile uint32_t br_prod_head; + volatile uint32_t br_prod_tail; + int br_prod_size; + int br_prod_mask; + /* + * Pad out to next L2 cache line + */ + uint64_t _pad0[14]; + + volatile uint32_t br_cons_head; + volatile uint32_t br_cons_tail; + int br_cons_size; + int br_cons_mask; + + /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 06:56:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D78531065686; Sat, 22 Nov 2008 06:56:49 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C57038FC1B; Sat, 22 Nov 2008 06:56:49 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAM6unAN009088; Sat, 22 Nov 2008 06:56:49 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAM6unB5009087; Sat, 22 Nov 2008 06:56:49 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811220656.mAM6unB5009087@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 22 Nov 2008 06:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185163 - head/sys/ia64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 06:56:50 -0000 Author: marcel Date: Sat Nov 22 06:56:49 2008 New Revision: 185163 URL: http://svn.freebsd.org/changeset/base/185163 Log: Define mb(), rmb() and wmb() for real. Modified: head/sys/ia64/include/atomic.h Modified: head/sys/ia64/include/atomic.h ============================================================================== --- head/sys/ia64/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) +++ head/sys/ia64/include/atomic.h Sat Nov 22 06:56:49 2008 (r185163) @@ -29,9 +29,9 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ -#define mb() -#define wmb() -#define rmb() +#define mb() __asm __volatile("mf") +#define wmb() mb() +#define rmb() mb() /* * Various simple arithmetic on memory which is atomic in the presence From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 07:35:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60D9D106564A; Sat, 22 Nov 2008 07:35:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C3E88FC12; Sat, 22 Nov 2008 07:35:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAM7ZjD6009905; Sat, 22 Nov 2008 07:35:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAM7Zjwo009895; Sat, 22 Nov 2008 07:35:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811220735.mAM7Zjwo009895@svn.freebsd.org> From: Kip Macy Date: Sat, 22 Nov 2008 07:35:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185164 - in head/sys: net net80211 netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 07:35:46 -0000 Author: kmacy Date: Sat Nov 22 07:35:45 2008 New Revision: 185164 URL: http://svn.freebsd.org/changeset/base/185164 Log: convert calls to IFQ_HANDOFF to if_transmit Modified: head/sys/net/if_ethersubr.c head/sys/net/if_fddisubr.c head/sys/net/if_fwsubr.c head/sys/net/if_lagg.c head/sys/net/if_tun.c head/sys/net/if_vlan.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_wds.c head/sys/netgraph/ng_iface.c Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net/if_ethersubr.c Sat Nov 22 07:35:45 2008 (r185164) @@ -393,7 +393,6 @@ bad: if (m != NULL) int ether_output_frame(struct ifnet *ifp, struct mbuf *m) { - int error; #if defined(INET) || defined(INET6) INIT_VNET_NET(ifp->if_vnet); struct ip_fw *rule = ip_dn_claim_rule(m); @@ -413,8 +412,7 @@ ether_output_frame(struct ifnet *ifp, st * Queue message on interface, update output statistics if * successful, and start output if interface not yet active. */ - IFQ_HANDOFF(ifp, m, error); - return (error); + return ((ifp->if_transmit)(ifp, m)); } #if defined(INET) || defined(INET6) Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net/if_fddisubr.c Sat Nov 22 07:35:45 2008 (r185164) @@ -335,7 +335,7 @@ fddi_output(ifp, m, dst, rt0) } } - IFQ_HANDOFF(ifp, m, error); + error = (ifp->if_transmit)(ifp, m); if (error) ifp->if_oerrors++; Modified: head/sys/net/if_fwsubr.c ============================================================================== --- head/sys/net/if_fwsubr.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net/if_fwsubr.c Sat Nov 22 07:35:45 2008 (r185164) @@ -249,7 +249,7 @@ firewire_output(struct ifnet *ifp, struc */ enc->ul[0] = htonl(enc->ul[0]); - IFQ_HANDOFF(ifp, m, error); + error = (ifp->if_transmit)(ifp, m); return (error); } else { /* @@ -309,7 +309,7 @@ firewire_output(struct ifnet *ifp, struc enc->ul[0] = htonl(enc->ul[0]); enc->ul[1] = htonl(enc->ul[1]); - IFQ_HANDOFF(ifp, m, error); + error = (ifp->if_transmit)(ifp, m); if (error) { if (mtail) m_freem(mtail); Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net/if_lagg.c Sat Nov 22 07:35:45 2008 (r185164) @@ -1370,10 +1370,8 @@ out: int lagg_enqueue(struct ifnet *ifp, struct mbuf *m) { - int error = 0; - IFQ_HANDOFF(ifp, m, error); - return (error); + return (ifp->if_transmit)(ifp, m); } /* Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net/if_tun.c Sat Nov 22 07:35:45 2008 (r185164) @@ -657,7 +657,7 @@ tunoutput( } } - IFQ_HANDOFF(ifp, m0, error); + error = (ifp->if_transmit)(ifp, m0); if (error) { ifp->if_collisions++; return (ENOBUFS); Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net/if_vlan.c Sat Nov 22 07:35:45 2008 (r185164) @@ -868,7 +868,7 @@ vlan_start(struct ifnet *ifp) * Send it, precisely as ether_output() would have. * We are already running at splimp. */ - IFQ_HANDOFF(p, m, error); + error = (p->if_transmit)(p, m); if (!error) ifp->if_opackets++; else Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net80211/ieee80211_hostap.c Sat Nov 22 07:35:45 2008 (r185164) @@ -355,7 +355,7 @@ hostap_deliver_data(struct ieee80211vap if (mcopy != NULL) { int len, err; len = mcopy->m_pkthdr.len; - IFQ_HANDOFF(ifp, mcopy, err); + err = (ifp->if_transmit)(ifp, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mcopy */ } else { Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net80211/ieee80211_output.c Sat Nov 22 07:35:45 2008 (r185164) @@ -268,7 +268,7 @@ ieee80211_start(struct ifnet *ifp) m->m_pkthdr.rcvif = (void *)ni; /* XXX defer if_start calls? */ - IFQ_HANDOFF(parent, m, error); + error = (parent->if_transmit)(parent, m); if (error != 0) { /* NB: IFQ_HANDOFF reclaims mbuf */ ieee80211_free_node(ni); Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/net80211/ieee80211_wds.c Sat Nov 22 07:35:45 2008 (r185164) @@ -278,7 +278,7 @@ ieee80211_dwds_mcast(struct ieee80211vap mcopy->m_flags |= M_MCAST | M_WDS; mcopy->m_pkthdr.rcvif = (void *) ni; - IFQ_HANDOFF(parent, mcopy, err); + err = (parent->if_transmit)(parent, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mbuf */ ifp->if_oerrors++; Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Sat Nov 22 06:56:49 2008 (r185163) +++ head/sys/netgraph/ng_iface.c Sat Nov 22 07:35:45 2008 (r185164) @@ -383,7 +383,7 @@ ng_iface_output(struct ifnet *ifp, struc return (ENOBUFS); } *(sa_family_t *)m->m_data = dst->sa_family; - IFQ_HANDOFF(ifp, m, error); + error = (ifp->if_transmit)(ifp, m); } else error = ng_iface_send(ifp, m, dst->sa_family); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 08:05:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B9081065672; Sat, 22 Nov 2008 08:05:05 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8527F8FC12; Sat, 22 Nov 2008 08:05:05 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAM855Ha010510; Sat, 22 Nov 2008 08:05:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAM855Qs010505; Sat, 22 Nov 2008 08:05:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811220805.mAM855Qs010505@svn.freebsd.org> From: Kip Macy Date: Sat, 22 Nov 2008 08:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185165 - head/sys/dev/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 08:05:05 -0000 Author: kmacy Date: Sat Nov 22 08:05:05 2008 New Revision: 185165 URL: http://svn.freebsd.org/changeset/base/185165 Log: - enable multiple transmit queues - invert sense of hw.cxgb.singleq tunable to hw.cxgb.multiq - don't wake up transmitting thread by default - add per tx queue ifaltq to handle ALTQ - remove several unused functions in cxgb_multiq.c - add several sysctls: multiq_tx_enable, coalesce_tx_enable, and wakeup_tx_thread - this obsoletes the hw.cxgb.snd_queue_len as ifq is replaced by a buf_ring Modified: head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_config.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_multiq.c head/sys/dev/cxgb/cxgb_sge.c Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Sat Nov 22 07:35:45 2008 (r185164) +++ head/sys/dev/cxgb/cxgb_adapter.h Sat Nov 22 08:05:05 2008 (r185165) @@ -260,7 +260,9 @@ struct sge_txq { */ struct mbuf_head cleanq; struct buf_ring *txq_mr; + struct ifaltq *txq_ifq; struct mbuf *immpkt; + uint32_t txq_drops; uint32_t txq_skipped; uint32_t txq_coalesced; @@ -604,7 +606,7 @@ static inline int offload_running(adapte } int cxgb_pcpu_enqueue_packet(struct ifnet *ifp, struct mbuf *m); -int cxgb_pcpu_start(struct ifnet *ifp, struct mbuf *m); +int cxgb_pcpu_transmit(struct ifnet *ifp, struct mbuf *m); void cxgb_pcpu_shutdown_threads(struct adapter *sc); void cxgb_pcpu_startup_threads(struct adapter *sc); Modified: head/sys/dev/cxgb/cxgb_config.h ============================================================================== --- head/sys/dev/cxgb/cxgb_config.h Sat Nov 22 07:35:45 2008 (r185164) +++ head/sys/dev/cxgb/cxgb_config.h Sat Nov 22 08:05:05 2008 (r185165) @@ -32,6 +32,7 @@ $FreeBSD$ #ifndef _CXGB_CONFIG_H_ #define _CXGB_CONFIG_H_ -#define CONFIG_CHELSIO_T3_CORE +#define CONFIG_CHELSIO_T3_CORE +#define IFNET_MULTIQUEUE #endif Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Sat Nov 22 07:35:45 2008 (r185164) +++ head/sys/dev/cxgb/cxgb_main.c Sat Nov 22 08:05:05 2008 (r185165) @@ -206,17 +206,17 @@ SYSCTL_UINT(_hw_cxgb, OID_AUTO, ofld_dis /* * The driver uses an auto-queue algorithm by default. - * To disable it and force a single queue-set per port, use singleq = 1. + * To disable it and force a single queue-set per port, use multiq = 0 */ -static int singleq = 0; -TUNABLE_INT("hw.cxgb.singleq", &singleq); -SYSCTL_UINT(_hw_cxgb, OID_AUTO, singleq, CTLFLAG_RDTUN, &singleq, 0, - "use a single queue-set per port"); - +static int multiq = 1; +TUNABLE_INT("hw.cxgb.multiq", &multiq); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, multiq, CTLFLAG_RDTUN, &multiq, 0, + "use min(ncpus/ports, 8) queue-sets per port"); /* - * The driver uses an auto-queue algorithm by default. - * To disable it and force a single queue-set per port, use singleq = 1. + * By default the driver will not update the firmware unless + * it was compiled against a newer version + * */ static int force_fw_update = 0; TUNABLE_INT("hw.cxgb.force_fw_update", &force_fw_update); @@ -228,15 +228,6 @@ TUNABLE_INT("hw.cxgb.use_16k_clusters", SYSCTL_UINT(_hw_cxgb, OID_AUTO, use_16k_clusters, CTLFLAG_RDTUN, &cxgb_use_16k_clusters, 0, "use 16kB clusters for the jumbo queue "); -/* - * Tune the size of the output queue. - */ -int cxgb_snd_queue_len = IFQ_MAXLEN; -TUNABLE_INT("hw.cxgb.snd_queue_len", &cxgb_snd_queue_len); -SYSCTL_UINT(_hw_cxgb, OID_AUTO, snd_queue_len, CTLFLAG_RDTUN, - &cxgb_snd_queue_len, 0, "send queue size "); - - enum { MAX_TXQ_ENTRIES = 16384, MAX_CTRL_TXQ_ENTRIES = 1024, @@ -368,8 +359,8 @@ cxgb_controller_probe(device_t dev) ports = "ports"; snprintf(buf, sizeof(buf), "%s %sNIC, rev: %d nports: %d %s", - ai->desc, is_offload(sc) ? "R" : "", - sc->params.rev, nports, ports); + ai->desc, is_offload(sc) ? "R" : "", + sc->params.rev, nports, ports); device_set_desc_copy(dev, buf); return (BUS_PROBE_DEFAULT); } @@ -415,8 +406,6 @@ cxgb_controller_attach(device_t dev) int msi_needed, reg; #endif int must_load = 0; - char buf[80]; - sc = device_get_softc(dev); sc->dev = dev; sc->msi_count = 0; @@ -537,7 +526,7 @@ cxgb_controller_attach(device_t dev) sc->cxgb_intr = t3b_intr; } - if ((sc->flags & USING_MSIX) && !singleq) + if ((sc->flags & USING_MSIX) && multiq) port_qsets = min((SGE_QSETS/(sc)->params.nports), mp_ncpus); /* Create a private taskqueue thread for handling driver events */ @@ -629,11 +618,6 @@ cxgb_controller_attach(device_t dev) G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers), G_FW_VERSION_MICRO(vers)); - snprintf(buf, sizeof(buf), "%s\t E/C: %s S/N: %s", - ai->desc, - sc->params.vpd.ec, sc->params.vpd.sn); - device_set_desc_copy(dev, buf); - device_printf(sc->dev, "Firmware Version %s\n", &sc->fw_version[0]); callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); t3_add_attach_sysctls(sc); @@ -843,15 +827,18 @@ cxgb_setup_msix(adapter_t *sc, int msix_ device_printf(sc->dev, "Cannot set up " "interrupt for message %d\n", rid); return (EINVAL); + } +#if 0 #ifdef IFNET_MULTIQUEUE - if (singleq == 0) { + if (multiq) { int vector = rman_get_start(sc->msix_irq_res[k]); if (bootverbose) device_printf(sc->dev, "binding vector=%d to cpu=%d\n", vector, k % mp_ncpus); intr_bind(vector, k % mp_ncpus); } -#endif +#endif +#endif } } @@ -941,16 +928,11 @@ cxgb_port_attach(device_t dev) ifp->if_ioctl = cxgb_ioctl; ifp->if_start = cxgb_start; -#if 0 -#ifdef IFNET_MULTIQUEUE - ifp->if_flags |= IFF_MULTIQ; - ifp->if_mq_start = cxgb_pcpu_start; -#endif -#endif + ifp->if_timer = 0; /* Disable ifnet watchdog */ ifp->if_watchdog = NULL; - ifp->if_snd.ifq_drv_maxlen = cxgb_snd_queue_len; + ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); @@ -968,6 +950,8 @@ cxgb_port_attach(device_t dev) } ether_ifattach(ifp, p->hw_addr); + + ifp->if_transmit = cxgb_pcpu_transmit; /* * Only default to jumbo frames on 10GigE */ Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Sat Nov 22 07:35:45 2008 (r185164) +++ head/sys/dev/cxgb/cxgb_multiq.c Sat Nov 22 08:05:05 2008 (r185165) @@ -27,8 +27,6 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -#define DEBUG_BUFRING - #include __FBSDID("$FreeBSD$"); @@ -89,12 +87,11 @@ __FBSDID("$FreeBSD$"); #include extern int txq_fills; -extern struct sysctl_oid_list sysctl__hw_cxgb_children; -static int cxgb_pcpu_tx_coalesce = 0; -TUNABLE_INT("hw.cxgb.tx_coalesce", &cxgb_pcpu_tx_coalesce); -SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce, CTLFLAG_RDTUN, &cxgb_pcpu_tx_coalesce, 0, - "coalesce small packets into a single work request"); +int multiq_tx_enable = 1; +int coalesce_tx_enable = 0; +int wakeup_tx_thread = 0; +extern struct sysctl_oid_list sysctl__hw_cxgb_children; static int sleep_ticks = 1; TUNABLE_INT("hw.cxgb.sleep_ticks", &sleep_ticks); SYSCTL_UINT(_hw_cxgb, OID_AUTO, sleep_ticks, CTLFLAG_RDTUN, &sleep_ticks, 0, @@ -106,12 +103,12 @@ SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_s "size of per-queue mbuf ring"); -static inline int32_t cxgb_pcpu_calc_cookie(struct ifnet *ifp, struct mbuf *immpkt); static void cxgb_pcpu_start_proc(void *arg); +static int cxgb_tx(struct sge_qset *qs, uint32_t txmax); + #ifdef IFNET_MULTIQUEUE -static int cxgb_pcpu_cookie_to_qidx(struct port_info *, uint32_t cookie); +static int cxgb_pcpu_cookie_to_qidx(struct port_info *pi, uint32_t cookie); #endif -static int cxgb_tx(struct sge_qset *qs, uint32_t txmax); static inline int cxgb_pcpu_enqueue_packet_(struct sge_qset *qs, struct mbuf *m) @@ -119,9 +116,6 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse struct sge_txq *txq; int err = 0; -#ifndef IFNET_MULTIQUEUE - panic("not expecting enqueue without multiqueue"); -#endif KASSERT(m != NULL, ("null mbuf")); KASSERT(m->m_type == MT_DATA, ("bad mbuf type %d", m->m_type)); if (qs->qs_flags & QS_EXITING) { @@ -134,9 +128,9 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse txq->txq_drops++; m_freem(m); } - if ((qs->txq[TXQ_ETH].flags & TXQ_TRANSMITTING) == 0) + if (wakeup_tx_thread && ((txq->flags & TXQ_TRANSMITTING) == 0)) wakeup(qs); - + return (err); } @@ -149,29 +143,34 @@ cxgb_pcpu_enqueue_packet(struct ifnet *i #ifdef IFNET_MULTIQUEUE int32_t calc_cookie; - calc_cookie = m->m_pkthdr.rss_hash; + calc_cookie = m->m_pkthdr.flowid; qidx = cxgb_pcpu_cookie_to_qidx(pi, calc_cookie); #else qidx = 0; #endif qs = &pi->adapter->sge.qs[qidx]; - err = cxgb_pcpu_enqueue_packet_(qs, m); + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_ENQUEUE(qs->txq[0].txq_ifq, m, err); + } else { + err = cxgb_pcpu_enqueue_packet_(qs, m); + } return (err); } static int cxgb_dequeue_packet(struct sge_txq *txq, struct mbuf **m_vec) { - struct mbuf *m; + struct mbuf *m, *m0; struct sge_qset *qs; int count, size, coalesced; struct adapter *sc; + #ifndef IFNET_MULTIQUEUE struct port_info *pi = txq->port; + mtx_assert(&txq->lock, MA_OWNED); if (txq->immpkt != NULL) panic("immediate packet set"); - mtx_assert(&txq->lock, MA_OWNED); IFQ_DRV_DEQUEUE(&pi->ifp->if_snd, m); if (m == NULL) @@ -180,7 +179,16 @@ cxgb_dequeue_packet(struct sge_txq *txq, m_vec[0] = m; return (1); #endif - + if (ALTQ_IS_ENABLED(txq->txq_ifq)) { + IFQ_DRV_DEQUEUE(txq->txq_ifq, m); + if (m == NULL) + return (0); + + m_vec[0] = m; + return (1); + } + + mtx_assert(&txq->lock, MA_OWNED); coalesced = count = size = 0; qs = txq_to_qset(txq, TXQ_ETH); if (qs->qs_flags & QS_EXITING) @@ -199,9 +207,10 @@ cxgb_dequeue_packet(struct sge_txq *txq, return (0); count = 1; + m_vec[0] = m; if (m->m_pkthdr.tso_segsz > 0 || m->m_pkthdr.len > TX_WR_SIZE_MAX || - m->m_next != NULL || (cxgb_pcpu_tx_coalesce == 0)) { + m->m_next != NULL || (coalesce_tx_enable == 0)) { return (count); } @@ -213,7 +222,11 @@ cxgb_dequeue_packet(struct sge_txq *txq, size + m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL) break; - buf_ring_dequeue_sc(txq->txq_mr); + m0 = buf_ring_dequeue_sc(txq->txq_mr); +#ifdef DEBUG_BUFRING + if (m0 != m) + panic("peek and dequeue don't match"); +#endif size += m->m_pkthdr.len; m_vec[count++] = m; @@ -227,134 +240,6 @@ cxgb_dequeue_packet(struct sge_txq *txq, return (count); } -static int32_t -cxgb_pcpu_get_cookie(struct ifnet *ifp, struct in6_addr *lip, uint16_t lport, struct in6_addr *rip, uint16_t rport, int ipv6) -{ - uint32_t base; - uint8_t buf[36]; - int count; - int32_t cookie; - - critical_enter(); - /* - * Can definitely bypass bcopy XXX - */ - if (ipv6 == 0) { - count = 12; - bcopy(rip, &buf[0], 4); - bcopy(lip, &buf[4], 4); - bcopy(&rport, &buf[8], 2); - bcopy(&lport, &buf[10], 2); - } else { - count = 36; - bcopy(rip, &buf[0], 16); - bcopy(lip, &buf[16], 16); - bcopy(&rport, &buf[32], 2); - bcopy(&lport, &buf[34], 2); - } - - base = 0xffffffff; - base = update_crc32(base, buf, count); - base = sctp_csum_finalize(base); - - /* - * Indirection table is 128 bits - * -> cookie indexes into indirection table which maps connection to queue - * -> RSS map maps queue to CPU - */ - cookie = (base & (RSS_TABLE_SIZE-1)); - critical_exit(); - - return (cookie); -} - -static int32_t -cxgb_pcpu_calc_cookie(struct ifnet *ifp, struct mbuf *immpkt) -{ - struct in6_addr lip, rip; - uint16_t lport, rport; - struct ether_header *eh; - int32_t cookie; - struct ip *ip; - struct ip6_hdr *ip6; - struct tcphdr *th; - struct udphdr *uh; - struct sctphdr *sh; - uint8_t *next, proto; - int etype; - - if (immpkt == NULL) - return -1; - -#if 1 - /* - * XXX perf test - */ - return (0); -#endif - rport = lport = 0; - cookie = -1; - next = NULL; - eh = mtod(immpkt, struct ether_header *); - etype = ntohs(eh->ether_type); - - switch (etype) { - case ETHERTYPE_IP: - ip = (struct ip *)(eh + 1); - next = (uint8_t *)(ip + 1); - bcopy(&ip->ip_src, &lip, 4); - bcopy(&ip->ip_dst, &rip, 4); - proto = ip->ip_p; - break; - case ETHERTYPE_IPV6: - ip6 = (struct ip6_hdr *)(eh + 1); - next = (uint8_t *)(ip6 + 1); - bcopy(&ip6->ip6_src, &lip, sizeof(struct in6_addr)); - bcopy(&ip6->ip6_dst, &rip, sizeof(struct in6_addr)); - if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { - struct ip6_hbh *hbh; - - hbh = (struct ip6_hbh *)(ip6 + 1); - proto = hbh->ip6h_nxt; - } else - proto = ip6->ip6_nxt; - break; - case ETHERTYPE_ARP: - default: - /* - * Default to queue zero - */ - proto = cookie = 0; - } - if (proto) { - switch (proto) { - case IPPROTO_TCP: - th = (struct tcphdr *)next; - lport = th->th_sport; - rport = th->th_dport; - break; - case IPPROTO_UDP: - uh = (struct udphdr *)next; - lport = uh->uh_sport; - rport = uh->uh_dport; - break; - case IPPROTO_SCTP: - sh = (struct sctphdr *)next; - lport = sh->src_port; - rport = sh->dest_port; - break; - default: - /* nothing to do */ - break; - } - } - - if (cookie) - cookie = cxgb_pcpu_get_cookie(ifp, &lip, lport, &rip, rport, (etype == ETHERTYPE_IPV6)); - - return (cookie); -} - static void cxgb_pcpu_free(struct sge_qset *qs) { @@ -377,10 +262,6 @@ cxgb_pcpu_reclaim_tx(struct sge_txq *txq int reclaimable; struct sge_qset *qs = txq_to_qset(txq, TXQ_ETH); -#ifdef notyet - KASSERT(qs->qs_cpuid == curcpu, ("cpu qset mismatch cpuid=%d curcpu=%d", - qs->qs_cpuid, curcpu)); -#endif mtx_assert(&txq->lock, MA_OWNED); reclaimable = desc_reclaimable(txq); @@ -426,7 +307,8 @@ cxgb_pcpu_start_(struct sge_qset *qs, st initerr = ENXIO; else if (immpkt) { - if (!buf_ring_empty(txq->txq_mr)) + if (!buf_ring_empty(txq->txq_mr) + || ALTQ_IS_ENABLED(&pi->ifp->if_snd)) initerr = cxgb_pcpu_enqueue_packet_(qs, immpkt); else txq->immpkt = immpkt; @@ -491,7 +373,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st } int -cxgb_pcpu_start(struct ifnet *ifp, struct mbuf *immpkt) +cxgb_pcpu_transmit(struct ifnet *ifp, struct mbuf *immpkt) { uint32_t cookie; int err, qidx, locked, resid; @@ -506,10 +388,10 @@ cxgb_pcpu_start(struct ifnet *ifp, struc qidx = resid = err = cookie = locked = 0; #ifdef IFNET_MULTIQUEUE - if (immpkt && (immpkt->m_pkthdr.rss_hash != 0)) { - cookie = immpkt->m_pkthdr.rss_hash; + if (immpkt && (immpkt->m_pkthdr.flowid != 0)) { + cookie = immpkt->m_pkthdr.flowid; qidx = cxgb_pcpu_cookie_to_qidx(pi, cookie); - DPRINTF("hash=0x%x qidx=%d cpu=%d\n", immpkt->m_pkthdr.rss_hash, qidx, curcpu); + DPRINTF("hash=0x%x qidx=%d cpu=%d\n", immpkt->m_pkthdr.flowid, qidx, curcpu); qs = &pi->adapter->sge.qs[qidx]; } else #endif @@ -519,7 +401,7 @@ cxgb_pcpu_start(struct ifnet *ifp, struc if (((sc->tunq_coalesce == 0) || (buf_ring_count(txq->txq_mr) >= TX_WR_COUNT_MAX) || - (cxgb_pcpu_tx_coalesce == 0)) && mtx_trylock(&txq->lock)) { + (coalesce_tx_enable == 0)) && mtx_trylock(&txq->lock)) { if (cxgb_debug) printf("doing immediate transmit\n"); @@ -534,10 +416,6 @@ cxgb_pcpu_start(struct ifnet *ifp, struc sc->tunq_coalesce, buf_ring_count(txq->txq_mr), mtx_owned(&txq->lock)); err = cxgb_pcpu_enqueue_packet_(qs, immpkt); } - - if (resid && (txq->flags & TXQ_TRANSMITTING) == 0) - wakeup(qs); - return ((err == ENOSPC) ? 0 : err); } @@ -552,7 +430,7 @@ cxgb_start(struct ifnet *ifp) if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) return; - cxgb_pcpu_start(ifp, NULL); + cxgb_pcpu_transmit(ifp, NULL); } static void @@ -562,11 +440,8 @@ cxgb_pcpu_start_proc(void *arg) struct thread *td; struct sge_txq *txq = &qs->txq[TXQ_ETH]; int idleticks, err = 0; -#ifdef notyet - struct adapter *sc = qs->port->adapter; -#endif - td = curthread; + td = curthread; sleep_ticks = max(hz/1000, 1); qs->qs_flags |= QS_RUNNING; thread_lock(td); @@ -642,6 +517,9 @@ cxgb_pcpu_cookie_to_qidx(struct port_inf { int qidx; uint32_t tmp; + + if (multiq_tx_enable == 0) + return (pi->first_qset); /* * Will probably need to be changed for 4-port XXX @@ -757,7 +635,7 @@ cxgb_tx(struct sge_qset *qs, uint32_t tx check_pkt_coalesce(qs); count = cxgb_dequeue_packet(txq, m_vec); if (count == 0) { - err = ENOBUFS; + err = ENOSPC; break; } ETHER_BPF_MTAP(ifp, m_vec[0]); @@ -767,28 +645,10 @@ cxgb_tx(struct sge_qset *qs, uint32_t tx txq->txq_enqueued += count; m_vec[0] = NULL; } -#if 0 /* !MULTIQ */ - if (__predict_false(err)) { - if (err == ENOMEM) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IFQ_LOCK(&ifp->if_snd); - IFQ_DRV_PREPEND(&ifp->if_snd, m_vec[0]); - IFQ_UNLOCK(&ifp->if_snd); - } - } - else if ((err == 0) && (txq->size <= txq->in_use + TX_MAX_DESC) && - (ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) { - setbit(&qs->txq_stopped, TXQ_ETH); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - txq_fills++; - err = ENOSPC; - } -#else if ((err == 0) && (txq->size <= txq->in_use + TX_MAX_DESC)) { - err = ENOSPC; + err = ENOBUFS; txq_fills++; setbit(&qs->txq_stopped, TXQ_ETH); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; } if (err == ENOMEM) { int i; @@ -799,7 +659,6 @@ cxgb_tx(struct sge_qset *qs, uint32_t tx for (i = 0; i < count; i++) m_freem(m_vec[i]); } -#endif return (err); } Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Sat Nov 22 07:35:45 2008 (r185164) +++ head/sys/dev/cxgb/cxgb_sge.c Sat Nov 22 08:05:05 2008 (r185165) @@ -26,8 +26,6 @@ ARISING IN ANY WAY OUT OF THE USE OF THI POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -#define DEBUG_BUFRING - #include __FBSDID("$FreeBSD$"); @@ -86,9 +84,9 @@ extern int cxgb_pcpu_cache_enable; extern int nmbjumbo4; extern int nmbjumbo9; extern int nmbjumbo16; - - - +extern int multiq_tx_enable; +extern int coalesce_tx_enable; +extern int wakeup_tx_thread; #define USE_GTS 0 @@ -1275,7 +1273,6 @@ t3_encap(struct sge_qset *qs, struct mbu KASSERT(txsd->mi.mi_base == NULL, ("overwriting valid entry mi_base==%p", txsd->mi.mi_base)); if (count > 1) { - panic("count > 1 not support in CVS\n"); if ((err = busdma_map_sg_vec(m, &m0, segs, count))) return (err); nsegs = count; @@ -1286,7 +1283,7 @@ t3_encap(struct sge_qset *qs, struct mbu } KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d count=%d", nsegs, count)); - if (!(m0->m_pkthdr.len <= PIO_LEN)) { + if ((m0->m_pkthdr.len > PIO_LEN) || (count > 1)) { mi_collapse_mbuf(&txsd->mi, m0); mi = &txsd->mi; } @@ -1718,9 +1715,15 @@ t3_free_qset(adapter_t *sc, struct sge_q t3_free_tx_desc_all(&q->txq[TXQ_ETH]); - for (i = 0; i < SGE_TXQ_PER_SET; i++) + for (i = 0; i < SGE_TXQ_PER_SET; i++) { if (q->txq[i].txq_mr != NULL) buf_ring_free(q->txq[i].txq_mr, M_DEVBUF); + if (q->txq[i].txq_ifq != NULL) { + ifq_detach(q->txq[i].txq_ifq); + free(q->txq[i].txq_ifq, M_DEVBUF); + } + } + for (i = 0; i < SGE_RXQ_PER_SET; ++i) { if (q->fl[i].desc) { mtx_lock_spin(&sc->sge.reg_lock); @@ -1882,19 +1885,16 @@ t3_free_tx_desc(struct sge_txq *q, int r bus_dmamap_unload(q->entry_tag, txsd->map); txsd->flags &= ~TX_SW_DESC_MAPPED; } - m_freem_iovec(&txsd->mi); + m_freem_iovec(&txsd->mi); +#if 0 + buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__); +#endif txsd->mi.mi_base = NULL; /* * XXX check for cache hit rate here * */ q->port->ifp->if_opackets++; -#if defined(DIAGNOSTIC) && 0 - if (m_get_priority(txsd->m[0]) != cidx) - printf("pri=%d cidx=%d\n", - (int)m_get_priority(txsd->m[0]), cidx); -#endif - } else q->txq_skipped++; @@ -2288,11 +2288,16 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i device_printf(sc->dev, "failed to allocate mbuf ring\n"); goto err; } + if ((q->txq[i].txq_ifq = + malloc(sizeof(struct ifaltq), M_DEVBUF, M_NOWAIT|M_ZERO)) + == NULL) { + device_printf(sc->dev, "failed to allocate ifq\n"); + goto err; + } + ifq_attach(q->txq[i].txq_ifq, pi->ifp); } - init_qset_cntxt(q, id); q->idx = id; - if ((ret = alloc_ring(sc, p->fl_size, sizeof(struct rx_desc), sizeof(struct rx_sw_desc), &q->fl[0].phys_addr, &q->fl[0].desc, &q->fl[0].sdesc, @@ -2880,7 +2885,7 @@ process_responses(adapter_t *adap, struc eop = get_packet(adap, drop_thresh, qs, &rspq->rspq_mbuf, r); #endif #ifdef IFNET_MULTIQUEUE - rspq->rspq_mh.mh_head->m_pkthdr.rss_hash = rss_hash; + rspq->rspq_mh.mh_head->m_pkthdr.flowid = rss_hash; #endif ethpad = 2; } else { @@ -3365,6 +3370,18 @@ t3_add_attach_sysctls(adapter_t *sc) CTLFLAG_RW, &cxgb_pcpu_cache_enable, 0, "#enable driver local pcpu caches"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "multiq_tx_enable", + CTLFLAG_RW, &multiq_tx_enable, + 0, "enable transmit by multiple tx queues"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "coalesce_tx_enable", + CTLFLAG_RW, &coalesce_tx_enable, + 0, "coalesce small packets in work requests - WARNING ALPHA"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "wakeup_tx_thread", + CTLFLAG_RW, &wakeup_tx_thread, + 0, "wakeup tx thread if no transmitter running"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "cache_alloc", CTLFLAG_RD, &cxgb_cached_allocations, 0, "#times a cluster was allocated from cache"); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 08:46:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C42A1065674; Sat, 22 Nov 2008 08:46:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65D9F8FC12; Sat, 22 Nov 2008 08:46:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAM8kHFN011392; Sat, 22 Nov 2008 08:46:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAM8kHsv011391; Sat, 22 Nov 2008 08:46:17 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811220846.mAM8kHsv011391@svn.freebsd.org> From: Kip Macy Date: Sat, 22 Nov 2008 08:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185166 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 08:46:17 -0000 Author: kmacy Date: Sat Nov 22 08:46:16 2008 New Revision: 185166 URL: http://svn.freebsd.org/changeset/base/185166 Log: Add flowid to mbuf to allow drivers to uniquely identify connection flows to guarantee ordering across queues Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Nov 22 08:05:05 2008 (r185165) +++ head/sys/sys/mbuf.h Sat Nov 22 08:46:16 2008 (r185166) @@ -115,6 +115,9 @@ struct pkthdr { /* variables for ip and tcp reassembly */ void *header; /* pointer to packet header */ int len; /* total packet length */ + uint32_t flowid; /* packet's 4-tuple system + * flow identifier + */ /* variables for hardware checksum */ int csum_flags; /* flags regarding checksum */ int csum_data; /* data field used by csum routines */ From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 11:29:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3125B1065670; Sat, 22 Nov 2008 11:29:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id B97F28FC08; Sat, 22 Nov 2008 11:29:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L3qgS-000DbQ-90; Sat, 22 Nov 2008 13:29:52 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAMBTnLu046787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 22 Nov 2008 13:29:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAMBTnOb072172; Sat, 22 Nov 2008 13:29:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAMBTngD072171; Sat, 22 Nov 2008 13:29:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 22 Nov 2008 13:29:49 +0200 From: Kostik Belousov To: Kip Macy Message-ID: <20081122112949.GA6408@deviant.kiev.zoral.com.ua> References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <200811220555.mAM5tuIJ007781@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L3qgS-000DbQ-90 ba306028f5f1162f008c9ee52dd14592 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 11:29:54 -0000 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 22, 2008 at 05:55:56AM +0000, Kip Macy wrote: > Author: kmacy > Date: Sat Nov 22 05:55:56 2008 > New Revision: 185162 > URL: http://svn.freebsd.org/changeset/base/185162 >=20 > Log: > - bump __FreeBSD version to reflect added buf_ring, memory barriers, > and ifnet functions > =20 > - add memory barriers to > Modified: head/sys/i386/include/atomic.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/i386/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) > +++ head/sys/i386/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) > @@ -32,6 +32,21 @@ > #error this file needs sys/cdefs.h as a prerequisite > #endif > =20 > + > +#if defined(I686_CPU) > +#define mb() __asm__ __volatile__ ("mfence;": : :"memory") > +#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") > +#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") > +#else > +/* > + * do we need a serializing instruction? > + */ > +#define mb() > +#define wmb() > +#define rmb() > +#endif > + > + > /* > * Various simple operations on memory, each of which is atomic in the > * presence of interrupts and multiple processors. AFAIR, sfence instruction was added with the Pentium III processor (SSE), while lfence was introduced with the Pentium 4 (SSE2). I think that #ifdef I686_CPU handling of the fences is wrong. We need to use a serialized instruction on CPUs that does not support corresponding fence, if needed. --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkn7SwACgkQC3+MBN1Mb4h8wACfVEKbjr0rNd5NS/gEQvt6jqHW gWoAnjKiPP1SnrpY8Q9OoELavQ16Ew8n =I9l2 -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND-- From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 12:34:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8E171065674; Sat, 22 Nov 2008 12:34:49 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8463C8FC0C; Sat, 22 Nov 2008 12:34:49 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMCYnsD017684; Sat, 22 Nov 2008 12:34:49 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMCYnb1017680; Sat, 22 Nov 2008 12:34:49 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811221234.mAMCYnb1017680@svn.freebsd.org> From: Joseph Koshy Date: Sat, 22 Nov 2008 12:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185168 - head/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 12:34:49 -0000 Author: jkoshy Date: Sat Nov 22 12:34:49 2008 New Revision: 185168 URL: http://svn.freebsd.org/changeset/base/185168 Log: Unbreak LINT. Modified: head/sys/dev/hwpmc/hwpmc_arm.c head/sys/dev/hwpmc/hwpmc_ia64.c head/sys/dev/hwpmc/hwpmc_powerpc.c head/sys/dev/hwpmc/hwpmc_sparc64.c Modified: head/sys/dev/hwpmc/hwpmc_arm.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_arm.c Sat Nov 22 08:48:01 2008 (r185167) +++ head/sys/dev/hwpmc/hwpmc_arm.c Sat Nov 22 12:34:49 2008 (r185168) @@ -39,6 +39,12 @@ pmc_md_initialize() return NULL; } +void +pmc_md_finalize(struct pmc_mdep *md) +{ + (void) md; +} + int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) Modified: head/sys/dev/hwpmc/hwpmc_ia64.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_ia64.c Sat Nov 22 08:48:01 2008 (r185167) +++ head/sys/dev/hwpmc/hwpmc_ia64.c Sat Nov 22 12:34:49 2008 (r185168) @@ -39,6 +39,12 @@ pmc_md_initialize() return NULL; } +void +pmc_md_finalize(struct pmc_mdep *md) +{ + (void) md; +} + int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_powerpc.c Sat Nov 22 08:48:01 2008 (r185167) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Sat Nov 22 12:34:49 2008 (r185168) @@ -39,6 +39,12 @@ pmc_md_initialize() return NULL; } +void +pmc_md_finalize(struct pmc_mdep *md) +{ + (void) md; +} + int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) Modified: head/sys/dev/hwpmc/hwpmc_sparc64.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_sparc64.c Sat Nov 22 08:48:01 2008 (r185167) +++ head/sys/dev/hwpmc/hwpmc_sparc64.c Sat Nov 22 12:34:49 2008 (r185168) @@ -39,6 +39,12 @@ pmc_md_initialize() return NULL; } +void +pmc_md_finalize(struct pmc_mdep *md) +{ + (void) md; +} + int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 12:36:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D8341065672; Sat, 22 Nov 2008 12:36:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F62B8FC1C; Sat, 22 Nov 2008 12:36:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMCaGNN017765; Sat, 22 Nov 2008 12:36:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMCaFbb017749; Sat, 22 Nov 2008 12:36:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811221236.mAMCaFbb017749@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 22 Nov 2008 12:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185169 - in head/sys: amd64/amd64 amd64/linux32 arm/arm compat/ia32 compat/svr4 i386/i386 i386/ibcs2 i386/linux ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 12:36:16 -0000 Author: kib Date: Sat Nov 22 12:36:15 2008 New Revision: 185169 URL: http://svn.freebsd.org/changeset/base/185169 Log: Add sv_flags field to struct sysentvec with intention to provide description of the ABI of the currently executing image. Change some places to test the flags instead of explicit comparing with address of known sysentvec structures to determine ABI features. Discussed with: dchagin, imp, jhb, peter Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/compat/svr4/svr4_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/i386/ibcs2/ibcs2_sysvec.c head/sys/i386/linux/linux_sysvec.c head/sys/ia64/ia64/elf_machdep.c head/sys/kern/imgact_aout.c head/sys/kern/kern_thr.c head/sys/kern/uipc_socket.c head/sys/mips/mips/elf_machdep.c head/sys/powerpc/powerpc/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/amd64/amd64/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -72,7 +72,8 @@ struct sysentvec elf64_freebsd_sysvec = .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 }; static Elf64_Brandinfo freebsd_brand_info = { Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/amd64/linux32/linux32_sysvec.c Sat Nov 22 12:36:15 2008 (r185169) @@ -1026,6 +1026,7 @@ struct sysentvec elf_linux_sysvec = { .sv_setregs = exec_linux_setregs, .sv_fixlimit = linux32_fixlimit, .sv_maxssiz = &linux32_maxssiz, + .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 }; static Elf32_Brandinfo linux_brand = { Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/arm/arm/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec = .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 }; static Elf32_Brandinfo freebsd_brand_info = { Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/compat/ia32/ia32_sysvec.c Sat Nov 22 12:36:15 2008 (r185169) @@ -135,7 +135,8 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_copyout_strings = ia32_copyout_strings, .sv_setregs = ia32_setregs, .sv_fixlimit = ia32_fixlimit, - .sv_maxssiz = &ia32_maxssiz + .sv_maxssiz = &ia32_maxssiz, + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 }; Modified: head/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- head/sys/compat/svr4/svr4_sysvec.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/compat/svr4/svr4_sysvec.c Sat Nov 22 12:36:15 2008 (r185169) @@ -190,7 +190,8 @@ struct sysentvec svr4_sysvec = { .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_UNDEF | SV_IA32 | SV_ILP32 }; const char svr4_emul_path[] = "/compat/svr4"; Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/i386/i386/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec = .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 }; static Elf32_Brandinfo freebsd_brand_info = { Modified: head/sys/i386/ibcs2/ibcs2_sysvec.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_sysvec.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/i386/ibcs2/ibcs2_sysvec.c Sat Nov 22 12:36:15 2008 (r185169) @@ -85,7 +85,8 @@ struct sysentvec ibcs2_svr3_sysvec = { .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_UNDEF | SV_IA32 | SV_ILP32 }; static int Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/i386/linux/linux_sysvec.c Sat Nov 22 12:36:15 2008 (r185169) @@ -837,7 +837,8 @@ struct sysentvec linux_sysvec = { .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_linux_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32 }; struct sysentvec elf_linux_sysvec = { @@ -867,7 +868,8 @@ struct sysentvec elf_linux_sysvec = { .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_linux_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 }; static Elf32_Brandinfo linux_brand = { Modified: head/sys/ia64/ia64/elf_machdep.c ============================================================================== --- head/sys/ia64/ia64/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/ia64/ia64/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec = .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 }; static Elf64_Brandinfo freebsd_brand_info = { Modified: head/sys/kern/imgact_aout.c ============================================================================== --- head/sys/kern/imgact_aout.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/kern/imgact_aout.c Sat Nov 22 12:36:15 2008 (r185169) @@ -82,7 +82,13 @@ struct sysentvec aout_sysvec = { .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_AOUT | +#if defined(__i386__) + SV_IA32 | SV_ILP32 +#else +#error Choose SV_XXX flags for the platform +#endif }; static int Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/kern/kern_thr.c Sat Nov 22 12:36:15 2008 (r185169) @@ -57,14 +57,12 @@ __FBSDID("$FreeBSD$"); #ifdef COMPAT_IA32 -extern struct sysentvec ia32_freebsd_sysvec; - static inline int suword_lwpid(void *addr, lwpid_t lwpid) { int error; - if (curproc->p_sysent != &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_LP64)) error = suword(addr, lwpid); else error = suword32(addr, lwpid); Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/kern/uipc_socket.c Sat Nov 22 12:36:15 2008 (r185169) @@ -136,9 +136,8 @@ __FBSDID("$FreeBSD$"); #ifdef COMPAT_IA32 #include +#include #include - -extern struct sysentvec ia32_freebsd_sysvec; #endif static int soreceive_rcvoob(struct socket *so, struct uio *uio, @@ -2280,7 +2279,7 @@ sosetopt(struct socket *so, struct socko case SO_SNDTIMEO: case SO_RCVTIMEO: #ifdef COMPAT_IA32 - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { struct timeval32 tv32; error = sooptcopyin(sopt, &tv32, sizeof tv32, @@ -2461,7 +2460,7 @@ integer: tv.tv_sec = optval / hz; tv.tv_usec = (optval % hz) * tick; #ifdef COMPAT_IA32 - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { struct timeval32 tv32; CP(tv, tv32, tv_sec); Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/mips/mips/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -74,7 +74,8 @@ struct sysentvec elf32_freebsd_sysvec = .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 }; static Elf32_Brandinfo freebsd_brand_info = { Modified: head/sys/powerpc/powerpc/elf_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/powerpc/powerpc/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -75,7 +75,8 @@ struct sysentvec elf32_freebsd_sysvec = .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 }; static Elf32_Brandinfo freebsd_brand_info = { Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/sparc64/sparc64/elf_machdep.c Sat Nov 22 12:36:15 2008 (r185169) @@ -87,7 +87,8 @@ static struct sysentvec elf64_freebsd_sy .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, - .sv_maxssiz = NULL + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 }; static Elf64_Brandinfo freebsd_brand_info = { Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sat Nov 22 12:34:49 2008 (r185168) +++ head/sys/sys/sysent.h Sat Nov 22 12:36:15 2008 (r185169) @@ -100,8 +100,22 @@ struct sysentvec { void (*sv_setregs)(struct thread *, u_long, u_long, u_long); void (*sv_fixlimit)(struct rlimit *, int); u_long *sv_maxssiz; + u_int sv_flags; }; +#define SV_ILP32 0x000100 +#define SV_LP64 0x000200 +#define SV_IA32 0x004000 +#define SV_AOUT 0x008000 + +#define SV_ABI_MASK 0xff +#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x)) +#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK) +/* same as ELFOSABI_XXX, to prevent header pollution */ +#define SV_ABI_LINUX 3 +#define SV_ABI_FREEBSD 9 +#define SV_ABI_UNDEF 255 + #ifdef _KERNEL extern struct sysentvec aout_sysvec; extern struct sysentvec elf_freebsd_sysvec; From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 13:11:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE13F1065673; Sat, 22 Nov 2008 13:11:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B303E8FC18; Sat, 22 Nov 2008 13:11:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMDBBr1018511; Sat, 22 Nov 2008 13:11:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMDBBU8018510; Sat, 22 Nov 2008 13:11:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811221311.mAMDBBU8018510@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 22 Nov 2008 13:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185170 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 13:11:11 -0000 Author: kib Date: Sat Nov 22 13:11:11 2008 New Revision: 185170 URL: http://svn.freebsd.org/changeset/base/185170 Log: Busy ufs filesystem around block of code that does ".." lookup. Since mnt_lock is before lock of any vnode on the mp, it uses LK_NOWAIT. Since MNTK_UNMOUNT may be transient, pdp lock is dropped when vfs_busy() failed, and operation is retried after some time. This way, ffs_vget() is not called on the mp that may be in the process of being destroyed by unmount. Check for the VI_DOOMED flag on pdp after its lock is reacquired, to better detect some situations where directory containing ".." entry is removed during the lookup. Reviewed by: tegge, attilio (previous version) Tested by: pho MFC after: 1 month Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Sat Nov 22 12:36:15 2008 (r185169) +++ head/sys/ufs/ufs/ufs_lookup.c Sat Nov 22 13:11:11 2008 (r185170) @@ -157,6 +157,8 @@ ufs_lookup(ap) int nameiop = cnp->cn_nameiop; ino_t ino; int ltype; + int pdoomed; + struct mount *mp; bp = NULL; slotoffset = -1; @@ -578,9 +580,32 @@ found: pdp = vdp; if (flags & ISDOTDOT) { ltype = VOP_ISLOCKED(pdp); + mp = pdp->v_mount; + for (;;) { + error = vfs_busy(mp, MBF_NOWAIT); + if (error == 0) + break; + VOP_UNLOCK(pdp, 0); + pause("ufs_dd", 1); + vn_lock(pdp, ltype | LK_RETRY); + VI_LOCK(pdp); + pdoomed = pdp->v_iflag & VI_DOOMED; + VI_UNLOCK(pdp); + if (pdoomed) + return (ENOENT); + } VOP_UNLOCK(pdp, 0); /* race to get the inode */ - error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp); + error = VFS_VGET(mp, ino, cnp->cn_lkflags, &tdp); + vfs_unbusy(mp); vn_lock(pdp, ltype | LK_RETRY); + VI_LOCK(pdp); + pdoomed = pdp->v_iflag & VI_DOOMED; + VI_UNLOCK(pdp); + if (pdoomed) { + if (error == 0) + vput(tdp); + error = ENOENT; + } if (error) return (error); *vpp = tdp; From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 13:22:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C70F1065673; Sat, 22 Nov 2008 13:22:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30E198FC18; Sat, 22 Nov 2008 13:22:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMDMOZ7018804; Sat, 22 Nov 2008 13:22:24 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMDMOw4018803; Sat, 22 Nov 2008 13:22:24 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811221322.mAMDMOw4018803@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 22 Nov 2008 13:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185171 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 13:22:25 -0000 Author: pjd Date: Sat Nov 22 13:22:24 2008 New Revision: 185171 URL: http://svn.freebsd.org/changeset/base/185171 Log: IFp4: Don't free pathname too soon, debugging code is still using it. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Sat Nov 22 13:11:11 2008 (r185170) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Sat Nov 22 13:22:24 2008 (r185171) @@ -88,11 +88,9 @@ spa_config_load(void) file = kobj_open_file(pathname); - kmem_free(pathname, MAXPATHLEN); - if (file == (struct _buf *)-1) { ZFS_LOG(1, "Cannot open %s.", pathname); - return; + goto out; } if (kobj_get_filesize(file, &fsize) != 0) { @@ -146,10 +144,11 @@ spa_config_load(void) nvlist_free(nvlist); out: + kmem_free(pathname, MAXPATHLEN); if (buf != NULL) kmem_free(buf, fsize); - - kobj_close_file(file); + if (file != (struct _buf *)-1) + kobj_close_file(file); } static void From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 13:24:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DB161065670; Sat, 22 Nov 2008 13:24:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51C648FC08; Sat, 22 Nov 2008 13:24:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMDOie7018905; Sat, 22 Nov 2008 13:24:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMDOiTc018904; Sat, 22 Nov 2008 13:24:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811221324.mAMDOiTc018904@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 22 Nov 2008 13:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185172 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 13:24:44 -0000 Author: pjd Date: Sat Nov 22 13:24:44 2008 New Revision: 185172 URL: http://svn.freebsd.org/changeset/base/185172 Log: IFp4: Finish implemnetation of chflags(2) for ZFS. While doing this I found that zfs_access() can only handle VREAD, VWRITE and VEXEC, for the rest we need to use vaccess(9). Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Nov 22 13:22:24 2008 (r185171) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Nov 22 13:24:44 2008 (r185172) @@ -3955,6 +3955,19 @@ zfs_freebsd_access(ap) } */ *ap; { + /* + * ZFS itself only knowns about VREAD, VWRITE and VEXEC, the rest + * we have to handle by calling vaccess(). + */ + if ((ap->a_accmode & ~(VREAD|VWRITE|VEXEC)) != 0) { + vnode_t *vp = ap->a_vp; + znode_t *zp = VTOZ(vp); + znode_phys_t *zphys = zp->z_phys; + + return (vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid, + zphys->zp_gid, ap->a_accmode, ap->a_cred, NULL)); + } + return (zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred, NULL)); } @@ -4132,7 +4145,9 @@ zfs_freebsd_setattr(ap) struct thread *a_td; } */ *ap; { + vnode_t *vp = ap->a_vp; vattr_t *vap = ap->a_vap; + cred_t *cred = ap->a_cred; xvattr_t xvap; u_long fflags; uint64_t zflags; @@ -4143,11 +4158,47 @@ zfs_freebsd_setattr(ap) xva_init(&xvap); xvap.xva_vattr = *vap; + zflags = VTOZ(vp)->z_phys->zp_flags; + if (vap->va_flags != VNOVAL) { + int error; + fflags = vap->va_flags; if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); - zflags = VTOZ(ap->a_vp)->z_phys->zp_flags; + /* + * Callers may only modify the file flags on objects they + * have VADMIN rights for. + */ + if ((error = VOP_ACCESS(vp, VADMIN, cred, curthread)) != 0) + return (error); + /* + * Unprivileged processes are not permitted to unset system + * flags, or modify flags if any system flags are set. + * Privileged non-jail processes may not modify system flags + * if securelevel > 0 and any existing system flags are set. + * Privileged jail processes behave like privileged non-jail + * processes if the security.jail.chflags_allowed sysctl is + * is non-zero; otherwise, they behave like unprivileged + * processes. + */ + if (priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0) == 0) { + if (zflags & + (ZFS_IMMUTABLE | ZFS_APPENDONLY | ZFS_NOUNLINK)) { + error = securelevel_gt(cred, 0); + if (error) + return (error); + } + } else { + if (zflags & + (ZFS_IMMUTABLE | ZFS_APPENDONLY | ZFS_NOUNLINK)) { + return (EPERM); + } + if (fflags & + (SF_IMMUTABLE | SF_APPEND | SF_NOUNLINK)) { + return (EPERM); + } + } #define FLAG_CHANGE(fflag, zflag, xflag, xfield) do { \ if (((fflags & (fflag)) && !(zflags & (zflag))) || \ @@ -4165,10 +4216,10 @@ zfs_freebsd_setattr(ap) FLAG_CHANGE(SF_NOUNLINK, ZFS_NOUNLINK, XAT_NOUNLINK, xvap.xva_xoptattrs.xoa_nounlink); FLAG_CHANGE(UF_NODUMP, ZFS_NODUMP, XAT_NODUMP, - xvap.xva_xoptattrs.xoa_nounlink); + xvap.xva_xoptattrs.xoa_nodump); #undef FLAG_CHANGE } - return (zfs_setattr(ap->a_vp, (vattr_t *)&xvap, 0, ap->a_cred, NULL)); + return (zfs_setattr(vp, (vattr_t *)&xvap, 0, cred, NULL)); } static int From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 13:27:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD5E01065679; Sat, 22 Nov 2008 13:27:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 916FA8FC1C; Sat, 22 Nov 2008 13:27:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMDRGeH019004; Sat, 22 Nov 2008 13:27:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMDRGgJ018990; Sat, 22 Nov 2008 13:27:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811221327.mAMDRGgJ018990@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 22 Nov 2008 13:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185173 - in head/tools/regression/fstest/tests: . chflags X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 13:27:16 -0000 Author: pjd Date: Sat Nov 22 13:27:15 2008 New Revision: 185173 URL: http://svn.freebsd.org/changeset/base/185173 Log: IFp4: Regression tests for FreeBSD/ZFS chflags(2)/lchflags(2). Modified: head/tools/regression/fstest/tests/chflags/00.t head/tools/regression/fstest/tests/chflags/01.t head/tools/regression/fstest/tests/chflags/02.t head/tools/regression/fstest/tests/chflags/03.t head/tools/regression/fstest/tests/chflags/04.t head/tools/regression/fstest/tests/chflags/05.t head/tools/regression/fstest/tests/chflags/06.t head/tools/regression/fstest/tests/chflags/07.t head/tools/regression/fstest/tests/chflags/08.t head/tools/regression/fstest/tests/chflags/09.t head/tools/regression/fstest/tests/chflags/11.t head/tools/regression/fstest/tests/chflags/12.t head/tools/regression/fstest/tests/chflags/13.t head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/chflags/00.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/00.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/00.t Sat Nov 22 13:27:15 2008 (r185173) @@ -8,7 +8,25 @@ dir=`dirname $0` require chflags -echo "1..191" +case "${os}:${fs}" in +FreeBSD:UFS) + allflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" + userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE" + systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" + + echo "1..247" + ;; +FreeBSD:ZFS) + allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" + userflags="UF_NODUMP" + systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" + + echo "1..167" + ;; +*) + quick_exit + ;; +esac n0=`namegen` n1=`namegen` @@ -20,36 +38,36 @@ cd ${n2} expect 0 create ${n0} 0644 expect none stat ${n0} flags -expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags -expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags -expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags +expect 0 chflags ${n0} ${allflags} +expect ${allflags} stat ${n0} flags +expect 0 chflags ${n0} ${userflags} +expect ${userflags} stat ${n0} flags +expect 0 chflags ${n0} ${systemflags} +expect ${systemflags} stat ${n0} flags expect 0 chflags ${n0} none expect none stat ${n0} flags expect 0 unlink ${n0} expect 0 mkdir ${n0} 0644 expect none stat ${n0} flags -expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags -expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags -expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags +expect 0 chflags ${n0} ${allflags} +expect ${allflags} stat ${n0} flags +expect 0 chflags ${n0} ${userflags} +expect ${userflags} stat ${n0} flags +expect 0 chflags ${n0} ${systemflags} +expect ${systemflags} stat ${n0} flags expect 0 chflags ${n0} none expect none stat ${n0} flags expect 0 rmdir ${n0} expect 0 mkfifo ${n0} 0644 expect none stat ${n0} flags -expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags -expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags -expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags +expect 0 chflags ${n0} ${allflags} +expect ${allflags} stat ${n0} flags +expect 0 chflags ${n0} ${userflags} +expect ${userflags} stat ${n0} flags +expect 0 chflags ${n0} ${systemflags} +expect ${systemflags} stat ${n0} flags expect 0 chflags ${n0} none expect none stat ${n0} flags expect 0 unlink ${n0} @@ -58,14 +76,14 @@ expect 0 create ${n0} 0644 expect 0 symlink ${n0} ${n1} expect none stat ${n1} flags expect none lstat ${n1} flags -expect 0 chflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n1} flags +expect 0 chflags ${n1} ${allflags} +expect ${allflags} stat ${n1} flags expect none lstat ${n1} flags -expect 0 chflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n1} flags +expect 0 chflags ${n1} ${userflags} +expect ${userflags} stat ${n1} flags expect none lstat ${n1} flags -expect 0 chflags ${n1} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n1} flags +expect 0 chflags ${n1} ${systemflags} +expect ${systemflags} stat ${n1} flags expect none lstat ${n1} flags expect 0 chflags ${n1} none expect none stat ${n1} flags @@ -77,14 +95,14 @@ expect 0 create ${n0} 0644 expect 0 symlink ${n0} ${n1} expect none stat ${n1} flags expect none lstat ${n1} flags -expect 0 lchflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK lstat ${n1} flags +expect 0 lchflags ${n1} ${allflags} +expect ${allflags} lstat ${n1} flags expect none stat ${n1} flags -expect 0 lchflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE -expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE lstat ${n1} flags +expect 0 lchflags ${n1} ${userflags} +expect ${userflags} lstat ${n1} flags expect none stat ${n1} flags -expect 0 lchflags ${n1} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK -expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK lstat ${n1} flags +expect 0 lchflags ${n1} ${systemflags} +expect ${systemflags} lstat ${n1} flags expect none stat ${n1} flags expect 0 lchflags ${n1} none expect none lstat ${n1} flags @@ -94,7 +112,7 @@ expect 0 unlink ${n0} # successful chflags(2) updates ctime. expect 0 create ${n0} 0644 -for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect 0 chflags ${n0} ${flag} @@ -104,7 +122,7 @@ done expect 0 unlink ${n0} expect 0 mkdir ${n0} 0755 -for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect 0 chflags ${n0} ${flag} @@ -114,7 +132,7 @@ done expect 0 rmdir ${n0} expect 0 mkfifo ${n0} 0644 -for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect 0 chflags ${n0} ${flag} @@ -124,7 +142,7 @@ done expect 0 unlink ${n0} expect 0 symlink ${n1} ${n0} -for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} lstat ${n0} ctime` sleep 1 expect 0 lchflags ${n0} ${flag} @@ -135,7 +153,7 @@ expect 0 unlink ${n0} # unsuccessful chflags(2) does not update ctime. expect 0 create ${n0} 0644 -for flag in UF_IMMUTABLE SF_IMMUTABLE none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect EPERM -u 65534 chflags ${n0} ${flag} @@ -145,7 +163,7 @@ done expect 0 unlink ${n0} expect 0 mkdir ${n0} 0755 -for flag in UF_IMMUTABLE SF_IMMUTABLE none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect EPERM -u 65534 chflags ${n0} ${flag} @@ -155,7 +173,7 @@ done expect 0 rmdir ${n0} expect 0 mkfifo ${n0} 0644 -for flag in UF_IMMUTABLE SF_IMMUTABLE none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect EPERM -u 65534 chflags ${n0} ${flag} @@ -165,7 +183,7 @@ done expect 0 unlink ${n0} expect 0 symlink ${n1} ${n0} -for flag in UF_IMMUTABLE SF_IMMUTABLE none; do +for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} lstat ${n0} ctime` sleep 1 expect EPERM -u 65534 lchflags ${n0} ${flag} Modified: head/tools/regression/fstest/tests/chflags/01.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/01.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/01.t Sat Nov 22 13:27:15 2008 (r185173) @@ -15,6 +15,6 @@ n1=`namegen` expect 0 mkdir ${n0} 0755 expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR chflags ${n0}/${n1}/test UF_IMMUTABLE +expect ENOTDIR chflags ${n0}/${n1}/test SF_IMMUTABLE expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chflags/02.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/02.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/02.t Sat Nov 22 13:27:15 2008 (r185173) @@ -11,8 +11,8 @@ require chflags echo "1..6" expect 0 create ${name255} 0644 -expect 0 chflags ${name255} UF_IMMUTABLE -expect UF_IMMUTABLE stat ${name255} flags +expect 0 chflags ${name255} SF_IMMUTABLE +expect SF_IMMUTABLE stat ${name255} flags expect 0 chflags ${name255} none expect 0 unlink ${name255} -expect ENAMETOOLONG chflags ${name256} UF_IMMUTABLE +expect ENAMETOOLONG chflags ${name256} SF_IMMUTABLE Modified: head/tools/regression/fstest/tests/chflags/03.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/03.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/03.t Sat Nov 22 13:27:15 2008 (r185173) @@ -15,10 +15,10 @@ expect 0 mkdir ${name255}/${name255} 075 expect 0 mkdir ${name255}/${name255}/${name255} 0755 expect 0 mkdir ${path1021} 0755 expect 0 create ${path1023} 0644 -expect 0 chflags ${path1023} UF_IMMUTABLE +expect 0 chflags ${path1023} SF_IMMUTABLE expect 0 chflags ${path1023} none expect 0 unlink ${path1023} -expect ENAMETOOLONG chflags ${path1024} UF_IMMUTABLE +expect ENAMETOOLONG chflags ${path1024} SF_IMMUTABLE expect 0 rmdir ${path1021} expect 0 rmdir ${name255}/${name255}/${name255} expect 0 rmdir ${name255}/${name255} Modified: head/tools/regression/fstest/tests/chflags/04.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/04.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/04.t Sat Nov 22 13:27:15 2008 (r185173) @@ -14,6 +14,6 @@ n0=`namegen` n1=`namegen` expect 0 mkdir ${n0} 0755 -expect ENOENT chflags ${n0}/${n1}/test UF_IMMUTABLE -expect ENOENT chflags ${n0}/${n1} UF_IMMUTABLE +expect ENOENT chflags ${n0}/${n1}/test SF_IMMUTABLE +expect ENOENT chflags ${n0}/${n1} SF_IMMUTABLE expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chflags/05.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/05.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/05.t Sat Nov 22 13:27:15 2008 (r185173) @@ -20,14 +20,14 @@ cd ${n0} expect 0 mkdir ${n1} 0755 expect 0 chown ${n1} 65534 65534 expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE -expect UF_IMMUTABLE -u 65534 -g 65534 stat ${n1}/${n2} flags +expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP +expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE +expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE -expect UF_IMMUTABLE -u 65534 -g 65534 stat ${n1}/${n2} flags +expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP +expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} expect 0 rmdir ${n1} Modified: head/tools/regression/fstest/tests/chflags/06.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/06.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/06.t Sat Nov 22 13:27:15 2008 (r185173) @@ -15,7 +15,7 @@ n1=`namegen` expect 0 symlink ${n0} ${n1} expect 0 symlink ${n1} ${n0} -expect ELOOP chflags ${n0}/test UF_IMMUTABLE -expect ELOOP chflags ${n1}/test UF_IMMUTABLE +expect ELOOP chflags ${n0}/test SF_IMMUTABLE +expect ELOOP chflags ${n1}/test SF_IMMUTABLE expect 0 unlink ${n0} expect 0 unlink ${n1} Modified: head/tools/regression/fstest/tests/chflags/07.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/07.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/07.t Sat Nov 22 13:27:15 2008 (r185173) @@ -19,34 +19,34 @@ cdir=`pwd` cd ${n0} expect 0 create ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE +expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect none stat ${n1} flags expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE +expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect none stat ${n1} flags expect 0 unlink ${n1} expect 0 mkdir ${n1} 0755 -expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE +expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect none stat ${n1} flags expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE +expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect none stat ${n1} flags expect 0 rmdir ${n1} expect 0 mkfifo ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE +expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect none stat ${n1} flags expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE +expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect none stat ${n1} flags expect 0 unlink ${n1} expect 0 symlink ${n2} ${n1} -expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE +expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP expect none lstat ${n1} flags expect 0 lchown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE +expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP expect none lstat ${n1} flags expect 0 unlink ${n1} Modified: head/tools/regression/fstest/tests/chflags/08.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/08.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/08.t Sat Nov 22 13:27:15 2008 (r185173) @@ -22,9 +22,9 @@ expect 0 create ${n1} 0644 expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE + expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE + expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags done expect 0 chflags ${n1} none @@ -34,9 +34,9 @@ expect 0 mkdir ${n1} 0755 expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE + expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE + expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags done expect 0 chflags ${n1} none @@ -46,9 +46,9 @@ expect 0 mkfifo ${n1} 0644 expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE + expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE + expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags done expect 0 chflags ${n1} none @@ -58,9 +58,9 @@ expect 0 symlink ${n2} ${n1} expect 0 lchown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 lchflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE + expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP expect ${flag} lstat ${n1} flags - expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE + expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP expect ${flag} lstat ${n1} flags done expect 0 lchflags ${n1} none Modified: head/tools/regression/fstest/tests/chflags/09.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/09.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/09.t Sat Nov 22 13:27:15 2008 (r185173) @@ -25,11 +25,11 @@ expect 0 create ${n1} 0644 expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags done expect 0 chflags ${n1} none @@ -39,11 +39,11 @@ expect 0 mkdir ${n1} 0755 expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags done expect 0 chflags ${n1} none @@ -53,11 +53,11 @@ expect 0 mkfifo ${n1} 0644 expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP expect ${flag} stat ${n1} flags done expect 0 chflags ${n1} none @@ -67,11 +67,11 @@ expect 0 symlink ${n2} ${n1} expect 0 lchown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect 0 lchflags ${n1} ${flag} - jexpect 1 `pwd` EPERM lchflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM lchflags ${n1} UF_NODUMP expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE + jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP expect ${flag} lstat ${n1} flags done expect 0 lchflags ${n1} none Modified: head/tools/regression/fstest/tests/chflags/11.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/11.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/11.t Sat Nov 22 13:27:15 2008 (r185173) @@ -6,7 +6,7 @@ desc="chflags returns EPERM if a user tr dir=`dirname $0` . ${dir}/../misc.sh -require chflags +require chflags_SF_SNAPSHOT echo "1..46" Modified: head/tools/regression/fstest/tests/chflags/12.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/12.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/12.t Sat Nov 22 13:27:15 2008 (r185173) @@ -37,6 +37,31 @@ FreeBSD:UFS) mdconfig -d -u ${n} expect 0 rmdir ${n0} ;; +FreeBSD:ZFS) + echo "1..12" + + n0=`namegen` + n1=`namegen` + + n=`mdconfig -a -n -t malloc -s 128m` + zpool create ${n0} /dev/md${n} + expect 0 create /${n0}/${n1} 0644 + expect 0 chflags /${n0}/${n1} UF_NODUMP + expect UF_NODUMP stat /${n0}/${n1} flags + expect 0 chflags /${n0}/${n1} none + expect none stat /${n0}/${n1} flags + zfs set readonly=on ${n0} + expect EROFS chflags /${n0}/${n1} UF_NODUMP + expect none stat /${n0}/${n1} flags + zfs set readonly=off ${n0} + expect 0 chflags /${n0}/${n1} UF_NODUMP + expect UF_NODUMP stat /${n0}/${n1} flags + expect 0 chflags /${n0}/${n1} none + expect none stat /${n0}/${n1} flags + expect 0 unlink /${n0}/${n1} + zpool destroy ${n0} + mdconfig -d -u ${n} + ;; *) quick_exit ;; Modified: head/tools/regression/fstest/tests/chflags/13.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/13.t Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/chflags/13.t Sat Nov 22 13:27:15 2008 (r185173) @@ -10,5 +10,5 @@ require chflags echo "1..2" -expect EFAULT chflags NULL UF_IMMUTABLE -expect EFAULT chflags DEADCODE UF_IMMUTABLE +expect EFAULT chflags NULL UF_NODUMP +expect EFAULT chflags DEADCODE UF_NODUMP Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Sat Nov 22 13:24:44 2008 (r185172) +++ head/tools/regression/fstest/tests/misc.sh Sat Nov 22 13:27:15 2008 (r185173) @@ -73,13 +73,18 @@ quick_exit() supported() { case "${1}" in + lchmod) + if [ "${os}" != "FreeBSD" ]; then + return 1 + fi + ;; chflags) - if [ ${os} != "FreeBSD" -o ${fs} != "UFS" ]; then + if [ "${os}" != "FreeBSD" ]; then return 1 fi ;; - lchmod) - if [ ${os} != "FreeBSD" ]; then + chflags_SF_SNAPSHOT) + if [ "${os}" != "FreeBSD" -o "${fs}" != "UFS" ]; then return 1 fi ;; From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 13:33:06 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8237B1065672; Sat, 22 Nov 2008 13:33:06 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64E5A8FC0C; Sat, 22 Nov 2008 13:33:06 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMDX6k6019152; Sat, 22 Nov 2008 13:33:06 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMDX6XZ019150; Sat, 22 Nov 2008 13:33:06 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811221333.mAMDX6XZ019150@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 22 Nov 2008 13:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185174 - in head: cddl/compat/opensolaris/misc sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 13:33:06 -0000 Author: pjd Date: Sat Nov 22 13:33:06 2008 New Revision: 185174 URL: http://svn.freebsd.org/changeset/base/185174 Log: IFp4: Don't rely on disk IDs and always use vdev guids, which means always look up for components by reading metadata. This might be slower when there are big number of disks in the system, but is definiately more reliable. Modified: head/cddl/compat/opensolaris/misc/deviceid.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/cddl/compat/opensolaris/misc/deviceid.c ============================================================================== --- head/cddl/compat/opensolaris/misc/deviceid.c Sat Nov 22 13:27:15 2008 (r185173) +++ head/cddl/compat/opensolaris/misc/deviceid.c Sat Nov 22 13:33:06 2008 (r185174) @@ -94,11 +94,7 @@ int devid_get(int fd, ddi_devid_t *retdevid) { - if (ioctl(fd, DIOCGIDENT, retdevid->devid) == -1) - return (errno); - if (retdevid->devid[0] == '\0') - return (ENOENT); - return (0); + return (ENOENT); } int Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 22 13:27:15 2008 (r185173) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 22 13:33:06 2008 (r185174) @@ -229,22 +229,6 @@ vdev_geom_worker(void *arg) } } -static char * -vdev_geom_get_id(struct g_consumer *cp) -{ - char *id; - int len; - - g_topology_assert_not(); - len = DISK_IDENT_SIZE; - id = kmem_zalloc(len, KM_SLEEP); - if (g_io_getattr("GEOM::ident", cp, &len, id) != 0) { - kmem_free(id, DISK_IDENT_SIZE); - return (NULL); - } - return (id); -} - static uint64_t nvlist_get_guid(nvlist_t *list) { @@ -261,79 +245,6 @@ nvlist_get_guid(nvlist_t *list) return (0); } -static char * -nvlist_get_devid(nvlist_t *list, uint64_t guid) -{ - nvpair_t *elem = NULL; - int progress; - char *id; - - progress = 0; - id = NULL; - - while ((elem = nvlist_next_nvpair(list, elem)) != NULL) { - switch (nvpair_type(elem)) { - case DATA_TYPE_STRING: - { - char *value; - - VERIFY(nvpair_value_string(elem, &value) == 0); - if (strcmp(nvpair_name(elem), "type") == 0 && - strcmp(value, "disk") == 0) { - progress |= 0x01; - } else if (strcmp(nvpair_name(elem), "devid") == 0) { - progress |= 0x02; - id = value; - } - break; - } - case DATA_TYPE_UINT64: - { - uint64_t value; - - VERIFY(nvpair_value_uint64(elem, &value) == 0); - if (strcmp(nvpair_name(elem), "guid") == 0 && - value == guid) { - progress |= 0x04; - } - break; - } - case DATA_TYPE_NVLIST: - { - nvlist_t *value; - char *lid; - - VERIFY(nvpair_value_nvlist(elem, &value) == 0); - lid = nvlist_get_devid(value, guid); - if (lid != NULL) - return (lid); - break; - } - case DATA_TYPE_NVLIST_ARRAY: - { - nvlist_t **value; - u_int c, count; - char *lid; - - VERIFY(nvpair_value_nvlist_array(elem, &value, - &count) == 0); - - for (c = 0; c < count; c++) { - lid = nvlist_get_devid(value[c], guid); - if (lid != NULL) - return (lid); - } - break; - } - } - if (progress == 0x07) - break; - } - if (progress != 0x07) - id = NULL; - return (id); -} - static int vdev_geom_io(struct g_consumer *cp, int cmd, void *data, off_t offset, off_t size) { @@ -368,8 +279,8 @@ vdev_geom_io(struct g_consumer *cp, int return (error); } -static char * -vdev_geom_read_id(struct g_consumer *cp) +static uint64_t +vdev_geom_read_guid(struct g_consumer *cp) { struct g_provider *pp; vdev_label_t *label; @@ -377,7 +288,7 @@ vdev_geom_read_id(struct g_consumer *cp) size_t buflen; uint64_t psize; off_t offset, size; - char *id; + uint64_t guid; int error, l, len; g_topology_assert_not(); @@ -390,13 +301,12 @@ vdev_geom_read_id(struct g_consumer *cp) size = sizeof(*label) + pp->sectorsize - ((sizeof(*label) - 1) % pp->sectorsize) - 1; - id = NULL; + guid = 0; label = kmem_alloc(size, KM_SLEEP); buflen = sizeof(label->vl_vdev_phys.vp_nvlist); - for (l = 0; l < VDEV_LABELS && id == NULL; l++) { + for (l = 0; l < VDEV_LABELS; l++) { nvlist_t *config = NULL; - uint64_t guid; offset = vdev_label_offset(psize, l, 0); if ((offset % pp->sectorsize) != 0) @@ -411,38 +321,19 @@ vdev_geom_read_id(struct g_consumer *cp) continue; guid = nvlist_get_guid(config); - if (guid == 0) { - nvlist_free(config); - continue; - } - id = nvlist_get_devid(config, guid); - if (id != NULL) { - char *tmp; - - tmp = kmem_zalloc(DISK_IDENT_SIZE, KM_SLEEP); - strlcpy(tmp, id, DISK_IDENT_SIZE); - id = tmp; - } - nvlist_free(config); + if (guid != 0) + break; } kmem_free(label, size); - if (id != NULL) - ZFS_LOG(1, "ID of %s: %s", pp->name, id); - return (id); -} - -static void -vdev_geom_free_id(char *id) -{ - - if (id != NULL) - kmem_free(id, DISK_IDENT_SIZE); + if (guid != 0) + ZFS_LOG(1, "guid for %s is %ju", pp->name, (uintmax_t)guid); + return (guid); } struct vdev_geom_find { - const char *id; + uint64_t guid; int write; struct g_consumer *cp; }; @@ -456,14 +347,14 @@ vdev_geom_taste_orphan(struct g_consumer } static void -vdev_geom_attach_by_id_event(void *arg, int flags __unused) +vdev_geom_attach_by_guid_event(void *arg, int flags __unused) { struct vdev_geom_find *ap; struct g_class *mp; struct g_geom *gp, *zgp; struct g_provider *pp; struct g_consumer *zcp; - char *id; + uint64_t guid; g_topology_assert(); @@ -474,7 +365,6 @@ vdev_geom_attach_by_id_event(void *arg, zgp->orphan = vdev_geom_taste_orphan; zcp = g_new_consumer(zgp); - /* First round tries to get provider's ID without reading metadata. */ LIST_FOREACH(mp, &g_classes, class) { if (mp == &zfs_vdev_class) continue; @@ -490,50 +380,12 @@ vdev_geom_attach_by_id_event(void *arg, continue; } g_topology_unlock(); - id = vdev_geom_get_id(zcp); + guid = vdev_geom_read_guid(zcp); g_topology_lock(); g_access(zcp, -1, 0, 0); g_detach(zcp); - if (id == NULL || strcmp(id, ap->id) != 0) { - vdev_geom_free_id(id); + if (guid != ap->guid) continue; - } - vdev_geom_free_id(id); - ap->cp = vdev_geom_attach(pp, ap->write); - if (ap->cp == NULL) { - printf("ZFS WARNING: Cannot open %s " - "for writting.\n", pp->name); - continue; - } - goto end; - } - } - } - /* Second round looks for ID by reading ZFS metadata. */ - LIST_FOREACH(mp, &g_classes, class) { - if (mp == &zfs_vdev_class) - continue; - LIST_FOREACH(gp, &mp->geom, geom) { - if (gp->flags & G_GEOM_WITHER) - continue; - LIST_FOREACH(pp, &gp->provider, provider) { - if (pp->flags & G_PF_WITHER) - continue; - g_attach(zcp, pp); - if (g_access(zcp, 1, 0, 0) != 0) { - g_detach(zcp); - continue; - } - g_topology_unlock(); - id = vdev_geom_read_id(zcp); - g_topology_lock(); - g_access(zcp, -1, 0, 0); - g_detach(zcp); - if (id == NULL || strcmp(id, ap->id) != 0) { - vdev_geom_free_id(id); - continue; - } - vdev_geom_free_id(id); ap->cp = vdev_geom_attach(pp, ap->write); if (ap->cp == NULL) { printf("ZFS WARNING: Cannot open %s " @@ -551,26 +403,53 @@ end: } static struct g_consumer * -vdev_geom_attach_by_id(const char *id, int write) +vdev_geom_attach_by_guid(uint64_t guid, int write) { struct vdev_geom_find *ap; struct g_consumer *cp; ap = kmem_zalloc(sizeof(*ap), KM_SLEEP); - ap->id = id; + ap->guid = guid; ap->write = write; - g_waitfor_event(vdev_geom_attach_by_id_event, ap, M_WAITOK, NULL); + g_waitfor_event(vdev_geom_attach_by_guid_event, ap, M_WAITOK, NULL); cp = ap->cp; kmem_free(ap, sizeof(*ap)); return (cp); } static struct g_consumer * -vdev_geom_open_by_path_and_devid(vdev_t *vd) +vdev_geom_open_by_guid(vdev_t *vd) +{ + struct g_consumer *cp; + char *buf; + size_t len; + + ZFS_LOG(1, "Searching by guid [%ju].", (uintmax_t)vd->vdev_guid); + cp = vdev_geom_attach_by_guid(vd->vdev_guid, !!(spa_mode & FWRITE)); + if (cp != NULL) { + len = strlen(cp->provider->name) + strlen("/dev/") + 1; + buf = kmem_alloc(len, KM_SLEEP); + + snprintf(buf, len, "/dev/%s", cp->provider->name); + spa_strfree(vd->vdev_path); + vd->vdev_path = buf; + + ZFS_LOG(1, "Attach by guid [%ju] succeeded, provider %s.", + (uintmax_t)vd->vdev_guid, vd->vdev_path); + } else { + ZFS_LOG(1, "Search by guid [%ju] failed.", + (uintmax_t)vd->vdev_guid); + } + + return (cp); +} + +static struct g_consumer * +vdev_geom_open_by_path(vdev_t *vd, int check_guid) { struct g_provider *pp; struct g_consumer *cp; - char *id; + uint64_t guid; cp = NULL; g_topology_lock(); @@ -578,20 +457,20 @@ vdev_geom_open_by_path_and_devid(vdev_t if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); cp = vdev_geom_attach(pp, !!(spa_mode & FWRITE)); - if (cp != NULL && vd->vdev_devid != NULL) { + if (cp != NULL && check_guid) { g_topology_unlock(); - id = vdev_geom_get_id(cp); + guid = vdev_geom_read_guid(cp); g_topology_lock(); - if (id == NULL || strcmp(id, vd->vdev_devid) != 0) { + if (guid != vd->vdev_guid) { vdev_geom_detach(cp, 0); cp = NULL; - ZFS_LOG(1, "ID mismatch for provider %s: " - "[%s]!=[%s].", vd->vdev_path, - vd->vdev_devid, id); - } else - ZFS_LOG(1, "ID match for provider %s.", + ZFS_LOG(1, "guid mismatch for provider %s: " + "%ju != %ju.", vd->vdev_path, + (uintmax_t)vd->vdev_guid, (uintmax_t)guid); + } else { + ZFS_LOG(1, "guid match for provider %s.", vd->vdev_path); - vdev_geom_free_id(id); + } } } g_topology_unlock(); @@ -599,37 +478,6 @@ vdev_geom_open_by_path_and_devid(vdev_t return (cp); } -static struct g_consumer * -vdev_geom_open_by_devid(vdev_t *vd) -{ - struct g_consumer *cp; - char *buf; - size_t len; - - /* - * We can't search by devid if it's missing. - */ - if (vd->vdev_devid == NULL) - return (NULL); - - ZFS_LOG(1, "Searching by ID [%s].", vd->vdev_devid); - cp = vdev_geom_attach_by_id(vd->vdev_devid, !!(spa_mode & FWRITE)); - if (cp != NULL) { - len = strlen(cp->provider->name) + strlen("/dev/") + 1; - buf = kmem_alloc(len, KM_SLEEP); - - snprintf(buf, len, "/dev/%s", cp->provider->name); - spa_strfree(vd->vdev_path); - vd->vdev_path = buf; - - ZFS_LOG(1, "Attach by ID [%s] succeeded, provider %s.", - vd->vdev_devid, vd->vdev_path); - } else - ZFS_LOG(1, "Search by ID [%s] failed.", vd->vdev_devid); - - return (cp); -} - static int vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) { @@ -650,21 +498,23 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if ((owned = mtx_owned(&Giant))) mtx_unlock(&Giant); - cp = vdev_geom_open_by_path_and_devid(vd); + cp = vdev_geom_open_by_path(vd, 0); if (cp == NULL) { /* - * The device at vd->vdev_path doesn't have the right devid. + * The device at vd->vdev_path doesn't have the expected guid. * The disks might have merely moved around so try all other - * geom providers to find one with the right devid. + * geom providers to find one with the right guid. */ - cp = vdev_geom_open_by_devid(vd); - if (cp == NULL) { - ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); - vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; - if (owned) - mtx_lock(&Giant); - return (EACCES); - } + cp = vdev_geom_open_by_guid(vd); + } + if (cp == NULL) + cp = vdev_geom_open_by_path(vd, 1); + if (cp == NULL) { + ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); + vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; + if (owned) + mtx_lock(&Giant); + return (EACCES); } if (owned) mtx_lock(&Giant); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 14:24:56 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18A6E106564A; Sat, 22 Nov 2008 14:24:56 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB50A8FC1A; Sat, 22 Nov 2008 14:24:55 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMEOt0h020070; Sat, 22 Nov 2008 14:24:55 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMEOtVt020067; Sat, 22 Nov 2008 14:24:55 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811221424.mAMEOtVt020067@svn.freebsd.org> From: Doug Rabson Date: Sat, 22 Nov 2008 14:24:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185175 - in head/sys/boot: i386 i386/gptzfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 14:24:56 -0000 Author: dfr Date: Sat Nov 22 14:24:55 2008 New Revision: 185175 URL: http://svn.freebsd.org/changeset/base/185175 Log: Fix amd64 build and re-enable gptzfsboot. Modified: head/sys/boot/i386/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/zfs/Makefile Modified: head/sys/boot/i386/Makefile ============================================================================== --- head/sys/boot/i386/Makefile Sat Nov 22 13:33:06 2008 (r185174) +++ head/sys/boot/i386/Makefile Sat Nov 22 14:24:55 2008 (r185175) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot zfsboot \ - kgzldr libi386 libfirewire loader + gptzfsboot kgzldr libi386 libfirewire loader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Sat Nov 22 13:33:06 2008 (r185174) +++ head/sys/boot/i386/gptzfsboot/Makefile Sat Nov 22 14:24:55 2008 (r185175) @@ -65,7 +65,7 @@ gptzfsboot.out: ${BTXCRT} zfsboot.o sio. zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c .if ${MACHINE_ARCH} == "amd64" -beforedepend gptzfsboot.o: machine +beforedepend zfsboot.o: machine CLEANFILES+= machine machine: ln -sf ${.CURDIR}/../../../i386/include machine Modified: head/sys/boot/zfs/Makefile ============================================================================== --- head/sys/boot/zfs/Makefile Sat Nov 22 13:33:06 2008 (r185174) +++ head/sys/boot/zfs/Makefile Sat Nov 22 14:24:55 2008 (r185175) @@ -9,10 +9,20 @@ CFLAGS+= -I${.CURDIR}/../common -I${.CUR CFLAGS+= -I${.CURDIR}/../../../lib/libstand CFLAGS+= -I${.CURDIR}/../../cddl/boot/zfs -# XXX need arch-specific bootstrap CFLAGS here -# -CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ - -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 +CFLAGS+= -ffreestanding +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +CFLAGS+= -mpreferred-stack-boundary=2 +CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 +.endif +.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -mno-sse3 +.endif +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm" +CFLAGS+= -msoft-float +.endif +.if ${MACHINE_ARCH} == "amd64" +CFLAGS+= -m32 -march=i386 +.endif CFLAGS+= -Wformat -Wall From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 14:32:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82A701065677 for ; Sat, 22 Nov 2008 14:32:15 +0000 (UTC) (envelope-from jkoshy.freebsd@gmail.com) Received: from ti-out-0910.google.com (ti-out-0910.google.com [209.85.142.187]) by mx1.freebsd.org (Postfix) with ESMTP id C7E1F8FC19 for ; Sat, 22 Nov 2008 14:32:14 +0000 (UTC) (envelope-from jkoshy.freebsd@gmail.com) Received: by ti-out-0910.google.com with SMTP id a1so755841tib.3 for ; Sat, 22 Nov 2008 06:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:to:cc:subject :in-reply-to:references:user-agent:mime-version:content-type:from :date:sender; bh=nqvaCnThqAVBGGx5rVWzmY+YVXjZz+99fv68pKABu4c=; b=edAZpOvHbhmy5az0nx99suppU8XrEGnIs3Grbm1b82fkEODqdS1Jeb7vN1dK0Q1dyd DKhBA6lMpg/GV5QWHx3Y4i687z2oMJMHUwEdab1t/p/lA/eW6mPpWCs0N1PCXnk5SyBm swj+aunoH+NvAbH4NZ+O9uWeJDqfFFJyfEjtc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:to:cc:subject:in-reply-to:references:user-agent :mime-version:content-type:from:date:sender; b=UTbdc2WfkDQ4rs8WSpO+35rXphN/XgxNwN9oH+F8b3EAwhhep9mSo+yO6Kreq2pPFa 0L4S6T+xmRYOFFaU8RRtNnAJw7DkNIDYHoqqqCGy5eIe9EmXzoXfU/hxJxPjrndN5qJQ K36C1EXCXg3yPYFfodXw6GG/qTAUbxg5b9/AY= Received: by 10.110.28.15 with SMTP id b15mr2257983tib.42.1227364333670; Sat, 22 Nov 2008 06:32:13 -0800 (PST) Received: from moria.unixconsulting.co.in ([117.195.162.191]) by mx.google.com with ESMTPS id w12sm5144260tib.10.2008.11.22.06.32.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 22 Nov 2008 06:32:12 -0800 (PST) Message-ID: <86hc5z7csx.wl%koshy@unixconsulting.co.in> To: Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= In-Reply-To: <863ahlpi4q.fsf@ds4.des.no> References: <200811151111.mAFBBWnf019276@svn.freebsd.org> <863ahlpi4q.fsf@ds4.des.no> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.7 Emacs/22.1 (x86_64-pc-freebsd) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII From: Joseph Koshy Date: Sat, 22 Nov 2008 19:58:56 -0000 Sender: Joseph Koshy Cc: svn-src-head@freebsd.org, Joseph Koshy , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184994 - head/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 14:32:15 -0000 > Joseph Koshy writes: > > Modified: head/sys/dev/hwpmc/hwpmc_mod.c > > ============================================================================== > > --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 15 11:07:54 2008 (r184993) > > +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 15 11:11:32 2008 (r184994) > > @@ -4656,6 +4656,9 @@ pmc_cleanup(void) > > if (md->pmd_pcpu_fini) > > md->pmd_pcpu_fini(cpu); > > } > > + > > + pmc_md_finalize(md); > > + > > free(md, M_PMC); > > md = NULL; > > pmc_restore_cpu_binding(&pb); > > This breaks the ia64, powerpc and sparc64 builds; pmc_md_finalize() is > only defined for i386 and amd64. Oh, ugh. Apologies. Should be fixed now. Koshy From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 14:48:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDF7A106564A; Sat, 22 Nov 2008 14:48:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A342F8FC1C; Sat, 22 Nov 2008 14:48:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMEme2M020553; Sat, 22 Nov 2008 14:48:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMEmeif020552; Sat, 22 Nov 2008 14:48:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811221448.mAMEmeif020552@svn.freebsd.org> From: Alexander Motin Date: Sat, 22 Nov 2008 14:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185176 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 14:48:40 -0000 Author: mav Date: Sat Nov 22 14:48:40 2008 New Revision: 185176 URL: http://svn.freebsd.org/changeset/base/185176 Log: Change check order to avoid array overrun. Found with: Coverity Prevent(tm) CID: 2497 Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sat Nov 22 14:24:55 2008 (r185175) +++ head/sys/dev/sound/pci/hda/hdac.c Sat Nov 22 14:48:40 2008 (r185176) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20081115_0116" +#define HDA_DRV_TEST_REV "20081122_0117" SND_DECLARE_FILE("$FreeBSD$"); @@ -4762,7 +4762,7 @@ hdac_audio_trace_as_out(struct hdac_devi nid_t min, res; /* Find next pin */ - for (i = seq; ases[as].pins[i] == 0 && i < 16; i++) + for (i = seq; i < 16 && ases[as].pins[i] == 0; i++) ; /* Check if there is no any left. If so - we succeded. */ if (i == 16) From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 15:35:22 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E67F106564A; Sat, 22 Nov 2008 15:35:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 448308FC14; Sat, 22 Nov 2008 15:35:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMFZL5X021569; Sat, 22 Nov 2008 15:35:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMFZLcZ021568; Sat, 22 Nov 2008 15:35:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811221535.mAMFZLcZ021568@svn.freebsd.org> From: Alexander Motin Date: Sat, 22 Nov 2008 15:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185177 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 15:35:22 -0000 Author: mav Date: Sat Nov 22 15:35:21 2008 New Revision: 185177 URL: http://svn.freebsd.org/changeset/base/185177 Log: Handle device_get_children() errors in more correct way. We shouldn't detach until all children are surely destroyed. Found with: Coverity Prevent(tm) CID: 2137 Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sat Nov 22 14:48:40 2008 (r185176) +++ head/sys/dev/sound/pci/hda/hdac.c Sat Nov 22 15:35:21 2008 (r185177) @@ -7571,17 +7571,20 @@ static int hdac_detach(device_t dev) { struct hdac_softc *sc; - device_t *devlist = NULL; - int i, devcount; + device_t *devlist; + int i, devcount, error; - sc = device_get_softc(dev); - - device_get_children(dev, &devlist, &devcount); - for (i = 0; devlist != NULL && i < devcount; i++) - device_delete_child(dev, devlist[i]); - if (devlist != NULL) - free(devlist, M_TEMP); + if ((error = device_get_children(dev, &devlist, &devcount)) != 0) + return (error); + for (i = 0; i < devcount; i++) { + if ((error = device_delete_child(dev, devlist[i])) != 0) { + free(devlist, M_TEMP); + return (error); + } + } + free(devlist, M_TEMP); + sc = device_get_softc(dev); hdac_release_resources(sc); return (0); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 15:38:24 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6CA31065672; Sat, 22 Nov 2008 15:38:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDC268FC17; Sat, 22 Nov 2008 15:38:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMFcO9N021658; Sat, 22 Nov 2008 15:38:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMFcOrR021657; Sat, 22 Nov 2008 15:38:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811221538.mAMFcOrR021657@svn.freebsd.org> From: Alexander Motin Date: Sat, 22 Nov 2008 15:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185178 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 15:38:25 -0000 Author: mav Date: Sat Nov 22 15:38:24 2008 New Revision: 185178 URL: http://svn.freebsd.org/changeset/base/185178 Log: Whitespace cleanup for previous commit. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sat Nov 22 15:35:21 2008 (r185177) +++ head/sys/dev/sound/pci/hda/hdac.c Sat Nov 22 15:38:24 2008 (r185178) @@ -7578,9 +7578,9 @@ hdac_detach(device_t dev) return (error); for (i = 0; i < devcount; i++) { if ((error = device_delete_child(dev, devlist[i])) != 0) { - free(devlist, M_TEMP); - return (error); - } + free(devlist, M_TEMP); + return (error); + } } free(devlist, M_TEMP); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 16:03:19 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 277BE106564A; Sat, 22 Nov 2008 16:03:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 109C58FC0A; Sat, 22 Nov 2008 16:03:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMG3IwT022242; Sat, 22 Nov 2008 16:03:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMG3I1e022241; Sat, 22 Nov 2008 16:03:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811221603.mAMG3I1e022241@svn.freebsd.org> From: Alexander Motin Date: Sat, 22 Nov 2008 16:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185179 - head/sys/netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 16:03:19 -0000 Author: mav Date: Sat Nov 22 16:03:18 2008 New Revision: 185179 URL: http://svn.freebsd.org/changeset/base/185179 Log: Remove unneeded NULL check. At first msg can't be null here and and at second NG_FREE_MSG() also checks it. Found with: Coverity Prevent(tm) Modified: head/sys/netgraph/ng_base.c Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Sat Nov 22 15:38:24 2008 (r185178) +++ head/sys/netgraph/ng_base.c Sat Nov 22 16:03:18 2008 (r185179) @@ -2853,8 +2853,7 @@ ng_generic_msg(node_p here, item_p item, */ out: NG_RESPOND_MSG(error, here, item, resp); - if (msg) - NG_FREE_MSG(msg); + NG_FREE_MSG(msg); return (error); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 16:40:12 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F71F106564A; Sat, 22 Nov 2008 16:40:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DF7D8FC14; Sat, 22 Nov 2008 16:40:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMGeCxI023185; Sat, 22 Nov 2008 16:40:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMGeCrI023184; Sat, 22 Nov 2008 16:40:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811221640.mAMGeCrI023184@svn.freebsd.org> From: Alexander Motin Date: Sat, 22 Nov 2008 16:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185182 - head/sys/netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 16:40:12 -0000 Author: mav Date: Sat Nov 22 16:40:12 2008 New Revision: 185182 URL: http://svn.freebsd.org/changeset/base/185182 Log: Fix typo. Clear session stats instead of config and part of stats. Found with: Coverity Prevent(tm) CID: 2472 Modified: head/sys/netgraph/ng_l2tp.c Modified: head/sys/netgraph/ng_l2tp.c ============================================================================== --- head/sys/netgraph/ng_l2tp.c Sat Nov 22 16:14:52 2008 (r185181) +++ head/sys/netgraph/ng_l2tp.c Sat Nov 22 16:40:12 2008 (r185182) @@ -733,7 +733,7 @@ ng_l2tp_reset_session(hook_p hook, void if (hpriv != NULL) { hpriv->conf.control_dseq = 0; hpriv->conf.enable_dseq = 0; - bzero(&hpriv->conf, sizeof(struct ng_l2tp_session_stats)); + bzero(&hpriv->stats, sizeof(struct ng_l2tp_session_stats)); hpriv->nr = 0; hpriv->ns = 0; } From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 16:55:56 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05B681065678; Sat, 22 Nov 2008 16:55:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA2E28FC0A; Sat, 22 Nov 2008 16:55:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMGttix023529; Sat, 22 Nov 2008 16:55:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMGttpJ023528; Sat, 22 Nov 2008 16:55:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811221655.mAMGttpJ023528@svn.freebsd.org> From: Alexander Motin Date: Sat, 22 Nov 2008 16:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185183 - head/sys/netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 16:55:56 -0000 Author: mav Date: Sat Nov 22 16:55:55 2008 New Revision: 185183 URL: http://svn.freebsd.org/changeset/base/185183 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3682 Modified: head/sys/netgraph/ng_socket.c Modified: head/sys/netgraph/ng_socket.c ============================================================================== --- head/sys/netgraph/ng_socket.c Sat Nov 22 16:40:12 2008 (r185182) +++ head/sys/netgraph/ng_socket.c Sat Nov 22 16:55:55 2008 (r185183) @@ -259,9 +259,8 @@ ngc_send(struct socket *so, int flags, s if (msg->header.typecookie == NGM_GENERIC_COOKIE && msg->header.cmd == NGM_MKPEER) { struct ngm_mkpeer *const mkp = (struct ngm_mkpeer *) msg->data; - struct ng_type *type; - if ((type = ng_findtype(mkp->type)) == NULL) { + if (ng_findtype(mkp->type) == NULL) { char filename[NG_TYPESIZ + 3]; int fileid; @@ -275,7 +274,7 @@ ngc_send(struct socket *so, int flags, s } /* See if type has been loaded successfully. */ - if ((type = ng_findtype(mkp->type)) == NULL) { + if (ng_findtype(mkp->type) == NULL) { free(msg, M_NETGRAPH_MSG); (void)kern_kldunload(curthread, fileid, LINKER_UNLOAD_NORMAL); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 17:54:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEC93106564A; Sat, 22 Nov 2008 17:54:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3DD98FC0C; Sat, 22 Nov 2008 17:54:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMHsUJa025131; Sat, 22 Nov 2008 17:54:30 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMHsUiN025130; Sat, 22 Nov 2008 17:54:30 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811221754.mAMHsUiN025130@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 22 Nov 2008 17:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185184 - in stable/7/sys: . geom/part modules/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 17:54:31 -0000 Author: marcel Date: Sat Nov 22 17:54:30 2008 New Revision: 185184 URL: http://svn.freebsd.org/changeset/base/185184 Log: MFC 184734: Fix a panic caused by a corrupted table when the header is still valid. PR: 119868 Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/geom/part/g_part_gpt.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/7/sys/geom/part/g_part_gpt.c Sat Nov 22 16:55:55 2008 (r185183) +++ stable/7/sys/geom/part/g_part_gpt.c Sat Nov 22 17:54:30 2008 (r185184) @@ -619,13 +619,16 @@ g_part_gpt_read(struct g_part_table *bas if (table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK && table->state[GPT_ELT_SECHDR] == GPT_STATE_OK && !gpt_matched_hdrs(&prihdr, &sechdr)) { - if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK) + if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK) { table->state[GPT_ELT_SECHDR] = GPT_STATE_INVALID; - else + table->state[GPT_ELT_SECTBL] = GPT_STATE_MISSING; + } else { table->state[GPT_ELT_PRIHDR] = GPT_STATE_INVALID; + table->state[GPT_ELT_PRITBL] = GPT_STATE_MISSING; + } } - if (table->state[GPT_ELT_PRIHDR] != GPT_STATE_OK) { + if (table->state[GPT_ELT_PRITBL] != GPT_STATE_OK) { printf("GEOM: %s: the primary GPT table is corrupt or " "invalid.\n", pp->name); printf("GEOM: %s: using the secondary instead -- recovery " @@ -635,7 +638,7 @@ g_part_gpt_read(struct g_part_table *bas if (pritbl != NULL) g_free(pritbl); } else { - if (table->state[GPT_ELT_SECHDR] != GPT_STATE_OK) { + if (table->state[GPT_ELT_SECTBL] != GPT_STATE_OK) { printf("GEOM: %s: the secondary GPT table is corrupt " "or invalid.\n", pp->name); printf("GEOM: %s: using the primary only -- recovery " From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 21:02:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAF201065672; Sat, 22 Nov 2008 21:02:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id BFDE48FC08; Sat, 22 Nov 2008 21:02:36 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 0ABCB2BC4B; Sun, 23 Nov 2008 10:02:36 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fsmlENmpGMIz; Sun, 23 Nov 2008 10:02:30 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Sun, 23 Nov 2008 10:02:30 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id BC6EE11458; Sun, 23 Nov 2008 10:02:29 +1300 (NZDT) Date: Sat, 22 Nov 2008 13:02:29 -0800 From: Andrew Thompson To: Alfred Perlstein Message-ID: <20081122210229.GA62676@citylink.fud.org.nz> References: <200811102054.mAAKsVAQ082218@svn.freebsd.org> <20081119085852.GK28578@elvis.mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081119085852.GK28578@elvis.mu.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184824 - in head/sys/dev/usb2: controller core serial storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 21:02:38 -0000 On Wed, Nov 19, 2008 at 12:58:52AM -0800, Alfred Perlstein wrote: > Cool, thank you, sorry I've been slow to pick up these deltas. > > I think we may be at a point where we can take some more of > those changes you have. > > Can you resend them? I think you had two deltas? I have updated them now for the below commit. http://people.freebsd.org/~thompsa/usb_func2.diff http://people.freebsd.org/~thompsa/usb_return2.diff > * Andrew Thompson [081110 12:54] wrote: > > Author: thompsa > > Date: Mon Nov 10 20:54:31 2008 > > New Revision: 184824 > > URL: http://svn.freebsd.org/changeset/base/184824 > > > > Log: > > Convert the two main locking areas into macros to make it clear on what we are > > grabbing and why. These are now: > > > > USB_BUS_LOCK/USB_BUS_UNLOCK > > USB_XFER_LOCK/USB_XFER_UNLOCK > > > > Reviewed by: alfred > > > > Modified: > > head/sys/dev/usb2/controller/at91dci.c > > head/sys/dev/usb2/controller/at91dci_atmelarm.c > > head/sys/dev/usb2/controller/ehci2.c > > head/sys/dev/usb2/controller/ehci2_pci.c > > head/sys/dev/usb2/controller/musb2_otg.c > > head/sys/dev/usb2/controller/musb2_otg_atmelarm.c > > head/sys/dev/usb2/controller/ohci2.c > > head/sys/dev/usb2/controller/ohci2_atmelarm.c > > head/sys/dev/usb2/controller/ohci2_pci.c > > head/sys/dev/usb2/controller/uhci2.c > > head/sys/dev/usb2/controller/uhci2_pci.c > > head/sys/dev/usb2/controller/usb2_bus.h > > head/sys/dev/usb2/controller/usb2_controller.c > > head/sys/dev/usb2/controller/uss820dci.c > > head/sys/dev/usb2/controller/uss820dci_atmelarm.c > > head/sys/dev/usb2/controller/uss820dci_pccard.c > > head/sys/dev/usb2/core/usb2_busdma.c > > head/sys/dev/usb2/core/usb2_core.h > > head/sys/dev/usb2/core/usb2_device.c > > head/sys/dev/usb2/core/usb2_handle_request.c > > head/sys/dev/usb2/core/usb2_hub.c > > head/sys/dev/usb2/core/usb2_request.c > > head/sys/dev/usb2/core/usb2_sw_transfer.c > > head/sys/dev/usb2/core/usb2_transfer.c > > head/sys/dev/usb2/core/usb2_transfer.h > > head/sys/dev/usb2/serial/uvscom2.c > > head/sys/dev/usb2/storage/ata-usb2.c > > > > Modified: head/sys/dev/usb2/controller/at91dci.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/at91dci.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/at91dci.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -291,7 +291,7 @@ at91dci_rem_wakeup_set(struct usb2_devic > > > > DPRINTFN(5, "is_on=%u\n", is_on); > > > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > > > sc = AT9100_DCI_BUS2SC(udev->bus); > > > > @@ -766,7 +766,7 @@ at91dci_vbus_interrupt(struct usb2_bus * > > > > DPRINTFN(5, "vbus = %u\n", is_on); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > if (is_on) { > > if (!sc->sc_flags.status_vbus) { > > sc->sc_flags.status_vbus = 1; > > @@ -791,7 +791,7 @@ at91dci_vbus_interrupt(struct usb2_bus * > > } > > } > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -801,13 +801,13 @@ at91dci_interrupt(struct at91dci_softc * > > { > > uint32_t status; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > status = AT91_UDP_READ_4(sc, AT91_UDP_ISR); > > status &= AT91_UDP_INT_DEFAULT; > > > > if (!status) { > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > /* acknowledge interrupts */ > > @@ -879,7 +879,7 @@ at91dci_interrupt(struct at91dci_softc * > > > > at91dci_interrupt_poll(sc); > > } > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1065,12 +1065,12 @@ at91dci_timeout(void *arg) > > > > DPRINTF("xfer=%p\n", xfer); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > /* transfer is transferred */ > > at91dci_device_done(xfer, USB_ERR_TIMEOUT); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1115,7 +1115,7 @@ at91dci_root_intr_done(struct usb2_xfer > > > > DPRINTFN(9, "\n"); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_PRE_DATA) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -1255,7 +1255,7 @@ at91dci_device_done(struct usb2_xfer *xf > > struct at91dci_softc *sc = xfer->usb2_sc; > > uint8_t ep_no; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", > > xfer, xfer->pipe, error); > > @@ -1281,7 +1281,7 @@ at91dci_set_stall(struct usb2_device *ud > > uint32_t csr_val; > > uint8_t csr_reg; > > > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > > > DPRINTFN(5, "pipe=%p\n", pipe); > > > > @@ -1405,7 +1405,7 @@ at91dci_clear_stall(struct usb2_device * > > > > DPRINTFN(5, "pipe=%p\n", pipe); > > > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > > > /* check mode */ > > if (udev->flags.usb2_mode != USB_MODE_DEVICE) { > > @@ -1438,7 +1438,7 @@ at91dci_init(struct at91dci_softc *sc) > > sc->sc_bus.usbrev = USB_REV_1_1; > > sc->sc_bus.methods = &at91dci_bus_methods; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > /* turn on clocks */ > > > > @@ -1446,7 +1446,7 @@ at91dci_init(struct at91dci_softc *sc) > > (sc->sc_clocks_on) (sc->sc_clocks_arg); > > } > > /* wait a little for things to stabilise */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > > > /* disable and clear all interrupts */ > > > > @@ -1483,7 +1483,7 @@ at91dci_init(struct at91dci_softc *sc) > > > > at91dci_clocks_off(sc); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > /* catch any lost interrupts */ > > > > @@ -1495,7 +1495,7 @@ at91dci_init(struct at91dci_softc *sc) > > void > > at91dci_uninit(struct at91dci_softc *sc) > > { > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > /* disable and clear all interrupts */ > > AT91_UDP_WRITE_4(sc, AT91_UDP_IDR, 0xFFFFFFFF); > > @@ -1510,7 +1510,7 @@ at91dci_uninit(struct at91dci_softc *sc) > > > > at91dci_pull_down(sc); > > at91dci_clocks_off(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1532,10 +1532,10 @@ at91dci_do_poll(struct usb2_bus *bus) > > { > > struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > at91dci_interrupt_poll(sc); > > at91dci_root_ctrl_poll(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1897,7 +1897,7 @@ at91dci_root_ctrl_done(struct usb2_xfer > > uint16_t index; > > uint8_t use_polling; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_SETUP) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -1913,7 +1913,7 @@ at91dci_root_ctrl_done(struct usb2_xfer > > value = UGETW(std->req.wValue); > > index = UGETW(std->req.wIndex); > > > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > > > /* demultiplex the control request */ > > > > > > Modified: head/sys/dev/usb2/controller/at91dci_atmelarm.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/at91dci_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/at91dci_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -210,7 +210,7 @@ at91_udp_attach(device_t dev) > > device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); > > > > err = usb2_config_td_setup(&sc->sc_dci.sc_config_td, sc, > > - &sc->sc_dci.sc_bus.mtx, NULL, 0, 4); > > + &sc->sc_dci.sc_bus.bus_mtx, NULL, 0, 4); > > if (err) { > > device_printf(dev, "could not setup config thread!\n"); > > goto error; > > > > Modified: head/sys/dev/usb2/controller/ehci2.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/ehci2.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/ehci2.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -164,7 +164,7 @@ ehci_hc_reset(ehci_softc_t *sc) > > EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ > > > > for (n = 0; n != 100; n++) { > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > hcr = EOREAD4(sc, EHCI_USBSTS); > > if (hcr & EHCI_STS_HCH) { > > hcr = 0; > > @@ -180,7 +180,7 @@ ehci_hc_reset(ehci_softc_t *sc) > > > > EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); > > for (n = 0; n != 100; n++) { > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > hcr = EOREAD4(sc, EHCI_USBCMD); > > if (!(hcr & EHCI_CMD_HCRESET)) { > > hcr = 0; > > @@ -208,11 +208,11 @@ ehci_init(ehci_softc_t *sc) > > uint16_t bit; > > usb2_error_t err = 0; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > DPRINTF("start\n"); > > > > - usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.mtx, > > + usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, > > CALLOUT_RETURNUNLOCKED); > > > > #if USB_DEBUG > > @@ -465,7 +465,7 @@ ehci_init(ehci_softc_t *sc) > > EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); > > > > for (i = 0; i < 100; i++) { > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; > > if (!hcr) { > > break; > > @@ -477,7 +477,7 @@ ehci_init(ehci_softc_t *sc) > > goto done; > > } > > done: > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > if (!err) { > > /* catch any lost interrupts */ > > @@ -492,7 +492,7 @@ done: > > void > > ehci_detach(struct ehci_softc *sc) > > { > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > usb2_callout_stop(&sc->sc_tmo_pcd); > > > > @@ -502,9 +502,9 @@ ehci_detach(struct ehci_softc *sc) > > DPRINTF("reset failed!\n"); > > } > > /* XXX let stray task complete */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, 50); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 50); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > usb2_callout_drain(&sc->sc_tmo_pcd); > > > > @@ -518,7 +518,7 @@ ehci_suspend(struct ehci_softc *sc) > > uint32_t hcr; > > uint8_t i; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > for (i = 1; i <= sc->sc_noport; i++) { > > cmd = EOREAD4(sc, EHCI_PORTSC(i)); > > @@ -541,7 +541,7 @@ ehci_suspend(struct ehci_softc *sc) > > if (hcr == 0) { > > break; > > } > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > } > > > > if (hcr != 0) { > > @@ -555,14 +555,14 @@ ehci_suspend(struct ehci_softc *sc) > > if (hcr == EHCI_STS_HCH) { > > break; > > } > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > } > > > > if (hcr != EHCI_STS_HCH) { > > device_printf(sc->sc_bus.bdev, > > "config timeout\n"); > > } > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -574,7 +574,7 @@ ehci_resume(struct ehci_softc *sc) > > uint32_t hcr; > > uint8_t i; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > /* restore things in case the bios doesn't */ > > EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); > > @@ -599,7 +599,7 @@ ehci_resume(struct ehci_softc *sc) > > } > > > > if (hcr) { > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_RESUME_WAIT); > > > > for (i = 1; i <= sc->sc_noport; i++) { > > @@ -618,15 +618,15 @@ ehci_resume(struct ehci_softc *sc) > > if (hcr != EHCI_STS_HCH) { > > break; > > } > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > } > > if (hcr == EHCI_STS_HCH) { > > device_printf(sc->sc_bus.bdev, "config timeout\n"); > > } > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_RESUME_WAIT); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > /* catch any lost interrupts */ > > ehci_do_poll(&sc->sc_bus); > > @@ -639,12 +639,12 @@ ehci_shutdown(ehci_softc_t *sc) > > { > > DPRINTF("stopping the HC\n"); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > if (ehci_hc_reset(sc)) { > > DPRINTF("reset failed!\n"); > > } > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > } > > > > #if USB_DEBUG > > @@ -1415,7 +1415,7 @@ transferred: > > static void > > ehci_pcd_enable(ehci_softc_t *sc) > > { > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > sc->sc_eintrs |= EHCI_STS_PCD; > > EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); > > @@ -1426,7 +1426,7 @@ ehci_pcd_enable(ehci_softc_t *sc) > > usb2_sw_transfer(&sc->sc_root_intr, > > &ehci_root_intr_done); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1460,7 +1460,7 @@ ehci_interrupt(ehci_softc_t *sc) > > { > > uint32_t status; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > DPRINTFN(16, "real interrupt\n"); > > > > @@ -1517,7 +1517,7 @@ ehci_interrupt(ehci_softc_t *sc) > > ehci_interrupt_poll(sc); > > > > done: > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1532,12 +1532,12 @@ ehci_timeout(void *arg) > > > > DPRINTF("xfer=%p\n", xfer); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > /* transfer is transferred */ > > ehci_device_done(xfer, USB_ERR_TIMEOUT); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1547,10 +1547,10 @@ ehci_do_poll(struct usb2_bus *bus) > > { > > struct ehci_softc *sc = EHCI_BUS2SC(bus); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > ehci_interrupt_poll(sc); > > ehci_root_ctrl_poll(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1965,7 +1965,7 @@ ehci_root_intr_done(struct usb2_xfer *xf > > uint16_t i; > > uint16_t m; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_PRE_DATA) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -2124,7 +2124,7 @@ ehci_device_done(struct usb2_xfer *xfer, > > struct usb2_pipe_methods *methods = xfer->pipe->methods; > > ehci_softc_t *sc = xfer->usb2_sc; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", > > xfer, xfer->pipe, error); > > @@ -3076,7 +3076,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > > uint8_t l; > > uint8_t use_polling; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_SETUP) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -3092,7 +3092,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > > value = UGETW(std->req.wValue); > > index = UGETW(std->req.wIndex); > > > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > > > DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " > > "wValue=0x%04x wIndex=0x%04x\n", > > @@ -3373,7 +3373,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > > DELAY(USB_PORT_ROOT_RESET_DELAY * 1000); > > } else { > > /* Wait for reset to complete. */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_PORT_ROOT_RESET_DELAY); > > } > > > > @@ -3385,7 +3385,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf > > DELAY(EHCI_PORT_RESET_COMPLETE * 1000); > > } else { > > /* Wait for HC to complete reset. */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > EHCI_PORT_RESET_COMPLETE); > > } > > > > > > Modified: head/sys/dev/usb2/controller/ehci2_pci.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/ehci2_pci.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/ehci2_pci.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -337,7 +337,7 @@ ehci_pci_attach(device_t self) > > sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); > > } > > > > - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.mtx, > > + err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, > > NULL, 0, 4); > > if (err) { > > device_printf(self, "could not setup config thread!\n"); > > > > Modified: head/sys/dev/usb2/controller/musb2_otg.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/musb2_otg.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/musb2_otg.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -221,7 +221,7 @@ musbotg_wakeup_peer(struct usb2_xfer *xf > > if (!(sc->sc_flags.status_suspend)) { > > return; > > } > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > > > temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); > > temp |= MUSB2_MASK_RESUME; > > @@ -233,7 +233,7 @@ musbotg_wakeup_peer(struct usb2_xfer *xf > > DELAY(8000); > > } else { > > /* Wait for reset to complete. */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, 8); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 8); > > } > > > > temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); > > @@ -982,7 +982,7 @@ musbotg_vbus_interrupt(struct usb2_bus * > > > > DPRINTFN(4, "vbus = %u\n", is_on); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > if (is_on) { > > if (!sc->sc_flags.status_vbus) { > > sc->sc_flags.status_vbus = 1; > > @@ -1007,7 +1007,7 @@ musbotg_vbus_interrupt(struct usb2_bus * > > } > > } > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1021,7 +1021,7 @@ musbotg_interrupt(struct musbotg_softc * > > uint8_t temp; > > uint8_t to = 2; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > repeat: > > > > @@ -1116,7 +1116,7 @@ repeat: > > if (--to) > > goto repeat; > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1273,12 +1273,12 @@ musbotg_timeout(void *arg) > > > > DPRINTFN(1, "xfer=%p\n", xfer); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > /* transfer is transferred */ > > musbotg_device_done(xfer, USB_ERR_TIMEOUT); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1356,7 +1356,7 @@ musbotg_root_intr_done(struct usb2_xfer > > > > DPRINTFN(8, "\n"); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_PRE_DATA) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -1516,7 +1516,7 @@ musbotg_set_stall(struct usb2_device *ud > > struct musbotg_softc *sc; > > uint8_t ep_no; > > > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > > > DPRINTFN(4, "pipe=%p\n", pipe); > > > > @@ -1702,7 +1702,7 @@ musbotg_clear_stall(struct usb2_device * > > > > DPRINTFN(4, "pipe=%p\n", pipe); > > > > - mtx_assert(&udev->bus->mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); > > > > /* check mode */ > > if (udev->flags.usb2_mode != USB_MODE_DEVICE) { > > @@ -1741,7 +1741,7 @@ musbotg_init(struct musbotg_softc *sc) > > sc->sc_bus.usbrev = USB_REV_2_0; > > sc->sc_bus.methods = &musbotg_bus_methods; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > /* turn on clocks */ > > > > @@ -1749,7 +1749,7 @@ musbotg_init(struct musbotg_softc *sc) > > (sc->sc_clocks_on) (sc->sc_clocks_arg); > > } > > /* wait a little for things to stabilise */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > > > /* disable all interrupts */ > > > > @@ -1762,7 +1762,7 @@ musbotg_init(struct musbotg_softc *sc) > > musbotg_pull_common(sc, 0); > > > > /* wait a little bit (10ms) */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, 10); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 10); > > > > /* disable double packet buffering */ > > MUSB2_WRITE_2(sc, MUSB2_REG_RXDBDIS, 0xFFFF); > > @@ -1871,7 +1871,7 @@ musbotg_init(struct musbotg_softc *sc) > > > > musbotg_clocks_off(sc); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > /* catch any lost interrupts */ > > > > @@ -1883,7 +1883,7 @@ musbotg_init(struct musbotg_softc *sc) > > void > > musbotg_uninit(struct musbotg_softc *sc) > > { > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > /* disable all interrupts */ > > MUSB2_WRITE_1(sc, MUSB2_REG_INTUSBE, 0); > > @@ -1899,7 +1899,7 @@ musbotg_uninit(struct musbotg_softc *sc) > > > > musbotg_pull_down(sc); > > musbotg_clocks_off(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1921,10 +1921,10 @@ musbotg_do_poll(struct usb2_bus *bus) > > { > > struct musbotg_softc *sc = MUSBOTG_BUS2SC(bus); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > musbotg_interrupt_poll(sc); > > musbotg_root_ctrl_poll(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -2293,7 +2293,7 @@ musbotg_root_ctrl_done(struct usb2_xfer > > uint16_t index; > > uint8_t use_polling; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_SETUP) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -2309,7 +2309,7 @@ musbotg_root_ctrl_done(struct usb2_xfer > > value = UGETW(std->req.wValue); > > index = UGETW(std->req.wIndex); > > > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > > > /* demultiplex the control request */ > > > > > > Modified: head/sys/dev/usb2/controller/musb2_otg_atmelarm.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/musb2_otg_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/musb2_otg_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -138,7 +138,7 @@ musbotg_attach(device_t dev) > > device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); > > > > err = usb2_config_td_setup(&sc->sc_otg.sc_config_td, sc, > > - &sc->sc_otg.sc_bus.mtx, NULL, 0, 4); > > + &sc->sc_otg.sc_bus.bus_mtx, NULL, 0, 4); > > if (err) { > > device_printf(dev, "could not setup config thread!\n"); > > goto error; > > > > Modified: head/sys/dev/usb2/controller/ohci2.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/ohci2.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/ohci2.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -173,7 +173,7 @@ ohci_controller_init(ohci_softc_t *sc) > > DPRINTF("SMM active, request owner change\n"); > > OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR); > > for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) { > > - usb2_pause_mtx(&sc->sc_bus.mtx, 1); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1); > > ctl = OREAD4(sc, OHCI_CONTROL); > > } > > if (ctl & OHCI_IR) { > > @@ -186,7 +186,7 @@ ohci_controller_init(ohci_softc_t *sc) > > DPRINTF("cold started\n"); > > reset: > > /* controller was cold started */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_BUS_RESET_DELAY); > > } > > > > @@ -197,7 +197,7 @@ reset: > > DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev)); > > OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); > > > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_BUS_RESET_DELAY); > > > > /* we now own the host controller and the bus has been reset */ > > @@ -260,7 +260,7 @@ reset: > > desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A); > > OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP); > > OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > OHCI_ENABLE_POWER_DELAY); > > OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca); > > > > @@ -270,7 +270,7 @@ reset: > > */ > > sc->sc_noport = 0; > > for (i = 0; (i < 10) && (sc->sc_noport == 0); i++) { > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > OHCI_READ_DESC_DELAY); > > sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A)); > > } > > @@ -309,7 +309,7 @@ ohci_init(ohci_softc_t *sc) > > uint16_t x; > > uint16_t y; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > DPRINTF("start\n"); > > > > @@ -391,7 +391,7 @@ ohci_init(ohci_softc_t *sc) > > /* set up the bus struct */ > > sc->sc_bus.methods = &ohci_bus_methods; > > > > - usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.mtx, > > + usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, > > CALLOUT_RETURNUNLOCKED); > > > > #if USB_DEBUG > > @@ -408,10 +408,10 @@ ohci_init(ohci_softc_t *sc) > > sc->sc_bus.usbrev = USB_REV_1_0; > > > > if (ohci_controller_init(sc)) { > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return (USB_ERR_INVAL); > > } else { > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > /* catch any lost interrupts */ > > ohci_do_poll(&sc->sc_bus); > > return (USB_ERR_NORMAL_COMPLETION); > > @@ -424,7 +424,7 @@ ohci_init(ohci_softc_t *sc) > > void > > ohci_detach(struct ohci_softc *sc) > > { > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > usb2_callout_stop(&sc->sc_tmo_rhsc); > > > > @@ -432,9 +432,9 @@ ohci_detach(struct ohci_softc *sc) > > OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); > > > > /* XXX let stray task complete */ > > - usb2_pause_mtx(&sc->sc_bus.mtx, 50); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, 50); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > usb2_callout_drain(&sc->sc_tmo_rhsc); > > > > @@ -449,7 +449,7 @@ ohci_suspend(ohci_softc_t *sc) > > { > > uint32_t ctl; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > #if USB_DEBUG > > DPRINTF("\n"); > > @@ -470,10 +470,10 @@ ohci_suspend(ohci_softc_t *sc) > > ctl |= OHCI_HCFS_SUSPEND; > > OWRITE4(sc, OHCI_CONTROL, ctl); > > > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_RESUME_WAIT); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -482,7 +482,7 @@ ohci_resume(ohci_softc_t *sc) > > { > > uint32_t ctl; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > #if USB_DEBUG > > DPRINTF("\n"); > > @@ -503,13 +503,13 @@ ohci_resume(ohci_softc_t *sc) > > ctl = OREAD4(sc, OHCI_CONTROL); > > ctl |= OHCI_HCFS_RESUME; > > OWRITE4(sc, OHCI_CONTROL, ctl); > > - usb2_pause_mtx(&sc->sc_bus.mtx, USB_RESUME_DELAY); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_DELAY); > > ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_OPERATIONAL; > > OWRITE4(sc, OHCI_CONTROL, ctl); > > - usb2_pause_mtx(&sc->sc_bus.mtx, USB_RESUME_RECOVERY); > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, USB_RESUME_RECOVERY); > > sc->sc_control = sc->sc_intre = 0; > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > /* catch any lost interrupts */ > > ohci_do_poll(&sc->sc_bus); > > @@ -699,7 +699,7 @@ _ohci_append_qh(ohci_ed_t *sed, uint32_t > > { > > DPRINTFN(11, "%p to %p\n", sed, last); > > > > - /* (sc->sc_bus.mtx) must be locked */ > > + /* (sc->sc_bus.bus_mtx) must be locked */ > > > > sed->next = last->next; > > sed->ed_next = last->ed_next; > > @@ -728,7 +728,7 @@ _ohci_remove_qh(ohci_ed_t *sed, ohci_ed_ > > { > > DPRINTFN(11, "%p from %p\n", sed, last); > > > > - /* (sc->sc_bus.mtx) must be locked */ > > + /* (sc->sc_bus.bus_mtx) must be locked */ > > > > /* only remove if not removed from a queue */ > > if (sed->prev) { > > @@ -1099,7 +1099,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) > > { > > DPRINTFN(5, "\n"); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > sc->sc_eintrs |= OHCI_RHSC; > > OWRITE4(sc, OHCI_INTERRUPT_ENABLE, OHCI_RHSC); > > @@ -1110,7 +1110,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) > > usb2_sw_transfer(&sc->sc_root_intr, > > &ohci_root_intr_done); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1146,7 +1146,7 @@ ohci_interrupt(ohci_softc_t *sc) > > uint32_t status; > > uint32_t done; > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > > > hcca = ohci_get_hcca(sc); > > > > @@ -1246,7 +1246,7 @@ ohci_interrupt(ohci_softc_t *sc) > > ohci_interrupt_poll(sc); > > > > done: > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1261,12 +1261,12 @@ ohci_timeout(void *arg) > > > > DPRINTF("xfer=%p\n", xfer); > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > /* transfer is transferred */ > > ohci_device_done(xfer, USB_ERR_TIMEOUT); > > > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > > > return; > > } > > @@ -1276,10 +1276,10 @@ ohci_do_poll(struct usb2_bus *bus) > > { > > struct ohci_softc *sc = OHCI_BUS2SC(bus); > > > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > ohci_interrupt_poll(sc); > > ohci_root_ctrl_poll(sc); > > - mtx_unlock(&sc->sc_bus.mtx); > > + USB_BUS_UNLOCK(&sc->sc_bus); > > return; > > } > > > > @@ -1617,7 +1617,7 @@ ohci_root_intr_done(struct usb2_xfer *xf > > uint16_t i; > > uint16_t m; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_PRE_DATA) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -1663,7 +1663,7 @@ ohci_device_done(struct usb2_xfer *xfer, > > ohci_softc_t *sc = xfer->usb2_sc; > > ohci_ed_t *ed; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > > > DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", > > @@ -2198,7 +2198,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > > uint8_t l; > > uint8_t use_polling; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > if (std->state != USB_SW_TR_SETUP) { > > if (std->state == USB_SW_TR_PRE_CALLBACK) { > > @@ -2214,7 +2214,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > > value = UGETW(std->req.wValue); > > index = UGETW(std->req.wIndex); > > > > - use_polling = mtx_owned(xfer->priv_mtx) ? 1 : 0; > > + use_polling = mtx_owned(xfer->xfer_mtx) ? 1 : 0; > > > > DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " > > "wValue=0x%04x wIndex=0x%04x\n", > > @@ -2375,7 +2375,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > > /* enable RHSC interrupt if condition is cleared. */ > > if ((OREAD4(sc, port) >> 16) == 0) { > > ohci_rhsc_enable(sc); > > - mtx_lock(&sc->sc_bus.mtx); > > + USB_BUS_LOCK(&sc->sc_bus); > > } > > break; > > default: > > @@ -2456,7 +2456,7 @@ ohci_root_ctrl_done(struct usb2_xfer *xf > > /* polling */ > > DELAY(USB_PORT_ROOT_RESET_DELAY * 1000); > > } else { > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_PORT_ROOT_RESET_DELAY); > > } > > > > > > Modified: head/sys/dev/usb2/controller/ohci2_atmelarm.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/ohci2_atmelarm.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/ohci2_atmelarm.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -111,7 +111,7 @@ ohci_atmelarm_attach(device_t dev) > > strlcpy(sc->sc_ohci.sc_vendor, "Atmel", sizeof(sc->sc_ohci.sc_vendor)); > > > > err = usb2_config_td_setup(&sc->sc_ohci.sc_config_td, sc, > > - &sc->sc_ohci.sc_bus.mtx, NULL, 0, 4); > > + &sc->sc_ohci.sc_bus.bus_mtx, NULL, 0, 4); > > if (err) { > > device_printf(dev, "could not setup config thread!\n"); > > goto error; > > > > Modified: head/sys/dev/usb2/controller/ohci2_pci.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/ohci2_pci.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/ohci2_pci.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -280,7 +280,7 @@ ohci_pci_attach(device_t self) > > sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); > > } > > > > - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.mtx, > > + err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, > > NULL, 0, 4); > > if (err) { > > device_printf(self, "could not setup config thread!\n"); > > > > Modified: head/sys/dev/usb2/controller/uhci2.c > > ============================================================================== > > --- head/sys/dev/usb2/controller/uhci2.c Mon Nov 10 18:24:11 2008 (r184823) > > +++ head/sys/dev/usb2/controller/uhci2.c Mon Nov 10 20:54:31 2008 (r184824) > > @@ -265,7 +265,7 @@ uhci_reset(uhci_softc_t *sc) > > struct usb2_page_search buf_res; > > uint16_t n; > > > > - mtx_assert(&sc->sc_bus.mtx, MA_OWNED); > > + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); > > > > DPRINTF("resetting the HC\n"); > > > > @@ -279,7 +279,7 @@ uhci_reset(uhci_softc_t *sc) > > > > /* wait */ > > > > - usb2_pause_mtx(&sc->sc_bus.mtx, > > + usb2_pause_mtx(&sc->sc_bus.bus_mtx, > > USB_BUS_RESET_DELAY); > > > > /* terminate all transfers */ > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > -- > - Alfred Perlstein From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 21:08:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62FC2106564A; Sat, 22 Nov 2008 21:08:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D4308FC19; Sat, 22 Nov 2008 21:08:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAML8PH6029226; Sat, 22 Nov 2008 21:08:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAML8P10029225; Sat, 22 Nov 2008 21:08:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811222108.mAML8P10029225@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 22 Nov 2008 21:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185185 - stable/7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 21:08:25 -0000 Author: kib Date: Sat Nov 22 21:08:25 2008 New Revision: 185185 URL: http://svn.freebsd.org/changeset/base/185185 Log: MFC r184860 (by obrien): Add the kerberos5 libs to the install32 target. Approved by: re (kensmith) Modified: stable/7/Makefile.inc1 (contents, props changed) Modified: stable/7/Makefile.inc1 ============================================================================== --- stable/7/Makefile.inc1 Sat Nov 22 17:54:30 2008 (r185184) +++ stable/7/Makefile.inc1 Sat Nov 22 21:08:25 2008 (r185185) @@ -487,6 +487,9 @@ distribute32 install32: .if ${MK_CRYPT} != "no" cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} .endif +.if ${MK_KERBEROS} != "no" + cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} +.endif cd ${.CURDIR}/libexec/rtld-elf; \ PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 21:12:48 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BD481065740; Sat, 22 Nov 2008 21:12:48 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 559328FC24; Sat, 22 Nov 2008 21:12:48 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMLCmCD029360; Sat, 22 Nov 2008 21:12:48 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMLCmiA029354; Sat, 22 Nov 2008 21:12:48 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200811222112.mAMLCmiA029354@svn.freebsd.org> From: Andrew Thompson Date: Sat, 22 Nov 2008 21:12:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185186 - head/usr.sbin/config X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 21:12:48 -0000 Author: thompsa Date: Sat Nov 22 21:12:47 2008 New Revision: 185186 URL: http://svn.freebsd.org/changeset/base/185186 Log: Allow multiple makeoption lines to be used with the += operator, this permits the following syntax in the kernel config. makeoptions MODULES_OVERRIDE=foo makeoptions MODULES_OVERRIDE+=bar makeoptions MODULES_OVERRIDE+=baz Bump config minor version to 600007. Modified: head/usr.sbin/config/config.5 head/usr.sbin/config/config.h head/usr.sbin/config/config.y head/usr.sbin/config/configvers.h head/usr.sbin/config/lang.l head/usr.sbin/config/mkmakefile.c Modified: head/usr.sbin/config/config.5 ============================================================================== --- head/usr.sbin/config/config.5 Sat Nov 22 21:08:25 2008 (r185185) +++ head/usr.sbin/config/config.5 Sat Nov 22 21:12:47 2008 (r185186) @@ -231,6 +231,7 @@ specifications. Each option specification has the form .Pp .D1 Ar MakeVariableName Ns Op = Ns Ar Value +.D1 Ar MakeVariableName Ns += Ns Ar Value .Pp and results in the appropriate .Xr make 1 @@ -243,7 +244,8 @@ is assumed to be the empty string. .Pp Example: .Bd -literal -offset indent -compact -makeoptions MYMAKEOPTION="foobar" +makeoptions MYMAKEOPTION="foo" +makeoptions MYMAKEOPTION+="bar" makeoptions MYNULLMAKEOPTION .Ed .\" -------- MAXUSERS -------- Modified: head/usr.sbin/config/config.h ============================================================================== --- head/usr.sbin/config/config.h Sat Nov 22 21:08:25 2008 (r185185) +++ head/usr.sbin/config/config.h Sat Nov 22 21:12:47 2008 (r185186) @@ -121,6 +121,7 @@ struct opt { char *op_value; int op_ownfile; /* true = own file, false = makefile */ SLIST_ENTRY(opt) op_next; + SLIST_ENTRY(opt) op_append; }; SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; Modified: head/usr.sbin/config/config.y ============================================================================== --- head/usr.sbin/config/config.y Sat Nov 22 21:08:25 2008 (r185185) +++ head/usr.sbin/config/config.y Sat Nov 22 21:12:47 2008 (r185186) @@ -13,6 +13,7 @@ %token NODEVICE %token ENV %token EQUALS +%token PLUSEQUALS %token HINTS %token IDENT %token MAXUSERS @@ -99,7 +100,7 @@ int yywrap(void); static void newdev(char *name); static void newfile(char *name); static void rmdev_schedule(struct device_head *dh, char *name); -static void newopt(struct opt_head *list, char *name, char *value); +static void newopt(struct opt_head *list, char *name, char *value, int append); static void rmopt_schedule(struct opt_head *list, char *name); static char * @@ -211,7 +212,7 @@ System_spec: ; System_id: - Save_id { newopt(&mkopt, ns("KERNEL"), $1); }; + Save_id { newopt(&mkopt, ns("KERNEL"), $1, 0); }; System_parameter_list: System_parameter_list ID @@ -226,13 +227,13 @@ Opt_list: Option: Save_id { - newopt(&opt, $1, NULL); + newopt(&opt, $1, NULL, 0); if (strchr($1, '=') != NULL) errx(1, "%s:%d: The `=' in options should not be " "quoted", yyfile, yyline); } | Save_id EQUALS Opt_value { - newopt(&opt, $1, $3); + newopt(&opt, $1, $3, 0); } ; Opt_value: @@ -255,8 +256,9 @@ Mkopt_list: ; Mkoption: - Save_id { newopt(&mkopt, $1, ns("")); } | - Save_id EQUALS Opt_value { newopt(&mkopt, $1, $3); } ; + Save_id { newopt(&mkopt, $1, ns(""), 0); } | + Save_id EQUALS Opt_value { newopt(&mkopt, $1, $3, 0); } | + Save_id PLUSEQUALS Opt_value { newopt(&mkopt, $1, $3, 1); } ; Dev: ID { $$ = $1; } @@ -282,7 +284,7 @@ NoDev_list: Device: Dev { - newopt(&opt, devopt($1), ns("1")); + newopt(&opt, devopt($1), ns("1"), 0); /* and the device part */ newdev($1); } @@ -401,9 +403,9 @@ findopt(struct opt_head *list, char *nam * Add an option to the list of options. */ static void -newopt(struct opt_head *list, char *name, char *value) +newopt(struct opt_head *list, char *name, char *value, int append) { - struct opt *op; + struct opt *op, *op2; /* * Ignore inclusions listed explicitly for configuration files. @@ -413,7 +415,8 @@ newopt(struct opt_head *list, char *name return; } - if (findopt(list, name)) { + op2 = findopt(list, name); + if (op2 != NULL && !append) { printf("WARNING: duplicate option `%s' encountered.\n", name); return; } @@ -422,7 +425,12 @@ newopt(struct opt_head *list, char *name op->op_name = name; op->op_ownfile = 0; op->op_value = value; - SLIST_INSERT_HEAD(list, op, op_next); + if (op2 != NULL) { + while (SLIST_NEXT(op2, op_append) != NULL) + op2 = SLIST_NEXT(op2, op_append); + SLIST_NEXT(op2, op_append) = op; + } else + SLIST_INSERT_HEAD(list, op, op_next); } /* Modified: head/usr.sbin/config/configvers.h ============================================================================== --- head/usr.sbin/config/configvers.h Sat Nov 22 21:08:25 2008 (r185185) +++ head/usr.sbin/config/configvers.h Sat Nov 22 21:12:47 2008 (r185186) @@ -49,5 +49,5 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600006 +#define CONFIGVERS 600007 #define MAJOR_VERS(x) ((x) / 100000) Modified: head/usr.sbin/config/lang.l ============================================================================== --- head/usr.sbin/config/lang.l Sat Nov 22 21:08:25 2008 (r185185) +++ head/usr.sbin/config/lang.l Sat Nov 22 21:12:47 2008 (r185186) @@ -156,6 +156,7 @@ PATH [./][-/.%^A-Za-z_0-9]+ ";" { return SEMICOLON; } "," { return COMMA; } "=" { BEGIN TOEOL; return EQUALS; } +"+=" { BEGIN TOEOL; return PLUSEQUALS; } <> { int tok; Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Sat Nov 22 21:08:25 2008 (r185185) +++ head/usr.sbin/config/mkmakefile.c Sat Nov 22 21:12:47 2008 (r185186) @@ -110,7 +110,7 @@ makefile(void) { FILE *ifp, *ofp; char line[BUFSIZ]; - struct opt *op; + struct opt *op, *t; int versreq; read_files(); @@ -127,8 +127,12 @@ makefile(void) if (ofp == 0) err(1, "%s", path("Makefile.new")); fprintf(ofp, "KERN_IDENT=%s\n", ident); - SLIST_FOREACH(op, &mkopt, op_next) - fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); + SLIST_FOREACH_SAFE(op, &mkopt, op_next, t) { + fprintf(ofp, "%s=%s", op->op_name, op->op_value); + while ((op = SLIST_NEXT(op, op_append)) != NULL) + fprintf(ofp, " %s", op->op_value); + fprintf(ofp, "\n"); + } if (debugging) fprintf(ofp, "DEBUG=-g\n"); if (profiling) From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 21:22:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C99A11065670; Sat, 22 Nov 2008 21:22:53 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C46C38FC1A; Sat, 22 Nov 2008 21:22:53 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMLMr8I029596; Sat, 22 Nov 2008 21:22:53 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMLMrCP029595; Sat, 22 Nov 2008 21:22:53 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811222122.mAMLMrCP029595@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 22 Nov 2008 21:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185187 - head/sys/dev/uart X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 21:22:53 -0000 Author: marcel Date: Sat Nov 22 21:22:53 2008 New Revision: 185187 URL: http://svn.freebsd.org/changeset/base/185187 Log: Cast to uintptr_t before casting to void*. This allows the QUICC backend to be built on LP64 platforms. This makes it possible to include the QUICC backend in the kernel module. PR: 127120 Modified: head/sys/dev/uart/uart_dev_quicc.c Modified: head/sys/dev/uart/uart_dev_quicc.c ============================================================================== --- head/sys/dev/uart/uart_dev_quicc.c Sat Nov 22 21:12:47 2008 (r185186) +++ head/sys/dev/uart/uart_dev_quicc.c Sat Nov 22 21:22:53 2008 (r185187) @@ -218,7 +218,7 @@ quicc_getc(struct uart_bas *bas, struct uart_lock(hwmtx); } - buf = (void *)quicc_read4(bas, rb + 4); + buf = (void *)(uintptr_t)quicc_read4(bas, rb + 4); c = *buf; quicc_write2(bas, rb, sc | 0x8000); @@ -433,7 +433,7 @@ quicc_bus_receive(struct uart_softc *sc) uart_lock(sc->sc_hwmtx); rb = quicc_read2(bas, QUICC_PRAM_SCC_RBASE(bas->chan - 1)); st = quicc_read2(bas, rb); - buf = (void *)quicc_read4(bas, rb + 4); + buf = (void *)(uintptr_t)quicc_read4(bas, rb + 4); uart_rx_put(sc, *buf); quicc_write2(bas, rb, st | 0x9000); uart_unlock(sc->sc_hwmtx); @@ -477,7 +477,7 @@ quicc_bus_transmit(struct uart_softc *sc uart_lock(sc->sc_hwmtx); tb = quicc_read2(bas, QUICC_PRAM_SCC_TBASE(bas->chan - 1)); st = quicc_read2(bas, tb); - buf = (void *)quicc_read4(bas, tb + 4); + buf = (void *)(uintptr_t)quicc_read4(bas, tb + 4); *buf = sc->sc_txbuf[0]; quicc_write2(bas, tb + 2, 1); quicc_write2(bas, tb, st | 0x9000); From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 21:24:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B2C31065677; Sat, 22 Nov 2008 21:24:08 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 961048FC1B; Sat, 22 Nov 2008 21:24:08 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMLO7me029664; Sat, 22 Nov 2008 21:24:07 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMLO70a029663; Sat, 22 Nov 2008 21:24:07 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811222124.mAMLO70a029663@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 22 Nov 2008 21:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185188 - head/sys/modules/uart X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 21:24:08 -0000 Author: marcel Date: Sat Nov 22 21:24:07 2008 New Revision: 185188 URL: http://svn.freebsd.org/changeset/base/185188 Log: Include the QUICC backend in the kernel module. PR: 127120 Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Sat Nov 22 21:22:53 2008 (r185187) +++ head/sys/modules/uart/Makefile Sat Nov 22 21:24:07 2008 (r185188) @@ -11,7 +11,8 @@ KMOD= uart SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ uart_core.c uart_dbg.c \ - uart_dev_ns8250.c uart_dev_sab82532.c uart_dev_z8530.c \ + uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ + uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c .if ${MACHINE} == "sun4v" SRCS+= uart_cpu_sparc64.c From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 21:51:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46D431065670 for ; Sat, 22 Nov 2008 21:51:18 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.230]) by mx1.freebsd.org (Postfix) with ESMTP id 318388FC0A for ; Sat, 22 Nov 2008 21:51:17 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so1448108rvf.43 for ; Sat, 22 Nov 2008 13:51:17 -0800 (PST) Received: by 10.141.13.16 with SMTP id q16mr997789rvi.272.1227389186493; Sat, 22 Nov 2008 13:26:26 -0800 (PST) Received: by 10.141.153.21 with HTTP; Sat, 22 Nov 2008 13:26:26 -0800 (PST) Message-ID: <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> Date: Sat, 22 Nov 2008 13:26:26 -0800 From: kmacy@freebsd.org To: "Kostik Belousov" In-Reply-To: <20081122112949.GA6408@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 21:51:18 -0000 This was a concern of mine - note that many driver writers assume they exist. Thoughts on efficiently handling it via checking cpuid at runtime? Alternatively we could have it be conditional on CPU_i786. On 11/22/08, Kostik Belousov wrote: > On Sat, Nov 22, 2008 at 05:55:56AM +0000, Kip Macy wrote: >> Author: kmacy >> Date: Sat Nov 22 05:55:56 2008 >> New Revision: 185162 >> URL: http://svn.freebsd.org/changeset/base/185162 >> >> Log: >> - bump __FreeBSD version to reflect added buf_ring, memory barriers, >> and ifnet functions >> >> - add memory barriers to > >> Modified: head/sys/i386/include/atomic.h >> ============================================================================== >> --- head/sys/i386/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) >> +++ head/sys/i386/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) >> @@ -32,6 +32,21 @@ >> #error this file needs sys/cdefs.h as a prerequisite >> #endif >> >> + >> +#if defined(I686_CPU) >> +#define mb() __asm__ __volatile__ ("mfence;": : :"memory") >> +#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") >> +#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") >> +#else >> +/* >> + * do we need a serializing instruction? >> + */ >> +#define mb() >> +#define wmb() >> +#define rmb() >> +#endif >> + >> + >> /* >> * Various simple operations on memory, each of which is atomic in the >> * presence of interrupts and multiple processors. > AFAIR, sfence instruction was added with the Pentium III processor (SSE), > while lfence was introduced with the Pentium 4 (SSE2). > > I think that #ifdef I686_CPU handling of the fences is wrong. We need to > use a serialized instruction on CPUs that does not support corresponding > fence, if needed. > -- If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 22:05:34 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 032B91065673; Sat, 22 Nov 2008 22:05:34 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id DD9BD8FC19; Sat, 22 Nov 2008 22:05:32 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id mAMM5Mfh020749; Sat, 22 Nov 2008 15:05:23 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <49288222.5060205@samsco.org> Date: Sat, 22 Nov 2008 15:05:22 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: kmacy@FreeBSD.org References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> In-Reply-To: <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: Kostik Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 22:05:34 -0000 A neat hack would be for the kernel linker to scan the text and do a drop-in replacement of the opcode that is appropriate for the platform. I can't see how a CPU_XXX definition would work because it's just a compile time construct, one that can be included with any kernel compile. Scott kmacy@FreeBSD.org wrote: > This was a concern of mine - note that many driver writers assume they exist. > > Thoughts on efficiently handling it via checking cpuid at runtime? > Alternatively we could have it be conditional on CPU_i786. > > On 11/22/08, Kostik Belousov wrote: >> On Sat, Nov 22, 2008 at 05:55:56AM +0000, Kip Macy wrote: >>> Author: kmacy >>> Date: Sat Nov 22 05:55:56 2008 >>> New Revision: 185162 >>> URL: http://svn.freebsd.org/changeset/base/185162 >>> >>> Log: >>> - bump __FreeBSD version to reflect added buf_ring, memory barriers, >>> and ifnet functions >>> >>> - add memory barriers to >>> Modified: head/sys/i386/include/atomic.h >>> ============================================================================== >>> --- head/sys/i386/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) >>> +++ head/sys/i386/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) >>> @@ -32,6 +32,21 @@ >>> #error this file needs sys/cdefs.h as a prerequisite >>> #endif >>> >>> + >>> +#if defined(I686_CPU) >>> +#define mb() __asm__ __volatile__ ("mfence;": : :"memory") >>> +#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") >>> +#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") >>> +#else >>> +/* >>> + * do we need a serializing instruction? >>> + */ >>> +#define mb() >>> +#define wmb() >>> +#define rmb() >>> +#endif >>> + >>> + >>> /* >>> * Various simple operations on memory, each of which is atomic in the >>> * presence of interrupts and multiple processors. >> AFAIR, sfence instruction was added with the Pentium III processor (SSE), >> while lfence was introduced with the Pentium 4 (SSE2). >> >> I think that #ifdef I686_CPU handling of the fences is wrong. We need to >> use a serialized instruction on CPUs that does not support corresponding >> fence, if needed. >> > > From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 22:10:52 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31FF31065675 for ; Sat, 22 Nov 2008 22:10:52 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.236]) by mx1.freebsd.org (Postfix) with ESMTP id 194808FC1D for ; Sat, 22 Nov 2008 22:10:52 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so1452506rvf.43 for ; Sat, 22 Nov 2008 14:10:51 -0800 (PST) Received: by 10.140.192.9 with SMTP id p9mr1033027rvf.57.1227391851741; Sat, 22 Nov 2008 14:10:51 -0800 (PST) Received: by 10.141.153.21 with HTTP; Sat, 22 Nov 2008 14:10:51 -0800 (PST) Message-ID: <3c1674c90811221410m4cadf277x9aa6f1fd4bfc2848@mail.gmail.com> Date: Sat, 22 Nov 2008 22:10:51 +0000 From: kmacy@freebsd.org To: "Scott Long" In-Reply-To: <49288222.5060205@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> <49288222.5060205@samsco.org> Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 22:10:52 -0000 On 11/22/08, Scott Long wrote: > A neat hack would be for the kernel linker to scan the text and do a > drop-in replacement of the opcode that is appropriate for the platform. Yup, Linux does that for a number of things wasn't sure we want to go down that road. > I can't see how a CPU_XXX definition would work because it's just a > compile time construct, one that can be included with any kernel > compile. It would be the user's responsibility not to include it if his target platform doesn't support it. > Scott > > > kmacy@FreeBSD.org wrote: >> This was a concern of mine - note that many driver writers assume they >> exist. >> >> Thoughts on efficiently handling it via checking cpuid at runtime? >> Alternatively we could have it be conditional on CPU_i786. >> >> On 11/22/08, Kostik Belousov wrote: >>> On Sat, Nov 22, 2008 at 05:55:56AM +0000, Kip Macy wrote: >>>> Author: kmacy >>>> Date: Sat Nov 22 05:55:56 2008 >>>> New Revision: 185162 >>>> URL: http://svn.freebsd.org/changeset/base/185162 >>>> >>>> Log: >>>> - bump __FreeBSD version to reflect added buf_ring, memory barriers, >>>> and ifnet functions >>>> >>>> - add memory barriers to >>>> Modified: head/sys/i386/include/atomic.h >>>> ============================================================================== >>>> --- head/sys/i386/include/atomic.h Sat Nov 22 01:48:20 2008 (r185161) >>>> +++ head/sys/i386/include/atomic.h Sat Nov 22 05:55:56 2008 (r185162) >>>> @@ -32,6 +32,21 @@ >>>> #error this file needs sys/cdefs.h as a prerequisite >>>> #endif >>>> >>>> + >>>> +#if defined(I686_CPU) >>>> +#define mb() __asm__ __volatile__ ("mfence;": : :"memory") >>>> +#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") >>>> +#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") >>>> +#else >>>> +/* >>>> + * do we need a serializing instruction? >>>> + */ >>>> +#define mb() >>>> +#define wmb() >>>> +#define rmb() >>>> +#endif >>>> + >>>> + >>>> /* >>>> * Various simple operations on memory, each of which is atomic in the >>>> * presence of interrupts and multiple processors. >>> AFAIR, sfence instruction was added with the Pentium III processor (SSE), >>> while lfence was introduced with the Pentium 4 (SSE2). >>> >>> I think that #ifdef I686_CPU handling of the fences is wrong. We need to >>> use a serialized instruction on CPUs that does not support corresponding >>> fence, if needed. >>> >> >> > > -- If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 22:15:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE0B31065670; Sat, 22 Nov 2008 22:15:34 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B71018FC08; Sat, 22 Nov 2008 22:15:34 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMMFYG7030706; Sat, 22 Nov 2008 22:15:34 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMMFYSF030705; Sat, 22 Nov 2008 22:15:34 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811222215.mAMMFYSF030705@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 22 Nov 2008 22:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185189 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 22:15:34 -0000 Author: marcel Date: Sat Nov 22 22:15:34 2008 New Revision: 185189 URL: http://svn.freebsd.org/changeset/base/185189 Log: Unbreak previous commit. Modified: head/sys/powerpc/include/atomic.h Modified: head/sys/powerpc/include/atomic.h ============================================================================== --- head/sys/powerpc/include/atomic.h Sat Nov 22 21:24:07 2008 (r185188) +++ head/sys/powerpc/include/atomic.h Sat Nov 22 22:15:34 2008 (r185189) @@ -531,6 +531,4 @@ atomic_fetchadd_32(volatile uint32_t *p, #define atomic_fetchadd_long(p, v) \ (u_long)atomic_fetchadd_32((volatile u_int *)(p), (u_int)(v)) -#undef __ATOMIC_BARRIER - #endif /* ! _MACHINE_ATOMIC_H_ */ From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 22:20:00 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2E491065674; Sat, 22 Nov 2008 22:19:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 87D928FC1A; Sat, 22 Nov 2008 22:19:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L40pY-000189-SM; Sun, 23 Nov 2008 00:19:57 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mAMMJsVH077325 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 23 Nov 2008 00:19:54 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mAMMJsj0047892; Sun, 23 Nov 2008 00:19:54 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mAMMJrWF047891; Sun, 23 Nov 2008 00:19:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Nov 2008 00:19:53 +0200 From: Kostik Belousov To: Scott Long Message-ID: <20081122221953.GO6408@deviant.kiev.zoral.com.ua> References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> <49288222.5060205@samsco.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vNrHrykRFvLVX6W3" Content-Disposition: inline In-Reply-To: <49288222.5060205@samsco.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L40pY-000189-SM dcdb72959fa04b012c3a604d40122628 X-Terabit: YES Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, kmacy@FreeBSD.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 22:20:00 -0000 --vNrHrykRFvLVX6W3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: > A neat hack would be for the kernel linker to scan the text and do a > drop-in replacement of the opcode that is appropriate for the platform. > I can't see how a CPU_XXX definition would work because it's just a > compile time construct, one that can be included with any kernel > compile. Yes, it is possible to do that. Less drastic change is to directly check features. I moved slow code to separate section to eliminate unconditional jump in fast path. Only compile-tested. diff --git a/sys/conf/ldscript.i386 b/sys/conf/ldscript.i386 index a94f32f..49d9636 100644 --- a/sys/conf/ldscript.i386 +++ b/sys/conf/ldscript.i386 @@ -45,6 +45,7 @@ SECTIONS .text : { *(.text) + *(.text.offpath) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h index f6bcf0c..5806d41 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -32,11 +32,38 @@ #error this file needs sys/cdefs.h as a prerequisite #endif =20 - +#ifdef _KERNEL #if defined(I686_CPU) -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") +#define mb() __asm__ __volatile__ ( \ + "testl\t$0x04000000,cpu_feature\n" \ + "\tje\t2f\n" \ + "\tmfence\n" \ + "1:\n" \ + "\t.section\t.text.offpath\n" \ + "2:\tlock;addl\t$0,cpu_feature\n" \ + "\tjmp\t1b\n" \ + "\t.text" \ + : : :"memory") +#define wmb() __asm__ __volatile__ ( \ + "testl\t$0x02000000,cpu_feature\n" \ + "\tje\t2f\n" \ + "\tsfence\n" \ + "1:\n" \ + "\t.section\t.text.offpath\n" \ + "2:\tlock;addl\t$0,cpu_feature\n" \ + "\tjmp\t1b\n" \ + "\t.text" \ + : : :"memory") +#define rmb() __asm__ __volatile__ ( \ + "testl\t$0x04000000,cpu_feature\n" \ + "\tje\t2f\n" \ + "\tlfence\n" \ + "1:\n" \ + "\t.section\t.text.offpath\n" \ + "2:\tlock;addl\t$0,cpu_feature\n" \ + "\tjmp\t1b\n" \ + "\t.text" \ + : : :"memory") #else /* * do we need a serializing instruction? @@ -45,7 +72,7 @@ #define wmb() #define rmb() #endif - +#endif =20 /* * Various simple operations on memory, each of which is atomic in the --vNrHrykRFvLVX6W3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkohYkACgkQC3+MBN1Mb4gGfgCbBbHvxaGmEChWn9k662Yui5z8 NYUAoLpu9ZpAWJTSvkO/71MLhvkmFVck =CVAC -----END PGP SIGNATURE----- --vNrHrykRFvLVX6W3-- From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 23:17:02 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE22F1065670; Sat, 22 Nov 2008 23:17:02 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 1E8A48FC1E; Sat, 22 Nov 2008 23:17:01 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id mAMN8xJW021129; Sat, 22 Nov 2008 16:08:59 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <4928910B.1020403@samsco.org> Date: Sat, 22 Nov 2008 16:08:59 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Kostik Belousov References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> <49288222.5060205@samsco.org> <20081122221953.GO6408@deviant.kiev.zoral.com.ua> In-Reply-To: <20081122221953.GO6408@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, kmacy@FreeBSD.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 23:17:02 -0000 Kostik Belousov wrote: > On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: >> A neat hack would be for the kernel linker to scan the text and do a >> drop-in replacement of the opcode that is appropriate for the platform. >> I can't see how a CPU_XXX definition would work because it's just a >> compile time construct, one that can be included with any kernel >> compile. > > Yes, it is possible to do that. Less drastic change is to directly > check features. I moved slow code to separate section to eliminate > unconditional jump in fast path. > Only compile-tested. > As long as it works, I think it's a step in the right direction; I'm assuming that cpu_feature is a symbol filled in at runtime and not a macro for the cpuid instruction, right? Scott From owner-svn-src-all@FreeBSD.ORG Sat Nov 22 23:48:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6F9D1065674; Sat, 22 Nov 2008 23:48:33 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D00888FC24; Sat, 22 Nov 2008 23:48:33 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMNmXTK032613; Sat, 22 Nov 2008 23:48:33 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMNmXf3032612; Sat, 22 Nov 2008 23:48:33 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811222348.mAMNmXf3032612@svn.freebsd.org> From: Sam Leffler Date: Sat, 22 Nov 2008 23:48:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185190 - stable/7/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 23:48:34 -0000 Author: sam Date: Sat Nov 22 23:48:33 2008 New Revision: 185190 URL: http://svn.freebsd.org/changeset/base/185190 Log: change private mbuf flags to use M_PROTO* so they don't conflict with public definitions; note this constitutes an ABI change so drivers that use M_TXCB or M_FF must be recompiled Approved by: re (kib) Modified: stable/7/sys/net80211/ieee80211_freebsd.h Modified: stable/7/sys/net80211/ieee80211_freebsd.h ============================================================================== --- stable/7/sys/net80211/ieee80211_freebsd.h Sat Nov 22 22:15:34 2008 (r185189) +++ stable/7/sys/net80211/ieee80211_freebsd.h Sat Nov 22 23:48:33 2008 (r185190) @@ -197,9 +197,10 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_LINK0 M_PROTO1 /* WEP requested */ #define M_PWR_SAV M_PROTO4 /* bypass PS handling */ #define M_MORE_DATA M_PROTO5 /* more data frames to follow */ -#define M_FF 0x20000 /* fast frame */ -#define M_TXCB 0x40000 /* do tx complete callback */ -#define M_80211_TX (0x60000|M_PROTO1|M_WME_AC_MASK|M_PROTO4|M_PROTO5) +#define M_FF M_PROTO6 /* fast frame */ +#define M_TXCB M_PROTO7 /* do tx complete callback */ +#define M_80211_TX \ + (M_LINK0|M_WME_AC_MASK|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB) /* rx path usage */ #define M_AMPDU M_PROTO1 /* A-MPDU processing done */