From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 24 09:42:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1DFA91065670; Sun, 24 Jun 2012 09:42:37 +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 082958FC19; Sun, 24 Jun 2012 09:42:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5O9ga8X001432; Sun, 24 Jun 2012 09:42:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5O9gaYp001429; Sun, 24 Jun 2012 09:42:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206240942.q5O9gaYp001429@svn.freebsd.org> From: Alexander Motin Date: Sun, 24 Jun 2012 09:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237533 - stable/8/sys/cam/scsi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 09:42:37 -0000 Author: mav Date: Sun Jun 24 09:42:36 2012 New Revision: 237533 URL: http://svn.freebsd.org/changeset/base/237533 Log: MFC r237225: Remove never used CD/DA_FLAG_TAGGED_QUEUING flags. Modified: stable/8/sys/cam/scsi/scsi_cd.c stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Sun Jun 24 09:41:27 2012 (r237532) +++ stable/8/sys/cam/scsi/scsi_cd.c Sun Jun 24 09:42:36 2012 (r237533) @@ -97,7 +97,6 @@ typedef enum { CD_FLAG_NEW_DISC = 0x0002, CD_FLAG_DISC_LOCKED = 0x0004, CD_FLAG_DISC_REMOVABLE = 0x0008, - CD_FLAG_TAGGED_QUEUING = 0x0010, CD_FLAG_CHANGER = 0x0040, CD_FLAG_ACTIVE = 0x0080, CD_FLAG_SCHED_ON_COMP = 0x0100, @@ -652,8 +651,6 @@ cdregister(struct cam_periph *periph, vo bioq_init(&softc->bio_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= CD_FLAG_DISC_REMOVABLE; - if ((cgd->inq_data.flags & SID_CmdQue) != 0) - softc->flags |= CD_FLAG_TAGGED_QUEUING; periph->softc = softc; softc->periph = periph; Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Sun Jun 24 09:41:27 2012 (r237532) +++ stable/8/sys/cam/scsi/scsi_da.c Sun Jun 24 09:42:36 2012 (r237533) @@ -76,7 +76,6 @@ typedef enum { DA_FLAG_NEW_PACK = 0x002, DA_FLAG_PACK_LOCKED = 0x004, DA_FLAG_PACK_REMOVABLE = 0x008, - DA_FLAG_TAGGED_QUEUING = 0x010, DA_FLAG_NEED_OTAG = 0x020, DA_FLAG_WENT_IDLE = 0x040, DA_FLAG_RETRY_UA = 0x080, @@ -1445,8 +1444,6 @@ daregister(struct cam_periph *periph, vo bioq_init(&softc->bio_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; - if ((cgd->inq_data.flags & SID_CmdQue) != 0) - softc->flags |= DA_FLAG_TAGGED_QUEUING; periph->softc = softc; From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 24 17:37:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6368106566B; Sun, 24 Jun 2012 17:37:08 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96F7B8FC12; Sun, 24 Jun 2012 17:37:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5OHb8nX022831; Sun, 24 Jun 2012 17:37:08 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5OHb8Y4022827; Sun, 24 Jun 2012 17:37:08 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201206241737.q5OHb8Y4022827@svn.freebsd.org> From: Christian Brueffer Date: Sun, 24 Jun 2012 17:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237538 - in stable/8: . share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 17:37:08 -0000 Author: brueffer Date: Sun Jun 24 17:37:08 2012 New Revision: 237538 URL: http://svn.freebsd.org/changeset/base/237538 Log: MFC: r211353 Tie up some loose ends r88509 left behind: - chooseproc() is long gone, MLINK choosethread instead - Update NAME section for choosethread - Mark chooseproc.9 for removal Modified: stable/8/ObsoleteFiles.inc (contents, props changed) stable/8/share/man/man9/Makefile stable/8/share/man/man9/runqueue.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Sun Jun 24 17:30:54 2012 (r237537) +++ stable/8/ObsoleteFiles.inc Sun Jun 24 17:37:08 2012 (r237538) @@ -27,6 +27,8 @@ OLD_FILES+=usr/share/man/man8/MAKEDEV.8. OLD_FILES+=usr/share/man/man9/vgonel.9.gz # 20101025: catch up with vm_page_sleep_if_busy rename OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz +# 20100815: retired last traces of chooseproc(9) +OLD_FILES+=usr/share/man/man9/chooseproc.9.gz # 20100327: fusword.9 and susword.9 removed OLD_FILES+=usr/share/man/man9/fusword.9.gz OLD_FILES+=usr/share/man/man9/susword.9.gz Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Sun Jun 24 17:30:54 2012 (r237537) +++ stable/8/share/man/man9/Makefile Sun Jun 24 17:37:08 2012 (r237538) @@ -1036,7 +1036,7 @@ MLINKS+=rtalloc.9 rtalloc1.9 \ rtalloc.9 rtalloc_ign.9 \ rtalloc.9 RTFREE.9 \ rtalloc.9 rtfree.9 -MLINKS+=runqueue.9 chooseproc.9 \ +MLINKS+=runqueue.9 choosethread.9 \ runqueue.9 procrunnable.9 \ runqueue.9 remrunqueue.9 \ runqueue.9 setrunqueue.9 Modified: stable/8/share/man/man9/runqueue.9 ============================================================================== --- stable/8/share/man/man9/runqueue.9 Sun Jun 24 17:30:54 2012 (r237537) +++ stable/8/share/man/man9/runqueue.9 Sun Jun 24 17:37:08 2012 (r237538) @@ -23,11 +23,11 @@ .\" .\" $FreeBSD$ .\" -.Dd November 3, 2000 +.Dd August 15, 2010 .Dt RUNQUEUE 9 .Os .Sh NAME -.Nm chooseproc , +.Nm choosethread , .Nm procrunnable , .Nm remrunqueue , .Nm setrunqueue From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 25 07:11:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 46789106564A; Mon, 25 Jun 2012 07:11:04 +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 30F818FC1E; Mon, 25 Jun 2012 07:11:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5P7B4GA056890; Mon, 25 Jun 2012 07:11:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5P7B3X2056888; Mon, 25 Jun 2012 07:11:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206250711.q5P7B3X2056888@svn.freebsd.org> From: Alexander Motin Date: Mon, 25 Jun 2012 07:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237550 - stable/8/sys/dev/twa X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 07:11:04 -0000 Author: mav Date: Mon Jun 25 07:11:03 2012 New Revision: 237550 URL: http://svn.freebsd.org/changeset/base/237550 Log: MFC r237460: Return CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE instead of CAM_TID_INVALID and CAM_LUN_INVALID for case of missing devices. In removes tons of error messages from CAM during bus scans. Reported and tested by: Mike Tancsa Modified: stable/8/sys/dev/twa/tw_osl_cam.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/twa/tw_osl_cam.c ============================================================================== --- stable/8/sys/dev/twa/tw_osl_cam.c Mon Jun 25 07:09:36 2012 (r237549) +++ stable/8/sys/dev/twa/tw_osl_cam.c Mon Jun 25 07:11:03 2012 (r237550) @@ -678,9 +678,9 @@ tw_osl_complete_io(struct tw_cl_req_hand ccb->ccb_h.status = CAM_REQ_CMP; else { if (req_pkt->status & TW_CL_ERR_REQ_INVALID_TARGET) - ccb->ccb_h.status |= CAM_TID_INVALID; + ccb->ccb_h.status |= CAM_SEL_TIMEOUT; else if (req_pkt->status & TW_CL_ERR_REQ_INVALID_LUN) - ccb->ccb_h.status |= CAM_LUN_INVALID; + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; else if (req_pkt->status & TW_CL_ERR_REQ_SCSI_ERROR) ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; else if (req_pkt->status & TW_CL_ERR_REQ_BUS_RESET) From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 25 07:29:14 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5D4D106564A; Mon, 25 Jun 2012 07:29:14 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B01148FC0C; Mon, 25 Jun 2012 07:29:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5P7TERd057761; Mon, 25 Jun 2012 07:29:14 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5P7TE9p057759; Mon, 25 Jun 2012 07:29:14 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206250729.q5P7TE9p057759@svn.freebsd.org> From: Fabien Thomas Date: Mon, 25 Jun 2012 07:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237553 - stable/8/sys/dev/xen/balloon X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 07:29:14 -0000 Author: fabient Date: Mon Jun 25 07:29:14 2012 New Revision: 237553 URL: http://svn.freebsd.org/changeset/base/237553 Log: MFC r237322: Allow booting XENHVM kernel without Xen hypervisor. Modified: stable/8/sys/dev/xen/balloon/balloon.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/xen/balloon/balloon.c ============================================================================== --- stable/8/sys/dev/xen/balloon/balloon.c Mon Jun 25 07:27:31 2012 (r237552) +++ stable/8/sys/dev/xen/balloon/balloon.c Mon Jun 25 07:29:14 2012 (r237553) @@ -437,6 +437,9 @@ balloon_init_watcher(void *arg) { int err; + if (!is_running_on_xen()) + return; + err = xs_register_watch(&target_watch); if (err) printf("Failed to set balloon watcher\n"); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 25 07:36:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50270106567C; Mon, 25 Jun 2012 07:36:01 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3ACF38FC15; Mon, 25 Jun 2012 07:36:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5P7a1CI058160; Mon, 25 Jun 2012 07:36:01 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5P7a1Tw058158; Mon, 25 Jun 2012 07:36:01 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206250736.q5P7a1Tw058158@svn.freebsd.org> From: Fabien Thomas Date: Mon, 25 Jun 2012 07:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237555 - stable/8/sys/dev/viawd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 07:36:01 -0000 Author: fabient Date: Mon Jun 25 07:36:00 2012 New Revision: 237555 URL: http://svn.freebsd.org/changeset/base/237555 Log: MFC r237295: Fix viawd(4) that was only working as a module. Modified: stable/8/sys/dev/viawd/viawd.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/viawd/viawd.c ============================================================================== --- stable/8/sys/dev/viawd/viawd.c Mon Jun 25 07:33:54 2012 (r237554) +++ stable/8/sys/dev/viawd/viawd.c Mon Jun 25 07:36:00 2012 (r237555) @@ -168,14 +168,18 @@ viawd_attach(device_t dev) } /* Allocate I/O register space. */ - sc->wd_rid = 0; - sc->wd_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->wd_rid, - pmbase, pmbase + VIAWD_MEM_LEN - 1, VIAWD_MEM_LEN, + sc->wd_rid = VIAWD_CONFIG_BASE; + sc->wd_res = bus_alloc_resource_any(sb_dev, SYS_RES_MEMORY, &sc->wd_rid, RF_ACTIVE | RF_SHAREABLE); if (sc->wd_res == NULL) { device_printf(dev, "Unable to map watchdog memory\n"); goto fail; } + if (rman_get_size(sc->wd_res) < VIAWD_MEM_LEN) { + device_printf(dev, "Bad size for watchdog memory: %#x\n", + (unsigned)rman_get_size(sc->wd_res)); + goto fail; + } /* Check if watchdog fired last boot. */ reg = viawd_read_4(sc, VIAWD_MEM_CTRL); @@ -192,7 +196,7 @@ viawd_attach(device_t dev) return (0); fail: if (sc->wd_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, + bus_release_resource(sb_dev, SYS_RES_MEMORY, sc->wd_rid, sc->wd_res); return (ENXIO); } @@ -224,7 +228,7 @@ viawd_detach(device_t dev) } if (sc->wd_res != NULL) - bus_release_resource(sc->dev, SYS_RES_MEMORY, + bus_release_resource(sc->sb_dev, SYS_RES_MEMORY, sc->wd_rid, sc->wd_res); return (0); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 25 12:30:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2BBC81065690; Mon, 25 Jun 2012 12:30:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 115168FC0A; Mon, 25 Jun 2012 12:30:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5PCUpt9073765; Mon, 25 Jun 2012 12:30:51 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5PCUpPA073759; Mon, 25 Jun 2012 12:30:51 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201206251230.q5PCUpPA073759@svn.freebsd.org> From: Christian Brueffer Date: Mon, 25 Jun 2012 12:30:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237562 - in stable/8/sys: amd64/conf i386/conf mips/conf pc98/conf sparc64/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 12:30:52 -0000 Author: brueffer Date: Mon Jun 25 12:30:51 2012 New Revision: 237562 URL: http://svn.freebsd.org/changeset/base/237562 Log: MFC: r225482 Fix a zyd(4) comment typo that was copy+pasted into most kernel config files. Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/i386/conf/GENERIC stable/8/sys/mips/conf/OCTEON1 stable/8/sys/pc98/conf/GENERIC stable/8/sys/sparc64/conf/GENERIC Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Mon Jun 25 11:52:26 2012 (r237561) +++ stable/8/sys/amd64/conf/GENERIC Mon Jun 25 12:30:51 2012 (r237562) @@ -319,7 +319,7 @@ device udav # Davicom DM9601E USB device rum # Ralink Technology RT2501USB wireless NICs device uath # Atheros AR5523 wireless NICs device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs +device zyd # ZyDAS zd1211/zd1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Mon Jun 25 11:52:26 2012 (r237561) +++ stable/8/sys/i386/conf/GENERIC Mon Jun 25 12:30:51 2012 (r237562) @@ -333,7 +333,7 @@ device udav # Davicom DM9601E USB device rum # Ralink Technology RT2501USB wireless NICs device uath # Atheros AR5523 wireless NICs device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs +device zyd # ZyDAS zd1211/zd1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: stable/8/sys/mips/conf/OCTEON1 ============================================================================== --- stable/8/sys/mips/conf/OCTEON1 Mon Jun 25 11:52:26 2012 (r237561) +++ stable/8/sys/mips/conf/OCTEON1 Mon Jun 25 12:30:51 2012 (r237562) @@ -295,4 +295,4 @@ device udav # Davicom DM9601E USB device rum # Ralink Technology RT2501USB wireless NICs device uath # Atheros AR5523 wireless NICs device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs +device zyd # ZyDAS zd1211/zd1211b wireless NICs Modified: stable/8/sys/pc98/conf/GENERIC ============================================================================== --- stable/8/sys/pc98/conf/GENERIC Mon Jun 25 11:52:26 2012 (r237561) +++ stable/8/sys/pc98/conf/GENERIC Mon Jun 25 12:30:51 2012 (r237562) @@ -283,7 +283,7 @@ device bpf # Berkeley packet filter #device rum # Ralink Technology RT2501USB wireless NICs #device uath # Atheros AR5523 wireless NICs #device ural # Ralink Technology RT2500USB wireless NICs -#device zyd # ZyDAS zb1211/zb1211b wireless NICs +#device zyd # ZyDAS zd1211/zd1211b wireless NICs # FireWire support #device firewire # FireWire bus code Modified: stable/8/sys/sparc64/conf/GENERIC ============================================================================== --- stable/8/sys/sparc64/conf/GENERIC Mon Jun 25 11:52:26 2012 (r237561) +++ stable/8/sys/sparc64/conf/GENERIC Mon Jun 25 12:30:51 2012 (r237562) @@ -262,7 +262,7 @@ device udav # Davicom DM9601E USB device rum # Ralink Technology RT2501USB wireless NICs device uath # Atheros AR5523 wireless NICs device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs +device zyd # ZyDAS zd1211/zd1211b wireless NICs # FireWire support device firewire # FireWire bus code From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 25 23:40:19 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B6505106566B; Mon, 25 Jun 2012 23:40:19 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A124E8FC0C; Mon, 25 Jun 2012 23:40:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5PNeJss002861; Mon, 25 Jun 2012 23:40:19 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5PNeJgE002859; Mon, 25 Jun 2012 23:40:19 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206252340.q5PNeJgE002859@svn.freebsd.org> From: Warren Block Date: Mon, 25 Jun 2012 23:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237585 - stable/8/lib/libc/locale X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 23:40:19 -0000 Author: wblock (doc committer) Date: Mon Jun 25 23:40:19 2012 New Revision: 237585 URL: http://svn.freebsd.org/changeset/base/237585 Log: MFC r225808: Fix grammar. PR: 140457 Submitted by: jeremyhu AT apple.com Approved by: gjb (mentor) Modified: stable/8/lib/libc/locale/isspace.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/locale/isspace.3 ============================================================================== --- stable/8/lib/libc/locale/isspace.3 Mon Jun 25 23:39:35 2012 (r237584) +++ stable/8/lib/libc/locale/isspace.3 Mon Jun 25 23:40:19 2012 (r237585) @@ -47,16 +47,16 @@ .Sh DESCRIPTION The .Fn isspace -function tests for the white-space characters. +function tests for white-space characters. For any locale, this includes the following standard characters: .Pp .Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ .It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''" .El .Pp -In the "C" locale +In the "C" locale, .Fn isspace -successful test is limited to this characters only. +returns non-zero for these characters only. The value of the argument must be representable as an .Vt "unsigned char" or the value of From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 26 03:05:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0B5510656B4; Tue, 26 Jun 2012 03:05:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A84A38FC17; Tue, 26 Jun 2012 03:05:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5Q35gxN011417; Tue, 26 Jun 2012 03:05:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5Q35g6f011405; Tue, 26 Jun 2012 03:05:42 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206260305.q5Q35g6f011405@svn.freebsd.org> From: Eitan Adler Date: Tue, 26 Jun 2012 03:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237590 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 03:05:42 -0000 Author: eadler Date: Tue Jun 26 03:05:42 2012 New Revision: 237590 URL: http://svn.freebsd.org/changeset/base/237590 Log: MFC r237259 r237260 r237329: Allow users with RO privilege to the device to read the RO attributes. [0] Add __unused macros to appropriate places in order to allow building with WARNS=6 on base gcc, gcc46, and clang PR: bin/167302 [0] Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/mfiutil/Makefile stable/8/usr.sbin/mfiutil/mfi_cmd.c stable/8/usr.sbin/mfiutil/mfi_config.c stable/8/usr.sbin/mfiutil/mfi_drive.c stable/8/usr.sbin/mfiutil/mfi_evt.c stable/8/usr.sbin/mfiutil/mfi_flash.c stable/8/usr.sbin/mfiutil/mfi_patrol.c stable/8/usr.sbin/mfiutil/mfi_show.c stable/8/usr.sbin/mfiutil/mfi_volume.c stable/8/usr.sbin/mfiutil/mfiutil.c stable/8/usr.sbin/mfiutil/mfiutil.h Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/Makefile ============================================================================== --- stable/8/usr.sbin/mfiutil/Makefile Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/Makefile Tue Jun 26 03:05:42 2012 (r237590) @@ -6,7 +6,6 @@ SRCS= mfiutil.c mfi_cmd.c mfi_config.c m MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime -WARNS?=3 DPADD= ${LIBUTIL} LDADD= -lutil Modified: stable/8/usr.sbin/mfiutil/mfi_cmd.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_cmd.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_cmd.c Tue Jun 26 03:05:42 2012 (r237590) @@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctr } int -mfi_open(int unit) +mfi_open(int unit, int acs) { char path[MAXPATHLEN]; snprintf(path, sizeof(path), "/dev/mfi%d", unit); - return (open(path, O_RDWR)); + return (open(path, acs)); } void Modified: stable/8/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_config.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_config.c Tue Jun 26 03:05:42 2012 (r237590) @@ -35,6 +35,7 @@ #endif #include #include +#include #include #ifdef DEBUG #include @@ -151,13 +152,13 @@ mfi_config_lookup_volume(struct mfi_conf } static int -clear_config(int ac, char **av) +clear_config(int ac __unused, char **av __unused) { struct mfi_ld_list list; int ch, error, fd; u_int i; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -410,7 +411,7 @@ find_next_volume(struct config_id_state /* Populate an array with drives. */ static void -build_array(int fd, char *arrayp, struct array_info *array_info, +build_array(int fd __unused, char *arrayp, struct array_info *array_info, struct config_id_state *state, int verbose) { struct mfi_array *ar = (struct mfi_array *)arrayp; @@ -575,7 +576,7 @@ create_volume(int ac, char **av) narrays = 0; error = 0; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -857,7 +858,7 @@ delete_volume(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -925,7 +926,7 @@ add_spare(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1050,7 +1051,7 @@ remove_spare(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1196,7 +1197,7 @@ debug_config(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1233,7 +1234,7 @@ dump(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_drive.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_drive.c Tue Jun 26 03:05:42 2012 (r237590) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,7 @@ mfi_drive_name(struct mfi_pd_info *pinfo else snprintf(buf, sizeof(buf), "%2u", device_id); - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { warn("mfi_open"); return (buf); @@ -329,11 +330,13 @@ cam_strvis(char *dst, const char *src, i const char * mfi_pd_inq_string(struct mfi_pd_info *info) { - struct scsi_inquiry_data *inq_data; + struct scsi_inquiry_data iqd, *inq_data = &iqd; char vendor[16], product[48], revision[16], rstr[12], serial[SID_VENDOR_SPECIFIC_0_SIZE]; static char inq_string[64]; - inq_data = (struct scsi_inquiry_data *)info->inquiry_data; + memcpy(inq_data, info->inquiry_data, + (sizeof (iqd) < sizeof (info->inquiry_data))? + sizeof (iqd) : sizeof (info->inquiry_data)); if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) return (NULL); if (SID_TYPE(inq_data) != T_DIRECT) @@ -383,7 +386,7 @@ drive_set_state(char *drive, uint16_t ne uint8_t mbox[6]; int error, fd; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -484,7 +487,7 @@ start_rebuild(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -541,7 +544,7 @@ abort_rebuild(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -597,7 +600,7 @@ drive_progress(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -663,7 +666,7 @@ drive_clear(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -723,7 +726,7 @@ drive_locate(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_evt.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_evt.c Tue Jun 26 03:05:42 2012 (r237590) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,7 @@ mfi_get_events(int fd, struct mfi_evt_li } static int -show_logstate(int ac, char **av) +show_logstate(int ac, char **av __unused) { struct mfi_evt_log_state info; int error, fd; @@ -73,7 +74,7 @@ show_logstate(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -541,7 +542,7 @@ show_events(int ac, char **av) int ch, error, fd, num_events, verbose; u_int i; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfi_flash.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_flash.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_flash.c Tue Jun 26 03:05:42 2012 (r237590) @@ -150,7 +150,7 @@ flash_adapter(int ac, char **av) goto error; } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfi_patrol.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_patrol.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_patrol.c Tue Jun 26 03:05:42 2012 (r237590) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -74,7 +75,7 @@ patrol_get_props(int fd, struct mfi_pr_p } static int -show_patrol(int ac, char **av) +show_patrol(int ac __unused, char **av __unused) { struct mfi_pr_properties prop; struct mfi_pr_status status; @@ -86,7 +87,7 @@ show_patrol(int ac, char **av) int error, fd; u_int i; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -192,11 +193,11 @@ show_patrol(int ac, char **av) MFI_COMMAND(show, patrol, show_patrol); static int -start_patrol(int ac, char **av) +start_patrol(int ac __unused, char **av __unused) { int error, fd; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -218,11 +219,11 @@ start_patrol(int ac, char **av) MFI_COMMAND(start, patrol, start_patrol); static int -stop_patrol(int ac, char **av) +stop_patrol(int ac __unused, char **av __unused) { int error, fd; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -293,7 +294,7 @@ patrol_config(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_show.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_show.c Tue Jun 26 03:05:42 2012 (r237590) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ format_stripe(char *buf, size_t buflen, } static int -show_adapter(int ac, char **av) +show_adapter(int ac, char **av __unused) { struct mfi_ctrl_info info; char stripe[5]; @@ -61,7 +62,7 @@ show_adapter(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -135,7 +136,7 @@ show_adapter(int ac, char **av) MFI_COMMAND(show, adapter, show_adapter); static int -show_battery(int ac, char **av) +show_battery(int ac, char **av __unused) { struct mfi_bbu_capacity_info cap; struct mfi_bbu_design_info design; @@ -148,7 +149,7 @@ show_battery(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -303,7 +304,7 @@ print_pd(struct mfi_pd_info *info, int s } static int -show_config(int ac, char **av) +show_config(int ac, char **av __unused) { struct mfi_config_data *config; struct mfi_array *ar; @@ -320,7 +321,7 @@ show_config(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -409,7 +410,7 @@ show_config(int ac, char **av) MFI_COMMAND(show, config, show_config); static int -show_volumes(int ac, char **av) +show_volumes(int ac, char **av __unused) { struct mfi_ld_list list; struct mfi_ld_info info; @@ -421,7 +422,7 @@ show_volumes(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -492,7 +493,7 @@ show_volumes(int ac, char **av) MFI_COMMAND(show, volumes, show_volumes); static int -show_drives(int ac, char **av) +show_drives(int ac, char **av __unused) { struct mfi_pd_list *list; struct mfi_pd_info info; @@ -504,7 +505,7 @@ show_drives(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -600,7 +601,7 @@ display_firmware(struct mfi_info_compone } static int -show_firmware(int ac, char **av) +show_firmware(int ac, char **av __unused) { struct mfi_ctrl_info info; struct mfi_info_component header; @@ -612,7 +613,7 @@ show_firmware(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -656,7 +657,7 @@ show_firmware(int ac, char **av) MFI_COMMAND(show, firmware, show_firmware); static int -show_progress(int ac, char **av) +show_progress(int ac, char **av __unused) { struct mfi_ld_list llist; struct mfi_pd_list *plist; @@ -672,7 +673,7 @@ show_progress(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfi_volume.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_volume.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfi_volume.c Tue Jun 26 03:05:42 2012 (r237590) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -294,7 +295,7 @@ volume_cache(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -402,7 +403,7 @@ volume_name(int ac, char **av) return (ENOSPC); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -453,7 +454,7 @@ volume_progress(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); Modified: stable/8/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfiutil.c Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfiutil.c Tue Jun 26 03:05:42 2012 (r237590) @@ -92,10 +92,10 @@ usage(void) } static int -version(int ac, char **av) +version(int ac __unused, char **av __unused) { - printf("mfiutil version 1.0.13"); + printf("mfiutil version 1.0.14"); #ifdef DEBUG printf(" (DEBUG)"); #endif Modified: stable/8/usr.sbin/mfiutil/mfiutil.h ============================================================================== --- stable/8/usr.sbin/mfiutil/mfiutil.h Tue Jun 26 03:05:17 2012 (r237589) +++ stable/8/usr.sbin/mfiutil/mfiutil.h Tue Jun 26 03:05:42 2012 (r237590) @@ -139,7 +139,7 @@ int mfi_lookup_drive(int fd, char *drive int mfi_lookup_volume(int fd, const char *name, uint8_t *target_id); int mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize, uint8_t *mbox, size_t mboxlen, uint8_t *statusp); -int mfi_open(int unit); +int mfi_open(int unit, int acs); int mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp); int mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info, uint8_t *statusp); From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 26 21:45:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F1621065756; Tue, 26 Jun 2012 21:45:48 +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 077998FC1E; Tue, 26 Jun 2012 21:45:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QLjlSm064004; Tue, 26 Jun 2012 21:45:47 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QLjlht064002; Tue, 26 Jun 2012 21:45:47 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206262145.q5QLjlht064002@svn.freebsd.org> From: Xin LI Date: Tue, 26 Jun 2012 21:45:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237610 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 21:45:48 -0000 Author: delphij Date: Tue Jun 26 21:45:47 2012 New Revision: 237610 URL: http://svn.freebsd.org/changeset/base/237610 Log: MFC r235036: Add ToS definitions for DiffServ Codepoints as per RFC2474. Obtained from: OpenBSD Modified: stable/8/sys/netinet/ip.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/ip.h ============================================================================== --- stable/8/sys/netinet/ip.h Tue Jun 26 21:20:54 2012 (r237609) +++ stable/8/sys/netinet/ip.h Tue Jun 26 21:45:47 2012 (r237610) @@ -92,6 +92,31 @@ struct ip { #define IPTOS_PREC_ROUTINE 0x00 /* + * Definitions for DiffServ Codepoints as per RFC2474 + */ +#define IPTOS_DSCP_CS0 0x00 +#define IPTOS_DSCP_CS1 0x20 +#define IPTOS_DSCP_AF11 0x28 +#define IPTOS_DSCP_AF12 0x30 +#define IPTOS_DSCP_AF13 0x38 +#define IPTOS_DSCP_CS2 0x40 +#define IPTOS_DSCP_AF21 0x48 +#define IPTOS_DSCP_AF22 0x50 +#define IPTOS_DSCP_AF23 0x58 +#define IPTOS_DSCP_CS3 0x60 +#define IPTOS_DSCP_AF31 0x68 +#define IPTOS_DSCP_AF32 0x70 +#define IPTOS_DSCP_AF33 0x78 +#define IPTOS_DSCP_CS4 0x80 +#define IPTOS_DSCP_AF41 0x88 +#define IPTOS_DSCP_AF42 0x90 +#define IPTOS_DSCP_AF43 0x98 +#define IPTOS_DSCP_CS5 0xa0 +#define IPTOS_DSCP_EF 0xb8 +#define IPTOS_DSCP_CS6 0xc0 +#define IPTOS_DSCP_CS7 0xe0 + +/* * ECN (Explicit Congestion Notification) codepoints in RFC3168 mapped to the * lower 2 bits of the TOS field. */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 26 23:31:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEDAE106566B; Tue, 26 Jun 2012 23:31:57 +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 C82228FC14; Tue, 26 Jun 2012 23:31:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QNVvEm068661; Tue, 26 Jun 2012 23:31:57 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QNVv2c068658; Tue, 26 Jun 2012 23:31:57 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206262331.q5QNVv2c068658@svn.freebsd.org> From: Xin LI Date: Tue, 26 Jun 2012 23:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237614 - stable/8/contrib/netcat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 23:31:58 -0000 Author: delphij Date: Tue Jun 26 23:31:57 2012 New Revision: 237614 URL: http://svn.freebsd.org/changeset/base/237614 Log: MFC: netcat from OpenBSD 5.1. Modified: stable/8/contrib/netcat/nc.1 stable/8/contrib/netcat/netcat.c Directory Properties: stable/8/contrib/netcat/ (props changed) Modified: stable/8/contrib/netcat/nc.1 ============================================================================== --- stable/8/contrib/netcat/nc.1 Tue Jun 26 23:17:33 2012 (r237613) +++ stable/8/contrib/netcat/nc.1 Tue Jun 26 23:31:57 2012 (r237614) @@ -1,4 +1,4 @@ -.\" $OpenBSD: nc.1,v 1.57 2011/01/09 22:16:46 jeremy Exp $ +.\" $OpenBSD: nc.1,v 1.60 2012/02/07 12:11:43 lum Exp $ .\" .\" Copyright (c) 1996 David Sacerdote .\" All rights reserved. @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2011 +.Dd October 4, 2011 .Dt NC 1 .Os .Sh NAME @@ -45,7 +45,7 @@ .Op Fl P Ar proxy_username .Op Fl p Ar source_port .Op Fl s Ar source -.Op Fl T Ar ToS +.Op Fl T Ar toskeyword .Op Fl V Ar rtable .Op Fl w Ar timeout .Op Fl X Ar proxy_protocol @@ -186,14 +186,21 @@ to create and use so that datagrams can It is an error to use this option in conjunction with the .Fl l option. -.It Fl T Ar ToS -Specifies IP Type of Service (ToS) for the connection. -Valid values are the tokens -.Dq lowdelay , -.Dq throughput , -.Dq reliability , -or an 8-bit hexadecimal value preceded by -.Dq 0x . +.It Fl T Ar toskeyword +Change IPv4 TOS value. +.Ar toskeyword +may be one of +.Ar critical , +.Ar inetcontrol , +.Ar lowdelay , +.Ar netcontrol , +.Ar throughput , +.Ar reliability , +or one of the DiffServ Code Points: +.Ar ef , +.Ar af11 ... af43 , +.Ar cs0 ... cs7 ; +or a number in either hex or decimal. .It Fl t Causes .Nm @@ -227,9 +234,9 @@ Have .Nm give more verbose output. .It Fl w Ar timeout -If a connection and stdin are idle for more than +Connections which cannot be established or are idle timeout after .Ar timeout -seconds, then the connection is silently closed. +seconds. The .Fl w flag has no effect on the @@ -480,8 +487,15 @@ Original implementation by *Hobbit* Rewritten with IPv6 support by .An Eric Jackson Aq ericj@monkey.org . .Sh CAVEATS -UDP port scans will always succeed -(i.e. report the port as open), -rendering the +UDP port scans using the .Fl uz -combination of flags relatively useless. +combination of flags will always report success irrespective of +the target machine's state. +However, +in conjunction with a traffic sniffer either on the target machine +or an intermediary device, +the +.Fl uz +combination could be useful for communications diagnostics. +Note that the amount of UDP traffic generated may be limited either +due to hardware resources and/or configuration settings. Modified: stable/8/contrib/netcat/netcat.c ============================================================================== --- stable/8/contrib/netcat/netcat.c Tue Jun 26 23:17:33 2012 (r237613) +++ stable/8/contrib/netcat/netcat.c Tue Jun 26 23:31:57 2012 (r237614) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.100 2011/01/09 22:16:46 jeremy Exp $ */ +/* $OpenBSD: netcat.c,v 1.105 2012/02/09 06:25:35 lum Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -107,6 +107,7 @@ void help(void); int local_listen(char *, char *, struct addrinfo); void readwrite(int); int remote_connect(const char *, const char *, struct addrinfo); +int timeout_connect(int, const struct sockaddr *, socklen_t); int socks_connect(const char *, const char *, struct addrinfo, const char *, const char *, struct addrinfo, int, const char *); int udptest(int); @@ -114,7 +115,7 @@ int unix_bind(char *); int unix_connect(char *); int unix_listen(char *); void set_common_sockopts(int); -int parse_iptos(char *); +int map_tos(char *, int *); void usage(int); #ifdef IPSEC @@ -281,7 +282,18 @@ main(int argc, char *argv[]) Sflag = 1; break; case 'T': - Tflag = parse_iptos(optarg); + errstr = NULL; + errno = 0; + if (map_tos(optarg, &Tflag)) + break; + if (strlen(optarg) > 1 && optarg[0] == '0' && + optarg[1] == 'x') + Tflag = (int)strtol(optarg, NULL, 16); + else + Tflag = (int)strtonum(optarg, 0, 255, + &errstr); + if (Tflag < 0 || Tflag > 255 || errstr || errno) + errx(1, "illegal tos value %s", optarg); break; default: usage(1); @@ -633,7 +645,7 @@ remote_connect(const char *host, const c set_common_sockopts(s); - if (connect(s, res0->ai_addr, res0->ai_addrlen) == 0) + if (timeout_connect(s, res0->ai_addr, res0->ai_addrlen) == 0) break; else if (vflag) warn("connect to %s port %s (%s) failed", host, port, @@ -648,6 +660,43 @@ remote_connect(const char *host, const c return (s); } +int +timeout_connect(int s, const struct sockaddr *name, socklen_t namelen) +{ + struct pollfd pfd; + socklen_t optlen; + int flags, optval; + int ret; + + if (timeout != -1) { + flags = fcntl(s, F_GETFL, 0); + if (fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1) + err(1, "set non-blocking mode"); + } + + if ((ret = connect(s, name, namelen)) != 0 && errno == EINPROGRESS) { + pfd.fd = s; + pfd.events = POLLOUT; + if ((ret = poll(&pfd, 1, timeout)) == 1) { + optlen = sizeof(optval); + if ((ret = getsockopt(s, SOL_SOCKET, SO_ERROR, + &optval, &optlen)) == 0) { + errno = optval; + ret = optval == 0 ? 0 : -1; + } + } else if (ret == 0) { + errno = ETIMEDOUT; + ret = -1; + } else + err(1, "poll failed"); + } + + if (timeout != -1 && fcntl(s, F_SETFL, flags) == -1) + err(1, "restoring flags"); + + return (ret); +} + /* * local_listen() * Returns a socket listening on a local port, binds to specified source @@ -818,7 +867,7 @@ atelnet(int nfd, unsigned char *buf, uns /* * build_ports() - * Build an array or ports in portlist[], listing each port + * Build an array of ports in portlist[], listing each port * that we should try to connect to. */ void @@ -830,9 +879,6 @@ build_ports(char *p) int x = 0; if ((n = strchr(p, '-')) != NULL) { - if (lflag) - errx(1, "Cannot use -l with multiple ports!"); - *n = '\0'; n++; @@ -884,8 +930,7 @@ build_ports(char *p) /* * udptest() * Do a few writes to see if the UDP port is there. - * XXX - Better way of doing this? Doesn't work for IPv6. - * Also fails after around 100 ports checked. + * Fails once PF state table is full. */ int udptest(int s) @@ -946,20 +991,51 @@ set_common_sockopts(int s) } int -parse_iptos(char *s) +map_tos(char *s, int *val) { - int tos = -1; + /* DiffServ Codepoints and other TOS mappings */ + const struct toskeywords { + const char *keyword; + int val; + } *t, toskeywords[] = { + { "af11", IPTOS_DSCP_AF11 }, + { "af12", IPTOS_DSCP_AF12 }, + { "af13", IPTOS_DSCP_AF13 }, + { "af21", IPTOS_DSCP_AF21 }, + { "af22", IPTOS_DSCP_AF22 }, + { "af23", IPTOS_DSCP_AF23 }, + { "af31", IPTOS_DSCP_AF31 }, + { "af32", IPTOS_DSCP_AF32 }, + { "af33", IPTOS_DSCP_AF33 }, + { "af41", IPTOS_DSCP_AF41 }, + { "af42", IPTOS_DSCP_AF42 }, + { "af43", IPTOS_DSCP_AF43 }, + { "critical", IPTOS_PREC_CRITIC_ECP }, + { "cs0", IPTOS_DSCP_CS0 }, + { "cs1", IPTOS_DSCP_CS1 }, + { "cs2", IPTOS_DSCP_CS2 }, + { "cs3", IPTOS_DSCP_CS3 }, + { "cs4", IPTOS_DSCP_CS4 }, + { "cs5", IPTOS_DSCP_CS5 }, + { "cs6", IPTOS_DSCP_CS6 }, + { "cs7", IPTOS_DSCP_CS7 }, + { "ef", IPTOS_DSCP_EF }, + { "inetcontrol", IPTOS_PREC_INTERNETCONTROL }, + { "lowdelay", IPTOS_LOWDELAY }, + { "netcontrol", IPTOS_PREC_NETCONTROL }, + { "reliability", IPTOS_RELIABILITY }, + { "throughput", IPTOS_THROUGHPUT }, + { NULL, -1 }, + }; + + for (t = toskeywords; t->keyword != NULL; t++) { + if (strcmp(s, t->keyword) == 0) { + *val = t->val; + return (1); + } + } - if (strcmp(s, "lowdelay") == 0) - return (IPTOS_LOWDELAY); - if (strcmp(s, "throughput") == 0) - return (IPTOS_THROUGHPUT); - if (strcmp(s, "reliability") == 0) - return (IPTOS_RELIABILITY); - - if (sscanf(s, "0x%x", &tos) != 1 || tos < 0 || tos > 0xff) - errx(1, "invalid IP Type of Service"); - return (tos); + return (0); } void @@ -990,7 +1066,7 @@ help(void) \t-r Randomize remote ports\n\ \t-S Enable the TCP MD5 signature option\n\ \t-s addr\t Local source address\n\ - \t-T ToS\t Set IP Type of Service\n\ + \t-T toskeyword\tSet IP Type of Service\n\ \t-t Answer TELNET negotiation\n\ \t-U Use UNIX domain socket\n\ \t-u UDP mode\n\ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 00:34:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 680FB106566C; Wed, 27 Jun 2012 00:34: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 389148FC0A; Wed, 27 Jun 2012 00:34:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5R0Y7A8071239; Wed, 27 Jun 2012 00:34:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5R0Y78A071237; Wed, 27 Jun 2012 00:34:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206270034.q5R0Y78A071237@svn.freebsd.org> From: Xin LI Date: Wed, 27 Jun 2012 00:34:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237616 - stable/8/bin/rm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 00:34:07 -0000 Author: delphij Date: Wed Jun 27 00:34:06 2012 New Revision: 237616 URL: http://svn.freebsd.org/changeset/base/237616 Log: MFC r237339: Polish previous revision: if the fts_* routines have lstat()'ed the directory entry then use the struct stat from that instead of doing it again, and skip the rm_overwrite() call if fts_read() indicated that the entry couldn't be a regular file. Obtained from: OpenBSD MFC r237284 (kevlo): Fix potential symlink race condition in "rm -P" by adding a check that the file we have opened is the one we expected. Also open in non-blocking mode to avoid a potential hang with FIFOs. Obtained from: NetBSD via OpenBSD Modified: stable/8/bin/rm/rm.c Directory Properties: stable/8/bin/rm/ (props changed) Modified: stable/8/bin/rm/rm.c ============================================================================== --- stable/8/bin/rm/rm.c Wed Jun 27 00:31:30 2012 (r237615) +++ stable/8/bin/rm/rm.c Wed Jun 27 00:34:06 2012 (r237616) @@ -301,10 +301,16 @@ rm_tree(char **argv) if (fflag) continue; /* FALLTHROUGH */ - default: + + case FTS_F: + case FTS_NSOK: if (Pflag) - if (!rm_overwrite(p->fts_accpath, NULL)) + if (!rm_overwrite(p->fts_accpath, p->fts_info == + FTS_NSOK ? NULL : p->fts_statp)) continue; + /* FALLTHROUGH */ + + default: rval = unlink(p->fts_accpath); if (rval == 0 || (fflag && errno == ENOENT)) { if (rval == 0 && vflag) @@ -408,7 +414,7 @@ rm_file(char **argv) int rm_overwrite(char *file, struct stat *sbp) { - struct stat sb; + struct stat sb, sb2; struct statfs fsb; off_t len; int bsize, fd, wlen; @@ -427,8 +433,15 @@ rm_overwrite(char *file, struct stat *sb file, sbp->st_ino); return (0); } - if ((fd = open(file, O_WRONLY, 0)) == -1) + if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) + goto err; + if (fstat(fd, &sb2)) goto err; + if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino || + !S_ISREG(sb2.st_mode)) { + errno = EPERM; + goto err; + } if (fstatfs(fd, &fsb) == -1) goto err; bsize = MAX(fsb.f_iosize, 1024); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 06:41:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 360D510657E5; Wed, 27 Jun 2012 06:41:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20CFD8FC16; Wed, 27 Jun 2012 06:41:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5R6fEZ6087684; Wed, 27 Jun 2012 06:41:14 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5R6fEAh087682; Wed, 27 Jun 2012 06:41:14 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206270641.q5R6fEAh087682@svn.freebsd.org> From: Eitan Adler Date: Wed, 27 Jun 2012 06:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237634 - stable/8/lib/libc/gen X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 06:41:15 -0000 Author: eadler Date: Wed Jun 27 06:41:14 2012 New Revision: 237634 URL: http://svn.freebsd.org/changeset/base/237634 Log: MFC r237286, r237523: Don't close an uninitialized descriptor. PR: bin/167302 Approved by: cperciva (implicit) Modified: stable/8/lib/libc/gen/syslog.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/gen/syslog.c ============================================================================== --- stable/8/lib/libc/gen/syslog.c Wed Jun 27 06:41:10 2012 (r237633) +++ stable/8/lib/libc/gen/syslog.c Wed Jun 27 06:41:14 2012 (r237634) @@ -413,8 +413,10 @@ void closelog(void) { THREAD_LOCK(); - (void)_close(LogFile); - LogFile = -1; + if (LogFile != -1) { + (void)_close(LogFile); + LogFile = -1; + } LogTag = NULL; status = NOCONN; THREAD_UNLOCK(); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 11:04:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8BC01065673; Wed, 27 Jun 2012 11:04:04 +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 941158FC18; Wed, 27 Jun 2012 11:04:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RB44fs006491; Wed, 27 Jun 2012 11:04:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RB447N006489; Wed, 27 Jun 2012 11:04:04 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206271104.q5RB447N006489@svn.freebsd.org> From: Alexander Motin Date: Wed, 27 Jun 2012 11:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237638 - stable/8/sys/cam X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 11:04:04 -0000 Author: mav Date: Wed Jun 27 11:04:04 2012 New Revision: 237638 URL: http://svn.freebsd.org/changeset/base/237638 Log: MFC r237398: In camisr() clear CAM_SIM_ON_DONEQ flag after camisr_runqueue() purged SIM done queue. Clearing it before caused extra SIM queueing in some cases. It was invisible during normal operation, but during USB device unplug and respective SIM destruction it could keep pointer on SIM without having counted reference and as result crash the system by use afer free. PR: usb/168743 Modified: stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Wed Jun 27 11:02:35 2012 (r237637) +++ stable/8/sys/cam/cam_xpt.c Wed Jun 27 11:04:04 2012 (r237638) @@ -4944,8 +4944,8 @@ camisr(void *dummy) while ((sim = TAILQ_FIRST(&queue)) != NULL) { TAILQ_REMOVE(&queue, sim, links); CAM_SIM_LOCK(sim); - sim->flags &= ~CAM_SIM_ON_DONEQ; camisr_runqueue(&sim->sim_doneq); + sim->flags &= ~CAM_SIM_ON_DONEQ; CAM_SIM_UNLOCK(sim); } mtx_lock(&cam_simq_lock); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 11:08:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08B00106564A; Wed, 27 Jun 2012 11:08:04 +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 E70CC8FC0C; Wed, 27 Jun 2012 11:08:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RB837X006770; Wed, 27 Jun 2012 11:08:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RB83Y4006768; Wed, 27 Jun 2012 11:08:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206271108.q5RB83Y4006768@svn.freebsd.org> From: Alexander Motin Date: Wed, 27 Jun 2012 11:08:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237640 - stable/8/sys/cam X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 11:08:04 -0000 Author: mav Date: Wed Jun 27 11:08:03 2012 New Revision: 237640 URL: http://svn.freebsd.org/changeset/base/237640 Log: MFC r237401: Make cam_periph_hold() behavior consistent: drop taken reference and return ENXIO if periph was invalidated while we were waiting for it. Modified: stable/8/sys/cam/cam_periph.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Wed Jun 27 11:07:01 2012 (r237639) +++ stable/8/sys/cam/cam_periph.c Wed Jun 27 11:08:03 2012 (r237640) @@ -390,6 +390,10 @@ cam_periph_hold(struct cam_periph *perip cam_periph_release_locked(periph); return (error); } + if (periph->flags & CAM_PERIPH_INVALID) { + cam_periph_release_locked(periph); + return (ENXIO); + } } periph->flags |= CAM_PERIPH_LOCKED; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 12:00:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB9301065850; Wed, 27 Jun 2012 12:00:35 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BF2C8FC1B; Wed, 27 Jun 2012 12:00:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RC0Z66009071; Wed, 27 Jun 2012 12:00:35 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RC0ZBZ009069; Wed, 27 Jun 2012 12:00:35 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206271200.q5RC0ZBZ009069@svn.freebsd.org> From: Martin Matuska Date: Wed, 27 Jun 2012 12:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237644 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 12:00:35 -0000 Author: mm Date: Wed Jun 27 12:00:35 2012 New Revision: 237644 URL: http://svn.freebsd.org/changeset/base/237644 Log: MFC r236823 (pjd): ds_guid of 0 is special, as it is used by snapshot receive code to differentiate between an incremental and full stream. Be sure not to generate guid equal to 0. Reported by: someone who saw 0 being generated as 64bit random guid Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jun 27 11:59:57 2012 (r237643) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jun 27 12:00:35 2012 (r237644) @@ -809,8 +809,10 @@ dsl_dataset_create_sync_dd(dsl_dir_t *dd dsphys->ds_dir_obj = dd->dd_object; dsphys->ds_flags = flags; dsphys->ds_fsid_guid = unique_create(); - (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid, - sizeof (dsphys->ds_guid)); + do { + (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid, + sizeof (dsphys->ds_guid)); + } while (dsphys->ds_guid == 0); dsphys->ds_snapnames_zapobj = zap_create_norm(mos, U8_TEXTPREP_TOUPPER, DMU_OT_DSL_DS_SNAP_MAP, DMU_OT_NONE, 0, tx); @@ -2082,8 +2084,10 @@ dsl_dataset_snapshot_sync(void *arg1, vo bzero(dsphys, sizeof (dsl_dataset_phys_t)); dsphys->ds_dir_obj = ds->ds_dir->dd_object; dsphys->ds_fsid_guid = unique_create(); - (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid, - sizeof (dsphys->ds_guid)); + do { + (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid, + sizeof (dsphys->ds_guid)); + } while (dsphys->ds_guid == 0); dsphys->ds_prev_snap_obj = ds->ds_phys->ds_prev_snap_obj; dsphys->ds_prev_snap_txg = ds->ds_phys->ds_prev_snap_txg; dsphys->ds_next_snap_obj = ds->ds_object; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 21:13:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 194C5106564A; Wed, 27 Jun 2012 21:13:01 +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 014B78FC0C; Wed, 27 Jun 2012 21:13:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RLD0di033037; Wed, 27 Jun 2012 21:13:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RLD0fO033026; Wed, 27 Jun 2012 21:13:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206272113.q5RLD0fO033026@svn.freebsd.org> From: John Baldwin Date: Wed, 27 Jun 2012 21:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237664 - in stable/8: sys/kern sys/sys sys/vm usr.bin/kdump usr.bin/ktrace X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 21:13:01 -0000 Author: jhb Date: Wed Jun 27 21:13:00 2012 New Revision: 237664 URL: http://svn.freebsd.org/changeset/base/237664 Log: MFC 233925,236357: Add new ktrace records for the start and end of VM faults. This gives a pair of records similar to syscall entry and return that a user can use to determine how long page faults take. The new ktrace records are enabled via the 'p' trace type, but are not enabled in the default set of trace points. Modified: stable/8/sys/kern/kern_ktrace.c stable/8/sys/sys/ktrace.h stable/8/sys/vm/vm_fault.c stable/8/usr.bin/kdump/kdump.1 stable/8/usr.bin/kdump/kdump.c stable/8/usr.bin/kdump/kdump_subr.h stable/8/usr.bin/kdump/mksubr stable/8/usr.bin/ktrace/ktrace.1 stable/8/usr.bin/ktrace/ktrace.h stable/8/usr.bin/ktrace/subr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/usr.bin/kdump/ (props changed) stable/8/usr.bin/ktrace/ (props changed) Modified: stable/8/sys/kern/kern_ktrace.c ============================================================================== --- stable/8/sys/kern/kern_ktrace.c Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/sys/kern/kern_ktrace.c Wed Jun 27 21:13:00 2012 (r237664) @@ -98,6 +98,8 @@ struct ktr_request { struct ktr_genio ktr_genio; struct ktr_psig ktr_psig; struct ktr_csw ktr_csw; + struct ktr_fault ktr_fault; + struct ktr_faultend ktr_faultend; } ktr_data; STAILQ_ENTRY(ktr_request) ktr_list; }; @@ -115,6 +117,8 @@ static int data_lengths[] = { 0, /* KTR_SYSCTL */ sizeof(struct ktr_proc_ctor), /* KTR_PROCCTOR */ 0, /* KTR_PROCDTOR */ + sizeof(struct ktr_fault), /* KTR_FAULT */ + sizeof(struct ktr_faultend), /* KTR_FAULTEND */ }; static STAILQ_HEAD(, ktr_request) ktr_free; @@ -767,6 +771,42 @@ ktrstruct(name, namelen, data, datalen) req->ktr_header.ktr_len = buflen; ktr_submitrequest(curthread, req); } + +void +ktrfault(vaddr, type) + vm_offset_t vaddr; + int type; +{ + struct thread *td = curthread; + struct ktr_request *req; + struct ktr_fault *kf; + + req = ktr_getrequest(KTR_FAULT); + if (req == NULL) + return; + kf = &req->ktr_data.ktr_fault; + kf->vaddr = vaddr; + kf->type = type; + ktr_enqueuerequest(td, req); + ktrace_exit(td); +} + +void +ktrfaultend(result) + int result; +{ + struct thread *td = curthread; + struct ktr_request *req; + struct ktr_faultend *kf; + + req = ktr_getrequest(KTR_FAULTEND); + if (req == NULL) + return; + kf = &req->ktr_data.ktr_faultend; + kf->result = result; + ktr_enqueuerequest(td, req); + ktrace_exit(td); +} #endif /* KTRACE */ /* Interface and common routines */ Modified: stable/8/sys/sys/ktrace.h ============================================================================== --- stable/8/sys/sys/ktrace.h Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/sys/sys/ktrace.h Wed Jun 27 21:13:00 2012 (r237664) @@ -178,6 +178,23 @@ struct ktr_proc_ctor { #define KTR_PROCDTOR 11 /* + * KTR_FAULT - page fault record + */ +#define KTR_FAULT 13 +struct ktr_fault { + vm_offset_t vaddr; + int type; +}; + +/* + * KTR_FAULTEND - end of page fault record + */ +#define KTR_FAULTEND 14 +struct ktr_faultend { + int result; +}; + +/* * KTR_DROP - If this bit is set in ktr_type, then at least one event * between the previous record and this record was dropped. */ @@ -198,6 +215,8 @@ struct ktr_proc_ctor { #define KTRFAC_SYSCTL (1< __FBSDID("$FreeBSD$"); +#include "opt_ktrace.h" #include "opt_vm.h" #include @@ -86,6 +87,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #include #include @@ -114,6 +118,9 @@ static int prefault_pageorder[] = { static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *); static void vm_fault_prefault(pmap_t, vm_offset_t, vm_map_entry_t); +#ifdef KTRACE +static int vm_fault_traced(vm_map_t, vm_offset_t, vm_prot_t, int); +#endif #define VM_FAULT_READ_AHEAD 8 #define VM_FAULT_READ_BEHIND 7 @@ -209,6 +216,24 @@ unlock_and_deallocate(struct faultstate int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags) +#ifdef KTRACE +{ + struct thread *td; + int result; + + td = curthread; + if (map != kernel_map && KTRPOINT(td, KTR_FAULT)) + ktrfault(vaddr, fault_type); + result = vm_fault_traced(map, vaddr, fault_type, fault_flags); + if (map != kernel_map && KTRPOINT(td, KTR_FAULTEND)) + ktrfaultend(result); + return (result); +} + +int +vm_fault_traced(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, + int fault_flags) +#endif { vm_prot_t prot; int is_first_object_locked, result; Modified: stable/8/usr.bin/kdump/kdump.1 ============================================================================== --- stable/8/usr.bin/kdump/kdump.1 Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/kdump/kdump.1 Wed Jun 27 21:13:00 2012 (r237664) @@ -32,7 +32,7 @@ .\" @(#)kdump.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 23, 2008 +.Dd April 5, 2012 .Dt KDUMP 1 .Os .Sh NAME @@ -175,6 +175,8 @@ The possible operations are: .It Li USER Ta data from user process Ta the data .It Li STRU Ta various syscalls Ta structure .It Li SCTL Ta Xr sysctl 3 requests Ta MIB name +.It Li PFLT Ta enter page fault Ta fault address and type +.It Li PRET Ta return from page fault Ta fault result .El .Sh SEE ALSO .Xr ktrace 1 Modified: stable/8/usr.bin/kdump/kdump.c ============================================================================== --- stable/8/usr.bin/kdump/kdump.c Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/kdump/kdump.c Wed Jun 27 21:13:00 2012 (r237664) @@ -103,6 +103,8 @@ void ktruser(int, unsigned char *); void ktrsockaddr(struct sockaddr *); void ktrstat(struct stat *); void ktrstruct(char *, size_t); +void ktrfault(struct ktr_fault *); +void ktrfaultend(struct ktr_faultend *); void usage(void); void sockfamilyname(int); const char *ioctlname(u_long); @@ -306,6 +308,12 @@ main(int argc, char *argv[]) case KTR_STRUCT: ktrstruct(m, ktrlen); break; + case KTR_FAULT: + ktrfault((struct ktr_fault *)m); + break; + case KTR_FAULTEND: + ktrfaultend((struct ktr_faultend *)m); + break; default: printf("\n"); break; @@ -445,6 +453,12 @@ dumpheader(struct ktr_header *kth) /* FALLTHROUGH */ case KTR_PROCDTOR: return; + case KTR_FAULT: + type = "PFLT"; + break; + case KTR_FAULTEND: + type = "PRET"; + break; default: (void)sprintf(unknown, "UNKNOWN(%d)", kth->ktr_type); type = unknown; @@ -1513,6 +1527,23 @@ invalid: printf("invalid record\n"); } +void +ktrfault(struct ktr_fault *ktr) +{ + + printf("0x%jx ", ktr->vaddr); + vmprotname(ktr->type); + printf("\n"); +} + +void +ktrfaultend(struct ktr_faultend *ktr) +{ + + vmresultname(ktr->result); + printf("\n"); +} + #if defined(__amd64__) || defined(__i386__) void linux_ktrsyscall(struct ktr_syscall *ktr) Modified: stable/8/usr.bin/kdump/kdump_subr.h ============================================================================== --- stable/8/usr.bin/kdump/kdump_subr.h Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/kdump/kdump_subr.h Wed Jun 27 21:13:00 2012 (r237664) @@ -46,3 +46,5 @@ void lio_listioname (int); void minheritname (int); void quotactlname (int); void ptraceopname (int); +void vmprotname (int); +void vmresultname (int); Modified: stable/8/usr.bin/kdump/mksubr ============================================================================== --- stable/8/usr.bin/kdump/mksubr Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/kdump/mksubr Wed Jun 27 21:13:00 2012 (r237664) @@ -183,6 +183,8 @@ cat <<_EOF_ #include #include #include +#include +#include #include "kdump_subr.h" @@ -327,6 +329,26 @@ sockoptlevelname (int level, int decimal } } +/* + * MANUAL + * + * Used for page fault type. Cannot use auto_or_type since the macro + * values contain a cast. Also, VM_PROT_NONE has to be handled specially. + */ +void +vmprotname (int type) +{ + int or = 0; + + if (type == VM_PROT_NONE) { + (void)printf("VM_PROT_NONE"); + return; + } + if_print_or(type, VM_PROT_READ, or); + if_print_or(type, VM_PROT_WRITE, or); + if_print_or(type, VM_PROT_EXECUTE, or); + if_print_or(type, VM_PROT_OVERRIDE_WRITE, or); +} _EOF_ auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h" @@ -368,6 +390,7 @@ auto_if_type "sockipprotoname" "IPPROTO_ auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" +auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h" cat <<_EOF_ /* Modified: stable/8/usr.bin/ktrace/ktrace.1 ============================================================================== --- stable/8/usr.bin/ktrace/ktrace.1 Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/ktrace/ktrace.1 Wed Jun 27 21:13:00 2012 (r237664) @@ -32,7 +32,7 @@ .\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 23, 2008 +.Dd May 31, 2012 .Dt KTRACE 1 .Os .Sh NAME @@ -112,6 +112,8 @@ The following table equates the letters .Bl -tag -width flag -compact .It Cm c trace system calls +.It Cm f +trace page faults .It Cm i trace .Tn I/O Modified: stable/8/usr.bin/ktrace/ktrace.h ============================================================================== --- stable/8/usr.bin/ktrace/ktrace.h Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/ktrace/ktrace.h Wed Jun 27 21:13:00 2012 (r237664) @@ -40,7 +40,8 @@ #define PROC_ABI_POINTS (KTRFAC_PROCCTOR | KTRFAC_PROCDTOR) -#define ALL_POINTS (DEF_POINTS | KTRFAC_CSW | PROC_ABI_POINTS) +#define ALL_POINTS (DEF_POINTS | KTRFAC_CSW | PROC_ABI_POINTS | \ + KTRFAC_FAULT | KTRFAC_FAULTEND) #define DEF_TRACEFILE "ktrace.out" Modified: stable/8/usr.bin/ktrace/subr.c ============================================================================== --- stable/8/usr.bin/ktrace/subr.c Wed Jun 27 21:12:15 2012 (r237663) +++ stable/8/usr.bin/ktrace/subr.c Wed Jun 27 21:13:00 2012 (r237664) @@ -65,6 +65,9 @@ getpoints(char *s) case 'c': facs |= KTRFAC_SYSCALL | KTRFAC_SYSRET; break; + case 'f': + facs |= KTRFAC_FAULT | KTRFAC_FAULTEND; + break; case 'n': facs |= KTRFAC_NAMEI; break; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 22:13:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8682E106566B; Wed, 27 Jun 2012 22:13:41 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7025A8FC18; Wed, 27 Jun 2012 22:13:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RMDfWa035910; Wed, 27 Jun 2012 22:13:41 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RMDfxt035907; Wed, 27 Jun 2012 22:13:41 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206272213.q5RMDfxt035907@svn.freebsd.org> From: Andrew Thompson Date: Wed, 27 Jun 2012 22:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237672 - stable/8/usr.bin/sockstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 22:13:41 -0000 Author: thompsa Date: Wed Jun 27 22:13:40 2012 New Revision: 237672 URL: http://svn.freebsd.org/changeset/base/237672 Log: MFC r235870 Allow the socket list to be limited to a specific jail id. Modified: stable/8/usr.bin/sockstat/sockstat.1 stable/8/usr.bin/sockstat/sockstat.c Directory Properties: stable/8/usr.bin/sockstat/ (props changed) Modified: stable/8/usr.bin/sockstat/sockstat.1 ============================================================================== --- stable/8/usr.bin/sockstat/sockstat.1 Wed Jun 27 22:11:31 2012 (r237671) +++ stable/8/usr.bin/sockstat/sockstat.1 Wed Jun 27 22:13:40 2012 (r237672) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2012 +.Dd May 16, 2012 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .Nm .Op Fl 46cLlu +.Op Fl j Ar jid .Op Fl p Ar ports .Op Fl P Ar protocols .Sh DESCRIPTION @@ -57,6 +58,8 @@ Show (IPv6) sockets. .It Fl c Show connected sockets. +.It Fl j Ar jid +Show only sockets belonging to the specified jail ID. .It Fl L Only show Internet sockets if the local or foreign addresses are not in the loopback network prefix Modified: stable/8/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/8/usr.bin/sockstat/sockstat.c Wed Jun 27 22:11:31 2012 (r237671) +++ stable/8/usr.bin/sockstat/sockstat.c Wed Jun 27 22:13:40 2012 (r237672) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); static int opt_4; /* Show IPv4 sockets */ static int opt_6; /* Show IPv6 sockets */ static int opt_c; /* Show connected sockets */ +static int opt_j; /* Show specified jail */ static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ static int opt_l; /* Show listening sockets */ static int opt_u; /* Show Unix domain sockets */ @@ -549,6 +550,27 @@ getprocname(pid_t pid) } static int +getprocjid(pid_t pid) +{ + static struct kinfo_proc proc; + size_t len; + int mib[4]; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = (int)pid; + len = sizeof proc; + if (sysctl(mib, 4, &proc, &len, NULL, 0) == -1) { + /* Do not warn if the process exits before we get its jid. */ + if (errno != ESRCH) + warn("sysctl()"); + return (-1); + } + return (proc.ki_jid); +} + +static int check_ports(struct sock *s) { int port; @@ -643,6 +665,8 @@ display(void) for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { if (xf->xf_data == NULL) continue; + if (opt_j >= 0 && opt_j != getprocjid(xf->xf_pid)) + continue; hash = (int)((uintptr_t)xf->xf_data % HASHSIZE); for (s = sockhash[hash]; s != NULL; s = s->next) if ((void *)s->socket == xf->xf_data) @@ -668,6 +692,8 @@ display(void) pos += xprintf("%d ", xf->xf_fd); displaysock(s, pos); } + if (opt_j >= 0) + return; for (hash = 0; hash < HASHSIZE; hash++) { for (s = sockhash[hash]; s != NULL; s = s->next) { if (s->shown) @@ -716,7 +742,8 @@ main(int argc, char *argv[]) int protos_defined = -1; int o, i; - while ((o = getopt(argc, argv, "46cLlp:P:uv")) != -1) + opt_j = -1; + while ((o = getopt(argc, argv, "46cj:Llp:P:uv")) != -1) switch (o) { case '4': opt_4 = 1; @@ -727,6 +754,9 @@ main(int argc, char *argv[]) case 'c': opt_c = 1; break; + case 'j': + opt_j = atoi(optarg); + break; case 'L': opt_L = 1; break; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 27 23:16:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C58931065677 for ; Wed, 27 Jun 2012 23:16:54 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6BDC38FC18 for ; Wed, 27 Jun 2012 23:16:54 +0000 (UTC) Received: by ggnm2 with SMTP id m2so1683397ggn.13 for ; Wed, 27 Jun 2012 16:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=Sp2zpQUGedtS5DW+7PUiPqZsh0hzsQs6PxpZt1rIawg=; b=GFkB59RLrgeBAQpfs3dnQnEKOApXiZ+crrxf4h8WFC0ibcoIBMQ09SZKjZC6HBzQmd /j9FrsY/u4a1thpw09d4yAH95mEyNuPN6rOhPpJjB6+EzBkG6E3779lLTG8VLfwBJQfz h2TqxuFe3+J7uR/HnuN37OQywfq7vLiqQx1EQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-gm-message-state; bh=Sp2zpQUGedtS5DW+7PUiPqZsh0hzsQs6PxpZt1rIawg=; b=QU3yeivEKuGrozhkBasruwpsDuSfY7WBvwbP60N8abnLdag96QYzdGHvp2T6yuLVKK bxt5dPyoG96MaKwjVFZJHnKPlCUJ2Tibk/QsI9dywrI47QHtxsVZYIJe0DcgqGGRCsZj CoccYbAgGl+YMzpfGrIPLG7/oTdKnYmFrr2jYJRMa0Tb1JPTPC8ZB3hD72FhW8OlSOsE r4aUnmczqPzzwGT6NnguQoLUNWKghahYNm0A7ZmPEGosWHBKWPfHwfYtOSU5fxtjoKMP H49lfji1NoTRIRdu6wnoep5U1FYMuyUNVSaWGEPdHYTGIa2z1n0j4M6/9ttfdcAC4EM2 ko6w== Received: by 10.236.177.104 with SMTP id c68mr23155843yhm.76.1340839013639; Wed, 27 Jun 2012 16:16:53 -0700 (PDT) Received: from DataIX.net (75-128-120-86.dhcp.aldl.mi.charter.com. [75.128.120.86]) by mx.google.com with ESMTPS id k67sm30865716yhj.18.2012.06.27.16.16.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 16:16:53 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q5RNGoc5012238 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Jun 2012 19:16:50 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jh@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q5RNGoGI012237; Wed, 27 Jun 2012 19:16:50 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Wed, 27 Jun 2012 19:16:50 -0400 From: Jason Hellenthal To: Andrew Thompson Message-ID: <20120627231650.GA7853@DataIX.net> References: <201206272213.q5RMDfxt035907@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206272213.q5RMDfxt035907@svn.freebsd.org> X-Gm-Message-State: ALoCoQnPVgEZGIMmnoJu6EU72l3bAmJ574EDWFJV3JZguEcqPMnjgOI9nIljiYZAzqtiGnWdxSY6 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r237672 - stable/8/usr.bin/sockstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 23:16:54 -0000 The usage information never got updated from this change... $ sockstat --help sockstat: illegal option -- - Usage: sockstat [-46cLlu] [-p ports] [-P protocols] On Wed, Jun 27, 2012 at 10:13:41PM +0000, Andrew Thompson wrote: > Author: thompsa > Date: Wed Jun 27 22:13:40 2012 > New Revision: 237672 > URL: http://svn.freebsd.org/changeset/base/237672 > > Log: > MFC r235870 > > Allow the socket list to be limited to a specific jail id. > > Modified: > stable/8/usr.bin/sockstat/sockstat.1 > stable/8/usr.bin/sockstat/sockstat.c > Directory Properties: > stable/8/usr.bin/sockstat/ (props changed) > > Modified: stable/8/usr.bin/sockstat/sockstat.1 > ============================================================================== > --- stable/8/usr.bin/sockstat/sockstat.1 Wed Jun 27 22:11:31 2012 (r237671) > +++ stable/8/usr.bin/sockstat/sockstat.1 Wed Jun 27 22:13:40 2012 (r237672) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 24, 2012 > +.Dd May 16, 2012 > .Dt SOCKSTAT 1 > .Os > .Sh NAME > @@ -36,6 +36,7 @@ > .Sh SYNOPSIS > .Nm > .Op Fl 46cLlu > +.Op Fl j Ar jid > .Op Fl p Ar ports > .Op Fl P Ar protocols > .Sh DESCRIPTION > @@ -57,6 +58,8 @@ Show > (IPv6) sockets. > .It Fl c > Show connected sockets. > +.It Fl j Ar jid > +Show only sockets belonging to the specified jail ID. > .It Fl L > Only show Internet sockets if the local or foreign addresses are not > in the loopback network prefix > > Modified: stable/8/usr.bin/sockstat/sockstat.c > ============================================================================== > --- stable/8/usr.bin/sockstat/sockstat.c Wed Jun 27 22:11:31 2012 (r237671) > +++ stable/8/usr.bin/sockstat/sockstat.c Wed Jun 27 22:13:40 2012 (r237672) > @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); > static int opt_4; /* Show IPv4 sockets */ > static int opt_6; /* Show IPv6 sockets */ > static int opt_c; /* Show connected sockets */ > +static int opt_j; /* Show specified jail */ > static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ > static int opt_l; /* Show listening sockets */ > static int opt_u; /* Show Unix domain sockets */ > @@ -549,6 +550,27 @@ getprocname(pid_t pid) > } > > static int > +getprocjid(pid_t pid) > +{ > + static struct kinfo_proc proc; > + size_t len; > + int mib[4]; > + > + mib[0] = CTL_KERN; > + mib[1] = KERN_PROC; > + mib[2] = KERN_PROC_PID; > + mib[3] = (int)pid; > + len = sizeof proc; > + if (sysctl(mib, 4, &proc, &len, NULL, 0) == -1) { > + /* Do not warn if the process exits before we get its jid. */ > + if (errno != ESRCH) > + warn("sysctl()"); > + return (-1); > + } > + return (proc.ki_jid); > +} > + > +static int > check_ports(struct sock *s) > { > int port; > @@ -643,6 +665,8 @@ display(void) > for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { > if (xf->xf_data == NULL) > continue; > + if (opt_j >= 0 && opt_j != getprocjid(xf->xf_pid)) > + continue; > hash = (int)((uintptr_t)xf->xf_data % HASHSIZE); > for (s = sockhash[hash]; s != NULL; s = s->next) > if ((void *)s->socket == xf->xf_data) > @@ -668,6 +692,8 @@ display(void) > pos += xprintf("%d ", xf->xf_fd); > displaysock(s, pos); > } > + if (opt_j >= 0) > + return; > for (hash = 0; hash < HASHSIZE; hash++) { > for (s = sockhash[hash]; s != NULL; s = s->next) { > if (s->shown) > @@ -716,7 +742,8 @@ main(int argc, char *argv[]) > int protos_defined = -1; > int o, i; > > - while ((o = getopt(argc, argv, "46cLlp:P:uv")) != -1) > + opt_j = -1; > + while ((o = getopt(argc, argv, "46cj:Llp:P:uv")) != -1) > switch (o) { > case '4': > opt_4 = 1; > @@ -727,6 +754,9 @@ main(int argc, char *argv[]) > case 'c': > opt_c = 1; > break; > + case 'j': > + opt_j = atoi(optarg); > + break; > case 'L': > opt_L = 1; > break; > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" -- - (2^(N-1)) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 01:05:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94C76106566C; Thu, 28 Jun 2012 01:05:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73DBE8FC08; Thu, 28 Jun 2012 01:05:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5S150QQ043285; Thu, 28 Jun 2012 01:05:00 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5S150sL043279; Thu, 28 Jun 2012 01:05:00 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206280105.q5S150sL043279@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 28 Jun 2012 01:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237679 - stable/8/contrib/gcc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 01:05:00 -0000 Author: pfg Date: Thu Jun 28 01:04:59 2012 New Revision: 237679 URL: http://svn.freebsd.org/changeset/base/237679 Log: MFC r237406: Bring a couple of fixes for gcc optimizations. The GCC4.3 branch contains some optimization fixes that were not considered regressions and therefore were never backported. We are bringing a couple of them that are under GPLv2 since they were made before the license switch upstream. Modified: stable/8/contrib/gcc/ChangeLog.gcc43 stable/8/contrib/gcc/fold-const.c stable/8/contrib/gcc/gimplify.c stable/8/contrib/gcc/tree-ssa-ccp.c stable/8/contrib/gcc/tree-ssa-pre.c Directory Properties: stable/8/contrib/gcc/ (props changed) Modified: stable/8/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/8/contrib/gcc/ChangeLog.gcc43 Thu Jun 28 01:02:50 2012 (r237678) +++ stable/8/contrib/gcc/ChangeLog.gcc43 Thu Jun 28 01:04:59 2012 (r237679) @@ -5,6 +5,18 @@ with SSE3 instruction set support. * doc/invoke.texi: Likewise. +2007-04-12 Richard Guenther (r123736) + + PR tree-optimization/24689 + PR tree-optimization/31307 + * fold-const.c (operand_equal_p): Compare INTEGER_CST array + indices by value. + * gimplify.c (canonicalize_addr_expr): To be consistent with + gimplify_compound_lval only set operands two and three of + ARRAY_REFs if they are not gimple_min_invariant. This makes + it never at this place. + * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. + 2007-04-07 H.J. Lu (r123639) * config/i386/i386.c (ix86_handle_option): Handle SSSE3. @@ -96,7 +108,7 @@ * doc/invoke.texi: Add entry about geode processor. -2006-10-24 Richard Guenther +2006-10-24 Richard Guenther (r118001) PR middle-end/28796 * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES @@ -170,7 +182,13 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. -2006-10-21 Richard Guenther +2006-10-21 Richard Guenther (r117932) + + PR tree-optimization/3511 + * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that + got new invariant arguments during PHI translation. + +2006-10-21 Richard Guenther (r117929) * builtins.c (fold_builtin_classify): Fix typo. Modified: stable/8/contrib/gcc/fold-const.c ============================================================================== --- stable/8/contrib/gcc/fold-const.c Thu Jun 28 01:02:50 2012 (r237678) +++ stable/8/contrib/gcc/fold-const.c Thu Jun 28 01:04:59 2012 (r237679) @@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u case ARRAY_REF: case ARRAY_RANGE_REF: - /* Operands 2 and 3 may be null. */ + /* Operands 2 and 3 may be null. + Compare the array index by value if it is constant first as we + may have different types but same value here. */ return (OP_SAME (0) - && OP_SAME (1) + && (tree_int_cst_equal (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1)) + || OP_SAME (1)) && OP_SAME_WITH_NULL (2) && OP_SAME_WITH_NULL (3)); Modified: stable/8/contrib/gcc/gimplify.c ============================================================================== --- stable/8/contrib/gcc/gimplify.c Thu Jun 28 01:02:50 2012 (r237678) +++ stable/8/contrib/gcc/gimplify.c Thu Jun 28 01:04:59 2012 (r237679) @@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p) /* All checks succeeded. Build a new node to merge the cast. */ *expr_p = build4 (ARRAY_REF, dctype, obj_expr, TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype), - size_int (TYPE_ALIGN_UNIT (dctype)))); + NULL_TREE, NULL_TREE); *expr_p = build1 (ADDR_EXPR, ctype, *expr_p); } Modified: stable/8/contrib/gcc/tree-ssa-ccp.c ============================================================================== --- stable/8/contrib/gcc/tree-ssa-ccp.c Thu Jun 28 01:02:50 2012 (r237678) +++ stable/8/contrib/gcc/tree-ssa-ccp.c Thu Jun 28 01:04:59 2012 (r237679) @@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas if (!integer_zerop (elt_offset)) idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0); - return build4 (ARRAY_REF, orig_type, base, idx, min_idx, - size_int (tree_low_cst (elt_size, 1) - / (TYPE_ALIGN_UNIT (elt_type)))); + return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE); } Modified: stable/8/contrib/gcc/tree-ssa-pre.c ============================================================================== --- stable/8/contrib/gcc/tree-ssa-pre.c Thu Jun 28 01:02:50 2012 (r237678) +++ stable/8/contrib/gcc/tree-ssa-pre.c Thu Jun 28 01:04:59 2012 (r237679) @@ -1076,6 +1076,7 @@ phi_translate (tree expr, value_set_t se tree newexpr; tree vh = get_value_handle (expr); bool listchanged = false; + bool invariantarg = false; VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh); VEC (tree, gc) *tvuses; @@ -1134,10 +1135,26 @@ phi_translate (tree expr, value_set_t se if (newval != oldval) { listchanged = true; + invariantarg |= is_gimple_min_invariant (newval); TREE_VALUE (newwalker) = get_value_handle (newval); } } } + + /* In case of new invariant args we might try to fold the call + again. */ + if (invariantarg) + { + tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr), + newop0, newarglist, newop2); + if (tmp) + { + STRIP_TYPE_NOPS (tmp); + if (is_gimple_min_invariant (tmp)) + return tmp; + } + } + if (listchanged) vn_lookup_or_add (newarglist, NULL); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 13:05:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F9F6106564A; Thu, 28 Jun 2012 13:05:57 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A2A08FC26; Thu, 28 Jun 2012 13:05:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SD5v8u077495; Thu, 28 Jun 2012 13:05:57 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SD5vOI077493; Thu, 28 Jun 2012 13:05:57 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206281305.q5SD5vOI077493@svn.freebsd.org> From: Warren Block Date: Thu, 28 Jun 2012 13:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237707 - stable/8/sbin/geom/class/raid X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 13:05:57 -0000 Author: wblock (doc committer) Date: Thu Jun 28 13:05:56 2012 New Revision: 237707 URL: http://svn.freebsd.org/changeset/base/237707 Log: MFC r237620: Use possessive "its", no apostrophe. Modified: stable/8/sbin/geom/class/raid/graid.8 Directory Properties: stable/8/sbin/geom/class/raid/ (props changed) Modified: stable/8/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/8/sbin/geom/class/raid/graid.8 Thu Jun 28 13:04:55 2012 (r237706) +++ stable/8/sbin/geom/class/raid/graid.8 Thu Jun 28 13:05:56 2012 (r237707) @@ -85,7 +85,7 @@ utility is used to manage software RAID GEOM RAID class. GEOM RAID class uses on-disk metadata to provide access to software-RAID volumes defined by different RAID BIOSes. -Depending on RAID BIOS type and it's metadata format, different subsets of +Depending on RAID BIOS type and its metadata format, different subsets of configurations and features are supported. To allow booting from RAID volume, the metadata format should match the RAID BIOS type and its capabilities. From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 13:11:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30E53106566C; Thu, 28 Jun 2012 13:11:35 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AFFB8FC1A; Thu, 28 Jun 2012 13:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SDBY15077895; Thu, 28 Jun 2012 13:11:34 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SDBYBs077893; Thu, 28 Jun 2012 13:11:34 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206281311.q5SDBYBs077893@svn.freebsd.org> From: Warren Block Date: Thu, 28 Jun 2012 13:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237709 - stable/8/share/man/man7 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 13:11:35 -0000 Author: wblock (doc committer) Date: Thu Jun 28 13:11:34 2012 New Revision: 237709 URL: http://svn.freebsd.org/changeset/base/237709 Log: MFC r237655: Point out that /usr/src, /usr/doc, and /usr/ports may be empty or not exist until populated with csup(1) or svn(1). PR: 169487 Submitted by: Moritz Wilhelmy Modified: stable/8/share/man/man7/build.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/build.7 ============================================================================== --- stable/8/share/man/man7/build.7 Thu Jun 28 13:10:36 2012 (r237708) +++ stable/8/share/man/man7/build.7 Thu Jun 28 13:11:34 2012 (r237709) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 29, 2011 +.Dd June 27, 2012 .Dt BUILD 7 .Os .Sh NAME @@ -39,6 +39,10 @@ normally .Pa /usr/doc , and .Pa /usr/ports . +These directories may be initially empty or non-existent until updated with +.Xr csup 1 +or +.Xr svn 1 . Directory .Pa /usr/src contains the @@ -455,7 +459,7 @@ on built objects. .It Va NO_SHARE If set, the build does not descend into the .Pa /usr/src/share -subdirectory (i.e. manpages, locale data files, timezone data files and +subdirectory (i.e., manpages, locale data files, timezone data files and other .Pa /usr/src/share files will not be rebuild from their sources). @@ -556,8 +560,10 @@ make TARGET=sparc64 DESTDIR=/clients/spa .Ed .Sh SEE ALSO .Xr cc 1 , +.Xr csup 1 , .Xr install 1 , .Xr make 1 , +.Xr svn 1 , .Xr make.conf 5 , .Xr src.conf 5 , .Xr ports 7 , From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 16:54:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1A91106566C; Thu, 28 Jun 2012 16:54:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83A838FC12; Thu, 28 Jun 2012 16:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SGsBGb087254; Thu, 28 Jun 2012 16:54:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SGsBoc087252; Thu, 28 Jun 2012 16:54:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206281654.q5SGsBoc087252@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 28 Jun 2012 16:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237717 - stable/8/sys/ufs/ffs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 16:54:11 -0000 Author: kib Date: Thu Jun 28 16:54:10 2012 New Revision: 237717 URL: http://svn.freebsd.org/changeset/base/237717 Log: MFC r237366: Fix unbounded-length malloc, controlled from usermode. The added check is performed before exact size of the buffer is calculated, but the buffer cannot have size greater then the total space allocated for extended attributes. The existing check is executing with precise size, but it is too late, since buffer needs to be allocated in advance. Also, adapt to uio_resid being of ssize_t type. Use lblktosize instead of multiplying by fs block size by hand as well. Modified: stable/8/sys/ufs/ffs/ffs_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_vnops.c Thu Jun 28 16:44:29 2012 (r237716) +++ stable/8/sys/ufs/ffs/ffs_vnops.c Thu Jun 28 16:54:10 2012 (r237717) @@ -1648,7 +1648,8 @@ vop_setextattr { struct inode *ip; struct fs *fs; uint32_t ealength, ul; - int ealen, olen, eapad1, eapad2, error, i, easize; + ssize_t ealen; + int olen, eapad1, eapad2, error, i, easize; u_char *eae, *p; ip = VTOI(ap->a_vp); @@ -1667,6 +1668,10 @@ vop_setextattr { if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); + ealen = ap->a_uio->uio_resid; + if (ealen < 0 || ealen > lblktosize(fs, NXADDR)) + return (EINVAL); + error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VWRITE); if (error) { @@ -1684,7 +1689,6 @@ vop_setextattr { if (error) return (error); - ealen = ap->a_uio->uio_resid; ealength = sizeof(uint32_t) + 3 + strlen(ap->a_name); eapad1 = 8 - (ealength % 8); if (eapad1 == 8) @@ -1712,7 +1716,7 @@ vop_setextattr { easize += (ealength - ul); } } - if (easize > NXADDR * fs->fs_bsize) { + if (easize > lblktosize(fs, NXADDR)) { free(eae, M_TEMP); ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); if (ip->i_ea_area != NULL && ip->i_ea_error == 0) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 18:38:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4B33E1065670; Thu, 28 Jun 2012 18:38:51 +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 34BAF8FC1B; Thu, 28 Jun 2012 18:38:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SIcpUq092086; Thu, 28 Jun 2012 18:38:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SIco0T092077; Thu, 28 Jun 2012 18:38:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206281838.q5SIco0T092077@svn.freebsd.org> From: John Baldwin Date: Thu, 28 Jun 2012 18:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237720 - in stable/8: sys/kern sys/sys usr.bin/kdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 18:38:51 -0000 Author: jhb Date: Thu Jun 28 18:38:50 2012 New Revision: 237720 URL: http://svn.freebsd.org/changeset/base/237720 Log: MFC 234494: Include the associated wait channel message for context switch ktrace records. kdump supports both the old and new messages. Modified: stable/8/sys/kern/kern_condvar.c stable/8/sys/kern/kern_ktrace.c stable/8/sys/kern/kern_synch.c stable/8/sys/kern/subr_trap.c stable/8/sys/sys/ktrace.h stable/8/usr.bin/kdump/kdump.1 stable/8/usr.bin/kdump/kdump.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/usr.bin/kdump/ (props changed) Modified: stable/8/sys/kern/kern_condvar.c ============================================================================== --- stable/8/sys/kern/kern_condvar.c Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/sys/kern/kern_condvar.c Thu Jun 28 18:38:50 2012 (r237720) @@ -103,7 +103,7 @@ _cv_wait(struct cv *cvp, struct lock_obj lock_state = 0; #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 0); + ktrcsw(1, 0, cv_wmesg(cvp)); #endif CV_ASSERT(cvp, lock, td); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, @@ -140,7 +140,7 @@ _cv_wait(struct cv *cvp, struct lock_obj #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, cv_wmesg(cvp)); #endif PICKUP_GIANT(); if (lock != &Giant.lock_object) { @@ -162,7 +162,7 @@ _cv_wait_unlock(struct cv *cvp, struct l td = curthread; #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 0); + ktrcsw(1, 0, cv_wmesg(cvp)); #endif CV_ASSERT(cvp, lock, td); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, @@ -197,7 +197,7 @@ _cv_wait_unlock(struct cv *cvp, struct l #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, cv_wmesg(cvp)); #endif PICKUP_GIANT(); } @@ -220,7 +220,7 @@ _cv_wait_sig(struct cv *cvp, struct lock lock_state = 0; #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 0); + ktrcsw(1, 0, cv_wmesg(cvp)); #endif CV_ASSERT(cvp, lock, td); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, @@ -258,7 +258,7 @@ _cv_wait_sig(struct cv *cvp, struct lock #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, cv_wmesg(cvp)); #endif PICKUP_GIANT(); if (lock != &Giant.lock_object) { @@ -286,7 +286,7 @@ _cv_timedwait(struct cv *cvp, struct loc lock_state = 0; #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 0); + ktrcsw(1, 0, cv_wmesg(cvp)); #endif CV_ASSERT(cvp, lock, td); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, @@ -324,7 +324,7 @@ _cv_timedwait(struct cv *cvp, struct loc #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, cv_wmesg(cvp)); #endif PICKUP_GIANT(); if (lock != &Giant.lock_object) { @@ -353,7 +353,7 @@ _cv_timedwait_sig(struct cv *cvp, struct lock_state = 0; #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 0); + ktrcsw(1, 0, cv_wmesg(cvp)); #endif CV_ASSERT(cvp, lock, td); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, @@ -392,7 +392,7 @@ _cv_timedwait_sig(struct cv *cvp, struct #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, cv_wmesg(cvp)); #endif PICKUP_GIANT(); if (lock != &Giant.lock_object) { Modified: stable/8/sys/kern/kern_ktrace.c ============================================================================== --- stable/8/sys/kern/kern_ktrace.c Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/sys/kern/kern_ktrace.c Thu Jun 28 18:38:50 2012 (r237720) @@ -728,8 +728,9 @@ ktrpsig(sig, action, mask, code) } void -ktrcsw(out, user) +ktrcsw(out, user, wmesg) int out, user; + const char *wmesg; { struct thread *td = curthread; struct ktr_request *req; @@ -741,6 +742,10 @@ ktrcsw(out, user) kc = &req->ktr_data.ktr_csw; kc->out = out; kc->user = user; + if (wmesg != NULL) + strlcpy(kc->wmesg, wmesg, sizeof(kc->wmesg)); + else + bzero(kc->wmesg, sizeof(kc->wmesg)); ktr_enqueuerequest(td, req); ktrace_exit(td); } Modified: stable/8/sys/kern/kern_synch.c ============================================================================== --- stable/8/sys/kern/kern_synch.c Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/sys/kern/kern_synch.c Thu Jun 28 18:38:50 2012 (r237720) @@ -158,7 +158,7 @@ _sleep(void *ident, struct lock_object * p = td->td_proc; #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 0); + ktrcsw(1, 0, wmesg); #endif WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, "Sleeping on \"%s\"", wmesg); @@ -252,7 +252,7 @@ _sleep(void *ident, struct lock_object * } #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, wmesg); #endif PICKUP_GIANT(); if (lock != NULL && lock != &Giant.lock_object && !(priority & PDROP)) { @@ -314,7 +314,7 @@ msleep_spin(void *ident, struct mtx *mtx #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) { sleepq_release(ident); - ktrcsw(1, 0); + ktrcsw(1, 0, wmesg); sleepq_lock(ident); } #endif @@ -332,7 +332,7 @@ msleep_spin(void *ident, struct mtx *mtx } #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 0); + ktrcsw(0, 0, wmesg); #endif PICKUP_GIANT(); mtx_lock_spin(mtx); Modified: stable/8/sys/kern/subr_trap.c ============================================================================== --- stable/8/sys/kern/subr_trap.c Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/sys/kern/subr_trap.c Thu Jun 28 18:38:50 2012 (r237720) @@ -207,7 +207,7 @@ ast(struct trapframe *framep) if (flags & TDF_NEEDRESCHED) { #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(1, 1); + ktrcsw(1, 1, __func__); #endif thread_lock(td); sched_prio(td, td->td_user_pri); @@ -215,7 +215,7 @@ ast(struct trapframe *framep) thread_unlock(td); #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) - ktrcsw(0, 1); + ktrcsw(0, 1, __func__); #endif } Modified: stable/8/sys/sys/ktrace.h ============================================================================== --- stable/8/sys/sys/ktrace.h Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/sys/sys/ktrace.h Thu Jun 28 18:38:50 2012 (r237720) @@ -139,9 +139,15 @@ struct ktr_psig { * KTR_CSW - trace context switches */ #define KTR_CSW 6 +struct ktr_csw_old { + int out; /* 1 if switch out, 0 if switch in */ + int user; /* 1 if usermode (ivcsw), 0 if kernel (vcsw) */ +}; + struct ktr_csw { int out; /* 1 if switch out, 0 if switch in */ int user; /* 1 if usermode (ivcsw), 0 if kernel (vcsw) */ + char wmesg[8]; }; /* @@ -227,7 +233,7 @@ struct ktr_faultend { #ifdef _KERNEL void ktrnamei(char *); -void ktrcsw(int, int); +void ktrcsw(int, int, const char *); void ktrpsig(int, sig_t, sigset_t *, int); void ktrfault(vm_offset_t, int); void ktrfaultend(int); Modified: stable/8/usr.bin/kdump/kdump.1 ============================================================================== --- stable/8/usr.bin/kdump/kdump.1 Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/usr.bin/kdump/kdump.1 Thu Jun 28 18:38:50 2012 (r237720) @@ -32,7 +32,7 @@ .\" @(#)kdump.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 5, 2012 +.Dd April 20, 2012 .Dt KDUMP 1 .Os .Sh NAME @@ -171,7 +171,7 @@ The possible operations are: .It Li NAMI Ta file name lookup Ta path to file .It Li GIO Ta general I/O Ta fd, read/write, number of bytes .It Li PSIG Ta signal Ta signal name, handler, mask, code -.It Li CSW Ta context switch Ta stop/resume user/kernel +.It Li CSW Ta context switch Ta stop/resume user/kernel wmesg .It Li USER Ta data from user process Ta the data .It Li STRU Ta various syscalls Ta structure .It Li SCTL Ta Xr sysctl 3 requests Ta MIB name Modified: stable/8/usr.bin/kdump/kdump.c ============================================================================== --- stable/8/usr.bin/kdump/kdump.c Thu Jun 28 18:38:24 2012 (r237719) +++ stable/8/usr.bin/kdump/kdump.c Thu Jun 28 18:38:50 2012 (r237720) @@ -99,6 +99,7 @@ void visdump(char *, int, int); void ktrgenio(struct ktr_genio *, int); void ktrpsig(struct ktr_psig *); void ktrcsw(struct ktr_csw *); +void ktrcsw_old(struct ktr_csw_old *); void ktruser(int, unsigned char *); void ktrsockaddr(struct sockaddr *); void ktrstat(struct stat *); @@ -300,7 +301,10 @@ main(int argc, char *argv[]) ktrpsig((struct ktr_psig *)m); break; case KTR_CSW: - ktrcsw((struct ktr_csw *)m); + if (ktrlen == sizeof(struct ktr_csw_old)) + ktrcsw_old((struct ktr_csw_old *)m); + else + ktrcsw((struct ktr_csw *)m); break; case KTR_USER: ktruser(ktrlen, m); @@ -1168,12 +1172,19 @@ ktrpsig(struct ktr_psig *psig) } void -ktrcsw(struct ktr_csw *cs) +ktrcsw_old(struct ktr_csw_old *cs) { (void)printf("%s %s\n", cs->out ? "stop" : "resume", cs->user ? "user" : "kernel"); } +void +ktrcsw(struct ktr_csw *cs) +{ + printf("%s %s \"%s\"\n", cs->out ? "stop" : "resume", + cs->user ? "user" : "kernel", cs->wmesg); +} + #define UTRACE_DLOPEN_START 1 #define UTRACE_DLOPEN_STOP 2 #define UTRACE_DLCLOSE_START 3 From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 18:52:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4530910657D0; Thu, 28 Jun 2012 18:52:41 +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 2F1888FC0C; Thu, 28 Jun 2012 18:52:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SIqfrH092807; Thu, 28 Jun 2012 18:52:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SIqeTY092805; Thu, 28 Jun 2012 18:52:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206281852.q5SIqeTY092805@svn.freebsd.org> From: John Baldwin Date: Thu, 28 Jun 2012 18:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237722 - stable/8/etc/periodic/daily X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 18:52:41 -0000 Author: jhb Date: Thu Jun 28 18:52:40 2012 New Revision: 237722 URL: http://svn.freebsd.org/changeset/base/237722 Log: MFC 235132: Display dropped transmit packets in the daily network interface output. Modified: stable/8/etc/periodic/daily/420.status-network Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/periodic/daily/420.status-network ============================================================================== --- stable/8/etc/periodic/daily/420.status-network Thu Jun 28 18:52:33 2012 (r237721) +++ stable/8/etc/periodic/daily/420.status-network Thu Jun 28 18:52:40 2012 (r237722) @@ -18,9 +18,9 @@ case "$daily_status_network_enable" in case "$daily_status_network_usedns" in [Yy][Ee][Ss]) - netstat -i && rc=0 || rc=3;; + netstat -id && rc=0 || rc=3;; *) - netstat -in && rc=0 || rc=3;; + netstat -idn && rc=0 || rc=3;; esac;; *) rc=0;; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 19:55:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66040106568D; Thu, 28 Jun 2012 19:55:47 +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 5046F8FC0A; Thu, 28 Jun 2012 19:55:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SJtlLP095591; Thu, 28 Jun 2012 19:55:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SJtlpq095589; Thu, 28 Jun 2012 19:55:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206281955.q5SJtlpq095589@svn.freebsd.org> From: John Baldwin Date: Thu, 28 Jun 2012 19:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237728 - stable/8/sys/boot/i386/boot2 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 19:55:47 -0000 Author: jhb Date: Thu Jun 28 19:55:46 2012 New Revision: 237728 URL: http://svn.freebsd.org/changeset/base/237728 Log: MFC 236405: Remove unnecessary initializations. The BSS of boot2 is in fact zero'd when boot2 begins execution by the _start() routine in btxcsu.S. Modified: stable/8/sys/boot/i386/boot2/boot2.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/i386/boot2/boot2.c Thu Jun 28 19:55:26 2012 (r237727) +++ stable/8/sys/boot/i386/boot2/boot2.c Thu Jun 28 19:55:46 2012 (r237728) @@ -129,8 +129,8 @@ static struct dsk { int init; } dsk; static char cmd[512], cmddup[512], knamebuf[1024]; -static const char *kname = NULL; -static uint32_t opts = 0; +static const char *kname; +static uint32_t opts; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 28 21:24:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0451B106564A; Thu, 28 Jun 2012 21:24:57 +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 E13038FC1F; Thu, 28 Jun 2012 21:24:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SLOu7O099470; Thu, 28 Jun 2012 21:24:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SLOu28099462; Thu, 28 Jun 2012 21:24:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206282124.q5SLOu28099462@svn.freebsd.org> From: John Baldwin Date: Thu, 28 Jun 2012 21:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237732 - in stable/8: sys/dev/pci usr.sbin/pciconf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 21:24:57 -0000 Author: jhb Date: Thu Jun 28 21:24:56 2012 New Revision: 237732 URL: http://svn.freebsd.org/changeset/base/237732 Log: MFC 228161,230774,230822,236415: Add a new -e flag to pciconf(8)'s list mode to display PCI error details. Currently this dumps the status of any error bits in the PCI status register and PCI-express device status register. It also lists any errors indicated by version 1 of PCI-express Advanced Error Reporting (AER). Added: stable/8/usr.sbin/pciconf/err.c - copied unchanged from r236415, head/usr.sbin/pciconf/err.c Modified: stable/8/sys/dev/pci/pcireg.h stable/8/usr.sbin/pciconf/Makefile stable/8/usr.sbin/pciconf/cap.c stable/8/usr.sbin/pciconf/pciconf.8 stable/8/usr.sbin/pciconf/pciconf.c stable/8/usr.sbin/pciconf/pciconf.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/usr.sbin/pciconf/ (props changed) Modified: stable/8/sys/dev/pci/pcireg.h ============================================================================== --- stable/8/sys/dev/pci/pcireg.h Thu Jun 28 21:24:09 2012 (r237731) +++ stable/8/sys/dev/pci/pcireg.h Thu Jun 28 21:24:56 2012 (r237732) @@ -693,6 +693,7 @@ #define PCIR_AER_UC_STATUS 0x04 #define PCIM_AER_UC_TRAINING_ERROR 0x00000001 #define PCIM_AER_UC_DL_PROTOCOL_ERROR 0x00000010 +#define PCIM_AER_UC_SURPRISE_LINK_DOWN 0x00000020 #define PCIM_AER_UC_POISONED_TLP 0x00001000 #define PCIM_AER_UC_FC_PROTOCOL_ERROR 0x00002000 #define PCIM_AER_UC_COMPLETION_TIMEOUT 0x00004000 @@ -711,6 +712,7 @@ #define PCIM_AER_COR_BAD_DLLP 0x00000080 #define PCIM_AER_COR_REPLAY_ROLLOVER 0x00000100 #define PCIM_AER_COR_REPLAY_TIMEOUT 0x00001000 +#define PCIM_AER_COR_ADVISORY_NF_ERROR 0x00002000 #define PCIR_AER_COR_MASK 0x14 /* Shares bits with COR_STATUS */ #define PCIR_AER_CAP_CONTROL 0x18 #define PCIM_AER_FIRST_ERROR_PTR 0x0000001f Modified: stable/8/usr.sbin/pciconf/Makefile ============================================================================== --- stable/8/usr.sbin/pciconf/Makefile Thu Jun 28 21:24:09 2012 (r237731) +++ stable/8/usr.sbin/pciconf/Makefile Thu Jun 28 21:24:56 2012 (r237732) @@ -2,7 +2,7 @@ # $FreeBSD$ PROG= pciconf -SRCS= pciconf.c cap.c +SRCS= pciconf.c cap.c err.c MAN= pciconf.8 CFLAGS+= -I${.CURDIR}/../../sys Modified: stable/8/usr.sbin/pciconf/cap.c ============================================================================== --- stable/8/usr.sbin/pciconf/cap.c Thu Jun 28 21:24:09 2012 (r237731) +++ stable/8/usr.sbin/pciconf/cap.c Thu Jun 28 21:24:56 2012 (r237732) @@ -630,3 +630,59 @@ list_ecaps(int fd, struct pci_conf *p) ecap = read_config(fd, &p->pc_sel, ptr, 4); } } + +/* Find offset of a specific capability. Returns 0 on failure. */ +uint8_t +pci_find_cap(int fd, struct pci_conf *p, uint8_t id) +{ + uint16_t sta; + uint8_t ptr, cap; + + /* Are capabilities present for this device? */ + sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); + if (!(sta & PCIM_STATUS_CAPPRESENT)) + return (0); + + switch (p->pc_hdr & PCIM_HDRTYPE) { + case PCIM_HDRTYPE_NORMAL: + case PCIM_HDRTYPE_BRIDGE: + ptr = PCIR_CAP_PTR; + break; + case PCIM_HDRTYPE_CARDBUS: + ptr = PCIR_CAP_PTR_2; + break; + default: + return (0); + } + + ptr = read_config(fd, &p->pc_sel, ptr, 1); + while (ptr != 0 && ptr != 0xff) { + cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1); + if (cap == id) + return (ptr); + ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1); + } + return (0); +} + +/* Find offset of a specific extended capability. Returns 0 on failure. */ +uint16_t +pcie_find_cap(int fd, struct pci_conf *p, uint16_t id) +{ + uint32_t ecap; + uint16_t ptr; + + ptr = PCIR_EXTCAP; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + if (ecap == 0xffffffff || ecap == 0) + return (0); + for (;;) { + if (PCI_EXTCAP_ID(ecap) == id) + return (ptr); + ptr = PCI_EXTCAP_NEXTPTR(ecap); + if (ptr == 0) + break; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + } + return (0); +} Copied: stable/8/usr.sbin/pciconf/err.c (from r236415, head/usr.sbin/pciconf/err.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/pciconf/err.c Thu Jun 28 21:24:56 2012 (r237732, copy of r236415, head/usr.sbin/pciconf/err.c) @@ -0,0 +1,167 @@ +/*- + * Copyright (c) 2012 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ + +#include +#include + +#include +#include + +#include + +#include "pciconf.h" + +struct bit_table { + uint32_t mask; + const char *desc; +}; + +/* Error indicators in the PCI status register (PCIR_STATUS). */ +static struct bit_table pci_status[] = { + { PCIM_STATUS_MDPERR, "Master Data Parity Error" }, + { PCIM_STATUS_STABORT, "Sent Target-Abort" }, + { PCIM_STATUS_RTABORT, "Received Target-Abort" }, + { PCIM_STATUS_RMABORT, "Received Master-Abort" }, + { PCIM_STATUS_SERR, "Signalled System Error" }, + { PCIM_STATUS_PERR, "Detected Parity Error" }, + { 0, NULL }, +}; + +/* Valid error indicator bits in PCIR_STATUS. */ +#define PCI_ERRORS (PCIM_STATUS_MDPERR | PCIM_STATUS_STABORT | \ + PCIM_STATUS_RTABORT | PCIM_STATUS_RMABORT | \ + PCIM_STATUS_SERR | PCIM_STATUS_PERR) + +/* Error indicators in the PCI-Express device status register. */ +static struct bit_table pcie_device_status[] = { + { PCIM_EXP_STA_CORRECTABLE_ERROR, "Correctable Error Detected" }, + { PCIM_EXP_STA_NON_FATAL_ERROR, "Non-Fatal Error Detected" }, + { PCIM_EXP_STA_FATAL_ERROR, "Fatal Error Detected" }, + { PCIM_EXP_STA_UNSUPPORTED_REQ, "Unsupported Request Detected" }, + { 0, NULL }, +}; + +/* Valid error indicator bits in the PCI-Express device status register. */ +#define PCIE_ERRORS (PCIM_EXP_STA_CORRECTABLE_ERROR | \ + PCIM_EXP_STA_NON_FATAL_ERROR | \ + PCIM_EXP_STA_FATAL_ERROR | \ + PCIM_EXP_STA_UNSUPPORTED_REQ) + +/* AER Uncorrected errors. */ +static struct bit_table aer_uc[] = { + { PCIM_AER_UC_TRAINING_ERROR, "Link Training Error" }, + { PCIM_AER_UC_DL_PROTOCOL_ERROR, "Data Link Protocol Error" }, + { PCIM_AER_UC_SURPRISE_LINK_DOWN, "Surprise Link Down Error" }, + { PCIM_AER_UC_POISONED_TLP, "Poisoned TLP" }, + { PCIM_AER_UC_FC_PROTOCOL_ERROR, "Flow Control Protocol Error" }, + { PCIM_AER_UC_COMPLETION_TIMEOUT, "Completion Timeout" }, + { PCIM_AER_UC_COMPLETER_ABORT, "Completer Abort" }, + { PCIM_AER_UC_UNEXPECTED_COMPLETION, "Unexpected Completion" }, + { PCIM_AER_UC_RECEIVER_OVERFLOW, "Receiver Overflow Error" }, + { PCIM_AER_UC_MALFORMED_TLP, "Malformed TLP" }, + { PCIM_AER_UC_ECRC_ERROR, "ECRC Error" }, + { PCIM_AER_UC_UNSUPPORTED_REQUEST, "Unsupported Request" }, + { PCIM_AER_UC_ACS_VIOLATION, "ACS Violation" }, + { 0, NULL }, +}; + +/* AER Corrected errors. */ +static struct bit_table aer_cor[] = { + { PCIM_AER_COR_RECEIVER_ERROR, "Receiver Error" }, + { PCIM_AER_COR_BAD_TLP, "Bad TLP" }, + { PCIM_AER_COR_BAD_DLLP, "Bad DLLP" }, + { PCIM_AER_COR_REPLAY_ROLLOVER, "REPLAY_NUM Rollover" }, + { PCIM_AER_COR_REPLAY_TIMEOUT, "Replay Timer Timeout" }, + { PCIM_AER_COR_ADVISORY_NF_ERROR, "Advisory Non-Fatal Error" }, + { 0, NULL }, +}; + +static void +print_bits(const char *header, struct bit_table *table, uint32_t mask) +{ + int first; + + first = 1; + for (; table->desc != NULL; table++) + if (mask & table->mask) { + if (first) { + printf("%14s = ", header); + first = 0; + } else + printf(" "); + printf("%s\n", table->desc); + mask &= ~table->mask; + } + if (mask != 0) { + if (first) + printf("%14s = ", header); + else + printf(" "); + printf("Unknown: 0x%08x\n", mask); + } +} + +void +list_errors(int fd, struct pci_conf *p) +{ + uint32_t mask, severity; + uint16_t sta, aer; + uint8_t pcie; + + /* First check for standard PCI errors. */ + sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); + print_bits("PCI errors", pci_status, sta & PCI_ERRORS); + + /* See if this is a PCI-express device. */ + pcie = pci_find_cap(fd, p, PCIY_EXPRESS); + if (pcie == 0) + return; + + /* Check for PCI-e errors. */ + sta = read_config(fd, &p->pc_sel, pcie + PCIR_EXPRESS_DEVICE_STA, 2); + print_bits("PCI-e errors", pcie_device_status, sta & PCIE_ERRORS); + + /* See if this device supports AER. */ + aer = pcie_find_cap(fd, p, PCIZ_AER); + if (aer == 0) + return; + + /* Check for uncorrected errors. */ + mask = read_config(fd, &p->pc_sel, aer + PCIR_AER_UC_STATUS, 4); + severity = read_config(fd, &p->pc_sel, aer + PCIR_AER_UC_SEVERITY, 4); + print_bits("Fatal", aer_uc, mask & severity); + print_bits("Non-fatal", aer_uc, mask & ~severity); + + /* Check for corrected errors. */ + mask = read_config(fd, &p->pc_sel, aer + PCIR_AER_COR_STATUS, 4); + print_bits("Corrected", aer_cor, mask); +} Modified: stable/8/usr.sbin/pciconf/pciconf.8 ============================================================================== --- stable/8/usr.sbin/pciconf/pciconf.8 Thu Jun 28 21:24:09 2012 (r237731) +++ stable/8/usr.sbin/pciconf/pciconf.8 Thu Jun 28 21:24:56 2012 (r237732) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2007 +.Dd June 1, 2012 .Dt PCICONF 8 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd diagnostic utility for the PCI bus .Sh SYNOPSIS .Nm -.Fl l Op Fl bcv +.Fl l Op Fl bcev .Nm .Fl a Ar selector .Nm @@ -155,6 +155,15 @@ in config space in hexadecimal. The format of the text after the equals sign is capability-specific. .Pp If the +.Fl e +option is supplied, +.Nm +will list any errors reported for this device in standard PCI error registers. +Errors are checked for in the PCI status register, +the PCI-express device status register, +and the Advanced Error Reporting status registers. +.Pp +If the .Fl v option is supplied, .Nm Modified: stable/8/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/8/usr.sbin/pciconf/pciconf.c Thu Jun 28 21:24:09 2012 (r237731) +++ stable/8/usr.sbin/pciconf/pciconf.c Thu Jun 28 21:24:56 2012 (r237732) @@ -68,7 +68,7 @@ struct pci_vendor_info TAILQ_HEAD(,pci_vendor_info) pci_vendors; static void list_bars(int fd, struct pci_conf *p); -static void list_devs(int verbose, int bars, int caps); +static void list_devs(int verbose, int bars, int caps, int errors); static void list_verbose(struct pci_conf *p); static const char *guess_class(struct pci_conf *p); static const char *guess_subclass(struct pci_conf *p); @@ -83,7 +83,7 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: pciconf -l [-bcv]", + "usage: pciconf -l [-bcev]", " pciconf -a selector", " pciconf -r [-b | -h] selector addr[:addr2]", " pciconf -w [-b | -h] selector addr value"); @@ -94,12 +94,14 @@ int main(int argc, char **argv) { int c; - int listmode, readmode, writemode, attachedmode, bars, caps, verbose; + int listmode, readmode, writemode, attachedmode; + int bars, caps, errors, verbose; int byte, isshort; - listmode = readmode = writemode = attachedmode = bars = caps = verbose = byte = isshort = 0; + listmode = readmode = writemode = attachedmode = 0; + bars = caps = errors = verbose = byte = isshort = 0; - while ((c = getopt(argc, argv, "abchlrwv")) != -1) { + while ((c = getopt(argc, argv, "abcehlrwv")) != -1) { switch(c) { case 'a': attachedmode = 1; @@ -114,6 +116,10 @@ main(int argc, char **argv) caps = 1; break; + case 'e': + errors = 1; + break; + case 'h': isshort = 1; break; @@ -146,7 +152,7 @@ main(int argc, char **argv) usage(); if (listmode) { - list_devs(verbose, bars, caps); + list_devs(verbose, bars, caps, errors); } else if (attachedmode) { chkattached(argv[optind]); } else if (readmode) { @@ -163,7 +169,7 @@ main(int argc, char **argv) } static void -list_devs(int verbose, int bars, int caps) +list_devs(int verbose, int bars, int caps, int errors) { int fd; struct pci_conf_io pc; @@ -173,7 +179,7 @@ list_devs(int verbose, int bars, int cap if (verbose) load_vendors(); - fd = open(_PATH_DEVPCI, caps ? O_RDWR : O_RDONLY, 0); + fd = open(_PATH_DEVPCI, (caps || errors) ? O_RDWR : O_RDONLY, 0); if (fd < 0) err(1, "%s", _PATH_DEVPCI); @@ -223,6 +229,8 @@ list_devs(int verbose, int bars, int cap list_bars(fd, p); if (caps) list_caps(fd, p); + if (errors) + list_errors(fd, p); } } while (pc.status == PCI_GETCONF_MORE_DEVS); Modified: stable/8/usr.sbin/pciconf/pciconf.h ============================================================================== --- stable/8/usr.sbin/pciconf/pciconf.h Thu Jun 28 21:24:09 2012 (r237731) +++ stable/8/usr.sbin/pciconf/pciconf.h Thu Jun 28 21:24:56 2012 (r237732) @@ -34,6 +34,9 @@ #define __PCICONF_H__ void list_caps(int fd, struct pci_conf *p); +void list_errors(int fd, struct pci_conf *p); +uint8_t pci_find_cap(int fd, struct pci_conf *p, uint8_t id); +uint16_t pcie_find_cap(int fd, struct pci_conf *p, uint16_t id); uint32_t read_config(int fd, struct pcisel *sel, long reg, int width); #endif From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 03:03:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD57106566C; Fri, 29 Jun 2012 03:03:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6538C8FC1B; Fri, 29 Jun 2012 03:03:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5T33hUa014802; Fri, 29 Jun 2012 03:03:43 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5T33hK2014788; Fri, 29 Jun 2012 03:03:43 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206290303.q5T33hK2014788@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 29 Jun 2012 03:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237739 - stable/8/lib/libedit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 03:03:43 -0000 Author: pfg Date: Fri Jun 29 03:03:42 2012 New Revision: 237739 URL: http://svn.freebsd.org/changeset/base/237739 Log: MFC r237448: Merge changes from upstream libedit. Here we update most of the files to at least match the version available in NetBSD's snapshot of 20091228. This version was chosen because it still doesn't include wide character support (UTF-8), which involves many changes and new files. Modified: stable/8/lib/libedit/common.c stable/8/lib/libedit/editline.3 stable/8/lib/libedit/editrc.5 stable/8/lib/libedit/el.c stable/8/lib/libedit/el.h stable/8/lib/libedit/histedit.h stable/8/lib/libedit/history.c stable/8/lib/libedit/key.c stable/8/lib/libedit/key.h stable/8/lib/libedit/prompt.c stable/8/lib/libedit/prompt.h stable/8/lib/libedit/read.c stable/8/lib/libedit/refresh.c stable/8/lib/libedit/search.c stable/8/lib/libedit/sig.c stable/8/lib/libedit/sig.h stable/8/lib/libedit/term.c stable/8/lib/libedit/term.h stable/8/lib/libedit/tty.c stable/8/lib/libedit/vi.c Directory Properties: stable/8/lib/libedit/ (props changed) Modified: stable/8/lib/libedit/common.c ============================================================================== --- stable/8/lib/libedit/common.c Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/common.c Fri Jun 29 03:03:42 2012 (r237739) @@ -908,7 +908,7 @@ ed_command(EditLine *el, int c __unused) int tmplen; tmplen = c_gets(el, tmpbuf, "\n: "); - term__putc('\n'); + term__putc(el, '\n'); if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) term_beep(el); Modified: stable/8/lib/libedit/editline.3 ============================================================================== --- stable/8/lib/libedit/editline.3 Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/editline.3 Fri Jun 29 03:03:42 2012 (r237739) @@ -1,4 +1,4 @@ -.\" $NetBSD: editline.3,v 1.55 2007/01/12 16:31:13 christos Exp $ +.\" $NetBSD: editline.3,v 1.70 2009/07/05 21:55:24 perry Exp $ .\" .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2007 +.Dd July 5, 2009 .Dt EDITLINE 3 .Os .Sh NAME @@ -165,6 +165,14 @@ is modified to contain the number of cha Returns the line read if successful, or .Dv NULL if no characters were read or if an error occurred. +If an error occurred, +.Fa count +is set to \-1 and +.Dv errno +contains the error code that caused it. +The return value may not remain valid across calls to +.Fn el_gets +and must be copied if the data is to be retained. .It Fn el_getc Read a character from the tty. .Fa ch @@ -225,10 +233,30 @@ are supported, along with the required a Define prompt printing function as .Fa f , which is to return a string that contains the prompt. +.It Dv EL_PROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" +Same as +.Dv EL_PROMPT , +but the +.Fa c +argument indicates the start/stop literal prompt character. +.Pp +If a start/stop literal character is found in the prompt, the +character itself +is not printed, but characters after it are printed directly to the +terminal without affecting the state of the current line. +A subsequent second start/stop literal character ends this behavior. +This is typically used to embed literal escape sequences that change the +color/style of the terminal in the prompt. +.Dv 0 +unsets it. +.It Dv EL_REFRESH +Re-display the current line on the next terminal line. .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" Define right side prompt printing function as .Fa f , which is to return a string that contains the prompt. +.It Dv EL_RPROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" +Define the right prompt printing function but with a literal escape character. .It Dv EL_TERMINAL , Fa "const char *type" Define terminal type of the tty to be .Fa type , @@ -262,66 +290,43 @@ reading command input: and .Dv SIGWINCH . Otherwise, the current signal handlers will be used. -.It Dv EL_BIND , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_BIND , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic bind builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_ECHOTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_ECHOTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic echotc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_SETTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_SETTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic settc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_SETTY , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_SETTY , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic setty builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_TELLTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_TELLTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic telltc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_ADDFN , Xo -.Fa "const char *name" , -.Fa "const char *help" , -.Fa "unsigned char (*func)(EditLine *e, int ch)" -.Xc +.It Dv EL_ADDFN , Fa "const char *name" , Fa "const char *help" , \ +Fa "unsigned char (*func)(EditLine *e, int ch)" Add a user defined function, .Fn func , referred to as @@ -363,10 +368,8 @@ Beep, and flush tty. .It Dv CC_FATAL Fatal error, reset tty to known state. .El -.It Dv EL_HIST , Xo -.Fa "History *(*func)(History *, int op, ...)" , -.Fa "const char *ptr" -.Xc +.It Dv EL_HIST , Fa "History *(*func)(History *, int op, ...)" , \ +Fa "const char *ptr" Defines which history function to use, which is usually .Fn history . .Fa ptr @@ -438,10 +441,22 @@ The following values for are supported, along with actual type of .Fa result : .Bl -tag -width 4n -.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" -Return a pointer to the function that displays the prompt. -.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" -Return a pointer to the function that displays the rightside prompt. +.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" +Return a pointer to the function that displays the prompt in +.Fa f . +If +.Fa c +is not +.Dv NULL , +return the start/stop literal prompt character in it. +.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" +Return a pointer to the function that displays the prompt in +.Fa f . +If +.Fa c +is not +.Dv NULL , +return the start/stop literal prompt character in it. .It Dv EL_EDITOR , Fa "const char *" Return the name of the editor, which will be one of .Dq emacs @@ -606,18 +621,11 @@ assumed to be created with .Fn history_init . .It Dv H_CLEAR Clear the history. -.It Dv H_FUNC , Xo -.Fa "void *ptr" , -.Fa "history_gfun_t first" , -.Fa "history_gfun_t next" , -.Fa "history_gfun_t last" , -.Fa "history_gfun_t prev" , -.Fa "history_gfun_t curr" , -.Fa "history_sfun_t set" , -.Fa "history_vfun_t clear" , -.Fa "history_efun_t enter" , -.Fa "history_efun_t add" -.Xc +.It Dv H_FUNC , Fa "void *ptr" , Fa "history_gfun_t first" , \ +Fa "history_gfun_t next" , Fa "history_gfun_t last" , \ +Fa "history_gfun_t prev" , Fa "history_gfun_t curr" , \ +Fa "history_sfun_t set" , Fa "history_vfun_t clear" , \ +Fa "history_efun_t enter" , Fa "history_efun_t add" Define functions to perform various history operations. .Fa ptr is the argument given to a function when it is invoked. Modified: stable/8/lib/libedit/editrc.5 ============================================================================== --- stable/8/lib/libedit/editrc.5 Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/editrc.5 Fri Jun 29 03:03:42 2012 (r237739) @@ -1,4 +1,4 @@ -.\" $NetBSD: editrc.5,v 1.20 2006/08/21 12:45:30 christos Exp $ +.\" $NetBSD: editrc.5,v 1.24 2009/04/11 22:17:52 wiz Exp $ .\" .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -92,16 +92,8 @@ shell. .Pp The following builtin commands are available: .Bl -tag -width 4n -.It Ic bind Xo -.Op Fl a -.Op Fl e -.Op Fl k -.Op Fl l -.Op Fl r -.Op Fl s -.Op Fl v -.Op Ar key Op Ar command -.Xc +.It Ic bind Oo Fl a Oc Oo Fl e Oc Oo Fl k Oc Oo Fl l Oc Oo Fl r Oc \ +Oo Fl s Oc Oo Fl v Oc Oo Ar key Oo Ar command Oc Oc Without options, list all bound keys, and the editor command to which each is bound. If @@ -195,11 +187,7 @@ if it has any, notably .Sq \e and .Sq ^ . -.It Ic echotc Xo -.Op Fl sv -.Ar arg -.Ar ... -.Xc +.It Ic echotc Oo Fl sv Oc Ar arg Ar ... Exercise terminal capabilities given in .Ar arg Ar ... . If @@ -255,16 +243,8 @@ to as defined in .Xr termcap 5 . No sanity checking is done. -.It Ic setty Xo -.Op Fl a -.Op Fl d -.Op Fl q -.Op Fl x -.Op Ar +mode -.Op Ar -mode -.Op Ar mode -.Op Ar char=c -.Xc +.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \ +Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=c Oc Control which tty modes that .Nm will not allow the user to change. Modified: stable/8/lib/libedit/el.c ============================================================================== --- stable/8/lib/libedit/el.c Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/el.c Fri Jun 29 03:03:42 2012 (r237739) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: el.c,v 1.44 2006/12/15 22:13:33 christos Exp $ + * $NetBSD: el.c,v 1.55 2009/07/25 21:19:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "el.h" #define HAVE_ISSETUGID @@ -156,9 +157,21 @@ el_set(EditLine *el, int op, ...) switch (op) { case EL_PROMPT: - case EL_RPROMPT: - rv = prompt_set(el, va_arg(ap, el_pfunc_t), op); + case EL_RPROMPT: { + el_pfunc_t p = va_arg(ap, el_pfunc_t); + + rv = prompt_set(el, p, 0, op); break; + } + + case EL_PROMPT_ESC: + case EL_RPROMPT_ESC: { + el_pfunc_t p = va_arg(ap, el_pfunc_t); + char c = va_arg(ap, int); + + rv = prompt_set(el, p, c, op); + break; + } case EL_TERMINAL: rv = term_set(el, va_arg(ap, char *)); @@ -309,6 +322,12 @@ el_set(EditLine *el, int op, ...) break; } + case EL_REFRESH: + re_clear_display(el); + re_refresh(el); + term__flush(el); + break; + default: rv = -1; break; @@ -335,9 +354,13 @@ el_get(EditLine *el, int op, ...) switch (op) { case EL_PROMPT: - case EL_RPROMPT: - rv = prompt_get(el, va_arg(ap, el_pfunc_t *), op); + case EL_RPROMPT: { + el_pfunc_t *p = va_arg(ap, el_pfunc_t *); + char *c = va_arg(ap, char *); + + rv = prompt_get(el, p, c, op); break; + } case EL_EDITOR: rv = map_get_editor(el, va_arg(ap, const char **)); @@ -364,7 +387,7 @@ el_get(EditLine *el, int op, ...) char *argv[20]; int i; - for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++) + for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++) if ((argv[i] = va_arg(ap, char *)) == NULL) break; @@ -495,12 +518,14 @@ el_source(EditLine *el, const char *fnam FILE *fp; size_t len; char *ptr; +#ifdef HAVE_ISSETUGID + char path[MAXPATHLEN]; +#endif fp = NULL; if (fname == NULL) { #ifdef HAVE_ISSETUGID static const char elpath[] = "/.editrc"; - char path[MAXPATHLEN]; if (issetugid()) return (-1); @@ -529,6 +554,13 @@ el_source(EditLine *el, const char *fnam if (len > 0 && ptr[len - 1] == '\n') --len; ptr[len] = '\0'; + + /* loop until first non-space char or EOL */ + while (*ptr != '\0' && isspace((unsigned char)*ptr)) + ptr++; + if (*ptr == '#') + continue; /* ignore, this is a comment line */ + if (parse_line(el, ptr) == -1) { (void) fclose(fp); return (-1); Modified: stable/8/lib/libedit/el.h ============================================================================== --- stable/8/lib/libedit/el.h Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/el.h Fri Jun 29 03:03:42 2012 (r237739) @@ -115,6 +115,7 @@ struct editline { FILE *el_errfile; /* Stdio stuff */ int el_infd; /* Input file descriptor */ int el_flags; /* Various flags. */ + int el_errno; /* Local copy of errno */ coord_t el_cursor; /* Cursor location */ char **el_display; /* Real screen image = what is there */ char **el_vdisplay; /* Virtual screen image = what we see */ Modified: stable/8/lib/libedit/histedit.h ============================================================================== --- stable/8/lib/libedit/histedit.h Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/histedit.h Fri Jun 29 03:03:42 2012 (r237739) @@ -131,10 +131,10 @@ unsigned char _el_fn_sh_complete(EditLin #define EL_GETCFN 13 /* , el_rfunc_t); */ #define EL_CLIENTDATA 14 /* , void *); */ #define EL_UNBUFFERED 15 /* , int); */ -#define EL_PREP_TERM 16 /* , int); */ +#define EL_PREP_TERM 16 /* , int); */ #define EL_GETTC 17 /* , const char *, ..., NULL); */ -#define EL_GETFP 18 /* , int, FILE **) */ -#define EL_SETFP 19 /* , int, FILE *) */ +#define EL_GETFP 18 /* , int, FILE **); */ +#define EL_SETFP 19 /* , int, FILE *); */ #define EL_REFRESH 20 /* , void); set */ #define EL_PROMPT_ESC 21 /* , prompt_func, Char); set/get */ #define EL_RPROMPT_ESC 22 /* , prompt_func, Char); set/get */ Modified: stable/8/lib/libedit/history.c ============================================================================== --- stable/8/lib/libedit/history.c Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/history.c Fri Jun 29 03:03:42 2012 (r237739) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $ + * $NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -116,6 +116,7 @@ private int history_prev_string(History */ typedef struct hentry_t { HistEvent ev; /* What we return */ + void *data; /* data */ struct hentry_t *next; /* Next entry */ struct hentry_t *prev; /* Previous entry */ } hentry_t; @@ -145,6 +146,9 @@ private int history_def_init(ptr_t *, Hi private int history_def_insert(history_t *, HistEvent *, const char *); private void history_def_delete(history_t *, HistEvent *, hentry_t *); +private int history_deldata_nth(history_t *, HistEvent *, int, void **); +private int history_set_nth(ptr_t, HistEvent *, int); + #define history_def_setsize(p, num)(void) (((history_t *)p)->max = (num)) #define history_def_getsize(p) (((history_t *)p)->cur) #define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE) != 0) @@ -335,6 +339,31 @@ history_def_set(ptr_t p, HistEvent *ev, } +/* history_set_nth(): + * Default function to set the current event in the history to the + * n-th one. + */ +private int +history_set_nth(ptr_t p, HistEvent *ev, int n) +{ + history_t *h = (history_t *) p; + + if (h->cur == 0) { + he_seterrev(ev, _HE_EMPTY_LIST); + return (-1); + } + for (h->cursor = h->list.prev; h->cursor != &h->list; + h->cursor = h->cursor->prev) + if (n-- <= 0) + break; + if (h->cursor == &h->list) { + he_seterrev(ev, _HE_NOT_FOUND); + return (-1); + } + return (0); +} + + /* history_def_add(): * Append string to element */ @@ -363,6 +392,24 @@ history_def_add(ptr_t p, HistEvent *ev, } +private int +history_deldata_nth(history_t *h, HistEvent *ev, + int num, void **data) +{ + if (history_set_nth(h, ev, num) != 0) + return (-1); + /* magic value to skip delete (just set to n-th history) */ + if (data == (void **)-1) + return (0); + ev->str = strdup(h->cursor->ev.str); + ev->num = h->cursor->ev.num; + if (data) + *data = h->cursor->data; + history_def_delete(h, ev, h->cursor); + return (0); +} + + /* history_def_del(): * Delete element hp of the h list */ @@ -392,8 +439,11 @@ history_def_delete(history_t *h, HistEventPrivate *evp = (void *)&hp->ev; if (hp == &h->list) abort(); - if (h->cursor == hp) + if (h->cursor == hp) { h->cursor = hp->prev; + if (h->cursor == &h->list) + h->cursor = hp->next; + } hp->prev->next = hp->next; hp->next->prev = hp->prev; h_free((ptr_t) evp->str); @@ -416,6 +466,7 @@ history_def_insert(history_t *h, HistEve h_free((ptr_t)h->cursor); goto oomem; } + h->cursor->data = NULL; h->cursor->ev.num = ++h->eventid; h->cursor->next = h->list.next; h->cursor->prev = &h->list; @@ -711,8 +762,8 @@ history_load(History *h, const char *fna (void) strunvis(ptr, line); line[sz] = c; if (HENTER(h, &ev, ptr) == -1) { - h_free((ptr_t)ptr); - return -1; + i = -1; + goto oomem; } } oomem: @@ -787,6 +838,23 @@ history_prev_event(History *h, HistEvent } +private int +history_next_evdata(History *h, HistEvent *ev, int num, void **d) +{ + int retval; + + for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) + if (num-- <= 0) { + if (d) + *d = ((history_t *)h->h_ref)->cursor->data; + return (0); + } + + he_seterrev(ev, _HE_NOT_FOUND); + return (-1); +} + + /* history_next_event(): * Find the next event, with number given */ @@ -976,11 +1044,42 @@ history(History *h, HistEvent *ev, int f retval = 0; break; + case H_NEXT_EVDATA: + { + int num = va_arg(va, int); + void **d = va_arg(va, void **); + retval = history_next_evdata(h, ev, num, d); + break; + } + + case H_DELDATA: + { + int num = va_arg(va, int); + void **d = va_arg(va, void **); + retval = history_deldata_nth((history_t *)h->h_ref, ev, num, d); + break; + } + + case H_REPLACE: /* only use after H_NEXT_EVDATA */ + { + const char *line = va_arg(va, const char *); + void *d = va_arg(va, void *); + const char *s; + if(!line || !(s = strdup(line))) { + retval = -1; + break; + } + ((history_t *)h->h_ref)->cursor->ev.str = s; + ((history_t *)h->h_ref)->cursor->data = d; + retval = 0; + break; + } + default: retval = -1; he_seterrev(ev, _HE_UNKNOWN); break; } va_end(va); - return (retval); + return retval; } Modified: stable/8/lib/libedit/key.c ============================================================================== --- stable/8/lib/libedit/key.c Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/key.c Fri Jun 29 03:03:42 2012 (r237739) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $ + * $NetBSD: key.c,v 1.20 2009/02/15 21:55:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -86,8 +86,8 @@ private void node__free(key_node_t *); private void node__put(EditLine *, key_node_t *); private int node__delete(EditLine *, key_node_t **, const char *); private int node_lookup(EditLine *, const char *, key_node_t *, - int); -private int node_enum(EditLine *, key_node_t *, int); + size_t); +private int node_enum(EditLine *, key_node_t *, size_t); #define KEY_BUFSIZ EL_BUFSIZ @@ -478,9 +478,9 @@ node__free(key_node_t *k) * Print if last node */ private int -node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt) +node_lookup(EditLine *el, const char *str, key_node_t *ptr, size_t cnt) { - int ncnt; + size_t ncnt; if (ptr == NULL) return (-1); /* cannot have null ptr */ @@ -493,7 +493,8 @@ node_lookup(EditLine *el, const char *st /* If match put this char into el->el_key.buf. Recurse */ if (ptr->ch == *str) { /* match found */ - ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, + ncnt = key__decode_char(el->el_key.buf, + (size_t)KEY_BUFSIZ, cnt, (unsigned char) ptr->ch); if (ptr->next != NULL) /* not yet at leaf */ @@ -527,9 +528,9 @@ node_lookup(EditLine *el, const char *st * Traverse the node printing the characters it is bound in buffer */ private int -node_enum(EditLine *el, key_node_t *ptr, int cnt) +node_enum(EditLine *el, key_node_t *ptr, size_t cnt) { - int ncnt; + size_t ncnt; if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */ el->el_key.buf[++cnt] = '"'; @@ -547,7 +548,7 @@ node_enum(EditLine *el, key_node_t *ptr, return (-1); } /* put this char at end of str */ - ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, + ncnt = key__decode_char(el->el_key.buf, (size_t)KEY_BUFSIZ, cnt, (unsigned char)ptr->ch); if (ptr->next == NULL) { /* print this key and function */ @@ -615,8 +616,8 @@ key_kprint(EditLine *el, const char *key /* key__decode_char(): * Put a printable form of char in buf. */ -protected int -key__decode_char(char *buf, int cnt, int off, int ch) +protected size_t +key__decode_char(char *buf, size_t cnt, size_t off, int ch) { char *sb = buf + off; char *eb = buf + cnt; @@ -626,7 +627,7 @@ key__decode_char(char *buf, int cnt, int if (ch == 0) { ADDC('^'); ADDC('@'); - return b - sb; + return (int)(b - sb); } if (iscntrl(ch)) { ADDC('^'); @@ -648,15 +649,15 @@ key__decode_char(char *buf, int cnt, int ADDC((((unsigned int) ch >> 3) & 7) + '0'); ADDC((ch & 7) + '0'); } - return b - sb; + return (size_t)(b - sb); } /* key__decode_str(): * Make a printable version of the ey */ -protected int -key__decode_str(const char *str, char *buf, int len, const char *sep) +protected size_t +key__decode_str(const char *str, char *buf, size_t len, const char *sep) { char *b = buf, *eb = b + len; const char *p; @@ -699,7 +700,7 @@ key__decode_str(const char *str, char *b } done: ADDC('\0'); - if (b - buf >= len) + if ((size_t)(b - buf) >= len) buf[len - 1] = '\0'; - return b - buf; + return (size_t)(b - buf); } Modified: stable/8/lib/libedit/key.h ============================================================================== --- stable/8/lib/libedit/key.h Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/key.h Fri Jun 29 03:03:42 2012 (r237739) @@ -76,8 +76,8 @@ protected int key_delete(EditLine *, c protected void key_print(EditLine *, const char *); protected void key_kprint(EditLine *, const char *, key_value_t *, int); -protected int key__decode_str(const char *, char *, int, +protected size_t key__decode_str(const char *, char *, size_t, const char *); -protected int key__decode_char(char *, int, int, int); +protected size_t key__decode_char(char *, size_t, size_t, int); #endif /* _h_el_key */ Modified: stable/8/lib/libedit/prompt.c ============================================================================== --- stable/8/lib/libedit/prompt.c Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/prompt.c Fri Jun 29 03:03:42 2012 (r237739) @@ -85,14 +85,23 @@ prompt_print(EditLine *el, int op) { el_prompt_t *elp; char *p; + int ignore = 0; if (op == EL_PROMPT) elp = &el->el_prompt; else elp = &el->el_rprompt; - p = (elp->p_func) (el); - while (*p) - re_putc(el, *p++, 1); + + for (p = (*elp->p_func)(el); *p; p++) { + if (elp->p_ignore == *p) { + ignore = !ignore; + continue; + } + if (ignore) + term__putc(el, *p); + else + re_putc(el, *p, 1); + } elp->p_pos.v = el->el_refresh.r_cursor.v; elp->p_pos.h = el->el_refresh.r_cursor.h; @@ -109,10 +118,12 @@ prompt_init(EditLine *el) el->el_prompt.p_func = prompt_default; el->el_prompt.p_pos.v = 0; el->el_prompt.p_pos.h = 0; + el->el_prompt.p_ignore = '\0'; el->el_rprompt.p_func = prompt_default_r; el->el_rprompt.p_pos.v = 0; el->el_rprompt.p_pos.h = 0; - return (0); + el->el_rprompt.p_ignore = '\0'; + return 0; } @@ -130,24 +141,29 @@ prompt_end(EditLine *el __unused) * Install a prompt printing function */ protected int -prompt_set(EditLine *el, el_pfunc_t prf, int op) +prompt_set(EditLine *el, el_pfunc_t prf, char c, int op) { el_prompt_t *p; - if (op == EL_PROMPT) + if (op == EL_PROMPT || op == EL_PROMPT_ESC) p = &el->el_prompt; else p = &el->el_rprompt; + if (prf == NULL) { - if (op == EL_PROMPT) + if (op == EL_PROMPT || op == EL_PROMPT_ESC) p->p_func = prompt_default; else p->p_func = prompt_default_r; } else p->p_func = prf; + + p->p_ignore = c; + p->p_pos.v = 0; p->p_pos.h = 0; - return (0); + + return 0; } @@ -155,14 +171,22 @@ prompt_set(EditLine *el, el_pfunc_t prf, * Retrieve the prompt printing function */ protected int -prompt_get(EditLine *el, el_pfunc_t *prf, int op) +prompt_get(EditLine *el, el_pfunc_t *prf, char *c, int op) { + el_prompt_t *p; if (prf == NULL) - return (-1); + return -1; + if (op == EL_PROMPT) - *prf = el->el_prompt.p_func; + p = &el->el_prompt; else - *prf = el->el_rprompt.p_func; - return (0); + p = &el->el_rprompt; + + *prf = el->el_rprompt.p_func; + + if (c) + *c = p->p_ignore; + + return 0; } Modified: stable/8/lib/libedit/prompt.h ============================================================================== --- stable/8/lib/libedit/prompt.h Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/prompt.h Fri Jun 29 03:03:42 2012 (r237739) @@ -47,11 +47,13 @@ typedef char * (*el_pfunc_t)(EditLine*); typedef struct el_prompt_t { el_pfunc_t p_func; /* Function to return the prompt */ coord_t p_pos; /* position in the line after prompt */ + char p_ignore; /* character to start/end literal +*/ } el_prompt_t; protected void prompt_print(EditLine *, int); -protected int prompt_set(EditLine *, el_pfunc_t, int); -protected int prompt_get(EditLine *, el_pfunc_t *, int); +protected int prompt_set(EditLine *, el_pfunc_t, char, int); +protected int prompt_get(EditLine *, el_pfunc_t *, char *, int); protected int prompt_init(EditLine *); protected void prompt_end(EditLine *); Modified: stable/8/lib/libedit/read.c ============================================================================== --- stable/8/lib/libedit/read.c Fri Jun 29 03:01:38 2012 (r237738) +++ stable/8/lib/libedit/read.c Fri Jun 29 03:03:42 2012 (r237739) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: read.c,v 1.40 2007/03/01 21:41:45 christos Exp $ + * $NetBSD: read.c,v 1.52 2009/07/22 15:57:00 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include "el.h" -#define OKCMD -1 +#define OKCMD -1 /* must be -1! */ private int read__fixio(int, int); private int read_preread(EditLine *); @@ -170,7 +170,7 @@ read__fixio(int fd __unused, int e) return (e ? 0 : -1); case EINTR: - return (0); + return (-1); default: return (-1); @@ -222,7 +222,7 @@ el_push(EditLine *el, const char *str) ma->level--; } term_beep(el); - term__flush(); + term__flush(el); } @@ -235,9 +235,12 @@ read_getcmd(EditLine *el, el_action_t *c el_action_t cmd; int num; + el->el_errno = 0; do { - if ((num = el_getc(el, ch)) != 1) /* if EOF or error */ + if ((num = el_getc(el, ch)) != 1) { /* if EOF or error */ + el->el_errno = num == 0 ? 0 : errno; return (num); + } #ifdef KANJI if ((*ch & 0200)) { @@ -286,18 +289,25 @@ read_getcmd(EditLine *el, el_action_t *c private int read_char(EditLine *el, char *cp) { - int num_read; + ssize_t num_read; int tried = 0; - while ((num_read = read(el->el_infd, cp, 1)) == -1) + again: + el->el_signal->sig_no = 0; + while ((num_read = read(el->el_infd, cp, 1)) == -1) { + if (el->el_signal->sig_no == SIGCONT) { + sig_set(el); + el_set(el, EL_REFRESH); + goto again; + } if (!tried && read__fixio(el->el_infd, errno) == 0) tried = 1; else { *cp = '\0'; return (-1); } - - return (num_read); + } + return (int)num_read; } /* read_pop(): @@ -309,8 +319,9 @@ read_pop(c_macro_t *ma) int i; el_free(ma->macro[0]); - for (i = ma->level--; i > 0; i--) - ma->macro[i - 1] = ma->macro[i]; + for (i = 0; i < ma->level; i++) + ma->macro[i] = ma->macro[i + 1]; + ma->level--; ma->offset = 0; } @@ -323,7 +334,7 @@ el_getc(EditLine *el, char *cp) int num_read; c_macro_t *ma = &el->el_chared.c_macro; - term__flush(); + term__flush(el); for (;;) { if (ma->level < 0) { if (!read_preread(el)) @@ -382,7 +393,7 @@ read_prepare(EditLine *el) re_refresh(el); /* print the prompt */ if (el->el_flags & UNBUFFERED) - term__flush(); + term__flush(el); } protected void @@ -402,15 +413,20 @@ el_gets(EditLine *el, int *nread) int num; /* how many chars we have read at NL */ char ch; int crlf = 0; + int nrb; #ifdef FIONREAD c_macro_t *ma = &el->el_chared.c_macro; #endif /* FIONREAD */ + if (nread == NULL) + nread = &nrb; + *nread = 0; + if (el->el_flags & NO_TTY) { char *cp = el->el_line.buffer; size_t idx; - while ((*el->el_read.read_char)(el, cp) == 1) { + while ((num = (*el->el_read.read_char)(el, cp)) == 1) { /* make sure there is space for next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); @@ -424,12 +440,16 @@ el_gets(EditLine *el, int *nread) if (cp[-1] == '\r' || cp[-1] == '\n') break; } + if (num == -1) { + if (errno == EINTR) + cp = el->el_line.buffer; + el->el_errno = errno; + } el->el_line.cursor = el->el_line.lastchar = cp; *cp = '\0'; - if (nread) - *nread = el->el_line.cursor - el->el_line.buffer; - return (el->el_line.buffer); + *nread = (int)(el->el_line.cursor - el->el_line.buffer); + goto done; } @@ -440,8 +460,8 @@ el_gets(EditLine *el, int *nread) (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 06:41:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A89C1065672; Fri, 29 Jun 2012 06:41:20 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748588FC08; Fri, 29 Jun 2012 06:41:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5T6fKLs024090; Fri, 29 Jun 2012 06:41:20 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5T6fKE1024088; Fri, 29 Jun 2012 06:41:20 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206290641.q5T6fKE1024088@svn.freebsd.org> From: Martin Matuska Date: Fri, 29 Jun 2012 06:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237747 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 06:41:20 -0000 Author: mm Date: Fri Jun 29 06:41:19 2012 New Revision: 237747 URL: http://svn.freebsd.org/changeset/base/237747 Log: MFC r237458: Import Illumos revision 13736:9f1d48e1681f 2901 ZFS receive fails for exabyte sparse files References: https://www.illumos.org/issues/2901 Obtained from: illumos (issue #2901) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Jun 29 06:41:03 2012 (r237746) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Jun 29 06:41:19 2012 (r237747) @@ -96,6 +96,9 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o { struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free); + if (length != -1ULL && offset + length < offset) + length = -1ULL; + /* * If there is a pending op, but it's not PENDING_FREE, push it out, * since free block aggregation can only be done for blocks of the From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 09:56:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 620D11065813; Fri, 29 Jun 2012 09:56:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7C18FC0A; Fri, 29 Jun 2012 09:56:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5T9uNsk032260; Fri, 29 Jun 2012 09:56:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5T9uNJg032257; Fri, 29 Jun 2012 09:56:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206290956.q5T9uNJg032257@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 09:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237754 - in stable/8/sys/boot: common sparc64/loader X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 09:56:23 -0000 Author: avg Date: Fri Jun 29 09:56:22 2012 New Revision: 237754 URL: http://svn.freebsd.org/changeset/base/237754 Log: MFC r235153: sys/boot: add common CTASSERT definition Modified: stable/8/sys/boot/common/bootstrap.h stable/8/sys/boot/sparc64/loader/main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/common/bootstrap.h ============================================================================== --- stable/8/sys/boot/common/bootstrap.h Fri Jun 29 09:41:09 2012 (r237753) +++ stable/8/sys/boot/common/bootstrap.h Fri Jun 29 09:56:22 2012 (r237754) @@ -311,4 +311,10 @@ void dev_cleanup(void); time_t time(time_t *tloc); +#ifndef CTASSERT /* Allow lint to override */ +#define CTASSERT(x) _CTASSERT(x, __LINE__) +#define _CTASSERT(x, y) __CTASSERT(x, y) +#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] +#endif + #endif /* !_BOOTSTRAP_H_ */ Modified: stable/8/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/8/sys/boot/sparc64/loader/main.c Fri Jun 29 09:41:09 2012 (r237753) +++ stable/8/sys/boot/sparc64/loader/main.c Fri Jun 29 09:56:22 2012 (r237754) @@ -74,12 +74,6 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "dev_net.h" -#ifndef CTASSERT -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] -#endif - extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; enum { From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:01:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C651B106566C; Fri, 29 Jun 2012 10:01:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE2F08FC23; Fri, 29 Jun 2012 10:01:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TA1qFN032657; Fri, 29 Jun 2012 10:01:52 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TA1qsJ032647; Fri, 29 Jun 2012 10:01:52 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291001.q5TA1qsJ032647@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237755 - in stable/8/sys/boot/i386: btx/btx btx/btxldr btx/lib common loader zfsboot X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:01:52 -0000 Author: avg Date: Fri Jun 29 10:01:52 2012 New Revision: 237755 URL: http://svn.freebsd.org/changeset/base/237755 Log: MFC r235154,r235158: btxldr: future-proof argument passing from boot1/2-ish to loader Added: stable/8/sys/boot/i386/btx/lib/btxcsu.S - copied unchanged from r235154, head/sys/boot/i386/btx/lib/btxcsu.S stable/8/sys/boot/i386/common/bootargs.h - copied unchanged from r235154, head/sys/boot/i386/common/bootargs.h Deleted: stable/8/sys/boot/i386/btx/lib/btxcsu.s Modified: stable/8/sys/boot/i386/btx/btx/Makefile stable/8/sys/boot/i386/btx/btx/btx.S stable/8/sys/boot/i386/btx/btxldr/Makefile stable/8/sys/boot/i386/btx/btxldr/btxldr.S stable/8/sys/boot/i386/btx/lib/Makefile stable/8/sys/boot/i386/loader/main.c stable/8/sys/boot/i386/zfsboot/zfsboot.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/i386/btx/btx/Makefile ============================================================================== --- stable/8/sys/boot/i386/btx/btx/Makefile Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/btx/btx/Makefile Fri Jun 29 10:01:52 2012 (r237755) @@ -12,6 +12,7 @@ BOOT_BTX_FLAGS=0x0 .endif CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} +CFLAGS+=-I${.CURDIR}/../../common .if defined(BTX_SERIAL) BOOT_COMCONSOLE_PORT?= 0x3f8 Modified: stable/8/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/8/sys/boot/i386/btx/btx/btx.S Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/btx/btx/btx.S Fri Jun 29 10:01:52 2012 (r237755) @@ -15,6 +15,8 @@ * $FreeBSD$ */ +#include + /* * Memory layout. */ @@ -205,7 +207,7 @@ init.8: xorl %ecx,%ecx # Zero movl $MEM_USR,%edx # User base address movzwl %ss:BDA_MEM,%eax # Get free memory shll $0xa,%eax # To bytes - subl $0x1000,%eax # Less arg space + subl $ARGSPACE,%eax # Less arg space subl %edx,%eax # Less base movb $SEL_UDATA,%cl # User data selector pushl %ecx # Set SS Modified: stable/8/sys/boot/i386/btx/btxldr/Makefile ============================================================================== --- stable/8/sys/boot/i386/btx/btxldr/Makefile Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/btx/btxldr/Makefile Fri Jun 29 10:01:52 2012 (r237755) @@ -6,6 +6,7 @@ NO_MAN= SRCS= btxldr.S CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} +CFLAGS+=-I${.CURDIR}/../../common .if defined(BTXLDR_VERBOSE) CFLAGS+=-DBTXLDR_VERBOSE Modified: stable/8/sys/boot/i386/btx/btxldr/btxldr.S ============================================================================== --- stable/8/sys/boot/i386/btx/btxldr/btxldr.S Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/btx/btxldr/btxldr.S Fri Jun 29 10:01:52 2012 (r237755) @@ -15,6 +15,8 @@ * $FreeBSD$ */ +#include + #define RBX_MUTE 0x10 /* -m */ #define OPT_SET(opt) (1 << (opt)) @@ -89,7 +91,7 @@ start: cld # String ops inc call hexout # stack call putstr # pointer movl $m_args,%esi # Format string - leal 0x4(%esp,1),%ebx # First argument + leal 0x4(%esp),%ebx # First argument movl $0x6,%ecx # Count start.1: movl (%ebx),%eax # Get argument and addl $0x4,%ebx # bump pointer @@ -97,24 +99,28 @@ start.1: movl (%ebx),%eax # Get argumen loop start.1 # Till done call putstr # End message #endif - movl $0x48,%ecx # Allocate space - subl %ecx,%ebp # for bootinfo - movl 0x18(%esp,1),%esi # Source: bootinfo + movl BA_BOOTINFO+4(%esp),%esi # Source: bootinfo cmpl $0x0, %esi # If the bootinfo pointer je start_null_bi # is null, don't copy it + movl BI_SIZE(%esi),%ecx # Allocate space + subl %ecx,%ebp # for bootinfo movl %ebp,%edi # Destination rep # Copy movsb # it - movl %ebp,0x18(%esp,1) # Update pointer + movl %ebp,BA_BOOTINFO+4(%esp) # Update pointer + movl %edi,%ebp # Restore base pointer #ifdef BTXLDR_VERBOSE movl $m_rel_bi,%esi # Display movl %ebp,%eax # bootinfo call hexout # relocation call putstr # message #endif -start_null_bi: movl $0x18,%ecx # Allocate space - subl %ecx,%ebp # for arguments - leal 0x4(%esp,1),%esi # Source +start_null_bi: movl $BOOTARGS_SIZE,%ecx # Fixed size of arguments + testl $KARGS_FLAGS_EXTARG, BA_BOOTFLAGS+4(%esp) # Check for extra data + jz start_fixed # Skip if the flag is not set + addl BOOTARGS_SIZE+4(%esp),%ecx # Add size of variable args +start_fixed: subl $ARGOFF,%ebp # Place args at fixed offset + leal 0x4(%esp),%esi # Source movl %ebp,%edi # Destination rep # Copy movsb # them Modified: stable/8/sys/boot/i386/btx/lib/Makefile ============================================================================== --- stable/8/sys/boot/i386/btx/lib/Makefile Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/btx/lib/Makefile Fri Jun 29 10:01:52 2012 (r237755) @@ -3,7 +3,8 @@ PROG= crt0.o INTERNALPROG= NO_MAN= -SRCS= btxcsu.s btxsys.s btxv86.s +SRCS= btxcsu.S btxsys.s btxv86.s +CFLAGS+=-I${.CURDIR}/../../common LDFLAGS=-Wl,-r .include Copied: stable/8/sys/boot/i386/btx/lib/btxcsu.S (from r235154, head/sys/boot/i386/btx/lib/btxcsu.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/i386/btx/lib/btxcsu.S Fri Jun 29 10:01:52 2012 (r237755, copy of r235154, head/sys/boot/i386/btx/lib/btxcsu.S) @@ -0,0 +1,49 @@ +# +# Copyright (c) 1998 Robert Nordier +# All rights reserved. +# +# Redistribution and use in source and binary forms are freely +# permitted provided that the above copyright notice and this +# paragraph and the following disclaimer are duplicated in all +# such forms. +# +# This software is provided "AS IS" and without any express or +# implied warranties, including, without limitation, the implied +# warranties of merchantability and fitness for a particular +# purpose. +# + +# $FreeBSD$ + +#include + +# +# BTX C startup code (ELF). +# + +# +# Globals. +# + .global _start +# +# Client entry point. +# +_start: cld + pushl %eax + movl $_edata,%edi + movl $_end,%ecx + subl %edi, %ecx + xorb %al, %al + rep + stosb + popl __base + movl %esp,%eax # Set + addl $ARGADJ,%eax # argument + movl %eax,__args # pointer + call main # Invoke client main() + call exit # Invoke client exit() +# +# Data. +# + .comm __base,4 # Client base address + .comm __args,4 # Client arguments Copied: stable/8/sys/boot/i386/common/bootargs.h (from r235154, head/sys/boot/i386/common/bootargs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/i386/common/bootargs.h Fri Jun 29 10:01:52 2012 (r237755, copy of r235154, head/sys/boot/i386/common/bootargs.h) @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2012 Andriy Gapon + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + * + * $FreeBSD$ + */ + +#ifndef _BOOT_I386_ARGS_H_ +#define _BOOT_I386_ARGS_H_ + +#define KARGS_FLAGS_CD 0x1 +#define KARGS_FLAGS_PXE 0x2 +#define KARGS_FLAGS_ZFS 0x4 +#define KARGS_FLAGS_EXTARG 0x8 /* variably sized extended argument */ + +#define BOOTARGS_SIZE 24 /* sizeof(struct bootargs) */ +#define BA_BOOTFLAGS 8 /* offsetof(struct bootargs, bootflags) */ +#define BA_BOOTINFO 20 /* offsetof(struct bootargs, bootinfo) */ +#define BI_SIZE 48 /* offsetof(struct bootinfo, bi_size) */ + +/* + * We reserve some space above BTX allocated stack for the arguments + * and certain data that could hang off them. Currently only struct bootinfo + * is supported in that category. The bootinfo is placed at the top + * of the arguments area and the actual arguments are placed at ARGOFF offset + * from the top and grow towards the top. Hopefully we have enough space + * for bootinfo and the arguments to not run into each other. + * Arguments area below ARGOFF is reserved for future use. + */ +#define ARGSPACE 0x1000 /* total size of the BTX args area */ +#define ARGOFF 0x800 /* actual args offset within the args area */ +#define ARGADJ (ARGSPACE - ARGOFF) + +#ifndef __ASSEMBLER__ + +struct bootargs +{ + uint32_t howto; + uint32_t bootdev; + uint32_t bootflags; + union { + struct { + uint32_t pxeinfo; + uint32_t reserved; + }; + uint64_t zfspool; + }; + uint32_t bootinfo; + + /* + * If KARGS_FLAGS_EXTARG is set in bootflags, then the above fields + * are followed by a uint32_t field that specifies a size of the + * extended arguments (including the size field). + */ +}; + +#endif /*__ASSEMBLER__*/ + +#endif /* !_BOOT_I386_ARGS_H_ */ Modified: stable/8/sys/boot/i386/loader/main.c ============================================================================== --- stable/8/sys/boot/i386/loader/main.c Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/loader/main.c Fri Jun 29 10:01:52 2012 (r237755) @@ -33,34 +33,24 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include #include #include "bootstrap.h" +#include "common/bootargs.h" #include "libi386/libi386.h" #include "btxv86.h" -#define KARGS_FLAGS_CD 0x1 -#define KARGS_FLAGS_PXE 0x2 -#define KARGS_FLAGS_ZFS 0x4 +CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE); +CTASSERT(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO); +CTASSERT(offsetof(struct bootargs, bootflags) == BA_BOOTFLAGS); +CTASSERT(offsetof(struct bootinfo, bi_size) == BI_SIZE); /* Arguments passed in from the boot1/boot2 loader */ -static struct -{ - u_int32_t howto; - u_int32_t bootdev; - u_int32_t bootflags; - union { - struct { - u_int32_t pxeinfo; - u_int32_t res2; - }; - uint64_t zfspool; - }; - u_int32_t bootinfo; -} *kargs; +static struct bootargs *kargs; static u_int32_t initial_howto; static u_int32_t initial_bootdev; Modified: stable/8/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/8/sys/boot/i386/zfsboot/zfsboot.c Fri Jun 29 09:56:22 2012 (r237754) +++ stable/8/sys/boot/i386/zfsboot/zfsboot.c Fri Jun 29 10:01:52 2012 (r237755) @@ -41,9 +41,7 @@ __FBSDID("$FreeBSD$"); #include "drv.h" #include "util.h" #include "cons.h" - -/* Hint to loader that we came from ZFS */ -#define KARGS_FLAGS_ZFS 0x4 +#include "bootargs.h" #define PATH_DOTCONFIG "/boot.config" #define PATH_CONFIG "/boot/config" From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:04:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5995E106576E; Fri, 29 Jun 2012 10:04:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29C228FC0A; Fri, 29 Jun 2012 10:04:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TA4Oib032876; Fri, 29 Jun 2012 10:04:24 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TA4NeV032871; Fri, 29 Jun 2012 10:04:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291004.q5TA4NeV032871@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237757 - in stable/8/sys/boot: i386/libi386 i386/zfsboot pc98/libpc98 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:04:24 -0000 Author: avg Date: Fri Jun 29 10:04:23 2012 New Revision: 237757 URL: http://svn.freebsd.org/changeset/base/237757 Log: MFC r235155: i386 boot: consolidate MAXBDDEV definition Modified: stable/8/sys/boot/i386/libi386/biosdisk.c stable/8/sys/boot/i386/libi386/libi386.h stable/8/sys/boot/i386/zfsboot/zfsboot.c stable/8/sys/boot/pc98/libpc98/biosdisk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosdisk.c Fri Jun 29 10:01:56 2012 (r237756) +++ stable/8/sys/boot/i386/libi386/biosdisk.c Fri Jun 29 10:04:23 2012 (r237757) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) -#define MAXBDDEV MAXDEV #define DT_ATAPI 0x10 /* disk type for ATAPI floppies */ #define WDMAJOR 0 /* major numbers for devices we frontend for */ Modified: stable/8/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/8/sys/boot/i386/libi386/libi386.h Fri Jun 29 10:01:56 2012 (r237756) +++ stable/8/sys/boot/i386/libi386/libi386.h Fri Jun 29 10:04:23 2012 (r237757) @@ -58,7 +58,8 @@ int i386_setcurrdev(struct env_var *ev, extern struct devdesc currdev; /* our current device */ -#define MAXDEV 31 /* maximum number of distinct devices */ +#define MAXDEV 31 /* maximum number of distinct devices */ +#define MAXBDDEV MAXDEV /* exported devices XXX rename? */ extern struct devsw bioscd; Modified: stable/8/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/8/sys/boot/i386/zfsboot/zfsboot.c Fri Jun 29 10:01:56 2012 (r237756) +++ stable/8/sys/boot/i386/zfsboot/zfsboot.c Fri Jun 29 10:04:23 2012 (r237757) @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); #define TYPE_MAXHARD TYPE_DA #define TYPE_FD 2 -#define MAXBDDEV 31 - extern uint32_t _end; #ifdef GPT Modified: stable/8/sys/boot/pc98/libpc98/biosdisk.c ============================================================================== --- stable/8/sys/boot/pc98/libpc98/biosdisk.c Fri Jun 29 10:01:56 2012 (r237756) +++ stable/8/sys/boot/pc98/libpc98/biosdisk.c Fri Jun 29 10:04:23 2012 (r237757) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) -#define MAXBDDEV MAXDEV #define DT_ATAPI 0x10 /* disk type for ATAPI floppies */ #define WDMAJOR 0 /* major numbers for devices we frontend for */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:07:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19B12106566C; Fri, 29 Jun 2012 10:07:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04DD18FC0A; Fri, 29 Jun 2012 10:07:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TA7GbA033087; Fri, 29 Jun 2012 10:07:16 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TA7Gi7033085; Fri, 29 Jun 2012 10:07:16 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291007.q5TA7Gi7033085@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237759 - stable/8/sys/boot/i386/loader X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:07:17 -0000 Author: avg Date: Fri Jun 29 10:07:16 2012 New Revision: 237759 URL: http://svn.freebsd.org/changeset/base/237759 Log: MFC r235156: i386 zfsloader: rename LIBZFS to LIBZFSBOOT Modified: stable/8/sys/boot/i386/loader/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/i386/loader/Makefile ============================================================================== --- stable/8/sys/boot/i386/loader/Makefile Fri Jun 29 10:06:37 2012 (r237758) +++ stable/8/sys/boot/i386/loader/Makefile Fri Jun 29 10:07:16 2012 (r237759) @@ -20,9 +20,7 @@ LIBFIREWIRE= ${.OBJDIR}/../libfirewire/l # Set by zfsloader Makefile .if defined(LOADER_ZFS_SUPPORT) CFLAGS+= -DLOADER_ZFS_SUPPORT -LIBZFS= ${.OBJDIR}/../../zfs/libzfsboot.a -.else -LIBZFS= +LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a .endif # Enable PXE TFTP or NFS support, not both. @@ -114,8 +112,8 @@ FILES+= loader.rc # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} -lstand +DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} -lstand .include From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:10:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0F37106564A; Fri, 29 Jun 2012 10:10:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B965A8FC08; Fri, 29 Jun 2012 10:10:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TAAhRk038686; Fri, 29 Jun 2012 10:10:43 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TAAh4j038681; Fri, 29 Jun 2012 10:10:43 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291010.q5TAAh4j038681@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237762 - in stable/8/sys/boot/i386: cdboot pxeldr X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:10:44 -0000 Author: avg Date: Fri Jun 29 10:10:43 2012 New Revision: 237762 URL: http://svn.freebsd.org/changeset/base/237762 Log: MFC r235219: cdboot, pxeldr: make use of bootargs.h instead of redefining flag constants Added: stable/8/sys/boot/i386/cdboot/cdboot.S - copied unchanged from r235219, head/sys/boot/i386/cdboot/cdboot.S Deleted: stable/8/sys/boot/i386/cdboot/cdboot.s Modified: stable/8/sys/boot/i386/cdboot/Makefile stable/8/sys/boot/i386/pxeldr/Makefile stable/8/sys/boot/i386/pxeldr/pxeldr.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/i386/cdboot/Makefile ============================================================================== --- stable/8/sys/boot/i386/cdboot/Makefile Fri Jun 29 10:10:16 2012 (r237761) +++ stable/8/sys/boot/i386/cdboot/Makefile Fri Jun 29 10:10:43 2012 (r237762) @@ -4,7 +4,9 @@ PROG= cdboot STRIP= BINMODE=${NOBINMODE} NO_MAN= -SRCS= ${PROG}.s +SRCS= ${PROG}.S + +CFLAGS+=-I${.CURDIR}/../common ORG= 0x7c00 Copied: stable/8/sys/boot/i386/cdboot/cdboot.S (from r235219, head/sys/boot/i386/cdboot/cdboot.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/i386/cdboot/cdboot.S Fri Jun 29 10:10:43 2012 (r237762, copy of r235219, head/sys/boot/i386/cdboot/cdboot.S) @@ -0,0 +1,597 @@ +# +# Copyright (c) 2001 John Baldwin +# 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 author nor the names of any co-contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# $FreeBSD$ + +# +# This program is a freestanding boot program to load an a.out binary +# from a CD-ROM booted with no emulation mode as described by the El +# Torito standard. Due to broken BIOSen that do not load the desired +# number of sectors, we try to fit this in as small a space as possible. +# +# Basically, we first create a set of boot arguments to pass to the loaded +# binary. Then we attempt to load /boot/loader from the CD we were booted +# off of. +# + +#include + +# +# Memory locations. +# + .set MEM_PAGE_SIZE,0x1000 # memory page size, 4k + .set MEM_ARG,0x900 # Arguments at start + .set MEM_ARG_BTX,0xa100 # Where we move them to so the + # BTX client can see them + .set MEM_ARG_SIZE,0x18 # Size of the arguments + .set MEM_BTX_ADDRESS,0x9000 # where BTX lives + .set MEM_BTX_ENTRY,0x9010 # where BTX starts to execute + .set MEM_BTX_OFFSET,MEM_PAGE_SIZE # offset of BTX in the loader + .set MEM_BTX_CLIENT,0xa000 # where BTX clients live +# +# a.out header fields +# + .set AOUT_TEXT,0x04 # text segment size + .set AOUT_DATA,0x08 # data segment size + .set AOUT_BSS,0x0c # zero'd BSS size + .set AOUT_SYMBOLS,0x10 # symbol table + .set AOUT_ENTRY,0x14 # entry point + .set AOUT_HEADER,MEM_PAGE_SIZE # size of the a.out header +# +# Segment selectors. +# + .set SEL_SDATA,0x8 # Supervisor data + .set SEL_RDATA,0x10 # Real mode data + .set SEL_SCODE,0x18 # PM-32 code + .set SEL_SCODE16,0x20 # PM-16 code +# +# BTX constants +# + .set INT_SYS,0x30 # BTX syscall interrupt +# +# Constants for reading from the CD. +# + .set ERROR_TIMEOUT,0x80 # BIOS timeout on read + .set NUM_RETRIES,3 # Num times to retry + .set SECTOR_SIZE,0x800 # size of a sector + .set SECTOR_SHIFT,11 # number of place to shift + .set BUFFER_LEN,0x100 # number of sectors in buffer + .set MAX_READ,0x10000 # max we can read at a time + .set MAX_READ_SEC,MAX_READ >> SECTOR_SHIFT + .set MEM_READ_BUFFER,0x9000 # buffer to read from CD + .set MEM_VOLDESC,MEM_READ_BUFFER # volume descriptor + .set MEM_DIR,MEM_VOLDESC+SECTOR_SIZE # Lookup buffer + .set VOLDESC_LBA,0x10 # LBA of vol descriptor + .set VD_PRIMARY,1 # Primary VD + .set VD_END,255 # VD Terminator + .set VD_ROOTDIR,156 # Offset of Root Dir Record + .set DIR_LEN,0 # Offset of Dir Record length + .set DIR_EA_LEN,1 # Offset of EA length + .set DIR_EXTENT,2 # Offset of 64-bit LBA + .set DIR_SIZE,10 # Offset of 64-bit length + .set DIR_NAMELEN,32 # Offset of 8-bit name len + .set DIR_NAME,33 # Offset of dir name +# +# We expect to be loaded by the BIOS at 0x7c00 (standard boot loader entry +# point) +# + .code16 + .globl start + .org 0x0, 0x0 +# +# Program start. +# +start: cld # string ops inc + xor %ax,%ax # zero %ax + mov %ax,%ss # setup the + mov $start,%sp # stack + mov %ax,%ds # setup the + mov %ax,%es # data segments + mov %dl,drive # Save BIOS boot device + mov $msg_welcome,%si # %ds:(%si) -> welcome message + call putstr # display the welcome message +# +# Setup the arguments that the loader is expecting from boot[12] +# + mov $msg_bootinfo,%si # %ds:(%si) -> boot args message + call putstr # display the message + mov $MEM_ARG,%bx # %ds:(%bx) -> boot args + mov %bx,%di # %es:(%di) -> boot args + xor %eax,%eax # zero %eax + mov $(MEM_ARG_SIZE/4),%cx # Size of arguments in 32-bit + # dwords + rep # Clear the arguments + stosl # to zero + mov drive,%dl # Store BIOS boot device + mov %dl,0x4(%bx) # in kargs->bootdev + or $KARGS_FLAGS_CD,0x8(%bx) # kargs->bootflags |= + # KARGS_FLAGS_CD +# +# Load Volume Descriptor +# + mov $VOLDESC_LBA,%eax # Set LBA of first VD +load_vd: push %eax # Save %eax + mov $1,%dh # One sector + mov $MEM_VOLDESC,%ebx # Destination + call read # Read it in + cmpb $VD_PRIMARY,(%bx) # Primary VD? + je have_vd # Yes + pop %eax # Prepare to + inc %eax # try next + cmpb $VD_END,(%bx) # Last VD? + jne load_vd # No, read next + mov $msg_novd,%si # No VD + jmp error # Halt +have_vd: # Have Primary VD +# +# Try to look up the loader binary using the paths in the loader_paths +# array. +# + mov $loader_paths,%si # Point to start of array +lookup_path: push %si # Save file name pointer + call lookup # Try to find file + pop %di # Restore file name pointer + jnc lookup_found # Found this file + xor %al,%al # Look for next + mov $0xffff,%cx # path name by + repnz # scanning for + scasb # nul char + mov %di,%si # Point %si at next path + mov (%si),%al # Get first char of next path + or %al,%al # Is it double nul? + jnz lookup_path # No, try it. + mov $msg_failed,%si # Failed message + jmp error # Halt +lookup_found: # Found a loader file +# +# Load the binary into the buffer. Due to real mode addressing limitations +# we have to read it in 64k chunks. +# + mov DIR_SIZE(%bx),%eax # Read file length + add $SECTOR_SIZE-1,%eax # Convert length to sectors + shr $SECTOR_SHIFT,%eax + cmp $BUFFER_LEN,%eax + jbe load_sizeok + mov $msg_load2big,%si # Error message + call error +load_sizeok: movzbw %al,%cx # Num sectors to read + mov DIR_EXTENT(%bx),%eax # Load extent + xor %edx,%edx + mov DIR_EA_LEN(%bx),%dl + add %edx,%eax # Skip extended + mov $MEM_READ_BUFFER,%ebx # Read into the buffer +load_loop: mov %cl,%dh + cmp $MAX_READ_SEC,%cl # Truncate to max read size + jbe load_notrunc + mov $MAX_READ_SEC,%dh +load_notrunc: sub %dh,%cl # Update count + push %eax # Save + call read # Read it in + pop %eax # Restore + add $MAX_READ_SEC,%eax # Update LBA + add $MAX_READ,%ebx # Update dest addr + jcxz load_done # Done? + jmp load_loop # Keep going +load_done: +# +# Turn on the A20 address line +# + call seta20 # Turn A20 on +# +# Relocate the loader and BTX using a very lazy protected mode +# + mov $msg_relocate,%si # Display the + call putstr # relocation message + mov MEM_READ_BUFFER+AOUT_ENTRY,%edi # %edi is the destination + mov $(MEM_READ_BUFFER+AOUT_HEADER),%esi # %esi is + # the start of the text + # segment + mov MEM_READ_BUFFER+AOUT_TEXT,%ecx # %ecx = length of the text + # segment + push %edi # Save entry point for later + lgdt gdtdesc # setup our own gdt + cli # turn off interrupts + mov %cr0,%eax # Turn on + or $0x1,%al # protected + mov %eax,%cr0 # mode + ljmp $SEL_SCODE,$pm_start # long jump to clear the + # instruction pre-fetch queue + .code32 +pm_start: mov $SEL_SDATA,%ax # Initialize + mov %ax,%ds # %ds and + mov %ax,%es # %es to a flat selector + rep # Relocate the + movsb # text segment + add $(MEM_PAGE_SIZE - 1),%edi # pad %edi out to a new page + and $~(MEM_PAGE_SIZE - 1),%edi # for the data segment + mov MEM_READ_BUFFER+AOUT_DATA,%ecx # size of the data segment + rep # Relocate the + movsb # data segment + mov MEM_READ_BUFFER+AOUT_BSS,%ecx # size of the bss + xor %eax,%eax # zero %eax + add $3,%cl # round %ecx up to + shr $2,%ecx # a multiple of 4 + rep # zero the + stosl # bss + mov MEM_READ_BUFFER+AOUT_ENTRY,%esi # %esi -> relocated loader + add $MEM_BTX_OFFSET,%esi # %esi -> BTX in the loader + mov $MEM_BTX_ADDRESS,%edi # %edi -> where BTX needs to go + movzwl 0xa(%esi),%ecx # %ecx -> length of BTX + rep # Relocate + movsb # BTX + ljmp $SEL_SCODE16,$pm_16 # Jump to 16-bit PM + .code16 +pm_16: mov $SEL_RDATA,%ax # Initialize + mov %ax,%ds # %ds and + mov %ax,%es # %es to a real mode selector + mov %cr0,%eax # Turn off + and $~0x1,%al # protected + mov %eax,%cr0 # mode + ljmp $0,$pm_end # Long jump to clear the + # instruction pre-fetch queue +pm_end: sti # Turn interrupts back on now +# +# Copy the BTX client to MEM_BTX_CLIENT +# + xor %ax,%ax # zero %ax and set + mov %ax,%ds # %ds and %es + mov %ax,%es # to segment 0 + mov $MEM_BTX_CLIENT,%di # Prepare to relocate + mov $btx_client,%si # the simple btx client + mov $(btx_client_end-btx_client),%cx # length of btx client + rep # Relocate the + movsb # simple BTX client +# +# Copy the boot[12] args to where the BTX client can see them +# + mov $MEM_ARG,%si # where the args are at now + mov $MEM_ARG_BTX,%di # where the args are moving to + mov $(MEM_ARG_SIZE/4),%cx # size of the arguments in longs + rep # Relocate + movsl # the words +# +# Save the entry point so the client can get to it later on +# + pop %eax # Restore saved entry point + stosl # and add it to the end of + # the arguments +# +# Now we just start up BTX and let it do the rest +# + mov $msg_jump,%si # Display the + call putstr # jump message + ljmp $0,$MEM_BTX_ENTRY # Jump to the BTX entry point + +# +# Lookup the file in the path at [SI] from the root directory. +# +# Trashes: All but BX +# Returns: CF = 0 (success), BX = pointer to record +# CF = 1 (not found) +# +lookup: mov $VD_ROOTDIR+MEM_VOLDESC,%bx # Root directory record + push %si + mov $msg_lookup,%si # Display lookup message + call putstr + pop %si + push %si + call putstr + mov $msg_lookup2,%si + call putstr + pop %si +lookup_dir: lodsb # Get first char of path + cmp $0,%al # Are we done? + je lookup_done # Yes + cmp $'/',%al # Skip path separator. + je lookup_dir + dec %si # Undo lodsb side effect + call find_file # Lookup first path item + jnc lookup_dir # Try next component + mov $msg_lookupfail,%si # Not found message + call putstr + stc # Set carry + ret + jmp error +lookup_done: mov $msg_lookupok,%si # Success message + call putstr + clc # Clear carry + ret + +# +# Lookup file at [SI] in directory whose record is at [BX]. +# +# Trashes: All but returns +# Returns: CF = 0 (success), BX = pointer to record, SI = next path item +# CF = 1 (not found), SI = preserved +# +find_file: mov DIR_EXTENT(%bx),%eax # Load extent + xor %edx,%edx + mov DIR_EA_LEN(%bx),%dl + add %edx,%eax # Skip extended attributes + mov %eax,rec_lba # Save LBA + mov DIR_SIZE(%bx),%eax # Save size + mov %eax,rec_size + xor %cl,%cl # Zero length + push %si # Save +ff.namelen: inc %cl # Update length + lodsb # Read char + cmp $0,%al # Nul? + je ff.namedone # Yes + cmp $'/',%al # Path separator? + jnz ff.namelen # No, keep going +ff.namedone: dec %cl # Adjust length and save + mov %cl,name_len + pop %si # Restore +ff.load: mov rec_lba,%eax # Load LBA + mov $MEM_DIR,%ebx # Address buffer + mov $1,%dh # One sector + call read # Read directory block + incl rec_lba # Update LBA to next block +ff.scan: mov %ebx,%edx # Check for EOF + sub $MEM_DIR,%edx + cmp %edx,rec_size + ja ff.scan.1 + stc # EOF reached + ret +ff.scan.1: cmpb $0,DIR_LEN(%bx) # Last record in block? + je ff.nextblock + push %si # Save + movzbw DIR_NAMELEN(%bx),%si # Find end of string +ff.checkver: cmpb $'0',DIR_NAME-1(%bx,%si) # Less than '0'? + jb ff.checkver.1 + cmpb $'9',DIR_NAME-1(%bx,%si) # Greater than '9'? + ja ff.checkver.1 + dec %si # Next char + jnz ff.checkver + jmp ff.checklen # All numbers in name, so + # no version +ff.checkver.1: movzbw DIR_NAMELEN(%bx),%cx + cmp %cx,%si # Did we find any digits? + je ff.checkdot # No + cmpb $';',DIR_NAME-1(%bx,%si) # Check for semicolon + jne ff.checkver.2 + dec %si # Skip semicolon + mov %si,%cx + mov %cl,DIR_NAMELEN(%bx) # Adjust length + jmp ff.checkdot +ff.checkver.2: mov %cx,%si # Restore %si to end of string +ff.checkdot: cmpb $'.',DIR_NAME-1(%bx,%si) # Trailing dot? + jne ff.checklen # No + decb DIR_NAMELEN(%bx) # Adjust length +ff.checklen: pop %si # Restore + movzbw name_len,%cx # Load length of name + cmp %cl,DIR_NAMELEN(%bx) # Does length match? + je ff.checkname # Yes, check name +ff.nextrec: add DIR_LEN(%bx),%bl # Next record + adc $0,%bh + jmp ff.scan +ff.nextblock: subl $SECTOR_SIZE,rec_size # Adjust size + jnc ff.load # If subtract ok, keep going + ret # End of file, so not found +ff.checkname: lea DIR_NAME(%bx),%di # Address name in record + push %si # Save + repe cmpsb # Compare name + je ff.match # We have a winner! + pop %si # Restore + jmp ff.nextrec # Keep looking. +ff.match: add $2,%sp # Discard saved %si + clc # Clear carry + ret + +# +# Load DH sectors starting at LBA EAX into [EBX]. +# +# Trashes: EAX +# +read: push %si # Save + push %cx # Save since some BIOSs trash + mov %eax,edd_lba # LBA to read from + mov %ebx,%eax # Convert address + shr $4,%eax # to segment + mov %ax,edd_addr+0x2 # and store +read.retry: call twiddle # Entertain the user + push %dx # Save + mov $edd_packet,%si # Address Packet + mov %dh,edd_len # Set length + mov drive,%dl # BIOS Device + mov $0x42,%ah # BIOS: Extended Read + int $0x13 # Call BIOS + pop %dx # Restore + jc read.fail # Worked? + pop %cx # Restore + pop %si + ret # Return +read.fail: cmp $ERROR_TIMEOUT,%ah # Timeout? + je read.retry # Yes, Retry. +read.error: mov %ah,%al # Save error + mov $hex_error,%di # Format it + call hex8 # as hex + mov $msg_badread,%si # Display Read error message + +# +# Display error message at [SI] and halt. +# +error: call putstr # Display message +halt: hlt + jmp halt # Spin + +# +# Display a null-terminated string. +# +# Trashes: AX, SI +# +putstr: push %bx # Save +putstr.load: lodsb # load %al from %ds:(%si) + test %al,%al # stop at null + jnz putstr.putc # if the char != null, output it + pop %bx # Restore + ret # return when null is hit +putstr.putc: call putc # output char + jmp putstr.load # next char + +# +# Display a single char. +# +putc: mov $0x7,%bx # attribute for output + mov $0xe,%ah # BIOS: put_char + int $0x10 # call BIOS, print char in %al + ret # Return to caller + +# +# Output the "twiddle" +# +twiddle: push %ax # Save + push %bx # Save + mov twiddle_index,%al # Load index + mov $twiddle_chars,%bx # Address table + inc %al # Next + and $3,%al # char + mov %al,twiddle_index # Save index for next call + xlat # Get char + call putc # Output it + mov $8,%al # Backspace + call putc # Output it + pop %bx # Restore + pop %ax # Restore + ret + +# +# Enable A20. Put an upper limit on the amount of time we wait for the +# keyboard controller to get ready (65K x ISA access time). If +# we wait more than that amount, the hardware is probably +# legacy-free and simply doesn't have a keyboard controller. +# Thus, the A20 line is already enabled. +# +seta20: cli # Disable interrupts + xor %cx,%cx # Clear +seta20.1: inc %cx # Increment, overflow? + jz seta20.3 # Yes + in $0x64,%al # Get status + test $0x2,%al # Busy? + jnz seta20.1 # Yes + mov $0xd1,%al # Command: Write + out %al,$0x64 # output port +seta20.2: in $0x64,%al # Get status + test $0x2,%al # Busy? + jnz seta20.2 # Yes + mov $0xdf,%al # Enable + out %al,$0x60 # A20 +seta20.3: sti # Enable interrupts + ret # To caller + +# +# Convert AL to hex, saving the result to [EDI]. +# +hex8: pushl %eax # Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + popl %eax # Restore +hex8.1: andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char + ret # (Recursive) + +# +# BTX client to start btxldr +# + .code32 +btx_client: mov $(MEM_ARG_BTX-MEM_BTX_CLIENT+MEM_ARG_SIZE-4), %esi + # %ds:(%esi) -> end + # of boot[12] args + mov $(MEM_ARG_SIZE/4),%ecx # Number of words to push + std # Go backwards +push_arg: lodsl # Read argument + push %eax # Push it onto the stack + loop push_arg # Push all of the arguments + cld # In case anyone depends on this + pushl MEM_ARG_BTX-MEM_BTX_CLIENT+MEM_ARG_SIZE # Entry point of + # the loader + push %eax # Emulate a near call + mov $0x1,%eax # 'exec' system call + int $INT_SYS # BTX system call +btx_client_end: + .code16 + + .p2align 4 +# +# Global descriptor table. +# +gdt: .word 0x0,0x0,0x0,0x0 # Null entry + .word 0xffff,0x0,0x9200,0xcf # SEL_SDATA + .word 0xffff,0x0,0x9200,0x0 # SEL_RDATA + .word 0xffff,0x0,0x9a00,0xcf # SEL_SCODE (32-bit) + .word 0xffff,0x0,0x9a00,0x8f # SEL_SCODE16 (16-bit) +gdt.1: +# +# Pseudo-descriptors. +# +gdtdesc: .word gdt.1-gdt-1 # Limit + .long gdt # Base +# +# EDD Packet +# +edd_packet: .byte 0x10 # Length + .byte 0 # Reserved +edd_len: .byte 0x0 # Num to read + .byte 0 # Reserved +edd_addr: .word 0x0,0x0 # Seg:Off +edd_lba: .quad 0x0 # LBA + +drive: .byte 0 + +# +# State for searching dir +# +rec_lba: .long 0x0 # LBA (adjusted for EA) +rec_size: .long 0x0 # File size +name_len: .byte 0x0 # Length of current name + +twiddle_index: .byte 0x0 + +msg_welcome: .asciz "CD Loader 1.2\r\n\n" +msg_bootinfo: .asciz "Building the boot loader arguments\r\n" +msg_relocate: .asciz "Relocating the loader and the BTX\r\n" +msg_jump: .asciz "Starting the BTX loader\r\n" +msg_badread: .ascii "Read Error: 0x" +hex_error: .asciz "00\r\n" +msg_novd: .asciz "Could not find Primary Volume Descriptor\r\n" +msg_lookup: .asciz "Looking up " +msg_lookup2: .asciz "... " +msg_lookupok: .asciz "Found\r\n" +msg_lookupfail: .asciz "File not found\r\n" +msg_load2big: .asciz "File too big\r\n" +msg_failed: .asciz "Boot failed\r\n" +twiddle_chars: .ascii "|/-\\" +loader_paths: .asciz "/BOOT/LOADER" + .asciz "/boot/loader" + .byte 0 + Modified: stable/8/sys/boot/i386/pxeldr/Makefile ============================================================================== --- stable/8/sys/boot/i386/pxeldr/Makefile Fri Jun 29 10:10:16 2012 (r237761) +++ stable/8/sys/boot/i386/pxeldr/Makefile Fri Jun 29 10:10:43 2012 (r237762) @@ -23,6 +23,8 @@ CFLAGS+=-DPROBE_KEYBOARD CFLAGS+=-DALWAYS_SERIAL .endif +CFLAGS+=-I${.CURDIR}/../common + LOADERBIN= ${.OBJDIR}/../loader/loader.bin CLEANFILES+= ${BOOT}.tmp Modified: stable/8/sys/boot/i386/pxeldr/pxeldr.S ============================================================================== --- stable/8/sys/boot/i386/pxeldr/pxeldr.S Fri Jun 29 10:10:16 2012 (r237761) +++ stable/8/sys/boot/i386/pxeldr/pxeldr.S Fri Jun 29 10:10:43 2012 (r237762) @@ -26,6 +26,7 @@ */ #include +#include /* * Memory locations. @@ -50,11 +51,6 @@ .set AOUT_ENTRY,0x14 # entry point .set AOUT_HEADER,MEM_PAGE_SIZE # size of the a.out header /* - * Flags for kargs->bootflags - */ - .set KARGS_FLAGS_PXE,0x2 # flag to indicate booting from - # PXE loader -/* * Segment selectors. */ .set SEL_SDATA,0x8 # Supervisor data From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:12:28 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51E34106584A; Fri, 29 Jun 2012 10:12:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE8768FC08; Fri, 29 Jun 2012 10:12:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TACRIv038891; Fri, 29 Jun 2012 10:12:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TACR9T038881; Fri, 29 Jun 2012 10:12:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291012.q5TACR9T038881@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237764 - in stable/8/sys/boot/pc98: btx/btx btx/btxldr btx/lib cdboot loader X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:12:28 -0000 Author: avg Date: Fri Jun 29 10:12:27 2012 New Revision: 237764 URL: http://svn.freebsd.org/changeset/base/237764 Log: MFC r235264: MFi386: improve argument passing via btxldr Added: stable/8/sys/boot/pc98/btx/lib/btxcsu.S - copied unchanged from r235264, head/sys/boot/pc98/btx/lib/btxcsu.S stable/8/sys/boot/pc98/cdboot/cdboot.S - copied unchanged from r235264, head/sys/boot/pc98/cdboot/cdboot.S Deleted: stable/8/sys/boot/pc98/btx/lib/btxcsu.s stable/8/sys/boot/pc98/cdboot/cdboot.s Modified: stable/8/sys/boot/pc98/btx/btx/Makefile stable/8/sys/boot/pc98/btx/btx/btx.S stable/8/sys/boot/pc98/btx/btxldr/Makefile stable/8/sys/boot/pc98/btx/btxldr/btxldr.S stable/8/sys/boot/pc98/btx/lib/Makefile stable/8/sys/boot/pc98/cdboot/Makefile stable/8/sys/boot/pc98/loader/main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/pc98/btx/btx/Makefile ============================================================================== --- stable/8/sys/boot/pc98/btx/btx/Makefile Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/btx/btx/Makefile Fri Jun 29 10:12:27 2012 (r237764) @@ -12,6 +12,7 @@ BOOT_BTX_FLAGS=0x0 .endif CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} +CFLAGS+=-I${.CURDIR}/../../../i386/common .if defined(BTX_SERIAL) BOOT_COMCONSOLE_PORT?= 0x238 Modified: stable/8/sys/boot/pc98/btx/btx/btx.S ============================================================================== --- stable/8/sys/boot/pc98/btx/btx/btx.S Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/btx/btx/btx.S Fri Jun 29 10:12:27 2012 (r237764) @@ -15,6 +15,8 @@ * $FreeBSD$ */ +#include + /* * Memory layout. */ @@ -205,7 +207,7 @@ init.8: xorl %ecx,%ecx # Zero andl $0x7,%eax incl %eax shll $0x11,%eax # To bytes - subl $0x1000,%eax # Less arg space + subl $ARGSPACE,%eax # Less arg space subl %edx,%eax # Less base movb $SEL_UDATA,%cl # User data selector pushl %ecx # Set SS Modified: stable/8/sys/boot/pc98/btx/btxldr/Makefile ============================================================================== --- stable/8/sys/boot/pc98/btx/btxldr/Makefile Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/btx/btxldr/Makefile Fri Jun 29 10:12:27 2012 (r237764) @@ -6,6 +6,7 @@ NO_MAN= SRCS= btxldr.S CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} +CFLAGS+=-I${.CURDIR}/../../../i386/common .if defined(BTXLDR_VERBOSE) CFLAGS+=-DBTXLDR_VERBOSE Modified: stable/8/sys/boot/pc98/btx/btxldr/btxldr.S ============================================================================== --- stable/8/sys/boot/pc98/btx/btxldr/btxldr.S Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/btx/btxldr/btxldr.S Fri Jun 29 10:12:27 2012 (r237764) @@ -20,6 +20,8 @@ * real thing should probably be more flexible, and in C. */ +#include + /* * Memory locations. */ @@ -105,7 +107,7 @@ gdcwait.2: inb $0x60,%al call hexout # stack call putstr # pointer movl $m_args,%esi # Format string - leal 0x4(%esp,1),%ebx # First argument + leal 0x4(%esp),%ebx # First argument movl $0x6,%ecx # Count start.1: movl (%ebx),%eax # Get argument and addl $0x4,%ebx # bump pointer @@ -113,24 +115,28 @@ start.1: movl (%ebx),%eax # Get argumen loop start.1 # Till done call putstr # End message #endif - movl $0x48,%ecx # Allocate space - subl %ecx,%ebp # for bootinfo - movl 0x18(%esp,1),%esi # Source: bootinfo + movl BA_BOOTINFO+4(%esp),%esi # Source: bootinfo cmpl $0x0, %esi # If the bootinfo pointer je start_null_bi # is null, don't copy it + movl BI_SIZE(%esi),%ecx # Allocate space + subl %ecx,%ebp # for bootinfo movl %ebp,%edi # Destination rep # Copy movsb # it - movl %ebp,0x18(%esp,1) # Update pointer + movl %ebp,BA_BOOTINFO+4(%esp) # Update pointer + movl %edi,%ebp # Restore base pointer #ifdef BTXLDR_VERBOSE movl $m_rel_bi,%esi # Display movl %ebp,%eax # bootinfo call hexout # relocation call putstr # message #endif -start_null_bi: movl $0x18,%ecx # Allocate space - subl %ecx,%ebp # for arguments - leal 0x4(%esp,1),%esi # Source +start_null_bi: movl $BOOTARGS_SIZE,%ecx # Fixed size of arguments + testl $KARGS_FLAGS_EXTARG, BA_BOOTFLAGS+4(%esp) # Check for extra data + jz start_fixed # Skip if the flag is not set + addl BOOTARGS_SIZE+4(%esp),%ecx # Add size of variable args +start_fixed: subl $ARGOFF,%ebp # Place args at fixed offset + leal 0x4(%esp),%esi # Source movl %ebp,%edi # Destination rep # Copy movsb # them Modified: stable/8/sys/boot/pc98/btx/lib/Makefile ============================================================================== --- stable/8/sys/boot/pc98/btx/lib/Makefile Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/btx/lib/Makefile Fri Jun 29 10:12:27 2012 (r237764) @@ -3,7 +3,8 @@ PROG= crt0.o INTERNALPROG= NO_MAN= -SRCS= btxcsu.s btxsys.s btxv86.s +SRCS= btxcsu.S btxsys.s btxv86.s +CFLAGS+=-I${.CURDIR}/../../../i386/common LDFLAGS=-Wl,-r .include Copied: stable/8/sys/boot/pc98/btx/lib/btxcsu.S (from r235264, head/sys/boot/pc98/btx/lib/btxcsu.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/pc98/btx/lib/btxcsu.S Fri Jun 29 10:12:27 2012 (r237764, copy of r235264, head/sys/boot/pc98/btx/lib/btxcsu.S) @@ -0,0 +1,49 @@ +# +# Copyright (c) 1998 Robert Nordier +# All rights reserved. +# +# Redistribution and use in source and binary forms are freely +# permitted provided that the above copyright notice and this +# paragraph and the following disclaimer are duplicated in all +# such forms. +# +# This software is provided "AS IS" and without any express or +# implied warranties, including, without limitation, the implied +# warranties of merchantability and fitness for a particular +# purpose. +# + +# $FreeBSD$ + +# +# BTX C startup code (ELF). +# + +#include + +# +# Globals. +# + .global _start +# +# Client entry point. +# +_start: cld + pushl %eax + movl $_edata,%edi + movl $_end,%ecx + subl %edi, %ecx + xorb %al, %al + rep + stosb + popl __base + movl %esp,%eax # Set + addl $ARGADJ,%eax # argument + movl %eax,__args # pointer + call main # Invoke client main() + call exit # Invoke client exit() +# +# Data. +# + .comm __base,4 # Client base address + .comm __args,4 # Client arguments Modified: stable/8/sys/boot/pc98/cdboot/Makefile ============================================================================== --- stable/8/sys/boot/pc98/cdboot/Makefile Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/cdboot/Makefile Fri Jun 29 10:12:27 2012 (r237764) @@ -4,7 +4,9 @@ PROG= cdboot STRIP= BINMODE=${NOBINMODE} NO_MAN= -SRCS= ${PROG}.s +SRCS= ${PROG}.S + +CFLAGS+=-I${.CURDIR}/../../i386/common ORG= 0x0000 Copied: stable/8/sys/boot/pc98/cdboot/cdboot.S (from r235264, head/sys/boot/pc98/cdboot/cdboot.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/pc98/cdboot/cdboot.S Fri Jun 29 10:12:27 2012 (r237764, copy of r235264, head/sys/boot/pc98/cdboot/cdboot.S) @@ -0,0 +1,808 @@ +# +# Copyright (c) 2006 TAKAHASHI Yoshihiro +# Copyright (c) 2001 John Baldwin +# 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 author nor the names of any co-contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# $FreeBSD$ + +#include + +# +# Basically, we first create a set of boot arguments to pass to the loaded +# binary. Then we attempt to load /boot/loader from the CD we were booted +# off of. +# + +# +# Memory locations. +# + .set STACK_OFF,0x6000 # Stack offset + .set LOAD_SEG,0x0700 # Load segment + .set LOAD_SIZE,2048 # Load size + .set DAUA,0x0584 # DA/UA + + .set MEM_PAGE_SIZE,0x1000 # memory page size, 4k + .set MEM_ARG,0x900 # Arguments at start + .set MEM_ARG_BTX,0xa100 # Where we move them to so the + # BTX client can see them + .set MEM_ARG_SIZE,0x18 # Size of the arguments + .set MEM_BTX_ADDRESS,0x9000 # where BTX lives + .set MEM_BTX_ENTRY,0x9010 # where BTX starts to execute + .set MEM_BTX_OFFSET,MEM_PAGE_SIZE # offset of BTX in the loader + .set MEM_BTX_CLIENT,0xa000 # where BTX clients live +# +# PC98 machine type from sys/pc98/pc98/pc98_machdep.h +# + .set MEM_SYS, 0xa100 # System common area segment + .set PC98_MACHINE_TYPE, 0x0620 # PC98 machine type + .set EPSON_ID, 0x0624 # EPSON machine id + + .set M_NEC_PC98, 0x0001 + .set M_EPSON_PC98, 0x0002 + .set M_NOT_H98, 0x0010 + .set M_H98, 0x0020 + .set M_NOTE, 0x0040 + .set M_NORMAL, 0x1000 + .set M_8M, 0x8000 +# +# Signature Constants +# + .set SIG1_OFF,0x1fe # Signature offset + .set SIG2_OFF,0x7fe # Signature offset +# +# a.out header fields +# + .set AOUT_TEXT,0x04 # text segment size + .set AOUT_DATA,0x08 # data segment size + .set AOUT_BSS,0x0c # zero'd BSS size + .set AOUT_SYMBOLS,0x10 # symbol table + .set AOUT_ENTRY,0x14 # entry point + .set AOUT_HEADER,MEM_PAGE_SIZE # size of the a.out header +# +# Segment selectors. +# + .set SEL_SDATA,0x8 # Supervisor data + .set SEL_RDATA,0x10 # Real mode data + .set SEL_SCODE,0x18 # PM-32 code + .set SEL_SCODE16,0x20 # PM-16 code +# +# BTX constants +# + .set INT_SYS,0x30 # BTX syscall interrupt +# +# Constants for reading from the CD. +# + .set ERROR_TIMEOUT,0x90 # BIOS timeout on read + .set NUM_RETRIES,3 # Num times to retry + .set SECTOR_SIZE,0x800 # size of a sector + .set SECTOR_SHIFT,11 # number of place to shift + .set BUFFER_LEN,0x100 # number of sectors in buffer + .set MAX_READ,0xf800 # max we can read at a time + .set MAX_READ_SEC,MAX_READ >> SECTOR_SHIFT + .set MEM_READ_BUFFER,0x9000 # buffer to read from CD + .set MEM_VOLDESC,MEM_READ_BUFFER # volume descriptor + .set MEM_DIR,MEM_VOLDESC+SECTOR_SIZE # Lookup buffer + .set VOLDESC_LBA,0x10 # LBA of vol descriptor + .set VD_PRIMARY,1 # Primary VD + .set VD_END,255 # VD Terminator + .set VD_ROOTDIR,156 # Offset of Root Dir Record + .set DIR_LEN,0 # Offset of Dir Record length + .set DIR_EA_LEN,1 # Offset of EA length + .set DIR_EXTENT,2 # Offset of 64-bit LBA + .set DIR_SIZE,10 # Offset of 64-bit length + .set DIR_NAMELEN,32 # Offset of 8-bit name len + .set DIR_NAME,33 # Offset of dir name + +# +# Program start. +# + .code16 + .globl start + +start: jmp main + + .org 4 + .ascii "IPL1 " + +main: cld + + /* Setup the stack */ + xor %ax,%ax + mov %ax,%ss + mov $STACK_OFF,%sp + + push %ecx + + /* Setup graphic screen */ + mov $0x42,%ah # 640x400 + mov $0xc0,%ch + int $0x18 + mov $0x40,%ah # graph on + int $0x18 + + /* Setup text screen */ + mov $0x0a00,%ax # 80x25 + int $0x18 + mov $0x0c,%ah # text on + int $0x18 + mov $0x13,%ah # cursor home + xor %dx,%dx + int $0x18 + mov $0x11,%ah # cursor on + int $0x18 + + /* Setup keyboard */ + mov $0x03,%ah + int $0x18 + + /* Transfer PC-9801 system common area */ + xor %ax,%ax + mov %ax,%si + mov %ax,%ds + mov %ax,%di + mov $MEM_SYS,%ax + mov %ax,%es + mov $0x0600,%cx + rep + movsb + + /* Transfer EPSON machine type */ + mov $0xfd00,%ax + mov %ax,%ds + mov (0x804),%eax + and $0x00ffffff,%eax + mov %eax,%es:(EPSON_ID) + + /* Set machine type to PC98_SYSTEM_PARAMETER */ + call machine_check + + /* Load cdboot */ + xor %ax,%ax + mov %ax,%ds + mov $0x06,%ah /* Read data */ + mov (DAUA),%al /* Read drive */ + pop %ecx /* cylinder */ + xor %dx,%dx /* head / sector */ + mov $LOAD_SEG,%bx /* Load address */ + mov %bx,%es + xor %bp,%bp + mov $LOAD_SIZE,%bx /* Load size */ + int $0x1b + mov $msg_readerr,%si + jc error + + /* Jump to cdboot */ + ljmp $LOAD_SEG,$cdboot + +# +# Set machine type to PC98_SYSTEM_PARAMETER. +# +machine_check: xor %edx,%edx + mov %dx,%ds + mov $MEM_SYS,%ax + mov %ax,%es + + /* Wait V-SYNC */ +vsync.1: inb $0x60,%al + test $0x20,%al + jnz vsync.1 +vsync.2: inb $0x60,%al + test $0x20,%al + jz vsync.2 + + /* ANK 'A' font */ + xor %al,%al + outb %al,$0xa1 + mov $0x41,%al + outb %al,$0xa3 + + /* Get 'A' font from CG window */ + push %ds + mov $0xa400,%ax + mov %ax,%ds + xor %eax,%eax + xor %bx,%bx + mov $4,%cx +font.1: add (%bx),%eax + add $4,%bx + loop font.1 + pop %ds + cmp $0x6efc58fc,%eax + jnz m_epson + +m_pc98: or $M_NEC_PC98,%edx + mov $0x0458,%bx + mov (%bx),%al + test $0x80,%al + jz m_not_h98 + or $M_H98,%edx + jmp 1f +m_epson: or $M_EPSON_PC98,%edx +m_not_h98: or $M_NOT_H98,%edx + +1: inb $0x42,%al + test $0x20,%al + jz 1f + or $M_8M,%edx + +1: mov $0x0400,%bx + mov (%bx),%al + test $0x80,%al + jz 1f + or $M_NOTE,%edx + +1: mov $PC98_MACHINE_TYPE,%bx + mov %edx,%es:(%bx) + ret + +# +# Print out the error message at [SI], wait for a keypress, and then +# reboot the machine. +# +error: call putstr + mov $msg_keypress,%si + call putstr + xor %ax,%ax # Get keypress + int $0x18 + xor %ax,%ax # CPU reset + outb %al,$0xf0 +halt: hlt + jmp halt # Spin + +# +# Display a null-terminated string at [SI]. +# +# Trashes: AX, BX, CX, DX, SI, DI +# +putstr: push %ds + push %es + mov %cs,%ax + mov %ax,%ds + mov $0xa000,%ax + mov %ax,%es + mov cursor,%di + mov $0x00e1,%bx # Attribute + mov $160,%cx +putstr.0: lodsb + testb %al,%al + jz putstr.done + cmp $0x0d,%al + jz putstr.cr + cmp $0x0a,%al + jz putstr.lf + mov %bl,%es:0x2000(%di) + stosb + inc %di + jmp putstr.move +putstr.cr: xor %dx,%dx + mov %di,%ax + div %cx + sub %dx,%di + jmp putstr.move +putstr.lf: add %cx,%di +putstr.move: mov %di,%dx + mov $0x13,%ah # Move cursor + int $0x18 + jmp putstr.0 +putstr.done: mov %di,cursor + pop %es + pop %ds + ret + +# +# Display a single char at [AL], but don't move a cursor. +# +putc: push %es + push %di + push %bx + mov $0xa000,%bx + mov %bx,%es + mov cursor,%di + mov $0xe1,%bl # Attribute + mov %bl,%es:0x2000(%di) + stosb + pop %bx + pop %di + pop %es + ret + +msg_readerr: .asciz "Read Error\r\n" +msg_keypress: .asciz "\r\nPress any key to reboot\r\n" + +/* Boot signature */ + + .org SIG1_OFF,0x90 + + .word 0xaa55 # Magic number + +# +# cdboot +# +cdboot: mov %cs,%ax + mov %ax,%ds + xor %ax,%ax + mov %ax,%es + mov %es:(DAUA),%al # Save BIOS boot device + mov %al,drive + mov %cx,cylinder # Save BIOS boot cylinder + + mov $msg_welcome,%si # %ds:(%si) -> welcome message + call putstr # display the welcome message +# +# Setup the arguments that the loader is expecting from boot[12] +# + mov $msg_bootinfo,%si # %ds:(%si) -> boot args message + call putstr # display the message + mov $MEM_ARG,%bx # %ds:(%bx) -> boot args + mov %bx,%di # %es:(%di) -> boot args + xor %eax,%eax # zero %eax + mov $(MEM_ARG_SIZE/4),%cx # Size of arguments in 32-bit + # dwords + rep # Clear the arguments + stosl # to zero + mov drive,%dl # Store BIOS boot device + mov %dl,%es:0x4(%bx) # in kargs->bootdev + or $KARGS_FLAGS_CD,%es:0x8(%bx) # kargs->bootflags |= + # KARGS_FLAGS_CD +# +# Load Volume Descriptor +# + mov $VOLDESC_LBA,%eax # Set LBA of first VD +load_vd: push %eax # Save %eax + mov $1,%dh # One sector + mov $MEM_VOLDESC,%ebx # Destination + call read # Read it in + cmpb $VD_PRIMARY,%es:(%bx) # Primary VD? + je have_vd # Yes + pop %eax # Prepare to + inc %eax # try next + cmpb $VD_END,%es:(%bx) # Last VD? + jne load_vd # No, read next + mov $msg_novd,%si # No VD + jmp error # Halt +have_vd: # Have Primary VD +# +# Try to look up the loader binary using the paths in the loader_paths +# array. +# + mov $loader_paths,%si # Point to start of array +lookup_path: push %si # Save file name pointer + call lookup # Try to find file + pop %di # Restore file name pointer + jnc lookup_found # Found this file + push %es + mov %cs,%ax + mov %ax,%es + xor %al,%al # Look for next + mov $0xffff,%cx # path name by + repnz # scanning for + scasb # nul char + pop %es + mov %di,%si # Point %si at next path + mov (%si),%al # Get first char of next path + or %al,%al # Is it double nul? + jnz lookup_path # No, try it. + mov $msg_failed,%si # Failed message + jmp error # Halt +lookup_found: # Found a loader file +# +# Load the binary into the buffer. Due to real mode addressing limitations +# we have to read it in 64k chunks. +# + mov %es:DIR_SIZE(%bx),%eax # Read file length + add $SECTOR_SIZE-1,%eax # Convert length to sectors + shr $SECTOR_SHIFT,%eax + cmp $BUFFER_LEN,%eax + jbe load_sizeok + mov $msg_load2big,%si # Error message + jmp error +load_sizeok: movzbw %al,%cx # Num sectors to read + mov %es:DIR_EXTENT(%bx),%eax # Load extent + xor %edx,%edx + mov %es:DIR_EA_LEN(%bx),%dl + add %edx,%eax # Skip extended + mov $MEM_READ_BUFFER,%ebx # Read into the buffer +load_loop: mov %cl,%dh + cmp $MAX_READ_SEC,%cl # Truncate to max read size + jbe load_notrunc + mov $MAX_READ_SEC,%dh +load_notrunc: sub %dh,%cl # Update count + push %eax # Save + call read # Read it in + pop %eax # Restore + add $MAX_READ_SEC,%eax # Update LBA + add $MAX_READ,%ebx # Update dest addr + jcxz load_done # Done? + jmp load_loop # Keep going +load_done: +# +# Turn on the A20 address line +# + xor %ax,%ax # Turn A20 on + outb %al,$0xf2 + mov $0x02,%al + outb %al,$0xf6 +# +# Relocate the loader and BTX using a very lazy protected mode +# + mov $msg_relocate,%si # Display the + call putstr # relocation message + mov %es:(MEM_READ_BUFFER+AOUT_ENTRY),%edi # %edi is the destination + mov $(MEM_READ_BUFFER+AOUT_HEADER),%esi # %esi is + # the start of the text + # segment + mov %es:(MEM_READ_BUFFER+AOUT_TEXT),%ecx # %ecx = length of the text + # segment + push %edi # Save entry point for later + lgdt gdtdesc # setup our own gdt + cli # turn off interrupts + mov %cr0,%eax # Turn on + or $0x1,%al # protected + mov %eax,%cr0 # mode + ljmp $SEL_SCODE,$pm_start # long jump to clear the + # instruction pre-fetch queue + .code32 +pm_start: mov $SEL_SDATA,%ax # Initialize + mov %ax,%ds # %ds and + mov %ax,%es # %es to a flat selector + rep # Relocate the + movsb # text segment + add $(MEM_PAGE_SIZE - 1),%edi # pad %edi out to a new page + and $~(MEM_PAGE_SIZE - 1),%edi # for the data segment + mov MEM_READ_BUFFER+AOUT_DATA,%ecx # size of the data segment + rep # Relocate the + movsb # data segment + mov MEM_READ_BUFFER+AOUT_BSS,%ecx # size of the bss + xor %eax,%eax # zero %eax + add $3,%cl # round %ecx up to + shr $2,%ecx # a multiple of 4 + rep # zero the + stosl # bss + mov MEM_READ_BUFFER+AOUT_ENTRY,%esi # %esi -> relocated loader + add $MEM_BTX_OFFSET,%esi # %esi -> BTX in the loader + mov $MEM_BTX_ADDRESS,%edi # %edi -> where BTX needs to go + movzwl 0xa(%esi),%ecx # %ecx -> length of BTX + rep # Relocate + movsb # BTX + ljmp $SEL_SCODE16,$pm_16 # Jump to 16-bit PM + .code16 +pm_16: mov $SEL_RDATA,%ax # Initialize + mov %ax,%ds # %ds and + mov %ax,%es # %es to a real mode selector + mov %cr0,%eax # Turn off + and $~0x1,%al # protected + mov %eax,%cr0 # mode + ljmp $LOAD_SEG,$pm_end # Long jump to clear the + # instruction pre-fetch queue +pm_end: sti # Turn interrupts back on now +# +# Copy the BTX client to MEM_BTX_CLIENT +# + mov %cs,%ax + mov %ax,%ds + xor %ax,%ax + mov %ax,%es + mov $MEM_BTX_CLIENT,%di # Prepare to relocate + mov $btx_client,%si # the simple btx client + mov $(btx_client_end-btx_client),%cx # length of btx client + rep # Relocate the + movsb # simple BTX client +# +# Copy the boot[12] args to where the BTX client can see them +# + xor %ax,%ax + mov %ax,%ds + mov $MEM_ARG,%si # where the args are at now + mov $MEM_ARG_BTX,%di # where the args are moving to + mov $(MEM_ARG_SIZE/4),%cx # size of the arguments in longs + rep # Relocate + movsl # the words +# +# Save the entry point so the client can get to it later on +# + pop %eax # Restore saved entry point + stosl # and add it to the end of + # the arguments +# +# Now we just start up BTX and let it do the rest +# + mov $msg_jump,%si # Display the + call putstr # jump message + ljmp $0,$MEM_BTX_ENTRY # Jump to the BTX entry point + +# +# Lookup the file in the path at [SI] from the root directory. +# +# Trashes: All but BX +# Returns: CF = 0 (success), BX = pointer to record +# CF = 1 (not found) +# +lookup: mov $VD_ROOTDIR+MEM_VOLDESC,%bx # Root directory record + push %bx + push %si + mov $msg_lookup,%si # Display lookup message + call putstr + pop %si + push %si + call putstr + mov $msg_lookup2,%si + call putstr + pop %si + pop %bx +lookup_dir: lodsb # Get first char of path + cmp $0,%al # Are we done? + je lookup_done # Yes + cmp $'/',%al # Skip path separator. + je lookup_dir + dec %si # Undo lodsb side effect + call find_file # Lookup first path item + jnc lookup_dir # Try next component + mov $msg_lookupfail,%si # Not found message + push %bx + call putstr + pop %bx + stc # Set carry + ret +lookup_done: mov $msg_lookupok,%si # Success message + push %bx + call putstr + pop %bx + clc # Clear carry + ret + +# +# Lookup file at [SI] in directory whose record is at [BX]. +# +# Trashes: All but returns +# Returns: CF = 0 (success), BX = pointer to record, SI = next path item +# CF = 1 (not found), SI = preserved +# +find_file: mov %es:DIR_EXTENT(%bx),%eax # Load extent + xor %edx,%edx + mov %es:DIR_EA_LEN(%bx),%dl + add %edx,%eax # Skip extended attributes + mov %eax,rec_lba # Save LBA + mov %es:DIR_SIZE(%bx),%eax # Save size + mov %eax,rec_size + xor %cl,%cl # Zero length + push %si # Save +ff.namelen: inc %cl # Update length + lodsb # Read char + cmp $0,%al # Nul? + je ff.namedone # Yes + cmp $'/',%al # Path separator? + jnz ff.namelen # No, keep going +ff.namedone: dec %cl # Adjust length and save + mov %cl,name_len + pop %si # Restore +ff.load: mov rec_lba,%eax # Load LBA + mov $MEM_DIR,%ebx # Address buffer + mov $1,%dh # One sector + call read # Read directory block + incl rec_lba # Update LBA to next block +ff.scan: mov %ebx,%edx # Check for EOF + sub $MEM_DIR,%edx + cmp %edx,rec_size + ja ff.scan.1 + stc # EOF reached + ret +ff.scan.1: cmpb $0,%es:DIR_LEN(%bx) # Last record in block? + je ff.nextblock + push %si # Save + movzbw %es:DIR_NAMELEN(%bx),%si # Find end of string +ff.checkver: cmpb $'0',%es:DIR_NAME-1(%bx,%si) # Less than '0'? + jb ff.checkver.1 + cmpb $'9',%es:DIR_NAME-1(%bx,%si) # Greater than '9'? + ja ff.checkver.1 + dec %si # Next char + jnz ff.checkver + jmp ff.checklen # All numbers in name, so + # no version +ff.checkver.1: movzbw %es:DIR_NAMELEN(%bx),%cx + cmp %cx,%si # Did we find any digits? + je ff.checkdot # No + cmpb $';',%es:DIR_NAME-1(%bx,%si) # Check for semicolon + jne ff.checkver.2 + dec %si # Skip semicolon + mov %si,%cx + mov %cl,%es:DIR_NAMELEN(%bx) # Adjust length + jmp ff.checkdot +ff.checkver.2: mov %cx,%si # Restore %si to end of string +ff.checkdot: cmpb $'.',%es:DIR_NAME-1(%bx,%si) # Trailing dot? + jne ff.checklen # No + decb %es:DIR_NAMELEN(%bx) # Adjust length +ff.checklen: pop %si # Restore + movzbw name_len,%cx # Load length of name + cmp %cl,%es:DIR_NAMELEN(%bx) # Does length match? + je ff.checkname # Yes, check name +ff.nextrec: add %es:DIR_LEN(%bx),%bl # Next record + adc $0,%bh + jmp ff.scan +ff.nextblock: subl $SECTOR_SIZE,rec_size # Adjust size + jnc ff.load # If subtract ok, keep going + ret # End of file, so not found +ff.checkname: lea DIR_NAME(%bx),%di # Address name in record + push %si # Save + repe cmpsb # Compare name + je ff.match # We have a winner! + pop %si # Restore + jmp ff.nextrec # Keep looking. +ff.match: add $2,%sp # Discard saved %si + clc # Clear carry + ret + +# +# Load DH sectors starting at LBA EAX into [EBX]. +# +# Trashes: EAX +# +read: push %es # Save + push %bp + push %dx + push %cx + push %ebx + mov %bx,%bp # Set destination address + and $0x000f,%bp + shr $4,%ebx + mov %bx,%es + xor %bx,%bx # Set read bytes + mov %dh,%bl + shl $SECTOR_SHIFT,%bx # 2048 bytes/sec + mov %ax,%cx # Set LBA + shr $16,%eax + mov %ax,%dx +read.retry: mov $0x06,%ah # BIOS device read + mov drive,%al + and $0x7f,%al + call twiddle # Entertain the user + int $0x1b # Call BIOS + jc read.fail # Worked? + pop %ebx # Restore + pop %cx + pop %dx + pop %bp + pop %es + ret # Return +read.fail: cmp $ERROR_TIMEOUT,%ah # Timeout? + je read.retry # Yes, Retry. +read.error: mov %ah,%al # Save error + mov $hex_error,%di # Format it + call hex8 # as hex + mov $msg_badread,%si # Display Read error message + jmp error + +# +# Output the "twiddle" +# +twiddle: push %ax # Save + push %bx # Save + mov twiddle_index,%al # Load index + mov $twiddle_chars,%bx # Address table + inc %al # Next + and $3,%al # char + mov %al,twiddle_index # Save index for next call + xlat # Get char + call putc # Output it + pop %bx # Restore + pop %ax # Restore + ret + +# +# Convert AL to hex, saving the result to [EDI]. +# +hex8: pushl %eax # Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + popl %eax # Restore +hex8.1: andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + mov %al,(%di) # Save char + inc %di + ret # (Recursive) + +# +# BTX client to start btxldr +# + .code32 +btx_client: mov $(MEM_ARG_BTX-MEM_BTX_CLIENT+MEM_ARG_SIZE-4), %esi + # %ds:(%esi) -> end + # of boot[12] args + mov $(MEM_ARG_SIZE/4),%ecx # Number of words to push + std # Go backwards +push_arg: lodsl # Read argument + push %eax # Push it onto the stack + loop push_arg # Push all of the arguments + cld # In case anyone depends on this + pushl MEM_ARG_BTX-MEM_BTX_CLIENT+MEM_ARG_SIZE # Entry point of + # the loader + push %eax # Emulate a near call + mov $0x1,%eax # 'exec' system call + int $INT_SYS # BTX system call +btx_client_end: + .code16 + + .p2align 4 +# +# Global descriptor table. +# +gdt: .word 0x0,0x0,0x0,0x0 # Null entry + .word 0xffff,0x0000,0x9200,0x00cf # SEL_SDATA + .word 0xffff,0x0000,0x9200,0x0000 # SEL_RDATA + .word 0xffff,LOAD_SEG<<4,0x9a00,0x00cf # SEL_SCODE (32-bit) + .word 0xffff,LOAD_SEG<<4,0x9a00,0x008f # SEL_SCODE16 (16-bit) +gdt.1: +# +# Pseudo-descriptors. +# +gdtdesc: .word gdt.1-gdt-1 # Limit + .long LOAD_SEG<<4 + gdt # Base + +# +# BOOT device +# +drive: .byte 0 +cylinder: .word 0 + +# +# State for searching dir +# +rec_lba: .long 0x0 # LBA (adjusted for EA) +rec_size: .long 0x0 # File size +name_len: .byte 0x0 # Length of current name + +cursor: .word 0 +twiddle_index: .byte 0x0 + +msg_welcome: .asciz "CD Loader 1.2\r\n\n" +msg_bootinfo: .asciz "Building the boot loader arguments\r\n" +msg_relocate: .asciz "Relocating the loader and the BTX\r\n" +msg_jump: .asciz "Starting the BTX loader\r\n" +msg_badread: .ascii "Read Error: 0x" +hex_error: .asciz "00\r\n" +msg_novd: .asciz "Could not find Primary Volume Descriptor\r\n" +msg_lookup: .asciz "Looking up " +msg_lookup2: .asciz "... " +msg_lookupok: .asciz "Found\r\n" +msg_lookupfail: .asciz "File not found\r\n" +msg_load2big: .asciz "File too big\r\n" +msg_failed: .asciz "Boot failed\r\n" +twiddle_chars: .ascii "|/-\\" +loader_paths: .asciz "/BOOT.PC98/LOADER" + .asciz "/boot.pc98/loader" + .asciz "/BOOT/LOADER" + .asciz "/boot/loader" + .byte 0 + +/* Boot signature */ + + .org SIG2_OFF,0x90 + + .word 0xaa55 # Magic number Modified: stable/8/sys/boot/pc98/loader/main.c ============================================================================== --- stable/8/sys/boot/pc98/loader/main.c Fri Jun 29 10:12:18 2012 (r237763) +++ stable/8/sys/boot/pc98/loader/main.c Fri Jun 29 10:12:27 2012 (r237764) @@ -33,28 +33,24 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include #include "bootstrap.h" +#include "common/bootargs.h" #include "libi386/libi386.h" #include "libpc98/libpc98.h" #include "btxv86.h" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:18:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 214DD106566C; Fri, 29 Jun 2012 10:18:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 083F68FC1B; Fri, 29 Jun 2012 10:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TAIapA039339; Fri, 29 Jun 2012 10:18:36 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TAIaIL039322; Fri, 29 Jun 2012 10:18:36 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291018.q5TAIaIL039322@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237765 - in stable/8/sys: boot/common boot/i386/libi386 boot/i386/loader boot/i386/zfsboot boot/ofw/libofw boot/sparc64/loader boot/zfs cddl/boot/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:18:37 -0000 Author: avg Date: Fri Jun 29 10:18:36 2012 New Revision: 237765 URL: http://svn.freebsd.org/changeset/base/237765 Log: MFC r235329,235343,235361,235364: zfsboot/zfsloader: support accessing filesystems within a pool Added: stable/8/sys/boot/zfs/devicename_stubs.c - copied unchanged from r235329, head/sys/boot/zfs/devicename_stubs.c stable/8/sys/boot/zfs/libzfs.h - copied unchanged from r235329, head/sys/boot/zfs/libzfs.h Modified: stable/8/sys/boot/common/bootstrap.h stable/8/sys/boot/i386/libi386/Makefile stable/8/sys/boot/i386/libi386/devicename.c stable/8/sys/boot/i386/libi386/libi386.h stable/8/sys/boot/i386/loader/conf.c stable/8/sys/boot/i386/loader/main.c stable/8/sys/boot/i386/zfsboot/zfsboot.c stable/8/sys/boot/ofw/libofw/Makefile stable/8/sys/boot/ofw/libofw/devicename.c stable/8/sys/boot/ofw/libofw/libofw.h stable/8/sys/boot/sparc64/loader/Makefile stable/8/sys/boot/sparc64/loader/main.c stable/8/sys/boot/zfs/zfs.c stable/8/sys/boot/zfs/zfsimpl.c stable/8/sys/cddl/boot/zfs/zfsimpl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/common/bootstrap.h ============================================================================== --- stable/8/sys/boot/common/bootstrap.h Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/common/bootstrap.h Fri Jun 29 10:18:36 2012 (r237765) @@ -301,6 +301,9 @@ struct arch_switch void (*arch_isaoutb)(int port, int value); /* Pass in initial kernel memory size */ void (*arch_maphint)(vm_offset_t va, size_t len); + + /* Probe ZFS pool(s), if needed. */ + void (*arch_zfs_probe)(void); }; extern struct arch_switch archsw; Modified: stable/8/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/8/sys/boot/i386/libi386/Makefile Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/i386/libi386/Makefile Fri Jun 29 10:18:36 2012 (r237765) @@ -9,6 +9,8 @@ SRCS= biosacpi.c bioscd.c biosdisk.c bio elf64_freebsd.c \ i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ smbios.c time.c vidconsole.c amd64_tramp.S +.PATH: ${.CURDIR}/../../zfs +SRCS+= devicename_stubs.c # Enable PXE TFTP or NFS support, not both. .if defined(LOADER_TFTP_SUPPORT) Modified: stable/8/sys/boot/i386/libi386/devicename.c ============================================================================== --- stable/8/sys/boot/i386/libi386/devicename.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/i386/libi386/devicename.c Fri Jun 29 10:18:36 2012 (r237765) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" #include "libi386.h" +#include "../zfs/libzfs.h" static int i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path); @@ -171,7 +172,6 @@ i386_parsedev(struct i386_devdesc **dev, case DEVT_CD: case DEVT_NET: - case DEVT_ZFS: unit = 0; if (*np && (*np != ':')) { @@ -192,7 +192,11 @@ i386_parsedev(struct i386_devdesc **dev, if (path != NULL) *path = (*cp == 0) ? cp : cp + 1; break; - + case DEVT_ZFS: + err = zfs_parsedev((struct zfs_devdesc *)idev, np, path); + if (err != 0) + goto fail; + break; default: err = EINVAL; goto fail; @@ -247,9 +251,10 @@ i386_fmtdev(void *vdev) break; case DEVT_NET: - case DEVT_ZFS: sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; + case DEVT_ZFS: + return(zfs_fmtdev(vdev)); } return(buf); } Modified: stable/8/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/8/sys/boot/i386/libi386/libi386.h Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/i386/libi386/libi386.h Fri Jun 29 10:18:36 2012 (r237765) @@ -30,7 +30,8 @@ /* * i386 fully-qualified device descriptor. * Note, this must match the 'struct devdesc' declaration - * in bootstrap.h. + * in bootstrap.h and also with struct zfs_devdesc for zfs + * support. */ struct i386_devdesc { @@ -49,6 +50,12 @@ struct i386_devdesc { void *data; } bioscd; + struct + { + void *data; + uint64_t pool_guid; + uint64_t root_guid; + } zfs; } d_kind; }; Modified: stable/8/sys/boot/i386/loader/conf.c ============================================================================== --- stable/8/sys/boot/i386/loader/conf.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/i386/loader/conf.c Fri Jun 29 10:18:36 2012 (r237765) @@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$"); #include #include #include "libi386/libi386.h" +#if defined(LOADER_ZFS_SUPPORT) +#include "../zfs/libzfs.h" +#endif /* * We could use linker sets for some or all of these, but @@ -50,10 +53,6 @@ __FBSDID("$FreeBSD$"); extern struct devsw fwohci; #endif -#if defined(LOADER_ZFS_SUPPORT) -extern struct devsw zfs_dev; -#endif - /* Exported for libstand */ struct devsw *devsw[] = { &bioscd, @@ -70,10 +69,6 @@ struct devsw *devsw[] = { NULL }; -#if defined(LOADER_ZFS_SUPPORT) -extern struct fs_ops zfs_fsops; -#endif - struct fs_ops *file_system[] = { &ufs_fsops, &ext2fs_fsops, Modified: stable/8/sys/boot/i386/loader/main.c ============================================================================== --- stable/8/sys/boot/i386/loader/main.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/i386/loader/main.c Fri Jun 29 10:18:36 2012 (r237765) @@ -44,6 +44,10 @@ __FBSDID("$FreeBSD$"); #include "libi386/libi386.h" #include "btxv86.h" +#ifdef LOADER_ZFS_SUPPORT +#include "../zfs/libzfs.h" +#endif + CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE); CTASSERT(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO); CTASSERT(offsetof(struct bootargs, bootflags) == BA_BOOTFLAGS); @@ -62,6 +66,9 @@ static void extract_currdev(void); static int isa_inb(int port); static void isa_outb(int port, int value); void exit(int code); +#ifdef LOADER_ZFS_SUPPORT +static void i386_zfs_probe(void); +#endif /* from vers.c */ extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; @@ -153,6 +160,9 @@ main(void) archsw.arch_readin = i386_readin; archsw.arch_isainb = isa_inb; archsw.arch_isaoutb = isa_outb; +#ifdef LOADER_ZFS_SUPPORT + archsw.arch_zfs_probe = i386_zfs_probe; +#endif /* * March through the device switch probing for things. @@ -196,8 +206,11 @@ main(void) static void extract_currdev(void) { - struct i386_devdesc new_currdev; - int biosdev = -1; + struct i386_devdesc new_currdev; +#ifdef LOADER_ZFS_SUPPORT + struct zfs_boot_args *zargs; +#endif + int biosdev = -1; /* Assume we are booting from a BIOS disk by default */ new_currdev.d_dev = &biosdisk; @@ -218,6 +231,24 @@ extract_currdev(void) new_currdev.d_kind.biosdisk.partition = 0; biosdev = -1; } +#ifdef LOADER_ZFS_SUPPORT + } else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) { + zargs = NULL; + /* check for new style extended argument */ + if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) + zargs = (struct zfs_boot_args *)(kargs + 1); + + if (zargs != NULL && zargs->size >= sizeof(*zargs)) { + /* sufficient data is provided */ + new_currdev.d_kind.zfs.pool_guid = zargs->pool; + new_currdev.d_kind.zfs.root_guid = zargs->root; + } else { + /* old style zfsboot block */ + new_currdev.d_kind.zfs.pool_guid = kargs->zfspool; + new_currdev.d_kind.zfs.root_guid = 0; + } + new_currdev.d_dev = &zfs_dev; +#endif } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { /* The passed-in boot device is bad */ new_currdev.d_kind.biosdisk.slice = -1; @@ -238,7 +269,7 @@ extract_currdev(void) biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */ } new_currdev.d_type = new_currdev.d_dev->dv_type; - + /* * If we are booting off of a BIOS disk and we didn't succeed in determining * which one we booted off of, just use disk0: as a reasonable default. @@ -249,33 +280,11 @@ extract_currdev(void) "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); new_currdev.d_unit = 0; } + env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), i386_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, env_nounset); - -#ifdef LOADER_ZFS_SUPPORT - /* - * If we were started from a ZFS-aware boot2, we can work out - * which ZFS pool we are booting from. - */ - if (kargs->bootflags & KARGS_FLAGS_ZFS) { - /* - * Dig out the pool guid and convert it to a 'unit number' - */ - uint64_t guid; - int unit; - char devname[32]; - extern int zfs_guid_to_unit(uint64_t); - - guid = kargs->zfspool; - unit = zfs_guid_to_unit(guid); - if (unit >= 0) { - sprintf(devname, "zfs%d", unit); - setenv("currdev", devname, 1); - } - } -#endif } COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); @@ -342,3 +351,30 @@ isa_outb(int port, int value) } } +#ifdef LOADER_ZFS_SUPPORT +static void +i386_zfs_probe(void) +{ + char devname[32]; + int unit, slice; + + /* + * Open all the disks we can find and see if we can reconstruct + * ZFS pools from them. Bogusly assumes that the disks are named + * diskN, diskNpM or diskNsM. + */ + for (unit = 0; unit < MAXBDDEV; unit++) { + sprintf(devname, "disk%d:", unit); + if (zfs_probe_dev(devname, NULL) == ENXIO) + continue; + for (slice = 1; slice <= 128; slice++) { + sprintf(devname, "disk%dp%d:", unit, slice); + zfs_probe_dev(devname, NULL); + } + for (slice = 1; slice <= 4; slice++) { + sprintf(devname, "disk%ds%d:", unit, slice); + zfs_probe_dev(devname, NULL); + } + } +} +#endif Modified: stable/8/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/8/sys/boot/i386/zfsboot/zfsboot.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/i386/zfsboot/zfsboot.c Fri Jun 29 10:18:36 2012 (r237765) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include "cons.h" #include "bootargs.h" +#include "libzfs.h" + #define PATH_DOTCONFIG "/boot.config" #define PATH_CONFIG "/boot/config" #define PATH_BOOT3 "/boot/zfsloader" @@ -91,9 +93,12 @@ static const unsigned char dev_maj[NDEV] static char cmd[512]; static char cmddup[512]; static char kname[1024]; +static char rootname[256]; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint32_t bootdev; +static struct zfs_boot_args zfsargs; +static struct zfsmount zfsmount; vm_offset_t high_heap_base; uint32_t bios_basemem, bios_extmem, high_heap_size; @@ -170,7 +175,7 @@ zfs_read(spa_t *spa, const dnode_phys_t /* * Current ZFS pool */ -spa_t *spa; +static spa_t *spa; /* * A wrapper for dskread that doesn't have to worry about whether the @@ -209,7 +214,7 @@ static int xfsread(const dnode_phys_t *dnode, off_t *offp, void *buf, size_t nbyte) { if ((size_t)zfs_read(spa, dnode, offp, buf, nbyte) != nbyte) { - printf("Invalid %s\n", "format"); + printf("Invalid format\n"); return -1; } return 0; @@ -524,10 +529,12 @@ main(void) } } - zfs_mount_pool(spa); - - if (zfs_lookup(spa, PATH_CONFIG, &dn) == 0 || - zfs_lookup(spa, PATH_DOTCONFIG, &dn) == 0) { + if (zfs_spa_init(spa) != 0 || zfs_mount(spa, 0, &zfsmount) != 0) { + printf("%s: failed to mount default pool %s\n", + BOOTPROG, spa->spa_name); + autoboot = 0; + } else if (zfs_lookup(&zfsmount, PATH_CONFIG, &dn) == 0 || + zfs_lookup(&zfsmount, PATH_DOTCONFIG, &dn) == 0) { off = 0; zfs_read(spa, &dn, &off, cmd, sizeof(cmd)); } @@ -562,11 +569,17 @@ main(void) /* Present the user with the boot2 prompt. */ for (;;) { - if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/x86 boot\n" - "Default: %s:%s\n" - "boot: ", - spa->spa_name, kname); + if (!autoboot || !OPT_CHECK(RBX_QUIET)) { + printf("\nFreeBSD/x86 boot\n"); + if (zfs_rlookup(spa, zfsmount.rootobj, rootname) != 0) + printf("Default: %s:<0x%llx>:%s\n" + "boot: ", + spa->spa_name, zfsmount.rootobj, kname); + else + printf("Default: %s:%s:%s\n" + "boot: ", + spa->spa_name, rootname, kname); + } if (ioctrl & IO_SERIAL) sio_flush(); if (!autoboot || keyhit(5)) @@ -602,7 +615,8 @@ load(void) uint32_t addr, x; int fmt, i, j; - if (zfs_lookup(spa, kname, &dn)) { + if (zfs_lookup(&zfsmount, kname, &dn)) { + printf("\nCan't find %s\n", kname); return; } off = 0; @@ -676,12 +690,16 @@ load(void) } bootinfo.bi_esymtab = VTOP(p); bootinfo.bi_kernelname = VTOP(kname); + zfsargs.size = sizeof(zfsargs); + zfsargs.pool = zfsmount.spa->spa_guid; + zfsargs.root = zfsmount.rootobj; __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), bootdev, - KARGS_FLAGS_ZFS, + KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG, (uint32_t) spa->spa_guid, (uint32_t) (spa->spa_guid >> 32), - VTOP(&bootinfo)); + VTOP(&bootinfo), + zfsargs); } static int @@ -733,7 +751,7 @@ parse(void) } if (c == '?') { dnode_phys_t dn; - if (zfs_lookup(spa, arg, &dn) == 0) { + if (zfs_lookup(&zfsmount, arg, &dn) == 0) { zap_list(spa, &dn); } return -1; @@ -755,17 +773,32 @@ parse(void) q = (char *) strchr(arg, ':'); if (q) { spa_t *newspa; + uint64_t newroot; *q++ = 0; newspa = spa_find_by_name(arg); if (newspa) { + arg = q; spa = newspa; - zfs_mount_pool(spa); + newroot = 0; + q = (char *) strchr(arg, ':'); + if (q) { + *q++ = 0; + if (zfs_lookup_dataset(spa, arg, &newroot)) { + printf("\nCan't find dataset %s in ZFS pool %s\n", + arg, spa->spa_name); + return -1; + } + arg = q; + } + if (zfs_mount(spa, newroot, &zfsmount)) { + printf("\nCan't mount ZFS dataset\n"); + return -1; + } } else { printf("\nCan't find ZFS pool %s\n", arg); return -1; } - arg = q; } if ((i = ep - arg)) { if ((size_t)i >= sizeof(kname)) Modified: stable/8/sys/boot/ofw/libofw/Makefile ============================================================================== --- stable/8/sys/boot/ofw/libofw/Makefile Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/ofw/libofw/Makefile Fri Jun 29 10:18:36 2012 (r237765) @@ -6,6 +6,8 @@ INTERNALLIB= SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \ ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \ ofw_time.c openfirm.c +.PATH: ${.CURDIR}/../../zfs +SRCS+= devicename_stubs.c CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ Modified: stable/8/sys/boot/ofw/libofw/devicename.c ============================================================================== --- stable/8/sys/boot/ofw/libofw/devicename.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/ofw/libofw/devicename.c Fri Jun 29 10:18:36 2012 (r237765) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libofw.h" +#include "../zfs/libzfs.h" static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); @@ -81,6 +82,7 @@ ofw_parsedev(struct ofw_devdesc **dev, c char *ep; char name[256]; char type[64]; + int err; int len; int i; @@ -114,14 +116,11 @@ found: idev->d_dev = dv; idev->d_type = dv->dv_type; if (idev->d_type == DEVT_ZFS) { - idev->d_unit = 0; - p = name + strlen(dv->dv_name); - if (*p && (*p != ':')) { - idev->d_unit = strtol(p, &ep, 0); - if (ep == p) { - free(idev); - return (EUNIT); - } + p = devspec + strlen(dv->dv_name); + err = zfs_parsedev((struct zfs_devdesc *)idev, p, path); + if (err != 0) { + free(idev); + return (err); } } Modified: stable/8/sys/boot/ofw/libofw/libofw.h ============================================================================== --- stable/8/sys/boot/ofw/libofw/libofw.h Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/ofw/libofw/libofw.h Fri Jun 29 10:18:36 2012 (r237765) @@ -33,7 +33,13 @@ struct ofw_devdesc { int d_type; int d_unit; ihandle_t d_handle; - char d_path[256]; + union { + char d_path[256]; + struct { + uint64_t pool_guid; + uint64_t root_guid; + }; + }; }; extern int ofw_getdev(void **vdev, const char *devspec, const char **path); Modified: stable/8/sys/boot/sparc64/loader/Makefile ============================================================================== --- stable/8/sys/boot/sparc64/loader/Makefile Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/sparc64/loader/Makefile Fri Jun 29 10:18:36 2012 (r237765) @@ -37,6 +37,7 @@ CFLAGS+= -DLOADER_CD9660_SUPPORT CFLAGS+= -DLOADER_ZFS_SUPPORT CFLAGS+= -I${.CURDIR}/../../zfs CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs +LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a .endif .if ${LOADER_GZIP_SUPPORT} == "yes" CFLAGS+= -DLOADER_GZIP_SUPPORT @@ -83,8 +84,8 @@ CFLAGS+= -I${.CURDIR}/../../ofw/libofw/ # where to get libstand from CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ -DPADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBOFW} -lstand +DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \ Modified: stable/8/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/8/sys/boot/sparc64/loader/main.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/sparc64/loader/main.c Fri Jun 29 10:18:36 2012 (r237765) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef LOADER_ZFS_SUPPORT #include +#include "../zfs/libzfs.h" #endif #include @@ -74,6 +75,8 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "dev_net.h" +#define MAXDEV 31 + extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; enum { @@ -154,11 +157,6 @@ static vm_offset_t heapva; static phandle_t root; -#ifdef LOADER_ZFS_SUPPORT -static int zfs_dev_init(void); -#include "zfs.c" -#endif - /* * Machine dependent structures that the machine independent * loader part uses. @@ -838,39 +836,20 @@ tlb_init_sun4v(void) } #ifdef LOADER_ZFS_SUPPORT - -static int -zfs_dev_init(void) +static void +sparc64_zfs_probe(void) { struct vtoc8 vtoc; - char devname[512]; - spa_t *spa; - vdev_t *vdev; + struct zfs_devdesc zfs_currdev; + char devname[32]; uint64_t guid; int fd, part, unit; - zfs_init(); - - guid = 0; /* Get the GUID of the ZFS pool on the boot device. */ - fd = open(getenv("currdev"), O_RDONLY); - if (fd != -1) { - if (vdev_probe(vdev_read, (void *)(uintptr_t) fd, &spa) == 0) - guid = spa->spa_guid; - close(fd); - } - - /* Clean up the environment to let ZFS work. */ - while ((vdev = STAILQ_FIRST(&zfs_vdevs)) != NULL) { - STAILQ_REMOVE_HEAD(&zfs_vdevs, v_alllink); - free(vdev); - } - while ((spa = STAILQ_FIRST(&zfs_pools)) != NULL) { - STAILQ_REMOVE_HEAD(&zfs_pools, spa_link); - free(spa); - } + guid = 0; + zfs_probe_dev(getenv("currdev"), &guid); - for (unit = 0; unit < MAXBDDEV; unit++) { + for (unit = 0; unit < MAXDEV; unit++) { /* Find freebsd-zfs slices in the VTOC. */ sprintf(devname, "disk%d:", unit); fd = open(devname, O_RDONLY); @@ -888,29 +867,23 @@ zfs_dev_init(void) VTOC_TAG_FREEBSD_ZFS) continue; sprintf(devname, "disk%d:%c", unit, part + 'a'); - fd = open(devname, O_RDONLY); - if (fd == -1) + if (zfs_probe_dev(devname, NULL) == ENXIO) break; - - if (vdev_probe(vdev_read, (void*)(uintptr_t) fd, 0)) - close(fd); } } if (guid != 0) { - unit = zfs_guid_to_unit(guid); - if (unit >= 0) { - /* Update the environment for ZFS. */ - sprintf(devname, "zfs%d", unit); - env_setenv("currdev", EV_VOLATILE, devname, - ofw_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, - env_noset, env_nounset); - } + zfs_currdev.pool_guid = guid; + zfs_currdev.root_guid = 0; + zfs_currdev.d_dev = &zfs_dev; + zfs_currdev.d_type = zfs_currdev.d_dev->dv_type; + /* Update the environment for ZFS. */ + env_setenv("currdev", EV_VOLATILE, zfs_fmtdev(&zfs_currdev), + ofw_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, zfs_fmtdev(&zfs_currdev), + env_noset, env_nounset); } - return (0); } - #endif /* LOADER_ZFS_SUPPORT */ int @@ -931,6 +904,9 @@ main(int (*openfirm)(void *)) archsw.arch_readin = sparc64_readin; archsw.arch_autoload = sparc64_autoload; archsw.arch_maphint = sparc64_maphint; +#ifdef LOADER_ZFS_SUPPORT + archsw.arch_zfs_probe = sparc64_zfs_probe; +#endif if (init_heap() == (vm_offset_t)-1) OF_exit(); Copied: stable/8/sys/boot/zfs/devicename_stubs.c (from r235329, head/sys/boot/zfs/devicename_stubs.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/zfs/devicename_stubs.c Fri Jun 29 10:18:36 2012 (r237765, copy of r235329, head/sys/boot/zfs/devicename_stubs.c) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2012 Andriy Gapon + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "libzfs.h" + +__attribute__((weak)) +int +zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path) +{ + return (EINVAL); +} + +__attribute__((weak)) +char * +zfs_fmtdev(void *vdev) +{ + static char buf[128]; + + return (buf); +} Copied: stable/8/sys/boot/zfs/libzfs.h (from r235329, head/sys/boot/zfs/libzfs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/zfs/libzfs.h Fri Jun 29 10:18:36 2012 (r237765, copy of r235329, head/sys/boot/zfs/libzfs.h) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2012 Andriy Gapon + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BOOT_LIBZFS_H_ +#define _BOOT_LIBZFS_H_ + +#define ZFS_MAXNAMELEN 256 + +/* + * ZFS fully-qualified device descriptor. + * Note, this must match the 'struct devdesc' declaration in bootstrap.h. + * Arch-specific device descriptors should be binary compatible with this + * structure if they are to support ZFS. + */ +struct zfs_devdesc +{ + struct devsw *d_dev; + int d_type; + int d_unit; + void *d_opendata; + uint64_t pool_guid; + uint64_t root_guid; +}; + +struct zfs_boot_args +{ + uint32_t size; + uint32_t reserved; + uint64_t pool; + uint64_t root; +}; + +int zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, + const char **path); +char *zfs_fmtdev(void *vdev); +int zfs_probe_dev(const char *devname, uint64_t *pool_guid); + +extern struct devsw zfs_dev; +extern struct fs_ops zfs_fsops; + +#endif /*_BOOT_LIBZFS_H_*/ Modified: stable/8/sys/boot/zfs/zfs.c ============================================================================== --- stable/8/sys/boot/zfs/zfs.c Fri Jun 29 10:12:27 2012 (r237764) +++ stable/8/sys/boot/zfs/zfs.c Fri Jun 29 10:18:36 2012 (r237765) @@ -43,9 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include "zfsimpl.c" +#include "libzfs.h" -#define MAXBDDEV 31 +#include "zfsimpl.c" static int zfs_open(const char *path, struct open_file *f); static int zfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); @@ -56,6 +56,7 @@ static int zfs_stat(struct open_file *f, static int zfs_readdir(struct open_file *f, struct dirent *d); struct devsw zfs_dev; +struct devsw zfs_dev_compat; struct fs_ops zfs_fsops = { "zfs", @@ -85,35 +86,20 @@ struct file { static int zfs_open(const char *upath, struct open_file *f) { - spa_t *spa = (spa_t *) f->f_devdata; + struct zfsmount *mount = (struct zfsmount *)f->f_devdata; struct file *fp; int rc; - if (f->f_dev != &zfs_dev) + if (f->f_dev != &zfs_dev && f->f_dev != &zfs_dev_compat) return (EINVAL); - rc = zfs_mount_pool(spa); - if (rc) - return (rc); - /* allocate file system specific data structure */ fp = malloc(sizeof(struct file)); bzero(fp, sizeof(struct file)); f->f_fsdata = (void *)fp; - if (spa->spa_root_objset.os_type != DMU_OST_ZFS) { - printf("Unexpected object set type %llu\n", - spa->spa_root_objset.os_type); - rc = EIO; - goto out; - } - - rc = zfs_lookup(spa, upath, &fp->f_dnode); - if (rc) - goto out; - + rc = zfs_lookup(mount, upath, &fp->f_dnode); fp->f_seekp = 0; -out: if (rc) { f->f_fsdata = NULL; free(fp); @@ -142,7 +128,7 @@ zfs_close(struct open_file *f) static int zfs_read(struct open_file *f, void *start, size_t size, size_t *resid /* out */) { - spa_t *spa = (spa_t *) f->f_devdata; + spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; struct file *fp = (struct file *)f->f_fsdata; struct stat sb; size_t n; @@ -216,7 +202,7 @@ zfs_seek(struct open_file *f, off_t offs static int zfs_stat(struct open_file *f, struct stat *sb) { - spa_t *spa = (spa_t *) f->f_devdata; + spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; struct file *fp = (struct file *)f->f_fsdata; return (zfs_dnode_stat(spa, &fp->f_dnode, sb)); @@ -225,7 +211,7 @@ zfs_stat(struct open_file *f, struct sta static int zfs_readdir(struct open_file *f, struct dirent *d) { - spa_t *spa = (spa_t *) f->f_devdata; + spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; struct file *fp = (struct file *)f->f_fsdata; mzap_ent_phys_t mze; struct stat sb; @@ -381,68 +367,33 @@ vdev_read(vdev_t *vdev, void *priv, off_ } } -/* - * Convert a pool guid to a 'unit number' suitable for use with zfs_dev_open. - */ -int -zfs_guid_to_unit(uint64_t guid) +static int +zfs_dev_init(void) { - spa_t *spa; - int unit; - - unit = 0; - STAILQ_FOREACH(spa, &zfs_pools, spa_link) { - if (spa->spa_guid == guid) - return unit; - unit++; - } - return (-1); + zfs_init(); + if (archsw.arch_zfs_probe == NULL) + return (ENXIO); + archsw.arch_zfs_probe(); + return (0); } -#if defined(__amd64__) || defined(__i386__) -static int -zfs_dev_init(void) +int +zfs_probe_dev(const char *devname, uint64_t *pool_guid) { - char devname[512]; - int unit, slice; + spa_t *spa; int fd; + int ret; - /* - * Open all the disks we can find and see if we can reconstruct - * ZFS pools from them. Bogusly assumes that the disks are named - * diskN, diskNpM or diskNsM. - */ - zfs_init(); - for (unit = 0; unit < MAXBDDEV; unit++) { - sprintf(devname, "disk%d:", unit); - fd = open(devname, O_RDONLY); - if (fd == -1) - continue; - - /* - * If we find a vdev, the zfs code will eat the fd, otherwise - * we close it. - */ - if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0)) - close(fd); - - for (slice = 1; slice <= 128; slice++) { - sprintf(devname, "disk%dp%d:", unit, slice); - fd = open(devname, O_RDONLY); - if (fd == -1) { - sprintf(devname, "disk%ds%d:", unit, slice); - fd = open(devname, O_RDONLY); - if (fd == -1) - continue; - } - if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0)) - close(fd); - } - } - + fd = open(devname, O_RDONLY); + if (fd == -1) + return (ENXIO); + ret = vdev_probe(vdev_read, (void *)(uintptr_t)fd, &spa); + if (ret != 0) + close(fd); + else if (pool_guid != NULL) + *pool_guid = spa->spa_guid; return (0); } -#endif /* * Print information about ZFS pools @@ -452,54 +403,52 @@ zfs_dev_print(int verbose) { spa_t *spa; char line[80]; - int unit; if (verbose) { spa_all_status(); return; } - unit = 0; STAILQ_FOREACH(spa, &zfs_pools, spa_link) { - sprintf(line, " zfs%d: %s\n", unit, spa->spa_name); + sprintf(line, " zfs:%s\n", spa->spa_name); pager_output(line); - unit++; } } /* * Attempt to open the pool described by (dev) for use by (f). */ -static int +static int zfs_dev_open(struct open_file *f, ...) { va_list args; - struct devdesc *dev; - int unit, i; + struct zfs_devdesc *dev; + struct zfsmount *mount; spa_t *spa; + int rv; va_start(args, f); - dev = va_arg(args, struct devdesc*); + dev = va_arg(args, struct zfs_devdesc *); va_end(args); - /* - * We mostly ignore the stuff that devopen sends us. For now, - * use the unit to find a pool - later we will override the - * devname parsing so that we can name a pool and a fs within - * the pool. - */ - unit = dev->d_unit; - - i = 0; - STAILQ_FOREACH(spa, &zfs_pools, spa_link) { - if (i == unit) - break; - i++; - } - if (!spa) { + spa = spa_find_by_guid(dev->pool_guid); + if (!spa) return (ENXIO); + rv = zfs_spa_init(spa); + if (rv != 0) + return (rv); + mount = malloc(sizeof(*mount)); + rv = zfs_mount(spa, dev->root_guid, mount); + if (rv != 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:22:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43BA41065726; Fri, 29 Jun 2012 10:22:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EF2C8FC08; Fri, 29 Jun 2012 10:22:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TAMa4h039661; Fri, 29 Jun 2012 10:22:36 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TAMZN4039659; Fri, 29 Jun 2012 10:22:35 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291022.q5TAMZN4039659@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237768 - stable/8/sys/boot/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:22:36 -0000 Author: avg Date: Fri Jun 29 10:22:35 2012 New Revision: 237768 URL: http://svn.freebsd.org/changeset/base/237768 Log: MFC r235330: zfs boot: try to set vfs.root.mountfrom from currdev as a fallback Modified: stable/8/sys/boot/common/boot.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/common/boot.c ============================================================================== --- stable/8/sys/boot/common/boot.c Fri Jun 29 10:22:20 2012 (r237767) +++ stable/8/sys/boot/common/boot.c Fri Jun 29 10:22:35 2012 (r237768) @@ -311,12 +311,12 @@ getrootmount(char *rootdev) if (getenv("vfs.root.mountfrom") != NULL) return(0); + error = 1; sprintf(lbuf, "%s/etc/fstab", rootdev); if ((fd = open(lbuf, O_RDONLY)) < 0) - return(1); + goto notfound; /* loop reading lines from /etc/fstab What was that about sscanf again? */ - error = 1; while (fgetstr(lbuf, sizeof(lbuf), fd) >= 0) { if ((lbuf[0] == 0) || (lbuf[0] == '#')) continue; @@ -377,6 +377,20 @@ getrootmount(char *rootdev) break; } close(fd); + +notfound: + if (error) { + const char *currdev; + + currdev = getenv("currdev"); + if (currdev != NULL && strncmp("zfs:", currdev, 4) == 0) { + cp = strdup(currdev); + cp[strlen(cp) - 1] = '\0'; + setenv("vfs.root.mountfrom", cp, 0); + error = 0; + } + } + return(error); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:28:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D28A106566C; Fri, 29 Jun 2012 10:28:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45CA38FC1C; Fri, 29 Jun 2012 10:28:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TASfaa040031; Fri, 29 Jun 2012 10:28:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TASfx0040027; Fri, 29 Jun 2012 10:28:41 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291028.q5TASfx0040027@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237769 - in stable/8: sys/boot/pc98/libpc98 sys/boot/zfs tools/tools/ath/common tools/tools/termcap tools/tools/zfsboottest X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:28:41 -0000 Author: avg Date: Fri Jun 29 10:28:40 2012 New Revision: 237769 URL: http://svn.freebsd.org/changeset/base/237769 Log: MFC r235392,235394,235395: fixes and cleanups for zfs boot MFC Modified: stable/8/sys/boot/pc98/libpc98/Makefile stable/8/sys/boot/zfs/zfs.c stable/8/tools/tools/zfsboottest/zfsboottest.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/tools/tools/ (props changed) stable/8/tools/tools/aac/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/cfi/ (props changed) stable/8/tools/tools/ether_reflect/ (props changed) stable/8/tools/tools/iwi/ (props changed) stable/8/tools/tools/mctest/ (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/ (props changed) stable/8/tools/tools/netrate/netblast/ (props changed) stable/8/tools/tools/netrate/netsend/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/umastat/ (props changed) stable/8/tools/tools/vimage/ (props changed) Modified: stable/8/sys/boot/pc98/libpc98/Makefile ============================================================================== --- stable/8/sys/boot/pc98/libpc98/Makefile Fri Jun 29 10:22:35 2012 (r237768) +++ stable/8/sys/boot/pc98/libpc98/Makefile Fri Jun 29 10:28:40 2012 (r237769) @@ -10,6 +10,8 @@ SRCS= bioscd.c biosdisk.c biosmem.c bios comconsole.c devicename.c elf32_freebsd.c \ i386_copy.c i386_module.c nullconsole.c pc98_sys.c pxe.c pxetramp.s \ time.c vidconsole.c +.PATH: ${.CURDIR}/../../zfs +SRCS+= devicename_stubs.c # Enable PXE TFTP or NFS support, not both. .if defined(LOADER_TFTP_SUPPORT) Modified: stable/8/sys/boot/zfs/zfs.c ============================================================================== --- stable/8/sys/boot/zfs/zfs.c Fri Jun 29 10:22:35 2012 (r237768) +++ stable/8/sys/boot/zfs/zfs.c Fri Jun 29 10:28:40 2012 (r237769) @@ -56,7 +56,6 @@ static int zfs_stat(struct open_file *f, static int zfs_readdir(struct open_file *f, struct dirent *d); struct devsw zfs_dev; -struct devsw zfs_dev_compat; struct fs_ops zfs_fsops = { "zfs", @@ -90,7 +89,7 @@ zfs_open(const char *upath, struct open_ struct file *fp; int rc; - if (f->f_dev != &zfs_dev && f->f_dev != &zfs_dev_compat) + if (f->f_dev != &zfs_dev) return (EINVAL); /* allocate file system specific data structure */ Modified: stable/8/tools/tools/zfsboottest/zfsboottest.c ============================================================================== --- stable/8/tools/tools/zfsboottest/zfsboottest.c Fri Jun 29 10:22:35 2012 (r237768) +++ stable/8/tools/tools/zfsboottest/zfsboottest.c Fri Jun 29 10:28:40 2012 (r237769) @@ -89,7 +89,11 @@ main(int argc, char** argv) char buf[512], hash[33]; MD5_CTX ctx; struct stat sb; + struct zfsmount zfsmnt; dnode_phys_t dn; +#if 0 + uint64_t rootobj; +#endif spa_t *spa; off_t off; ssize_t n; @@ -138,14 +142,28 @@ main(int argc, char** argv) exit(1); } - if (zfs_mount_pool(spa)) { - fprintf(stderr, "can't mount pool\n"); + if (zfs_spa_init(spa)) { + fprintf(stderr, "can't init pool\n"); exit(1); } +#if 0 + if (zfs_get_root(spa, &rootobj)) { + fprintf(stderr, "can't get root\n"); + exit(1); + } + + if (zfs_mount(spa, rootobj, &zfsmnt)) { +#else + if (zfs_mount(spa, 0, &zfsmnt)) { + fprintf(stderr, "can't mount\n"); + exit(1); + } +#endif + printf("\n"); for (++i, failures = 0; i < argc; i++) { - if (zfs_lookup(spa, argv[i], &dn)) { + if (zfs_lookup(&zfsmnt, argv[i], &dn)) { fprintf(stderr, "%s: can't lookup\n", argv[i]); failures++; continue; From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 10:31:27 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F9A310657C1; Fri, 29 Jun 2012 10:31:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 393378FC1F; Fri, 29 Jun 2012 10:31:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TAVRq5040294; Fri, 29 Jun 2012 10:31:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TAVRNM040291; Fri, 29 Jun 2012 10:31:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291031.q5TAVRNM040291@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 10:31:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237772 - stable/8/sys/boot/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 10:31:27 -0000 Author: avg Date: Fri Jun 29 10:31:26 2012 New Revision: 237772 URL: http://svn.freebsd.org/changeset/base/237772 Log: MFC r235390: zfs boot code: mark spa_t arguments as const where they are used as such Modified: stable/8/sys/boot/zfs/zfs.c stable/8/sys/boot/zfs/zfsimpl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/zfs/zfs.c ============================================================================== --- stable/8/sys/boot/zfs/zfs.c Fri Jun 29 10:30:59 2012 (r237771) +++ stable/8/sys/boot/zfs/zfs.c Fri Jun 29 10:31:26 2012 (r237772) @@ -127,7 +127,7 @@ zfs_close(struct open_file *f) static int zfs_read(struct open_file *f, void *start, size_t size, size_t *resid /* out */) { - spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; + const spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; struct file *fp = (struct file *)f->f_fsdata; struct stat sb; size_t n; @@ -201,7 +201,7 @@ zfs_seek(struct open_file *f, off_t offs static int zfs_stat(struct open_file *f, struct stat *sb) { - spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; + const spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; struct file *fp = (struct file *)f->f_fsdata; return (zfs_dnode_stat(spa, &fp->f_dnode, sb)); @@ -210,7 +210,7 @@ zfs_stat(struct open_file *f, struct sta static int zfs_readdir(struct open_file *f, struct dirent *d) { - spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; + const spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa; struct file *fp = (struct file *)f->f_fsdata; mzap_ent_phys_t mze; struct stat sb; Modified: stable/8/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/8/sys/boot/zfs/zfsimpl.c Fri Jun 29 10:30:59 2012 (r237771) +++ stable/8/sys/boot/zfs/zfsimpl.c Fri Jun 29 10:31:26 2012 (r237772) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); struct zfsmount { - spa_t *spa; + const spa_t *spa; objset_phys_t objset; uint64_t rootobj; }; @@ -63,7 +63,7 @@ static char *zfs_temp_buf, *zfs_temp_end #define TEMP_SIZE (1024 * 1024) -static int zio_read(spa_t *spa, const blkptr_t *bp, void *buf); +static int zio_read(const spa_t *spa, const blkptr_t *bp, void *buf); static void zfs_init(void) @@ -981,7 +981,7 @@ ilog2(int n) } static int -zio_read_gang(spa_t *spa, const blkptr_t *bp, void *buf) +zio_read_gang(const spa_t *spa, const blkptr_t *bp, void *buf) { blkptr_t gbh_bp; zio_gbh_phys_t zio_gb; @@ -1018,7 +1018,7 @@ zio_read_gang(spa_t *spa, const blkptr_t } static int -zio_read(spa_t *spa, const blkptr_t *bp, void *buf) +zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) { int cpfunc = BP_GET_COMPRESS(bp); uint64_t align, size; @@ -1078,7 +1078,7 @@ zio_read(spa_t *spa, const blkptr_t *bp, } static int -dnode_read(spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_t buflen) +dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_t buflen) { int ibshift = dnode->dn_indblkshift - SPA_BLKPTRSHIFT; int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; @@ -1141,7 +1141,7 @@ dnode_read(spa_t *spa, const dnode_phys_ * scratch buffer contains the directory contents. */ static int -mzap_lookup(spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t *value) +mzap_lookup(const dnode_phys_t *dnode, const char *name, uint64_t *value) { const mzap_phys_t *mz; const mzap_ent_phys_t *mze; @@ -1222,7 +1222,7 @@ fzap_leaf_value(const zap_leaf_t *zl, co * buffer contains the directory header. */ static int -fzap_lookup(spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t *value) +fzap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t *value) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; zap_phys_t zh = *(zap_phys_t *) zap_scratch; @@ -1300,7 +1300,7 @@ fzap_lookup(spa_t *spa, const dnode_phys * Lookup a name in a zap object and return its value as a uint64_t. */ static int -zap_lookup(spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t *value) +zap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t *value) { int rc; uint64_t zap_type; @@ -1312,7 +1312,7 @@ zap_lookup(spa_t *spa, const dnode_phys_ zap_type = *(uint64_t *) zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_lookup(spa, dnode, name, value); + return mzap_lookup(dnode, name, value); else if (zap_type == ZBT_HEADER) return fzap_lookup(spa, dnode, name, value); printf("ZFS: invalid zap_type=%d\n", (int)zap_type); @@ -1326,7 +1326,7 @@ zap_lookup(spa_t *spa, const dnode_phys_ * the directory contents. */ static int -mzap_list(spa_t *spa, const dnode_phys_t *dnode) +mzap_list(const dnode_phys_t *dnode) { const mzap_phys_t *mz; const mzap_ent_phys_t *mze; @@ -1356,7 +1356,7 @@ mzap_list(spa_t *spa, const dnode_phys_t * the directory header. */ static int -fzap_list(spa_t *spa, const dnode_phys_t *dnode) +fzap_list(const spa_t *spa, const dnode_phys_t *dnode) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; zap_phys_t zh = *(zap_phys_t *) zap_scratch; @@ -1395,7 +1395,7 @@ fzap_list(spa_t *spa, const dnode_phys_t namelen = zc->l_entry.le_name_length; if (namelen > sizeof(name)) namelen = sizeof(name); - + /* * Paste the name back together. */ @@ -1429,7 +1429,7 @@ fzap_list(spa_t *spa, const dnode_phys_t * List a zap directory. */ static int -zap_list(spa_t *spa, const dnode_phys_t *dnode) +zap_list(const spa_t *spa, const dnode_phys_t *dnode) { uint64_t zap_type; size_t size = dnode->dn_datablkszsec * 512; @@ -1439,7 +1439,7 @@ zap_list(spa_t *spa, const dnode_phys_t zap_type = *(uint64_t *) zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_list(spa, dnode); + return mzap_list(dnode); else return fzap_list(spa, dnode); } @@ -1447,7 +1447,7 @@ zap_list(spa_t *spa, const dnode_phys_t #endif static int -objset_get_dnode(spa_t *spa, const objset_phys_t *os, uint64_t objnum, dnode_phys_t *dnode) +objset_get_dnode(const spa_t *spa, const objset_phys_t *os, uint64_t objnum, dnode_phys_t *dnode) { off_t offset; @@ -1457,7 +1457,7 @@ objset_get_dnode(spa_t *spa, const objse } static int -mzap_rlookup(spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) +mzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) { const mzap_phys_t *mz; const mzap_ent_phys_t *mze; @@ -1510,7 +1510,7 @@ fzap_name_copy(const zap_leaf_t *zl, con } static int -fzap_rlookup(spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) +fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; zap_phys_t zh = *(zap_phys_t *) zap_scratch; @@ -1585,7 +1585,7 @@ fzap_rlookup(spa_t *spa, const dnode_phy } static int -zap_rlookup(spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) +zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value) { int rc; uint64_t zap_type; @@ -1603,7 +1603,7 @@ zap_rlookup(spa_t *spa, const dnode_phys } static int -zfs_rlookup(spa_t *spa, uint64_t objnum, char *result) +zfs_rlookup(const spa_t *spa, uint64_t objnum, char *result) { char name[256]; char component[256]; @@ -1661,7 +1661,7 @@ zfs_rlookup(spa_t *spa, uint64_t objnum, } static int -zfs_lookup_dataset(spa_t *spa, const char *name, uint64_t *objnum) +zfs_lookup_dataset(const spa_t *spa, const char *name, uint64_t *objnum) { char element[256]; uint64_t dir_obj, child_dir_zapobj; @@ -1714,7 +1714,7 @@ zfs_lookup_dataset(spa_t *spa, const cha * and return its details in *objset */ static int -zfs_mount_dataset(spa_t *spa, uint64_t objnum, objset_phys_t *objset) +zfs_mount_dataset(const spa_t *spa, uint64_t objnum, objset_phys_t *objset) { dnode_phys_t dataset; dsl_dataset_phys_t *ds; @@ -1739,7 +1739,7 @@ zfs_mount_dataset(spa_t *spa, uint64_t o * dataset if there is none and return its details in *objset */ static int -zfs_get_root(spa_t *spa, uint64_t *objid) +zfs_get_root(const spa_t *spa, uint64_t *objid) { dnode_phys_t dir, propdir; uint64_t props, bootfs, root; @@ -1784,7 +1784,7 @@ zfs_get_root(spa_t *spa, uint64_t *objid } static int -zfs_mount(spa_t *spa, uint64_t rootobj, struct zfsmount *mount) +zfs_mount(const spa_t *spa, uint64_t rootobj, struct zfsmount *mount) { mount->spa = spa; @@ -1822,7 +1822,7 @@ zfs_spa_init(spa_t *spa) } static int -zfs_dnode_stat(spa_t *spa, dnode_phys_t *dn, struct stat *sb) +zfs_dnode_stat(const spa_t *spa, dnode_phys_t *dn, struct stat *sb) { if (dn->dn_bonustype != DMU_OT_SA) { @@ -1881,7 +1881,7 @@ zfs_lookup(const struct zfsmount *mount, { int rc; uint64_t objnum, rootnum, parentnum; - spa_t *spa; + const spa_t *spa; dnode_phys_t dn; const char *p, *q; char element[256]; From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 13:02:46 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAF5F106566B; Fri, 29 Jun 2012 13:02:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4FF28FC0A; Fri, 29 Jun 2012 13:02:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TD2kML047172; Fri, 29 Jun 2012 13:02:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TD2krY047170; Fri, 29 Jun 2012 13:02:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206291302.q5TD2krY047170@svn.freebsd.org> From: Andriy Gapon Date: Fri, 29 Jun 2012 13:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237779 - stable/8/sys/boot X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 13:02:46 -0000 Author: avg Date: Fri Jun 29 13:02:46 2012 New Revision: 237779 URL: http://svn.freebsd.org/changeset/base/237779 Log: fix a mismerge in r237765 sys/boot stable/8 doesn't have Makefile.spac64, instead it has spar64-specific blocks in Makefile. This is a direct commit. Pointyhat to: avg Modified: stable/8/sys/boot/Makefile Modified: stable/8/sys/boot/Makefile ============================================================================== --- stable/8/sys/boot/Makefile Fri Jun 29 13:00:28 2012 (r237778) +++ stable/8/sys/boot/Makefile Fri Jun 29 13:02:46 2012 (r237779) @@ -22,7 +22,7 @@ SUBDIR+= ofw SUBDIR+= uboot .endif -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || ${MACHINE_ARCH} == "sparc64" SUBDIR+= zfs .endif From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 14:14:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5082D1065672; Fri, 29 Jun 2012 14:14:50 +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 321CA8FC0C; Fri, 29 Jun 2012 14:14:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TEEogm050113; Fri, 29 Jun 2012 14:14:50 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TEEnnn050111; Fri, 29 Jun 2012 14:14:50 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201206291414.q5TEEnnn050111@svn.freebsd.org> From: Peter Holm Date: Fri, 29 Jun 2012 14:14:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237780 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 14:14:50 -0000 Author: pho Date: Fri Jun 29 14:14:49 2012 New Revision: 237780 URL: http://svn.freebsd.org/changeset/base/237780 Log: MFC: r237219 In tty_makedev() the following construction: dev = make_dev_cred(); dev->si_drv1 = tp; leaves a small window where the newly created device may be opened and si_drv1 is NULL. As this is a vary rare situation, using a lock to close the window seems overkill. Instead just wait for the assignment of si_drv1. Modified: stable/8/sys/kern/tty.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/tty.c ============================================================================== --- stable/8/sys/kern/tty.c Fri Jun 29 13:02:46 2012 (r237779) +++ stable/8/sys/kern/tty.c Fri Jun 29 14:14:49 2012 (r237780) @@ -216,9 +216,15 @@ ttydev_leave(struct tty *tp) static int ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { - struct tty *tp = dev->si_drv1; + struct tty *tp; int error = 0; + while ((tp = dev->si_drv1) == NULL) { + error = tsleep(&dev->si_drv1, PCATCH, "ttdrv1", 1); + if (error != EWOULDBLOCK) + return (error); + } + tty_lock(tp); if (tty_gone(tp)) { /* Device is already gone. */ @@ -726,9 +732,14 @@ static struct cdevsw ttydev_cdevsw = { static int ttyil_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { - struct tty *tp = dev->si_drv1; + struct tty *tp; int error = 0; + while ((tp = dev->si_drv1) == NULL) { + error = tsleep(&dev->si_drv1, PCATCH, "ttdrv1", 1); + if (error != EWOULDBLOCK) + return (error); + } tty_lock(tp); if (tty_gone(tp)) error = ENODEV; @@ -1166,6 +1177,7 @@ tty_makedev(struct tty *tp, struct ucred dev = make_dev_cred(&ttydev_cdevsw, 0, cred, uid, gid, mode, "%s%s", prefix, name); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); tp->t_dev = dev; /* Slave call-in devices. */ @@ -1174,12 +1186,14 @@ tty_makedev(struct tty *tp, struct ucred uid, gid, mode, "%s%s.init", prefix, name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_init_in; dev = make_dev_cred(&ttyil_cdevsw, 0, cred, uid, gid, mode, "%s%s.lock", prefix, name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_lock_in; } @@ -1189,6 +1203,7 @@ tty_makedev(struct tty *tp, struct ucred UID_UUCP, GID_DIALER, 0660, "cua%s", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); /* Slave call-out devices. */ if (tp->t_flags & TF_INITLOCK) { @@ -1196,12 +1211,14 @@ tty_makedev(struct tty *tp, struct ucred UID_UUCP, GID_DIALER, 0660, "cua%s.init", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_init_out; dev = make_dev_cred(&ttyil_cdevsw, 0, cred, UID_UUCP, GID_DIALER, 0660, "cua%s.lock", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_lock_out; } } From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 15:24:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 858E2106585F; Fri, 29 Jun 2012 15:24:56 +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 DE8EF8FC15; Fri, 29 Jun 2012 15:24:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TFOtYe053511; Fri, 29 Jun 2012 15:24:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TFOtqL053508; Fri, 29 Jun 2012 15:24:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291524.q5TFOtqL053508@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 15:24:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237790 - stable/8/usr.bin/kdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 15:24:58 -0000 Author: jhb Date: Fri Jun 29 15:24:55 2012 New Revision: 237790 URL: http://svn.freebsd.org/changeset/base/237790 Log: MFC 236577: Allow the -p argument to kdump to accept either a PID or a thread ID. Modified: stable/8/usr.bin/kdump/kdump.1 stable/8/usr.bin/kdump/kdump.c Directory Properties: stable/8/usr.bin/kdump/ (props changed) Modified: stable/8/usr.bin/kdump/kdump.1 ============================================================================== --- stable/8/usr.bin/kdump/kdump.1 Fri Jun 29 15:24:46 2012 (r237789) +++ stable/8/usr.bin/kdump/kdump.1 Fri Jun 29 15:24:55 2012 (r237790) @@ -32,7 +32,7 @@ .\" @(#)kdump.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 20, 2012 +.Dd June 4, 2012 .Dt KDUMP 1 .Os .Sh NAME @@ -90,9 +90,9 @@ string. Suppressing this feature yields a more consistent output format and is easily amenable to further processing. .It Fl p Ar pid -Display only trace events that correspond to the process +Display only trace events that correspond to the process or thread .Ar pid . -This may be useful when there are multiple processes recorded in the +This may be useful when there are multiple processes or threads recorded in the same trace file. .It Fl R Display relative timestamps (time since previous entry). Modified: stable/8/usr.bin/kdump/kdump.c ============================================================================== --- stable/8/usr.bin/kdump/kdump.c Fri Jun 29 15:24:46 2012 (r237789) +++ stable/8/usr.bin/kdump/kdump.c Fri Jun 29 15:24:55 2012 (r237790) @@ -253,7 +253,8 @@ main(int argc, char *argv[]) } } if (trpoints & (1< Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8FC531065679; Fri, 29 Jun 2012 16:30:16 +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 6FD7D8FC0A; Fri, 29 Jun 2012 16:30:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TGUGne056499; Fri, 29 Jun 2012 16:30:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TGUGse056497; Fri, 29 Jun 2012 16:30:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291630.q5TGUGse056497@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 16:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237798 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 16:30:16 -0000 Author: jhb Date: Fri Jun 29 16:30:15 2012 New Revision: 237798 URL: http://svn.freebsd.org/changeset/base/237798 Log: MFC 237008,237271,237272,237673: - Fix a couple of bugs that prevented windows in PCI-PCI bridges from growing "downward" (moving the start address down). First, an off by one error caused the end address to be moved down an extra alignment chunk unnecessarily. Second, when aligning the new candidate starting address, the wrong bits were masked off. - Add a 'wmask' variable to hold the expression '(1ul << w->step) - 1' in pcib_grow_window(). - For subtractively decoding bridges, don't try to grow windows but pass the request up the tree in order to be on the safe side. Growing windows in this case would mean to switch resources to positive decoding and it's unclear how to correctly handle this. At least with ALi/ULi M5249 PCI-PCI bridges, this also just doesn't work out of the box. Modified: stable/8/sys/dev/pci/pci_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/pci/pci_pci.c ============================================================================== --- stable/8/sys/dev/pci/pci_pci.c Fri Jun 29 16:29:38 2012 (r237797) +++ stable/8/sys/dev/pci/pci_pci.c Fri Jun 29 16:30:15 2012 (r237798) @@ -695,7 +695,7 @@ static int pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type, u_long start, u_long end, u_long count, u_int flags) { - u_long align, start_free, end_free, front, back; + u_long align, start_free, end_free, front, back, wmask; int error, rid; /* @@ -708,6 +708,7 @@ pcib_grow_window(struct pcib_softc *sc, end = w->rman.rm_end; if (start + count - 1 > end || start + count < start) return (EINVAL); + wmask = (1ul << w->step) - 1; /* * If there is no resource at all, just try to allocate enough @@ -718,8 +719,8 @@ pcib_grow_window(struct pcib_softc *sc, flags &= ~RF_ALIGNMENT_MASK; flags |= RF_ALIGNMENT_LOG2(w->step); } - start &= ~((1ul << w->step) - 1); - end |= ((1ul << w->step) - 1); + start &= ~wmask; + end |= wmask; count = roundup2(count, 1ul << w->step); rid = w->reg; w->res = bus_alloc_resource(sc->dev, type, &rid, start, end, @@ -773,9 +774,9 @@ pcib_grow_window(struct pcib_softc *sc, if (start < rman_get_start(w->res)) { if (rman_first_free_region(&w->rman, &start_free, &end_free) != 0 || start_free != rman_get_start(w->res)) - end_free = rman_get_start(w->res) - 1; + end_free = rman_get_start(w->res); if (end_free > end) - end_free = end; + end_free = end + 1; /* Move end_free down until it is properly aligned. */ end_free &= ~(align - 1); @@ -793,7 +794,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tfront candidate range: %#lx-%#lx\n", front, end_free); - front &= (1ul << w->step) - 1; + front &= ~wmask; front = rman_get_start(w->res) - front; } else front = 0; @@ -821,7 +822,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tback candidate range: %#lx-%#lx\n", start_free, back); - back = roundup2(back + 1, 1ul << w->step) - 1; + back |= wmask; back -= rman_get_end(w->res); } else back = 0; @@ -880,10 +881,8 @@ updatewin: /* Save the new window. */ w->base = rman_get_start(w->res); w->limit = rman_get_end(w->res); - KASSERT((w->base & ((1ul << w->step) - 1)) == 0, - ("start address is not aligned")); - KASSERT((w->limit & ((1ul << w->step) - 1)) == (1ul << w->step) - 1, - ("end address is not aligned")); + KASSERT((w->base & wmask) == 0, ("start address is not aligned")); + KASSERT((w->limit & wmask) == wmask, ("end address is not aligned")); pcib_write_windows(sc, w->mask); return (0); } @@ -919,7 +918,7 @@ pcib_alloc_resource(device_t dev, device case SYS_RES_IOPORT: r = pcib_suballoc_resource(sc, &sc->io, child, type, rid, start, end, count, flags); - if (r != NULL) + if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) break; if (pcib_grow_window(sc, &sc->io, type, start, end, count, flags) == 0) @@ -943,7 +942,7 @@ pcib_alloc_resource(device_t dev, device } r = pcib_suballoc_resource(sc, &sc->mem, child, type, rid, start, end, count, flags); - if (r != NULL) + if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) break; if (flags & RF_PREFETCHABLE) { if (pcib_grow_window(sc, &sc->pmem, type, start, end, From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 17:12:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC313106570F; Fri, 29 Jun 2012 17:12:26 +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 A6B6F8FC16; Fri, 29 Jun 2012 17:12:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5THCQd1058503; Fri, 29 Jun 2012 17:12:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5THCQ9U058501; Fri, 29 Jun 2012 17:12:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291712.q5THCQ9U058501@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 17:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237804 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 17:12:26 -0000 Author: jhb Date: Fri Jun 29 17:12:26 2012 New Revision: 237804 URL: http://svn.freebsd.org/changeset/base/237804 Log: MFC 237334: Move the per-thread deferred user map entries list into a private list in vm_map_process_deferred() which is then iterated to release map entries. This avoids having a nested vm map unlock operation called from the loop body attempt to recuse into vm_map_process_deferred(). This can happen if the vm_map_remove() triggers the OOM killer. Modified: stable/8/sys/vm/vm_map.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/vm/vm_map.c ============================================================================== --- stable/8/sys/vm/vm_map.c Fri Jun 29 17:12:03 2012 (r237803) +++ stable/8/sys/vm/vm_map.c Fri Jun 29 17:12:26 2012 (r237804) @@ -457,13 +457,15 @@ static void vm_map_process_deferred(void) { struct thread *td; - vm_map_entry_t entry; + vm_map_entry_t entry, next; td = curthread; - - while ((entry = td->td_map_def_user) != NULL) { - td->td_map_def_user = entry->next; + entry = td->td_map_def_user; + td->td_map_def_user = NULL; + while (entry != NULL) { + next = entry->next; vm_map_entry_deallocate(entry, FALSE); + entry = next; } } From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 17:21:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 722211065687; Fri, 29 Jun 2012 17:21:47 +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 5C82A8FC12; Fri, 29 Jun 2012 17:21:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5THLl0e058978; Fri, 29 Jun 2012 17:21:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5THLlG6058974; Fri, 29 Jun 2012 17:21:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291721.q5THLlG6058974@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 17:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237806 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 17:21:47 -0000 Author: jhb Date: Fri Jun 29 17:21:46 2012 New Revision: 237806 URL: http://svn.freebsd.org/changeset/base/237806 Log: MFC 233191: Fix madvise(MADV_WILLNEED) to properly handle individual mappings larger than 4GB. Specifically, the inlined version of 'ptoa' of the the 'int' count of pages overflowed on 64-bit platforms. While here, change vm_object_madvise() to accept two vm_pindex_t parameters (start and end) rather than a (start, count) tuple to match other VM APIs as suggested by alc@. Modified: stable/8/sys/vm/vm_map.c stable/8/sys/vm/vm_object.c stable/8/sys/vm/vm_object.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/vm/vm_map.c ============================================================================== --- stable/8/sys/vm/vm_map.c Fri Jun 29 17:21:19 2012 (r237805) +++ stable/8/sys/vm/vm_map.c Fri Jun 29 17:21:46 2012 (r237806) @@ -2085,8 +2085,7 @@ vm_map_madvise( } vm_map_unlock(map); } else { - vm_pindex_t pindex; - int count; + vm_pindex_t pstart, pend; /* * madvise behaviors that are implemented in the underlying @@ -2104,30 +2103,29 @@ vm_map_madvise( if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; - pindex = OFF_TO_IDX(current->offset); - count = atop(current->end - current->start); + pstart = OFF_TO_IDX(current->offset); + pend = pstart + atop(current->end - current->start); useStart = current->start; if (current->start < start) { - pindex += atop(start - current->start); - count -= atop(start - current->start); + pstart += atop(start - current->start); useStart = start; } if (current->end > end) - count -= atop(current->end - end); + pend -= atop(current->end - end); - if (count <= 0) + if (pstart >= pend) continue; - vm_object_madvise(current->object.vm_object, - pindex, count, behav); + vm_object_madvise(current->object.vm_object, pstart, + pend, behav); if (behav == MADV_WILLNEED) { vm_map_pmap_enter(map, useStart, current->protection, current->object.vm_object, - pindex, - (count << PAGE_SHIFT), + pstart, + ptoa(pend - pstart), MAP_PREFAULT_MADVISE ); } Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Fri Jun 29 17:21:19 2012 (r237805) +++ stable/8/sys/vm/vm_object.c Fri Jun 29 17:21:46 2012 (r237806) @@ -1056,16 +1056,16 @@ vm_object_sync(vm_object_t object, vm_oo * without I/O. */ void -vm_object_madvise(vm_object_t object, vm_pindex_t pindex, int count, int advise) +vm_object_madvise(vm_object_t object, vm_pindex_t pindex, vm_pindex_t end, + int advise) { - vm_pindex_t end, tpindex; + vm_pindex_t tpindex; vm_object_t backing_object, tobject; vm_page_t m; if (object == NULL) return; VM_OBJECT_LOCK(object); - end = pindex + count; /* * Locate and adjust resident pages */ Modified: stable/8/sys/vm/vm_object.h ============================================================================== --- stable/8/sys/vm/vm_object.h Fri Jun 29 17:21:19 2012 (r237805) +++ stable/8/sys/vm/vm_object.h Fri Jun 29 17:21:46 2012 (r237806) @@ -218,6 +218,7 @@ void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); +void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); void vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end); boolean_t vm_object_page_clean(vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); @@ -230,7 +231,6 @@ void vm_object_shadow (vm_object_t *, vm void vm_object_split(vm_map_entry_t); boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t, boolean_t); -void vm_object_madvise (vm_object_t, vm_pindex_t, int, int); #endif /* _KERNEL */ #endif /* _VM_OBJECT_ */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 17:28:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21FA3106566C; Fri, 29 Jun 2012 17:28:04 +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 0BFF38FC12; Fri, 29 Jun 2012 17:28:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5THS3Nf059369; Fri, 29 Jun 2012 17:28:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5THS3Vl059366; Fri, 29 Jun 2012 17:28:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291728.q5THS3Vl059366@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 17:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237808 - in stable/8/etc/periodic: daily security X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 17:28:04 -0000 Author: jhb Date: Fri Jun 29 17:28:03 2012 New Revision: 237808 URL: http://svn.freebsd.org/changeset/base/237808 Log: MFC 197552: Silence warning printed by getfsspec(3) when /etc/fstab does not exist fstab: /etc/fstab:0: No such file or directory and from dump(8) when setfsent(3) fails due to /etc/fstab not existing: DUMP: Can't open /etc/fstab for dump table information: No such... This makes daily and security periodic runs somewhat cleaner in jails which lack /etc/fstab files. Modified: stable/8/etc/periodic/daily/400.status-disks stable/8/etc/periodic/security/200.chkmounts Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/periodic/daily/400.status-disks ============================================================================== --- stable/8/etc/periodic/daily/400.status-disks Fri Jun 29 17:26:37 2012 (r237807) +++ stable/8/etc/periodic/daily/400.status-disks Fri Jun 29 17:28:03 2012 (r237808) @@ -19,6 +19,9 @@ case "$daily_status_disks_enable" in df $daily_status_disks_df_flags && rc=1 || rc=3 # display which filesystems need backing up + if ! [ -f /etc/fstab ]; then + export PATH_FSTAB=/dev/null + fi echo "" dump W || rc=3;; Modified: stable/8/etc/periodic/security/200.chkmounts ============================================================================== --- stable/8/etc/periodic/security/200.chkmounts Fri Jun 29 17:26:37 2012 (r237807) +++ stable/8/etc/periodic/security/200.chkmounts Fri Jun 29 17:28:03 2012 (r237808) @@ -50,6 +50,9 @@ case "$daily_status_security_chkmounts_e ignore="${ignore}|^amd:" esac [ -n "$ignore" ] && cmd="egrep -v ${ignore#|}" || cmd=cat + if ! [ -f /etc/fstab ]; then + export PATH_FSTAB=/dev/null + fi mount -p | sort | ${cmd} | check_diff mount - "${host} changes in mounted filesystems:" rc=$?;; From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 17:28:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45CB710657BB; Fri, 29 Jun 2012 17:28:59 +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 2D5FC8FC1A; Fri, 29 Jun 2012 17:28:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5THSxK0059501; Fri, 29 Jun 2012 17:28:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5THSwnw059499; Fri, 29 Jun 2012 17:28:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291728.q5THSwnw059499@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 17:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237810 - stable/8/etc/periodic/daily X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 17:28:59 -0000 Author: jhb Date: Fri Jun 29 17:28:58 2012 New Revision: 237810 URL: http://svn.freebsd.org/changeset/base/237810 Log: MFC 237337: Only output a list of file systems that need to be dumped if the system has a non-empty dumpdates file. Modified: stable/8/etc/periodic/daily/400.status-disks Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/periodic/daily/400.status-disks ============================================================================== --- stable/8/etc/periodic/daily/400.status-disks Fri Jun 29 17:28:48 2012 (r237809) +++ stable/8/etc/periodic/daily/400.status-disks Fri Jun 29 17:28:58 2012 (r237810) @@ -19,12 +19,15 @@ case "$daily_status_disks_enable" in df $daily_status_disks_df_flags && rc=1 || rc=3 # display which filesystems need backing up - if ! [ -f /etc/fstab ]; then - export PATH_FSTAB=/dev/null - fi + if [ -s /etc/dumpdates ]; then + if ! [ -f /etc/fstab ]; then + export PATH_FSTAB=/dev/null + fi - echo "" - dump W || rc=3;; + echo "" + dump W || rc=3 + fi + ;; *) rc=0;; esac From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 18:39:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D72F1065744; Fri, 29 Jun 2012 18:39:31 +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 DBE978FC1A; Fri, 29 Jun 2012 18:39:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TIdVki063940; Fri, 29 Jun 2012 18:39:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TIdVlT063938; Fri, 29 Jun 2012 18:39:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206291839.q5TIdVlT063938@svn.freebsd.org> From: Marius Strobl Date: Fri, 29 Jun 2012 18:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237816 - stable/8/sys/boot/sparc64/loader X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 18:39:33 -0000 Author: marius Date: Fri Jun 29 18:39:31 2012 New Revision: 237816 URL: http://svn.freebsd.org/changeset/base/237816 Log: MFC: r236581 The loaddev environment variable is not modifiable once set, so it is not update for ZFS. It seems that this does not really affect anything except the help command. Nevertheless, rearrange things so loaddev is set only once in all cases in order to get it right. Pointed out by: avg Modified: stable/8/sys/boot/sparc64/loader/main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/8/sys/boot/sparc64/loader/main.c Fri Jun 29 18:39:22 2012 (r237815) +++ stable/8/sys/boot/sparc64/loader/main.c Fri Jun 29 18:39:31 2012 (r237816) @@ -155,6 +155,7 @@ static int is_sun4v = 0; static vm_offset_t curkva = 0; static vm_offset_t heapva; +static char bootpath[64]; static phandle_t root; /* @@ -847,7 +848,7 @@ sparc64_zfs_probe(void) /* Get the GUID of the ZFS pool on the boot device. */ guid = 0; - zfs_probe_dev(getenv("currdev"), &guid); + zfs_probe_dev(bootpath, &guid); for (unit = 0; unit < MAXDEV; unit++) { /* Find freebsd-zfs slices in the VTOC. */ @@ -864,7 +865,7 @@ sparc64_zfs_probe(void) for (part = 0; part < 8; part++) { if (part == 2 || vtoc.part[part].tag != - VTOC_TAG_FREEBSD_ZFS) + VTOC_TAG_FREEBSD_ZFS) continue; sprintf(devname, "disk%d:%c", unit, part + 'a'); if (zfs_probe_dev(devname, NULL) == ENXIO) @@ -877,11 +878,9 @@ sparc64_zfs_probe(void) zfs_currdev.root_guid = 0; zfs_currdev.d_dev = &zfs_dev; zfs_currdev.d_type = zfs_currdev.d_dev->dv_type; - /* Update the environment for ZFS. */ - env_setenv("currdev", EV_VOLATILE, zfs_fmtdev(&zfs_currdev), - ofw_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, zfs_fmtdev(&zfs_currdev), - env_noset, env_nounset); + (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev), + sizeof(bootpath) - 1); + bootpath[sizeof(bootpath) - 1] = '\0'; } } #endif /* LOADER_ZFS_SUPPORT */ @@ -889,7 +888,6 @@ sparc64_zfs_probe(void) int main(int (*openfirm)(void *)) { - char bootpath[64]; char compatible[32]; struct devsw **dp; @@ -949,16 +947,11 @@ main(int (*openfirm)(void *)) */ if (bootpath[strlen(bootpath) - 2] == ':' && bootpath[strlen(bootpath) - 1] == 'f' && - strstr(bootpath, "cdrom")) { + strstr(bootpath, "cdrom") != NULL) { bootpath[strlen(bootpath) - 1] = 'a'; printf("Boot path set to %s\n", bootpath); } - env_setenv("currdev", EV_VOLATILE, bootpath, - ofw_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, bootpath, - env_noset, env_nounset); - /* * Initialize devices. */ @@ -966,6 +959,15 @@ main(int (*openfirm)(void *)) if ((*dp)->dv_init != 0) (*dp)->dv_init(); + /* + * Now that sparc64_zfs_probe() might have altered bootpath, + * export it. + */ + env_setenv("currdev", EV_VOLATILE, bootpath, + ofw_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, bootpath, + env_noset, env_nounset); + printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 29 21:25:25 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00D4E1065740; Fri, 29 Jun 2012 21:25:25 +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 DC7E98FC17; Fri, 29 Jun 2012 21:25:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TLPOiw071107; Fri, 29 Jun 2012 21:25:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TLPOid071099; Fri, 29 Jun 2012 21:25:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206292125.q5TLPOid071099@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 21:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237823 - in stable/8: share/man/man4 sys/amd64/acpica sys/dev/acpica sys/i386/acpica X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 21:25:25 -0000 Author: jhb Date: Fri Jun 29 21:25:24 2012 New Revision: 237823 URL: http://svn.freebsd.org/changeset/base/237823 Log: MFC 235024,235029,235556,235834,235845: Use MADT to match ACPI Processor objects to CPUs. MADT and DSDT/SSDTs may list CPUs in different orders, especially for disabled logical cores. Now we match ACPI IDs from the MADT with Processor objects, strictly order CPUs accordingly, and ignore disabled cores. This prevents us from executing methods for other CPUs, e. g., _PSS for disabled logical core, which may not exist. Unfortunately, it is known that there are a few systems with buggy BIOSes that do not have unique ACPI IDs for MADT and Processor objects. To work around these problems, 'debug.acpi.cpu_unordered' tunable is added. Set this to a non-zero value to restore the old behavior. Modified: stable/8/share/man/man4/acpi.4 stable/8/sys/amd64/acpica/acpi_machdep.c stable/8/sys/dev/acpica/acpi_cpu.c stable/8/sys/dev/acpica/acpi_ec.c stable/8/sys/dev/acpica/acpi_smbat.c stable/8/sys/dev/acpica/acpivar.h stable/8/sys/i386/acpica/acpi_machdep.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/share/man/man4/acpi.4 ============================================================================== --- stable/8/share/man/man4/acpi.4 Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/share/man/man4/acpi.4 Fri Jun 29 21:25:24 2012 (r237823) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2012 +.Dd May 4, 2012 .Dt ACPI 4 .Os .Sh NAME @@ -198,6 +198,11 @@ entry for access after boot. Enables loading of a custom ACPI DSDT. .It Va acpi_dsdt_name Name of the DSDT table to load, if loading is enabled. +.It Va debug.acpi.cpu_unordered +Do not use the MADT to match ACPI Processor objects to CPUs. +This is needed on a few systems with a buggy BIOS that does not use +consistent processor IDs. +Default is 0 (disabled). .It Va debug.acpi.disabled Selectively disables portions of ACPI for debugging purposes. .It Va debug.acpi.interpreter_slack Modified: stable/8/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- stable/8/sys/amd64/acpica/acpi_machdep.c Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/sys/amd64/acpica/acpi_machdep.c Fri Jun 29 21:25:24 2012 (r237823) @@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$"); #include -SYSCTL_DECL(_debug_acpi); - int acpi_resume_beep; TUNABLE_INT("debug.acpi.resume_beep", &acpi_resume_beep); SYSCTL_INT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RW, &acpi_resume_beep, Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/sys/dev/acpica/acpi_cpu.c Fri Jun 29 21:25:24 2012 (r237823) @@ -121,6 +121,13 @@ struct acpi_cpu_device { #define PIIX4_STOP_BREAK_MASK (PIIX4_BRLD_EN_IRQ0 | PIIX4_BRLD_EN_IRQ | PIIX4_BRLD_EN_IRQ8) #define PIIX4_PCNTRL_BST_EN (1<<10) +/* Allow users to ignore processor orders in MADT. */ +static int cpu_unordered; +TUNABLE_INT("debug.acpi.cpu_unordered", &cpu_unordered); +SYSCTL_INT(_debug_acpi, OID_AUTO, cpu_unordered, CTLFLAG_RDTUN, + &cpu_unordered, 0, + "Do not use the MADT to match ACPI Processor objects to CPUs."); + /* Platform hardware resource information. */ static uint32_t cpu_smi_cmd; /* Value to write to SMI_CMD. */ static uint8_t cpu_cst_cnt; /* Indicate we are _CST aware. */ @@ -145,7 +152,7 @@ static int acpi_cpu_probe(device_t dev); static int acpi_cpu_attach(device_t dev); static int acpi_cpu_suspend(device_t dev); static int acpi_cpu_resume(device_t dev); -static int acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, +static int acpi_pcpu_get_id(device_t dev, uint32_t *acpi_id, uint32_t *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, @@ -242,7 +249,7 @@ acpi_cpu_probe(device_t dev) */ acpi_id = obj->Processor.ProcId; AcpiOsFree(obj); - if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0) + if (acpi_pcpu_get_id(dev, &acpi_id, &cpu_id) != 0) return (ENXIO); /* @@ -433,36 +440,66 @@ acpi_cpu_resume(device_t dev) } /* - * Find the nth present CPU and return its pc_cpuid as well as set the - * pc_acpi_id from the most reliable source. + * Find the processor associated with a given ACPI ID. By default, + * use the MADT to map ACPI IDs to APIC IDs and use that to locate a + * processor. Some systems have inconsistent ASL and MADT however. + * For these systems the cpu_unordered tunable can be set in which + * case we assume that Processor objects are listed in the same order + * in both the MADT and ASL. */ static int -acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, uint32_t *cpu_id) +acpi_pcpu_get_id(device_t dev, uint32_t *acpi_id, uint32_t *cpu_id) { - struct pcpu *pcpu_data; - uint32_t i; + struct pcpu *pc; + uint32_t i, idx; KASSERT(acpi_id != NULL, ("Null acpi_id")); KASSERT(cpu_id != NULL, ("Null cpu_id")); + idx = device_get_unit(dev); + + /* + * If pc_acpi_id for CPU 0 is not initialized (e.g. a non-APIC + * UP box) use the ACPI ID from the first processor we find. + */ + if (idx == 0 && mp_ncpus == 1) { + pc = pcpu_find(0); + if (pc->pc_acpi_id == 0xffffffff) + pc->pc_acpi_id = *acpi_id; + *cpu_id = 0; + return (0); + } + CPU_FOREACH(i) { - pcpu_data = pcpu_find(i); - KASSERT(pcpu_data != NULL, ("no pcpu data for %d", i)); - if (idx-- == 0) { - /* - * If pc_acpi_id was not initialized (e.g., a non-APIC UP box) - * override it with the value from the ASL. Otherwise, if the - * two don't match, prefer the MADT-derived value. Finally, - * return the pc_cpuid to reference this processor. - */ - if (pcpu_data->pc_acpi_id == 0xffffffff) - pcpu_data->pc_acpi_id = *acpi_id; - else if (pcpu_data->pc_acpi_id != *acpi_id) - *acpi_id = pcpu_data->pc_acpi_id; - *cpu_id = pcpu_data->pc_cpuid; - return (0); + pc = pcpu_find(i); + KASSERT(pc != NULL, ("no pcpu data for %d", i)); + if (cpu_unordered) { + if (idx-- == 0) { + /* + * If pc_acpi_id doesn't match the ACPI ID from the + * ASL, prefer the MADT-derived value. + */ + if (pc->pc_acpi_id != *acpi_id) + *acpi_id = pc->pc_acpi_id; + *cpu_id = pc->pc_cpuid; + return (0); + } + } else { + if (pc->pc_acpi_id == *acpi_id) { + if (bootverbose) + device_printf(dev, + "Processor %s (ACPI ID %u) -> APIC ID %d\n", + acpi_name(acpi_get_handle(dev)), *acpi_id, + pc->pc_cpuid); + *cpu_id = pc->pc_cpuid; + return (0); + } } } + if (bootverbose) + printf("ACPI: Processor %s (ACPI ID %u) ignored\n", + acpi_name(acpi_get_handle(dev)), *acpi_id); + return (ESRCH); } Modified: stable/8/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_ec.c Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/sys/dev/acpica/acpi_ec.c Fri Jun 29 21:25:24 2012 (r237823) @@ -178,7 +178,6 @@ struct acpi_ec_softc { ACPI_SERIAL_DECL(ec, "ACPI embedded controller"); -SYSCTL_DECL(_debug_acpi); SYSCTL_NODE(_debug_acpi, OID_AUTO, ec, CTLFLAG_RD, NULL, "EC debugging"); static int ec_burst_mode; Modified: stable/8/sys/dev/acpica/acpi_smbat.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_smbat.c Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/sys/dev/acpica/acpi_smbat.c Fri Jun 29 21:25:24 2012 (r237823) @@ -62,7 +62,6 @@ static int acpi_smbat_get_bst(device_t d ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery"); -SYSCTL_DECL(_debug_acpi); SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, "Battery debugging"); /* On some laptops with smart batteries, enabling battery monitoring Modified: stable/8/sys/dev/acpica/acpivar.h ============================================================================== --- stable/8/sys/dev/acpica/acpivar.h Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/sys/dev/acpica/acpivar.h Fri Jun 29 21:25:24 2012 (r237823) @@ -475,5 +475,7 @@ ACPI_HANDLE acpi_GetReference(ACPI_HANDL /* Use the device logging level for ktr(4). */ #define KTR_ACPI KTR_DEV +SYSCTL_DECL(_debug_acpi); + #endif /* _KERNEL */ #endif /* !_ACPIVAR_H_ */ Modified: stable/8/sys/i386/acpica/acpi_machdep.c ============================================================================== --- stable/8/sys/i386/acpica/acpi_machdep.c Fri Jun 29 21:24:56 2012 (r237822) +++ stable/8/sys/i386/acpica/acpi_machdep.c Fri Jun 29 21:25:24 2012 (r237823) @@ -59,8 +59,6 @@ __FBSDID("$FreeBSD$"); #include -SYSCTL_DECL(_debug_acpi); - uint32_t acpi_resume_beep; TUNABLE_INT("debug.acpi.resume_beep", &acpi_resume_beep); SYSCTL_UINT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RW, &acpi_resume_beep, From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 30 14:06:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA9E21065670; Sat, 30 Jun 2012 14:06:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 955078FC17; Sat, 30 Jun 2012 14:06:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5UE6HcR022983; Sat, 30 Jun 2012 14:06:17 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5UE6HMn022981; Sat, 30 Jun 2012 14:06:17 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206301406.q5UE6HMn022981@svn.freebsd.org> From: Andriy Gapon Date: Sat, 30 Jun 2012 14:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237838 - stable/8/usr.sbin/cpucontrol X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 14:06:17 -0000 Author: avg Date: Sat Jun 30 14:06:17 2012 New Revision: 237838 URL: http://svn.freebsd.org/changeset/base/237838 Log: MFC r236504: cpucontrol: use CPUCTL_UPDATE ioctl on correct file descriptor (in amd case) Modified: stable/8/usr.sbin/cpucontrol/amd.c Directory Properties: stable/8/usr.sbin/cpucontrol/ (props changed) Modified: stable/8/usr.sbin/cpucontrol/amd.c ============================================================================== --- stable/8/usr.sbin/cpucontrol/amd.c Sat Jun 30 14:05:35 2012 (r237837) +++ stable/8/usr.sbin/cpucontrol/amd.c Sat Jun 30 14:06:17 2012 (r237838) @@ -162,7 +162,7 @@ amd_update(const char *dev, const char * args.data = fw_image; args.size = st.st_size; - error = ioctl(fd, CPUCTL_UPDATE, &args); + error = ioctl(devfd, CPUCTL_UPDATE, &args); if (error < 0) { fprintf(stderr, "failed.\n"); warn("ioctl()"); From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 30 14:18:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDDD3106564A; Sat, 30 Jun 2012 14:18:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E31C8FC12; Sat, 30 Jun 2012 14:18:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5UEI4CH023651; Sat, 30 Jun 2012 14:18:04 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5UEI4dO023645; Sat, 30 Jun 2012 14:18:04 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201206301418.q5UEI4dO023645@svn.freebsd.org> From: Andriy Gapon Date: Sat, 30 Jun 2012 14:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237840 - in stable/8/sys: amd64/amd64 i386/i386 kern x86/x86 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 14:18:04 -0000 Author: avg Date: Sat Jun 30 14:18:04 2012 New Revision: 237840 URL: http://svn.freebsd.org/changeset/base/237840 Log: MFC r236503: free wdog_kern_pat calls in post-panic paths from under SW_WATCHDOG Modified: stable/8/sys/amd64/amd64/minidump_machdep.c stable/8/sys/i386/i386/minidump_machdep.c stable/8/sys/kern/kern_shutdown.c stable/8/sys/kern/vfs_subr.c stable/8/sys/x86/x86/dump_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/minidump_machdep.c Sat Jun 30 14:17:59 2012 (r237839) +++ stable/8/sys/amd64/amd64/minidump_machdep.c Sat Jun 30 14:18:04 2012 (r237840) @@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SW_WATCHDOG #include -#endif #include #include #include @@ -175,9 +173,9 @@ blk_write(struct dumperinfo *di, char *p report_progress(progress, dumpsize); counter &= (1<<24) - 1; } -#ifdef SW_WATCHDOG + wdog_kern_pat(WD_LASTVAL); -#endif + if (ptr) { error = dump_write(di, ptr, 0, dumplo, len); if (error) Modified: stable/8/sys/i386/i386/minidump_machdep.c ============================================================================== --- stable/8/sys/i386/i386/minidump_machdep.c Sat Jun 30 14:17:59 2012 (r237839) +++ stable/8/sys/i386/i386/minidump_machdep.c Sat Jun 30 14:18:04 2012 (r237840) @@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SW_WATCHDOG #include -#endif #include #include #include @@ -143,9 +141,9 @@ blk_write(struct dumperinfo *di, char *p printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); counter &= (1<<24) - 1; } -#ifdef SW_WATCHDOG + wdog_kern_pat(WD_LASTVAL); -#endif + if (ptr) { error = dump_write(di, ptr, 0, dumplo, len); if (error) Modified: stable/8/sys/kern/kern_shutdown.c ============================================================================== --- stable/8/sys/kern/kern_shutdown.c Sat Jun 30 14:17:59 2012 (r237839) +++ stable/8/sys/kern/kern_shutdown.c Sat Jun 30 14:18:04 2012 (r237840) @@ -66,9 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SW_WATCHDOG #include -#endif #include @@ -330,9 +328,7 @@ boot(int howto) waittime = 0; -#ifdef SW_WATCHDOG wdog_kern_pat(WD_LASTVAL); -#endif sync(curthread, NULL); /* @@ -358,9 +354,8 @@ boot(int howto) if (nbusy < pbusy) iter = 0; pbusy = nbusy; -#ifdef SW_WATCHDOG + wdog_kern_pat(WD_LASTVAL); -#endif sync(curthread, NULL); #ifdef PREEMPTION Modified: stable/8/sys/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Sat Jun 30 14:17:59 2012 (r237839) +++ stable/8/sys/kern/vfs_subr.c Sat Jun 30 14:18:04 2012 (r237840) @@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SW_WATCHDOG #include -#endif #include @@ -1878,10 +1876,10 @@ sched_sync(void) LIST_INSERT_HEAD(next, bo, bo_synclist); continue; } -#ifdef SW_WATCHDOG + if (first_printf == 0) wdog_kern_pat(WD_LASTVAL); -#endif + } if (!LIST_EMPTY(gslp)) { mtx_unlock(&sync_mtx); Modified: stable/8/sys/x86/x86/dump_machdep.c ============================================================================== --- stable/8/sys/x86/x86/dump_machdep.c Sat Jun 30 14:17:59 2012 (r237839) +++ stable/8/sys/x86/x86/dump_machdep.c Sat Jun 30 14:18:04 2012 (r237840) @@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SW_WATCHDOG #include -#endif #include #include #include @@ -198,9 +196,9 @@ cb_dumpdata(struct md_pa *mdp, int seqnr a = pa + i * PAGE_SIZE; va = pmap_kenter_temporary(trunc_page(a), i); } -#ifdef SW_WATCHDOG + wdog_kern_pat(WD_LASTVAL); -#endif + error = dump_write(di, va, 0, dumplo, sz); if (error) break; From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 30 18:58:21 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C113C1065707; Sat, 30 Jun 2012 18:58:21 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAD288FC14; Sat, 30 Jun 2012 18:58:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5UIwLEI036075; Sat, 30 Jun 2012 18:58:21 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5UIwLGu036073; Sat, 30 Jun 2012 18:58:21 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206301858.q5UIwLGu036073@svn.freebsd.org> From: Andrew Thompson Date: Sat, 30 Jun 2012 18:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237851 - stable/8/usr.bin/sockstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 18:58:21 -0000 Author: thompsa Date: Sat Jun 30 18:58:21 2012 New Revision: 237851 URL: http://svn.freebsd.org/changeset/base/237851 Log: MFC r237674 Update the usage with the new jail option. Modified: stable/8/usr.bin/sockstat/sockstat.c Directory Properties: stable/8/usr.bin/sockstat/ (props changed) Modified: stable/8/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/8/usr.bin/sockstat/sockstat.c Sat Jun 30 18:57:55 2012 (r237850) +++ stable/8/usr.bin/sockstat/sockstat.c Sat Jun 30 18:58:21 2012 (r237851) @@ -732,7 +732,7 @@ static void usage(void) { fprintf(stderr, - "Usage: sockstat [-46cLlu] [-p ports] [-P protocols]\n"); + "Usage: sockstat [-46cLlu] [-j jid] [-p ports] [-P protocols]\n"); exit(1); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 30 20:25:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EF8D1065767; Sat, 30 Jun 2012 20:25:51 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19C158FC1C; Sat, 30 Jun 2012 20:25:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5UKPo9u039970; Sat, 30 Jun 2012 20:25:50 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5UKPoE3039968; Sat, 30 Jun 2012 20:25:50 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201206302025.q5UKPoE3039968@svn.freebsd.org> From: Gavin Atkinson Date: Sat, 30 Jun 2012 20:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237856 - stable/8/sbin/mdconfig X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 20:25:51 -0000 Author: gavin Date: Sat Jun 30 20:25:50 2012 New Revision: 237856 URL: http://svn.freebsd.org/changeset/base/237856 Log: Merge r237645 from head: The -S option, to specify the sector size, has been usable on all types of memory disks since r135340. Update the man page to reflect this. Noticed by: avg Modified: stable/8/sbin/mdconfig/mdconfig.8 Directory Properties: stable/8/sbin/mdconfig/ (props changed) Modified: stable/8/sbin/mdconfig/mdconfig.8 ============================================================================== --- stable/8/sbin/mdconfig/mdconfig.8 Sat Jun 30 20:25:12 2012 (r237855) +++ stable/8/sbin/mdconfig/mdconfig.8 Sat Jun 30 20:25:50 2012 (r237856) @@ -41,7 +41,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2008 +.Dd June 27, 2012 .Dt MDCONFIG 8 .Os .Sh NAME @@ -143,7 +143,7 @@ and .Fl t Ar swap are implied if not specified. .It Fl S Ar sectorsize -Sectorsize to use for malloc backed device. +Sectorsize to use for the memory disk, in bytes. .It Fl x Ar sectors/track See the description of the .Fl y