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); > + US