From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 06:46:40 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 317281065672; Sun, 1 Mar 2009 06:46:40 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F59C8FC14; Sun, 1 Mar 2009 06:46:40 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n216kdZo033448; Sun, 1 Mar 2009 06:46:39 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n216kdfW033447; Sun, 1 Mar 2009 06:46:39 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010646.n216kdfW033447@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 06:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189210 - stable/7/sys/cam X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 06:46:40 -0000 Author: scottl Date: Sun Mar 1 06:46:39 2009 New Revision: 189210 URL: http://svn.freebsd.org/changeset/base/189210 Log: Merge r186891: Retry TEST UNIT READY if needed. Modified: stable/7/sys/cam/cam_xpt.c (contents, props changed) Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:27:03 2009 (r189209) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:46:39 2009 (r189210) @@ -5652,7 +5652,7 @@ probestart(struct cam_periph *periph, un case PROBE_DV_EXIT: { scsi_test_unit_ready(csio, - /*retries*/4, + /*retries*/10, probedone, MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, @@ -6259,6 +6259,13 @@ probedone(struct cam_periph *periph, uni break; } case PROBE_TUR_FOR_NEGOTIATION: + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + DELAY(500000); + if (cam_periph_error(done_ccb, 0, SF_RETRY_UA, + NULL) == ERESTART) + return; + } + /* FALLTHROUGH */ case PROBE_DV_EXIT: if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 06:57:26 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10745106564A; Sun, 1 Mar 2009 06:57:25 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBF088FC0A; Sun, 1 Mar 2009 06:57:25 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n216vPlK033745; Sun, 1 Mar 2009 06:57:25 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n216vPB1033744; Sun, 1 Mar 2009 06:57:25 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010657.n216vPB1033744@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 06:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189211 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 06:57:26 -0000 Author: scottl Date: Sun Mar 1 06:57:25 2009 New Revision: 189211 URL: http://svn.freebsd.org/changeset/base/189211 Log: Merge 188570: Fix tag negotiation for pseudo-scsi devices and subsystems. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:46:39 2009 (r189210) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:57:25 2009 (r189211) @@ -6143,10 +6143,9 @@ probedone(struct cam_periph *periph, uni xpt_schedule(periph, priority); return; } - xpt_release_ccb(done_ccb); - softc->action = PROBE_TUR_FOR_NEGOTIATION; - xpt_schedule(periph, priority); - return; + + csio->data_ptr = NULL; + /* FALLTHROUGH */ } case PROBE_SERIAL_NUM_1: From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:00:52 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C0161065673; Sun, 1 Mar 2009 07:00:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 581288FC08; Sun, 1 Mar 2009 07:00:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2170qhH033967; Sun, 1 Mar 2009 07:00:52 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2170qUk033966; Sun, 1 Mar 2009 07:00:52 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010700.n2170qUk033966@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189212 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:00:53 -0000 Author: scottl Date: Sun Mar 1 07:00:52 2009 New Revision: 189212 URL: http://svn.freebsd.org/changeset/base/189212 Log: Merge 188670: Instrument the probe state machine Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:57:25 2009 (r189211) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:00:52 2009 (r189212) @@ -5419,9 +5419,33 @@ typedef enum { PROBE_TUR_FOR_NEGOTIATION, PROBE_INQUIRY_BASIC_DV1, PROBE_INQUIRY_BASIC_DV2, - PROBE_DV_EXIT + PROBE_DV_EXIT, + PROBE_INVALID } probe_action; +static char *probe_action_text[] = { + "PROBE_TUR", + "PROBE_INQUIRY", + "PROBE_FULL_INQUIRY", + "PROBE_MODE_SENSE", + "PROBE_SERIAL_NUM_0", + "PROBE_SERIAL_NUM_1", + "PROBE_TUR_FOR_NEGOTIATION", + "PROBE_INQUIRY_BASIC_DV1", + "PROBE_INQUIRY_BASIC_DV2", + "PROBE_DV_EXIT", + "PROBE_INVALID" +}; + +#define PROBE_SET_ACTION(softc, newaction) \ +do { \ + char **text = probe_action_text; \ + CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO, \ + ("Probe %s to %s\n", text[(softc)->action], \ + text[(newaction)])); \ + (softc)->action = (newaction); \ +} while(0) + typedef enum { PROBE_INQUIRY_CKSUM = 0x01, PROBE_SERIAL_CKSUM = 0x02, @@ -5435,6 +5459,7 @@ typedef struct { probe_flags flags; MD5_CTX context; u_int8_t digest[16]; + struct cam_periph *periph; } probe_softc; static void @@ -5566,6 +5591,8 @@ proberegister(struct cam_periph *periph, periph_links.tqe); softc->flags = 0; periph->softc = softc; + softc->periph = periph; + softc->action = PROBE_INVALID; status = cam_periph_acquire(periph); if (status != CAM_REQ_CMP) { return (status); @@ -5617,13 +5644,13 @@ probeschedule(struct cam_periph *periph) */ if (((ccb->ccb_h.path->device->flags & CAM_DEV_UNCONFIGURED) == 0) && (ccb->ccb_h.target_lun == 0)) { - softc->action = PROBE_TUR; + PROBE_SET_ACTION(softc, PROBE_TUR); } else if ((cpi.hba_inquiry & (PI_WIDE_32|PI_WIDE_16|PI_SDTR_ABLE)) != 0 && (cpi.hba_misc & PIM_NOBUSRESET) != 0) { proberequestdefaultnegotiation(periph); - softc->action = PROBE_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_INQUIRY); } else { - softc->action = PROBE_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_INQUIRY); } if (ccb->crcn.flags & CAM_EXPECT_INQ_CHANGE) @@ -5712,7 +5739,7 @@ probestart(struct cam_periph *periph, un if (inq_buf == NULL) { xpt_print(periph->path, "malloc failure- skipping Basic" "Domain Validation\n"); - softc->action = PROBE_DV_EXIT; + PROBE_SET_ACTION(softc, PROBE_DV_EXIT); scsi_test_unit_ready(csio, /*retries*/4, probedone, @@ -5758,7 +5785,7 @@ probestart(struct cam_periph *periph, un } xpt_print(periph->path, "Unable to mode sense control page - " "malloc failure\n"); - softc->action = PROBE_SERIAL_NUM_0; + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); } /* FALLTHROUGH */ case PROBE_SERIAL_NUM_0: @@ -5827,6 +5854,11 @@ probestart(struct cam_periph *periph, un probedone(periph, start_ccb); return; } + case PROBE_INVALID: + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, + ("probestart: invalid action state\n")); + default: + break; } xpt_action(start_ccb); } @@ -5980,7 +6012,7 @@ probedone(struct cam_periph *periph, uni /*count*/1, /*run_queue*/TRUE); } - softc->action = PROBE_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_INQUIRY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; @@ -6017,7 +6049,7 @@ probedone(struct cam_periph *periph, uni additional_length) + 1; if (softc->action == PROBE_INQUIRY && len > SHORT_INQUIRY_LENGTH) { - softc->action = PROBE_FULL_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_FULL_INQUIRY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; @@ -6027,9 +6059,9 @@ probedone(struct cam_periph *periph, uni xpt_devise_transport(path); if (INQ_DATA_TQ_ENABLED(inq_buf)) - softc->action = PROBE_MODE_SENSE; + PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); else - softc->action = PROBE_SERIAL_NUM_0; + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); path->device->flags &= ~CAM_DEV_UNCONFIGURED; @@ -6094,7 +6126,7 @@ probedone(struct cam_periph *periph, uni } xpt_release_ccb(done_ccb); free(mode_hdr, M_CAMXPT); - softc->action = PROBE_SERIAL_NUM_0; + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); xpt_schedule(periph, priority); return; } @@ -6139,7 +6171,7 @@ probedone(struct cam_periph *periph, uni if (serialnum_supported) { xpt_release_ccb(done_ccb); - softc->action = PROBE_SERIAL_NUM_1; + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_1); xpt_schedule(periph, priority); return; } @@ -6250,7 +6282,7 @@ probedone(struct cam_periph *periph, uni * Perform a TUR to allow the controller to * perform any necessary transfer negotiation. */ - softc->action = PROBE_TUR_FOR_NEGOTIATION; + PROBE_SET_ACTION(softc, PROBE_TUR_FOR_NEGOTIATION); xpt_schedule(periph, priority); return; } @@ -6283,7 +6315,7 @@ probedone(struct cam_periph *periph, uni ("Begin Domain Validation\n")); path->device->flags |= CAM_DEV_IN_DV; xpt_release_ccb(done_ccb); - softc->action = PROBE_INQUIRY_BASIC_DV1; + PROBE_SET_ACTION(softc, PROBE_INQUIRY_BASIC_DV1); xpt_schedule(periph, priority); return; } @@ -6321,10 +6353,10 @@ probedone(struct cam_periph *periph, uni softc->action == PROBE_INQUIRY_BASIC_DV1 ? 1 : 2); if (proberequestbackoff(periph, path->device)) { path->device->flags &= ~CAM_DEV_IN_DV; - softc->action = PROBE_TUR_FOR_NEGOTIATION; + PROBE_SET_ACTION(softc, PROBE_TUR_FOR_NEGOTIATION); } else { /* give up */ - softc->action = PROBE_DV_EXIT; + PROBE_SET_ACTION(softc, PROBE_DV_EXIT); } free(nbuf, M_CAMXPT); xpt_release_ccb(done_ccb); @@ -6333,12 +6365,12 @@ probedone(struct cam_periph *periph, uni } free(nbuf, M_CAMXPT); if (softc->action == PROBE_INQUIRY_BASIC_DV1) { - softc->action = PROBE_INQUIRY_BASIC_DV2; + PROBE_SET_ACTION(softc, PROBE_INQUIRY_BASIC_DV2); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } - if (softc->action == PROBE_DV_EXIT) { + if (softc->action == PROBE_INQUIRY_BASIC_DV2) { CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Leave Domain Validation Successfully\n")); } @@ -6354,6 +6386,11 @@ probedone(struct cam_periph *periph, uni xpt_release_ccb(done_ccb); break; } + case PROBE_INVALID: + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, + ("probedone: invalid action state\n")); + default: + break; } done_ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs); TAILQ_REMOVE(&softc->request_ccbs, &done_ccb->ccb_h, periph_links.tqe); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:02:16 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F11D31065670; Sun, 1 Mar 2009 07:02:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6B0D8FC12; Sun, 1 Mar 2009 07:02:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2172GBZ034090; Sun, 1 Mar 2009 07:02:16 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2172G2n034089; Sun, 1 Mar 2009 07:02:16 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010702.n2172G2n034089@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189213 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:02:17 -0000 Author: scottl Date: Sun Mar 1 07:02:16 2009 New Revision: 189213 URL: http://svn.freebsd.org/changeset/base/189213 Log: Merge 188688: GCC bogon. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:00:52 2009 (r189212) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:02:16 2009 (r189213) @@ -5439,7 +5439,8 @@ static char *probe_action_text[] = { #define PROBE_SET_ACTION(softc, newaction) \ do { \ - char **text = probe_action_text; \ + char **text; \ + text = probe_action_text; \ CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO, \ ("Probe %s to %s\n", text[(softc)->action], \ text[(newaction)])); \ From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:03:35 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0D75106564A; Sun, 1 Mar 2009 07:03:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E4148FC1A; Sun, 1 Mar 2009 07:03:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2173ZdR034186; Sun, 1 Mar 2009 07:03:35 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2173ZJL034185; Sun, 1 Mar 2009 07:03:35 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010703.n2173ZJL034185@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189214 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:03:36 -0000 Author: scottl Date: Sun Mar 1 07:03:35 2009 New Revision: 189214 URL: http://svn.freebsd.org/changeset/base/189214 Log: Merge 188671: Fix negotiation for imperfect SCSI and pseudo-SCSI devices. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:02:16 2009 (r189213) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:03:35 2009 (r189214) @@ -6680,9 +6680,7 @@ xpt_set_transfer_settings(struct ccb_tra if (((device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0 && (inq_data->flags & SID_Sync) == 0 && cts->type == CTS_TYPE_CURRENT_SETTINGS) - || ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) - || (spi->sync_offset == 0) - || (spi->sync_period == 0)) { + || ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0)) { /* Force async */ spi->sync_period = 0; spi->sync_offset = 0; @@ -6730,7 +6728,8 @@ xpt_set_transfer_settings(struct ccb_tra if (spi->bus_width == 0) spi->ppr_options = 0; - if ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) == 0) { + if ((spi->valid & CTS_SPI_VALID_DISC) + && ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) == 0)) { /* * Can't tag queue without disconnection. */ From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:06:45 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33A881065673; Sun, 1 Mar 2009 07:06:45 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20D798FC19; Sun, 1 Mar 2009 07:06:45 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2176iav034335; Sun, 1 Mar 2009 07:06:44 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2176iA6034334; Sun, 1 Mar 2009 07:06:44 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010706.n2176iA6034334@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189215 - in stable/7/sys: . cam contrib/pf dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:06:45 -0000 Author: scottl Date: Sun Mar 1 07:06:44 2009 New Revision: 189215 URL: http://svn.freebsd.org/changeset/base/189215 Log: Merge 186396: Fix comment Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_sim.h stable/7/sys/cam/cam_xpt.c (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_sim.h ============================================================================== --- stable/7/sys/cam/cam_sim.h Sun Mar 1 07:03:35 2009 (r189214) +++ stable/7/sys/cam/cam_sim.h Sun Mar 1 07:06:44 2009 (r189215) @@ -109,7 +109,7 @@ struct cam_sim { struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ - /* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */ + /* "Pool" of inactive ccbs managed by xpt_get_ccb and xpt_release_ccb */ SLIST_HEAD(,ccb_hdr) ccb_freeq; /* * Maximum size of ccb pool. Modified as devices are added/removed From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:16:52 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FEF4106564A; Sun, 1 Mar 2009 07:16:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72C2F8FC0C; Sun, 1 Mar 2009 07:16:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n217Gpsh034735; Sun, 1 Mar 2009 07:16:51 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n217Gp0r034734; Sun, 1 Mar 2009 07:16:51 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010716.n217Gp0r034734@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:16:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189217 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:16:53 -0000 Author: scottl Date: Sun Mar 1 07:16:50 2009 New Revision: 189217 URL: http://svn.freebsd.org/changeset/base/189217 Log: Fix mergeinfo for cam_xpt.c Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:22:47 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C696106564A; Sun, 1 Mar 2009 07:22:47 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1989E8FC15; Sun, 1 Mar 2009 07:22:47 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n217MkPb034911; Sun, 1 Mar 2009 07:22:46 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n217MkQa034910; Sun, 1 Mar 2009 07:22:46 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010722.n217MkQa034910@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189218 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:22:47 -0000 Author: scottl Date: Sun Mar 1 07:22:46 2009 New Revision: 189218 URL: http://svn.freebsd.org/changeset/base/189218 Log: Merge 176204: Fix typo Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c ============================================================================== --- stable/7/sys/cam/cam_periph.c Sun Mar 1 07:16:50 2009 (r189217) +++ stable/7/sys/cam/cam_periph.c Sun Mar 1 07:22:46 2009 (r189218) @@ -1632,7 +1632,7 @@ cam_periph_error(union ccb *ccb, cam_fla ccb->ccb_h.retry_count--; error = ERESTART; } else { - action_string = "Retries Exausted"; + action_string = "Retries Exhausted"; error = EIO; } break; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 07:24:26 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5CCB106567F; Sun, 1 Mar 2009 07:24:26 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D29388FC1C; Sun, 1 Mar 2009 07:24:26 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n217OQgH035012; Sun, 1 Mar 2009 07:24:26 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n217OQnF035011; Sun, 1 Mar 2009 07:24:26 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903010724.n217OQnF035011@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 07:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189219 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 07:24:27 -0000 Author: scottl Date: Sun Mar 1 07:24:26 2009 New Revision: 189219 URL: http://svn.freebsd.org/changeset/base/189219 Log: Merge 188395: Fix "invalid periph name" error condition. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c ============================================================================== --- stable/7/sys/cam/cam_periph.c Sun Mar 1 07:22:46 2009 (r189218) +++ stable/7/sys/cam/cam_periph.c Sun Mar 1 07:24:26 2009 (r189219) @@ -171,7 +171,7 @@ cam_periph_alloc(periph_ctor_t *periph_c break; } xpt_unlock_buses(); - if (p_drv == NULL) { + if (*p_drv == NULL) { printf("cam_periph_alloc: invalid periph name '%s'\n", name); return (CAM_REQ_INVALID); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 10:51:34 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEAAF1065670; Sun, 1 Mar 2009 10:51:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB9F78FC1D; Sun, 1 Mar 2009 10:51:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21ApY2t041205; Sun, 1 Mar 2009 10:51:34 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21ApYYP041203; Sun, 1 Mar 2009 10:51:34 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200903011051.n21ApYYP041203@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 1 Mar 2009 10:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189224 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 10:51:35 -0000 Author: trasz Date: Sun Mar 1 10:51:34 2009 New Revision: 189224 URL: http://svn.freebsd.org/changeset/base/189224 Log: MFC r174937 by imp. Reviewed by: imp Approved by: rwatson (mentor) Original commit log: A partial solution to some of the 'pull the umass device with a mounted FS' problems. These are more along the lines of 'avoiding an avoidable panic' than a complete solution to removable devices. We now close the barn door after the horse has gotten lose and has been hit by a truck, as it were. The barn no longer catches fire in this case, but the horse is still dead :-). The vfs_bio.c fix causes us not to put a failed write back into the dirty pool if the error returned was ENXIO. In that case, the buffer is treated like any other clean buffer that's being retured. ENXIO means the device isn't there anymore and will never be there again in the future, so retrying is futile. The vfs_mount.c fix treats 'ENXIO' as success for unmounting a file system. If the device is gone, retrying later won't help and we'll never be able to unmount the device. These two are part of a larger patch set submitted by the author. The other patches will be forth coming. I added comments to these two patches. Submitted by: Henrik Gulbrandsen Reviewed by: phk@ PR: usb/46176 (partial) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_bio.c stable/7/sys/kern/vfs_mount.c Modified: stable/7/sys/kern/vfs_bio.c ============================================================================== --- stable/7/sys/kern/vfs_bio.c Sun Mar 1 09:51:50 2009 (r189223) +++ stable/7/sys/kern/vfs_bio.c Sun Mar 1 10:51:34 2009 (r189224) @@ -1170,6 +1170,7 @@ brelse(struct buf *bp) if (bp->b_iocmd == BIO_WRITE && (bp->b_ioflags & BIO_ERROR) && + bp->b_error != ENXIO && !(bp->b_flags & B_INVAL)) { /* * Failed write, redirty. Must clear BIO_ERROR to prevent @@ -1177,6 +1178,9 @@ brelse(struct buf *bp) * this case is not run and the next case is run to * destroy the buffer. B_INVAL can occur if the buffer * is outside the range supported by the underlying device. + * If the error is that the device went away (ENXIO), we + * shouldn't redirty the buffer either, but discard the + * data too. */ bp->b_ioflags &= ~BIO_ERROR; bdirty(bp); Modified: stable/7/sys/kern/vfs_mount.c ============================================================================== --- stable/7/sys/kern/vfs_mount.c Sun Mar 1 09:51:50 2009 (r189223) +++ stable/7/sys/kern/vfs_mount.c Sun Mar 1 10:51:34 2009 (r189224) @@ -1293,8 +1293,13 @@ dounmount(mp, flags, td) error = VFS_UNMOUNT(mp, flags, td); } vn_finished_write(mp); - if (error) { - /* Undo cdir/rdir and rootvnode changes made above. */ + /* + * If we failed to flush the dirty blocks for this mount point, + * undo all the cdir/rdir and rootvnode changes we made above. + * Unless we failed to do so because the device is reporting that + * it doesn't exist anymore. + */ + if (error && error != ENXIO) { if ((flags & MNT_FORCE) && VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp, td) == 0) { if (mp->mnt_vnodecovered != NULL) From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 11:02:38 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5473B1065739; Sun, 1 Mar 2009 11:02:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38D788FC28; Sun, 1 Mar 2009 11:02:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21B2cIO041541; Sun, 1 Mar 2009 11:02:38 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21B2b6G041531; Sun, 1 Mar 2009 11:02:37 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200903011102.n21B2b6G041531@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 1 Mar 2009 11:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189226 - in stable/7: share/man/man9 sys sys/contrib/pf sys/dev/cxgb sys/fs/hpfs sys/fs/msdosfs sys/fs/ntfs sys/fs/nwfs sys/fs/smbfs sys/gnu/fs/ext2fs sys/gnu/fs/reiserfs sys/gnu/fs/xf... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 11:02:39 -0000 Author: trasz Date: Sun Mar 1 11:02:37 2009 New Revision: 189226 URL: http://svn.freebsd.org/changeset/base/189226 Log: MFC r186194: According to phk@, VOP_STRATEGY should never, _ever_, return anything other than 0. Make it so. This fixes "panic: VOP_STRATEGY failed bp=0xc320dd90 vp=0xc3b9f648", encountered when writing to an orphaned filesystem. Reason for the panic was the following assert: KASSERT(i == 0, ("VOP_STRATEGY failed bp=%p vp=%p", bp, bp->b_vp)); at vfs_bio:bufstrategy(). Reviewed by: scottl, phk Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/VOP_STRATEGY.9 stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/hpfs/hpfs_vnops.c stable/7/sys/fs/msdosfs/msdosfs_vnops.c stable/7/sys/fs/ntfs/ntfs_vnops.c stable/7/sys/fs/nwfs/nwfs_vnops.c stable/7/sys/fs/smbfs/smbfs_vnops.c stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c stable/7/sys/ufs/ufs/ufs_vnops.c Modified: stable/7/share/man/man9/VOP_STRATEGY.9 ============================================================================== --- stable/7/share/man/man9/VOP_STRATEGY.9 Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/share/man/man9/VOP_STRATEGY.9 Sun Mar 1 11:02:37 2009 (r189226) @@ -53,7 +53,9 @@ This call either reads or writes data fr .Pp The call may block. .Sh RETURN VALUES -Zero is returned on success, otherwise an error is returned. +Always zero. +Errors should be signalled by setting BIO_ERROR on b_ioflags field in struct buf, +and setting b_error to the appropriate errno value. .Sh SEE ALSO .\" .Xr buf 9 , .Xr vnode 9 Modified: stable/7/sys/fs/hpfs/hpfs_vnops.c ============================================================================== --- stable/7/sys/fs/hpfs/hpfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/hpfs/hpfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -663,7 +663,7 @@ hpfs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/7/sys/fs/msdosfs/msdosfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/msdosfs/msdosfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -1880,7 +1880,7 @@ msdosfs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/fs/ntfs/ntfs_vnops.c ============================================================================== --- stable/7/sys/fs/ntfs/ntfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/ntfs/ntfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -339,7 +339,7 @@ ntfs_strategy(ap) } } bufdone(bp); - return (error); + return (0); } static int Modified: stable/7/sys/fs/nwfs/nwfs_vnops.c ============================================================================== --- stable/7/sys/fs/nwfs/nwfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/nwfs/nwfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -807,7 +807,7 @@ static int nwfs_strategy (ap) */ if ((bp->b_flags & B_ASYNC) == 0 ) error = nwfs_doio(ap->a_vp, bp, cr, td); - return (error); + return (0); } Modified: stable/7/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- stable/7/sys/fs/smbfs/smbfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/fs/smbfs/smbfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -864,7 +864,7 @@ smbfs_strategy (ap) if ((bp->b_flags & B_ASYNC) == 0 ) error = smbfs_doio(ap->a_vp, bp, cr, td); - return error; + return (0); } int Modified: stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/gnu/fs/ext2fs/ext2_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -1408,7 +1408,7 @@ ext2_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c ============================================================================== --- stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/gnu/fs/reiserfs/reiserfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -350,8 +350,13 @@ reiserfs_strategy(struct vop_strategy_ar bp->b_ioflags |= BIO_ERROR; } + if (error) { + bp->b_ioflags |= BIO_ERROR; + bp->b_error = error; + } + bufdone(bp); - return (error); + return (0); } /* Modified: stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c ============================================================================== --- stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -1138,7 +1138,7 @@ _xfs_strategy( bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: stable/7/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_vnops.c Sun Mar 1 11:01:00 2009 (r189225) +++ stable/7/sys/ufs/ufs/ufs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) @@ -2015,7 +2015,7 @@ ufs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 11:11:15 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D401106566C; Sun, 1 Mar 2009 11:11:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A8CC8FC16; Sun, 1 Mar 2009 11:11:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21BBFEV041750; Sun, 1 Mar 2009 11:11:15 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21BBFCD041749; Sun, 1 Mar 2009 11:11:15 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200903011111.n21BBFCD041749@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 1 Mar 2009 11:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189227 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/devfs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 11:11:16 -0000 Author: trasz Date: Sun Mar 1 11:11:14 2009 New Revision: 189227 URL: http://svn.freebsd.org/changeset/base/189227 Log: MFC r186911: Don't panic with "vinvalbuf: dirty bufs" when the mounted device that was being written to goes away. Reviewed by: kib, scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/devfs/devfs_vnops.c Modified: stable/7/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_vnops.c Sun Mar 1 11:02:37 2009 (r189226) +++ stable/7/sys/fs/devfs/devfs_vnops.c Sun Mar 1 11:11:14 2009 (r189227) @@ -481,12 +481,28 @@ devfs_close_f(struct file *fp, struct th return (error); } -/* ARGSUSED */ static int devfs_fsync(struct vop_fsync_args *ap) { - if (!vn_isdisk(ap->a_vp, NULL)) + int error; + struct bufobj *bo; + struct devfs_dirent *de; + + if (!vn_isdisk(ap->a_vp, &error)) { + bo = &ap->a_vp->v_bufobj; + de = ap->a_vp->v_data; + if (error == ENXIO && bo->bo_dirty.bv_cnt > 0) { + printf("Device %s went missing before all of the data " + "could be written to it; expect data loss.\n", + de->de_dirent->d_name); + + error = vop_stdfsync(ap); + if (bo->bo_dirty.bv_cnt != 0 || error != 0) + panic("devfs_fsync: vop_stdfsync failed."); + } + return (0); + } return (vop_stdfsync(ap)); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 11:17:39 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DF3106564A; Sun, 1 Mar 2009 11:17:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 234D18FC0C; Sun, 1 Mar 2009 11:17:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21BHdDs041898; Sun, 1 Mar 2009 11:17:39 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21BHdnY041897; Sun, 1 Mar 2009 11:17:39 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200903011117.n21BHdnY041897@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 1 Mar 2009 11:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189228 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/msdosfs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 11:17:39 -0000 Author: trasz Date: Sun Mar 1 11:17:38 2009 New Revision: 189228 URL: http://svn.freebsd.org/changeset/base/189228 Log: MFC r187199: Turn a "panic: non-decreasing id" into an error printf. This seems to be caused by a metadata corruption that occurs quite often after unplugging a pendrive during write activity. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/msdosfs/msdosfs_conv.c Modified: stable/7/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/7/sys/fs/msdosfs/msdosfs_conv.c Sun Mar 1 11:11:14 2009 (r189227) +++ stable/7/sys/fs/msdosfs/msdosfs_conv.c Sun Mar 1 11:17:38 2009 (r189228) @@ -1060,8 +1060,11 @@ mbnambuf_write(struct mbnambuf *nbp, cha char *slot; size_t count, newlen; - KASSERT(nbp->nb_len == 0 || id == nbp->nb_last_id - 1, - ("non-decreasing id: id %d, last id %d", id, nbp->nb_last_id)); + if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { + printf("msdosfs: non-decreasing id: id %d, last id %d\n", + id, nbp->nb_last_id); + return; + } /* Will store this substring in a WIN_CHARS-aligned slot. */ slot = &nbp->nb_buf[id * WIN_CHARS]; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 11:20:36 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ADA510656E9; Sun, 1 Mar 2009 11:20:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1EE18FC0C; Sun, 1 Mar 2009 11:20:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21BKZdD042000; Sun, 1 Mar 2009 11:20:35 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21BKZOQ041999; Sun, 1 Mar 2009 11:20:35 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200903011120.n21BKZOQ041999@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 1 Mar 2009 11:20:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189229 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ffs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 11:20:37 -0000 Author: trasz Date: Sun Mar 1 11:20:35 2009 New Revision: 189229 URL: http://svn.freebsd.org/changeset/base/189229 Log: MFC r188240: When a device containing mounted UFS filesystem disappears, the type of devvp becomes VBAD, which UFS incorrectly interprets as snapshot vnode, which in turns causes panic. Fix it by replacing '!= VCHR' with '== VREG'. With this fix in place, you should no longer be able to panic the system by removing a device with an UFS filesystem mounted from it - assuming you don't use softupdates. Reviewed by: kib Tested by: pho Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ffs/ffs_alloc.c Modified: stable/7/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_alloc.c Sun Mar 1 11:17:38 2009 (r189228) +++ stable/7/sys/ufs/ffs/ffs_alloc.c Sun Mar 1 11:20:35 2009 (r189229) @@ -1858,7 +1858,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i struct cdev *dev; cg = dtog(fs, bno); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ dev = VTOI(devvp)->i_devvp->v_rdev; cgblkno = fragstoblks(fs, cgtod(fs, cg)); @@ -1903,7 +1903,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i if (size == fs->fs_bsize) { fragno = fragstoblks(fs, cgbno); if (!ffs_isfreeblock(fs, blksfree, fragno)) { - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { UFS_UNLOCK(ump); /* devvp is a snapshot */ brelse(bp); @@ -2056,7 +2056,7 @@ ffs_freefile(ump, fs, devvp, ino, mode) struct cdev *dev; cg = ino_to_cg(fs, ino); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ dev = VTOI(devvp)->i_devvp->v_rdev; cgbno = fragstoblks(fs, cgtod(fs, cg)); @@ -2122,7 +2122,7 @@ ffs_checkfreefile(fs, devvp, ino) u_int8_t *inosused; cg = ino_to_cg(fs, ino); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ cgbno = fragstoblks(fs, cgtod(fs, cg)); } else { From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 14:57:34 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AF73106564A; Sun, 1 Mar 2009 14:57:34 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2EC48FC25; Sun, 1 Mar 2009 14:57:33 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21EvXuL046413; Sun, 1 Mar 2009 14:57:33 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21EvXB8046412; Sun, 1 Mar 2009 14:57:33 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903011457.n21EvXB8046412@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 1 Mar 2009 14:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189235 - stable/7/release/picobsd/bridge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 14:57:34 -0000 Author: luigi Date: Sun Mar 1 14:57:33 2009 New Revision: 189235 URL: http://svn.freebsd.org/changeset/base/189235 Log: document the possibility of hardwiring kenv/getenv values; remove duplicate isa and npx entries; remove DEVICE_POLLING add tap, bpf devices; add re and nfe drivers Modified: stable/7/release/picobsd/bridge/PICOBSD Modified: stable/7/release/picobsd/bridge/PICOBSD ============================================================================== --- stable/7/release/picobsd/bridge/PICOBSD Sun Mar 1 14:51:07 2009 (r189234) +++ stable/7/release/picobsd/bridge/PICOBSD Sun Mar 1 14:57:33 2009 (r189235) @@ -7,6 +7,10 @@ options MD_ROOT_SIZE=3200 # same as def_sz hints "PICOBSD.hints" + +# values accessible through getenv() +# env "PICOBSD.env" + cpu I486_CPU cpu I586_CPU cpu I686_CPU @@ -41,7 +45,6 @@ options DUMMYNET device if_bridge options HZ=1000 -device isa device pci # Floppy drives @@ -64,9 +67,6 @@ device vga # VGA screen device sc -# Floating point support - do not disable. -device npx - # Serial (COM) ports device sio @@ -91,8 +91,10 @@ device miibus #device de # DEC/Intel DC21x4x (``Tulip'') #device lnc device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device nfe # nVidia nForce MCP on-board Ethernet #device xl # 3Com device rl # RealTek 8129/8139 +device re # RealTek 8139C+/8169/8169S/8110S device sis # National/SiS #device vx # 3Com 3c590, 3c595 (``Vortex'') #device wx # Intel Gigabit Ethernet Card (``Wiseman'') @@ -107,10 +109,10 @@ device pty # Pseudo-ttys (telnet etc) device md # Memory "disks" #device gif 4 # IPv6 and IPv4 tunneling #device faith 1 # IPv6-to-IPv4 relaying (translation) -#device tap +device tap -options DEVICE_POLLING +#options DEVICE_POLLING # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! -#device bpf # Berkeley packet filter +device bpf # Berkeley packet filter From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 15:01:01 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AFFD106566C; Sun, 1 Mar 2009 15:01:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1759E8FC12; Sun, 1 Mar 2009 15:01:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21F10Th046544; Sun, 1 Mar 2009 15:01:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21F10gv046543; Sun, 1 Mar 2009 15:01:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200903011501.n21F10gv046543@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 1 Mar 2009 15:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189236 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ffs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 15:01:02 -0000 Author: trasz Date: Sun Mar 1 15:01:00 2009 New Revision: 189236 URL: http://svn.freebsd.org/changeset/base/189236 Log: MFC r187894. Note that r188501 should be merged too. Make sure the cdev doesn't go away while the filesystem is still mounted. Otherwise dev2udev() could return garbage. Reviewed by: kib Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ffs/ffs_vfsops.c Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_vfsops.c Sun Mar 1 14:57:33 2009 (r189235) +++ stable/7/sys/ufs/ffs/ffs_vfsops.c Sun Mar 1 15:01:00 2009 (r189236) @@ -641,6 +641,7 @@ ffs_mountfs(devvp, mp, td) VOP_UNLOCK(devvp, 0, td); if (error) return (error); + dev_ref(dev); if (devvp->v_rdev->si_iosize_max != 0) mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max; if (mp->mnt_iosize_max > MAXPHYS) @@ -921,6 +922,7 @@ out: free(ump, M_UFSMNT); mp->mnt_data = (qaddr_t)0; } + dev_rel(dev); return (error); } @@ -1107,6 +1109,7 @@ ffs_unmount(mp, mntflags, td) g_topology_unlock(); PICKUP_GIANT(); vrele(ump->um_devvp); + dev_rel(ump->um_dev); mtx_destroy(UFS_MTX(ump)); if (mp->mnt_gjprovider != NULL) { free(mp->mnt_gjprovider, M_UFSMNT); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 15:03:09 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0888A1065709; Sun, 1 Mar 2009 15:03:09 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E11EA8FC0C; Sun, 1 Mar 2009 15:03:08 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21F387p046614; Sun, 1 Mar 2009 15:03:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21F38RH046613; Sun, 1 Mar 2009 15:03:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903011503.n21F38RH046613@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 1 Mar 2009 15:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189237 - stable/7/release/picobsd/build X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 15:03:21 -0000 Author: luigi Date: Sun Mar 1 15:03:08 2009 New Revision: 189237 URL: http://svn.freebsd.org/changeset/base/189237 Log: sync the build script with the version in -current. The most relevant changes are the building of libraries in the --init call, and the ability to use /boot/loader (on by default) which seems to be necessary for large kernels. Modified: stable/7/release/picobsd/build/picobsd Modified: stable/7/release/picobsd/build/picobsd ============================================================================== --- stable/7/release/picobsd/build/picobsd Sun Mar 1 15:01:00 2009 (r189236) +++ stable/7/release/picobsd/build/picobsd Sun Mar 1 15:03:08 2009 (r189237) @@ -21,7 +21,6 @@ # Makefile.conf Makefile used to build the kernel # config shell variables, sourced here. # mfs.mtree mtree config file -# # floppy.tree/ files which go on the floppy # mfs_tree/ files which go onto the mfs # @@ -29,10 +28,13 @@ # PICOBSD kernel config file # config shell variables, sourced here. # crunch.conf crunchgen configuration +# mfs.mtree overrides ${PICO_TREE}/mfs.mtree # floppy.tree.exclude files from floppy.tree/ which we do not need here. -# floppy.tree/ local additions to the floppy.tree +# floppy.tree/ local additions to ${PICO_TREE}/mfs_free # floppy.tree.${site}/ same as above, site specific. # mfs_tree/ local additions to the mfs_free +# buildtree.mk optional makefile to build an extension for floppy tree +# (generated in buildtree/ ) # #--- The main entry point is at the end. @@ -98,6 +100,7 @@ set_defaults() { EDITOR=${EDITOR:-vi} fd_size=${fd_size:-1440} + o_use_loader="yes" # use /boot/loader o_all_in_mfs="yes" # put all files in mfs so you can boot and run # the image via diskless boot. o_clean="" # do not clean @@ -127,6 +130,7 @@ set_defaults() { # mountpoint used to build memory filesystems c_fs=fs.PICOBSD # filename used for the memory filesystem c_img=picobsd.bin # filename used for the picobsd image + generate_iso="NO" # don't generate the iso image # select the right memory disk name case `uname -r` in @@ -146,6 +150,7 @@ set_defaults() { trap fail 15 } +# use the new build infrastructure create_includes_and_libraries2() { local no log "create_includes_and_libraries2() for ${SRC}" @@ -158,7 +163,7 @@ create_includes_and_libraries2() { export MAKEOBJDIRPREFIX ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld - make _+_= $no toolchain + make _+_= $no toolchain _includes _libraries ) } @@ -207,7 +212,7 @@ create_includes_and_libraries() { # set_type looks in user or system directories for the floppy type # specified as first argument, and sets variables according to the config. -# file. Sets THETYPE, SITE, name, MY_TREE and BUILDDIR +# file. Also sets MY_TREE and BUILDDIR and SITE set_type() { local a i @@ -220,17 +225,17 @@ set_type() { for i in ${c_startdir}/${a} ${PICO_TREE}/${a} ; do log "set_type: checking $i" [ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] || continue - set -- `cat $i/PICOBSD | \ + set -- `cat $i/PICOBSD | \ awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'` [ x"$1" != "x" ] || continue - MFS_SIZE=$1 ; init_name=$2 - mfs_inodes=$3 ; fd_inodes=$4 - name=`(cd $i ; pwd) ` - name=`basename $name` - MY_TREE=$i - BUILDDIR=${c_startdir}/build_dir-${name} - log "Matching file $name in $i" - return ; + MFS_SIZE=$1 ; init_name=$2 + mfs_inodes=$3 ; fd_inodes=$4 + name=`(cd $i ; pwd) ` + name=`basename $name` + MY_TREE=$i + BUILDDIR=${c_startdir}/build_dir-${name} + log "Matching file $name in $i" + return ; done logverbose "Type $a NOT FOUND" } @@ -255,6 +260,13 @@ set_msgs() { # OK \t3. Site-info: ${SITE}\n\t4. Full-path: ${MY_TREE}\n" } +# build the iso image +build_iso_image() { + log "build_iso_image()" + clear + set_msgs + printf "${MSG}---> Build the iso image not ready yet\n\n" +} # Main build procedure. build_image() { @@ -307,10 +319,6 @@ build_package() { echo "##############################################" >>build.status for z in bridge dial router net isp ; do set_type ${z} - if [ "${name}" = "" ] ; then - echo "*** TYPE=${z} not found" >>build.status - continue - fi echo "---------------------------------------------">>build.status echo "Building TYPE=${z}, SIZE=${MFS_SIZE}" >>build.status msg="(ok)" # error message @@ -484,10 +492,10 @@ populate_floppy_fs() { # OK dst=${BUILDDIR}/floppy.tree log "pwd=`pwd` Populating floppy filesystem..." - # clean relics from old compilations. - rm -rf ${dst} || true - mkdir ${dst} + rm -rf ${dst} || true # clean relics from old compilations. + mkdir ${dst} # create a clean tree + # compute exclude list for generic tree excl=${MY_TREE}/floppy.tree.exclude if [ -f ${excl} ] ; then log "Files excluded from generic tree: `echo;cat ${excl}`" @@ -495,29 +503,26 @@ populate_floppy_fs() { # OK else excl="" fi - (cd ${PICO_TREE}/floppy.tree ; tar -cf - --exclude CVS --exclude .svn \ - ${excl} . ) | \ + # copy from the floppy trees into the destination + for FLOPPY_TREE in ${PICO_TREE}/floppy.tree ${MY_TREE}/floppy.tree \ + ${MY_TREE}/floppy.tree.${SITE} ; do + if [ -d ${FLOPPY_TREE} ] ; then + (cd ${FLOPPY_TREE} ; tar -cf - --exclude CVS \ + --exclude .svn ${excl} . ) | \ (cd ${dst} ; tar x${o_tarv}f - ) - log "Copied from generic floppy-tree `echo; ls -laR ${dst}`" - - srcdir=${MY_TREE}/floppy.tree - if [ -d ${srcdir} ] ; then - log "update with type-specific files:" - (cd ${srcdir} ; tar -cf - --exclude CVS --exclude .svn . ) | \ - (cd ${dst} ; tar x${o_tarv}f - ) - log "Copied from type floppy-tree `echo; ls -laR ${dst}`" - else - log "No type-specific floppy-tree" - fi - if [ -d ${srcdir}.${SITE} ] ; then - log "Update with site-specific (${SITE}) files:" - (cd ${srcdir}.${SITE} ; tar -cf - --exclude CVS --exclude .svn . ) | \ - (cd ${dst} ; tar x${o_tarv}f - ) - log "Copied from site floppy-tree `echo; ls -laR ${dst}`" - else - log "No site-specific floppy-tree" - fi + log "Copied from ${FLOPPY_TREE}" + fi + excl="" # reset the exclude list. + done + # add local manipulation + if [ -f ${MY_TREE}/buildtree.mk ] ; then + log "building local floppy tree" + ${BINMAKE} -C ${dst} -f ${MY_TREE}/buildtree.mk floppy.tree + fi + + # compress the files in etc/, just in case + # XXX this should be done in the makefile. # gzip returns an error if it fails to compress some file (cd $dst ; gzip -9 etc/* log "Compressed files in etc/ `echo; ls -l etc`" @@ -532,13 +537,12 @@ populate_floppy_fs() { # OK # Finally, if required, make a copy of the floppy.tree onto /fd populate_mfs_tree() { - local a dst + local a dst MFS_TREE log "populate_mfs_tree()" dst=${BUILDDIR}/mfs.tree - # clean relics from old compilations. - rm -rf ${dst} || true - mkdir ${dst} + rm -rf ${dst} || true # clean relics from old compilations. + mkdir ${dst} # create a fresh tree log "pwd=`pwd`, Populating MFS tree..." @@ -555,7 +559,7 @@ populate_mfs_tree() { ln -s /dev/null ${dst}/var/run/log ln -s /etc/termcap ${dst}/usr/share/misc/termcap - + ### now build the crunched binaries ### ( cd ${BUILDDIR}/crunch log "Making and installing crunch1 from `pwd` src ${SRC}..." @@ -599,12 +603,18 @@ populate_mfs_tree() { fi done + if [ -f ${MY_TREE}/buildtree.mk ] ; then + log "building local floppy tree" + ${BINMAKE} -C ${dst} -f ${MY_TREE}/buildtree.mk mfs.tree + fi + if [ "${o_all_in_mfs}" = "yes" ]; then log "Copy generic floppy_tree into MFS..." - # this may fail in case the floppy is empty + # ignore failure in case the floppy is empty cp -Rp ${BUILDDIR}/floppy.tree/* ${dst}/fd || true fi + # 4.x compatibility - create device nodes if [ "${o_no_devfs}" != "" ] ; then # create device entries using MAKEDEV (cd ${dst}/dev @@ -623,19 +633,21 @@ populate_mfs_tree() { log "importing ${import_files} into mfs" # We do it in a chroot environment on the target so # symlinks are followed correctly. - cp `which tar` ${dst}/my_copy_of_tar + # Make sure we have a statically linked tar there. + mkdir -p ${dst}/rescue + cp /rescue/tar ${dst}/rescue (cd ${l_usrtree}/.. ; tar cf - ${import_files} ) | \ - (chroot ${dst} /my_copy_of_tar xf - ) - rm ${dst}/my_copy_of_tar + (chroot ${dst} /rescue/tar xPf - ) + rm -rf ${dst}/rescue fi (cd ${BUILDDIR} # override the owner echo "/set uid=0 gid=0" > mtree.out - mtree -c -p ${dst} -k "" >> mtree.out + mtree -ic -p ${dst} -k "" >> mtree.out log "mtre.out at ${BUILDDIR}/mtree.out" makefs -t ffs -o bsize=4096 -o fsize=512 \ - -s ${MFS_SIZE}k -f 100 -F mtree.out ${c_fs} ${dst} + -s ${MFS_SIZE}k -f 1000 -F mtree.out ${c_fs} ${dst} ls -l ${c_fs} ) log "done mfs image" } @@ -712,14 +724,16 @@ fill_floppy_image() { fi log "Labeling floppy image" - log "patch ${c_boot2} to boot /kernel right away" b2=${BUILDDIR}/boot2 # modified boot2 cp -f ${c_boot2} ${b2} chmod 0644 ${b2} - set `strings -at d ${b2} | grep "/boot/loader"` - echo -e "/kernel\0\0\0\0\0" | \ - dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null + if [ ${o_use_loader} = "no" ] ; then + log "patch ${c_boot2} to boot /kernel right away" + set `strings -at d ${b2} | grep "/boot/loader"` + echo -e "/kernel\0\0\0\0\0" | \ + dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null + fi chmod 0444 ${b2} dst=${BUILDDIR}/image.tree @@ -739,22 +753,39 @@ fill_floppy_image() { if [ ${mfs_start} -gt 0 -a ${mfs_size} -ge ${imgsize} ] ; then mfs_ofs=$((${mfs_start} + 8192)) log "Preload kernel with file ${c_fs} at ${mfs_ofs}" + logverbose "`ls -l ${c_fs}` to fit in ${mfs_size}" dd if=${c_fs} ibs=8192 iseek=1 of=kernel obs=${mfs_ofs} \ - oseek=1 conv=notrunc 2> /dev/null + oseek=1 conv=notrunc # 2> /dev/null else log "not loading mfs, size ${mfs_size} img ${imgsize}" fi log "Compress with kgzip and copy to floppy image" - kgzip -o kernel.gz kernel - cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel" + if [ ${o_use_loader} = "no" ] ; then + kgzip -o kernel.gz kernel + cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel" + else + gzip kernel + mkdir -p ${dst}/boot/kernel + echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf + echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf + cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader" + cp -p kernel.gz ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel" + fi - log "Now transfer floppy tree if not already in MFS image" # now transfer the floppy tree. If it is already in mfs, dont bother. if [ "${o_all_in_mfs}" != "yes" ] ; then + log "Now transfer floppy tree if not already in MFS image" cp -Rp floppy.tree/* ${dst} || \ fail $? no_space "copying floppy tree" fi ) + + # add local manipulation to the image + if [ -f ${MY_TREE}/buildtree.mk ] ; then + ${BINMAKE} -C ${dst} -f ${MY_TREE}/buildtree.mk image.tree + fi + + log "image used `du -s ${dst}` of ${blocks}k" (cd ${BUILDDIR} makefs -t ffs -o bsize=4096 -o fsize=512 \ -s ${blocks}k -f 50 ${c_img} ${dst} @@ -764,9 +795,19 @@ fill_floppy_image() { ${l_label} -f `pwd`/${c_img} | sed -e '/ c:/{p;s/c:/a:/;}' | \ ${l_label} -R -f `pwd`/${c_img} /dev/stdin ${l_label} -f `pwd`/${c_img} + ls -l ${c_img} - logverbose "after disklabel" - ) + ${l_label} -f `pwd`/${c_img} + logverbose "after disklabel" + ) + + echo "BUILDDIR ${BUILDDIR}" + if [ "${generate_iso}" = "YES" ]; then + echo "generate_iso ${generate_iso}" + #build_iso_image() + exit 1 + fi + # dump the primary and secondary boot # XXX primary is 512 bytes dd if=${c_boot1} of=${BUILDDIR}/${c_img} conv=notrunc 2>/dev/null @@ -781,7 +822,8 @@ fill_floppy_image() { rm -rf ${BUILDDIR}/floppy.tree || true # cleanup # df -ik ${dst} | colrm 70 > .build.reply rm -rf ${dst} - rm ${BUILDDIR}/kernel.gz ${BUILDDIR}/${c_fs} + rm ${BUILDDIR}/${c_fs} + # rm ${BUILDDIR}/kernel.gz } # This function creates variables which depend on the source tree in use: @@ -824,8 +866,7 @@ set_build_parameters() { # arguments. set_defaults -args="" -while [ x"$1" != x ]; do +while [ true ]; do case $1 in --src) # set the source path instead of /usr/src SRC=`(cd $2; pwd)` @@ -840,12 +881,17 @@ while [ x"$1" != x ]; do shift ;; + --no_loader) # omit /boot/loader, just rely on boot2 + # (it may have problems with kernels > 4MB) + o_use_loader="no" + ;; + --all_in_mfs) o_all_in_mfs="yes" ;; --no_all_in_mfs) - o_all_in_mfs="" + o_all_in_mfs="no" ;; --modules) # also build kernel modules @@ -865,21 +911,24 @@ while [ x"$1" != x ]; do o_tarv="v" # tar verbose flag o_makeopts="-d l" # be verbose ;; + + --iso) # generate iso image + generate_iso="YES" + ;; + *) - args="$args $1" # accumulate args + break ;; esac shift done set_build_parameters # things that depend on ${SRC} +set_type $1 $2 # type and site, respectively # If $1="package", it creates a neat set of floppies -set -- ${args} [ "$1" = "package" ] && build_package -set_type $args # type and site, respectively - [ "${o_interactive}" != "NO" ] && main_dialog if [ "${o_clean}" = "YES" ] ; then From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:24:57 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C106C106566C; Sun, 1 Mar 2009 16:24:57 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC84E8FC08; Sun, 1 Mar 2009 16:24:57 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21GOveC048224; Sun, 1 Mar 2009 16:24:57 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GOvOi048222; Sun, 1 Mar 2009 16:24:57 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011624.n21GOvOi048222@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189239 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:24:58 -0000 Author: scottl Date: Sun Mar 1 16:24:57 2009 New Revision: 189239 URL: http://svn.freebsd.org/changeset/base/189239 Log: Merge 181381: Update SCSI opcodes and ASCs from t10.org. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_all.c stable/7/sys/cam/scsi/scsi_all.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 15:08:33 2009 (r189238) +++ stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 16:24:57 2009 (r189239) @@ -103,23 +103,27 @@ static int set_scsi_delay(int delay); #if !defined(SCSI_NO_OP_STRINGS) -#define D 0x001 -#define T 0x002 -#define L 0x004 -#define P 0x008 -#define W 0x010 -#define R 0x020 -#define S 0x040 -#define O 0x080 -#define M 0x100 -#define C 0x200 -#define A 0x400 -#define E 0x800 +#define D (1 << T_DIRECT) +#define T (1 << T_SEQUENTIAL) +#define L (1 << T_PRINTER) +#define P (1 << T_PROCESSOR) +#define W (1 << T_WORM) +#define R (1 << T_CDROM) +#define O (1 << T_OPTICAL) +#define M (1 << T_CHANGER) +#define A (1 << T_STORARRAY) +#define E (1 << T_ENCLOSURE) +#define B (1 << T_RBC) +#define K (1 << T_OCRW) +#define V (1 << T_ADC) +#define F (1 << T_OSD) +#define S (1 << T_SCANNER) +#define C (1 << T_COMM) -#define ALL 0xFFF +#define ALL (D | T | L | P | W | R | O | M | A | E | B | K | V | F | S | C) static struct op_table_entry plextor_cd_ops[] = { - {0xD8, R, "CD-DA READ"} + { 0xD8, R, "CD-DA READ" } }; static struct scsi_op_quirk_entry scsi_op_quirk_table[] = { @@ -140,519 +144,456 @@ static struct scsi_op_quirk_entry scsi_o }; static struct op_table_entry scsi_op_codes[] = { -/* - * From: ftp://ftp.symbios.com/pub/standards/io/t10/drafts/spc/op-num.txt - * Modifications by Kenneth Merry (ken@FreeBSD.ORG) - * - * Note: order is important in this table, scsi_op_desc() currently - * depends on the opcodes in the table being in order to save search time. - */ -/* - * File: OP-NUM.TXT - * - * SCSI Operation Codes - * Numeric Sorted Listing - * as of 11/13/96 - * - * D - DIRECT ACCESS DEVICE (SBC) device column key - * .T - SEQUENTIAL ACCESS DEVICE (SSC) ------------------- - * . L - PRINTER DEVICE (SSC) M = Mandatory - * . P - PROCESSOR DEVICE (SPC) O = Optional - * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC) V = Vendor specific - * . . R - CD DEVICE (MMC) R = Reserved - * . . S - SCANNER DEVICE (SGC) Z = Obsolete - * . . .O - OPTICAL MEMORY DEVICE (SBC) - * . . . M - MEDIA CHANGER DEVICE (SMC) - * . . . C - COMMUNICATION DEVICE (SSC) - * . . . .A - STORAGE ARRAY DEVICE (SCC) - * . . . . E - ENCLOSURE SERVICES DEVICE (SES) - * OP DTLPWRSOMCAE Description - * -- ------------ ---------------------------------------------------- */ -/* 00 MMMMMMMMMMMM TEST UNIT READY */ -{0x00, ALL, "TEST UNIT READY"}, - -/* 01 M REWIND */ -{0x01, T, "REWIND"}, -/* 01 Z V ZO ZO REZERO UNIT */ -{0x01, D|L|W|O|M, "REZERO UNIT"}, - -/* 02 VVVVVV V */ - -/* 03 MMMMMMMMMMMM REQUEST SENSE */ -{0x03, ALL, "REQUEST SENSE"}, - -/* 04 M O O FORMAT UNIT */ -{0x04, D|R|O, "FORMAT UNIT"}, -/* 04 O FORMAT MEDIUM */ -{0x04, T, "FORMAT MEDIUM"}, -/* 04 O FORMAT */ -{0x04, L, "FORMAT"}, - -/* 05 VMVVVV V READ BLOCK LIMITS */ -{0x05, T, "READ BLOCK LIMITS"}, - -/* 06 VVVVVV V */ - -/* 07 OVV O OV REASSIGN BLOCKS */ -{0x07, D|W|O, "REASSIGN BLOCKS"}, -/* 07 O INITIALIZE ELEMENT STATUS */ -{0x07, M, "INITIALIZE ELEMENT STATUS"}, - -/* 08 OMV OO OV READ(06) */ -{0x08, D|T|W|R|O, "READ(06)"}, -/* 08 O RECEIVE */ -{0x08, P, "RECEIVE"}, -/* 08 M GET MESSAGE(06) */ -{0x08, C, "GET MESSAGE(06)"}, - -/* 09 VVVVVV V */ - -/* 0A OM O OV WRITE(06) */ -{0x0A, D|T|W|O, "WRITE(06)"}, -/* 0A M SEND(06) */ -{0x0A, P, "SEND(06)"}, -/* 0A M SEND MESSAGE(06) */ -{0x0A, C, "SEND MESSAGE(06)"}, -/* 0A M PRINT */ -{0x0A, L, "PRINT"}, - -/* 0B Z ZO ZV SEEK(06) */ -{0x0B, D|W|R|O, "SEEK(06)"}, -/* 0B O SLEW AND PRINT */ -{0x0B, L, "SLEW AND PRINT"}, - -/* 0C VVVVVV V */ -/* 0D VVVVVV V */ -/* 0E VVVVVV V */ -/* 0F VOVVVV V READ REVERSE */ -{0x0F, T, "READ REVERSE"}, - -/* 10 VM VVV WRITE FILEMARKS */ -{0x10, T, "WRITE FILEMARKS"}, -/* 10 O O SYNCHRONIZE BUFFER */ -{0x10, L|W, "SYNCHRONIZE BUFFER"}, - -/* 11 VMVVVV SPACE */ -{0x11, T, "SPACE"}, - -/* 12 MMMMMMMMMMMM INQUIRY */ -{0x12, ALL, "INQUIRY"}, - -/* 13 VOVVVV VERIFY(06) */ -{0x13, T, "VERIFY(06)"}, - -/* 14 VOOVVV RECOVER BUFFERED DATA */ -{0x14, T|L, "RECOVER BUFFERED DATA"}, - -/* 15 OMO OOOOOOOO MODE SELECT(06) */ -{0x15, ALL & ~(P), "MODE SELECT(06)"}, - -/* 16 MMMOMMMM O RESERVE(06) */ -{0x16, D|T|L|P|W|R|S|O|E, "RESERVE(06)"}, -/* 16 M RESERVE ELEMENT(06) */ -{0x16, M, "RESERVE ELEMENT(06)"}, - -/* 17 MMMOMMMM O RELEASE(06) */ -{0x17, ALL & ~(M|C|A), "RELEASE(06)"}, -/* 17 M RELEASE ELEMENT(06) */ -{0x17, M, "RELEASE ELEMENT(06)"}, - -/* 18 OOOOOOOO COPY */ -{0x18, ALL & ~(M|C|A|E), "COPY"}, - -/* 19 VMVVVV ERASE */ -{0x19, T, "ERASE"}, - -/* 1A OMO OOOOOOOO MODE SENSE(06) */ -{0x1A, ALL & ~(P), "MODE SENSE(06)"}, - -/* 1B O OM O STOP START UNIT */ -{0x1B, D|W|R|O, "STOP START UNIT"}, -/* 1B O LOAD UNLOAD */ -{0x1B, T, "LOAD UNLOAD"}, -/* 1B O SCAN */ -{0x1B, S, "SCAN"}, -/* 1B O STOP PRINT */ -{0x1B, L, "STOP PRINT"}, - -/* 1C OOOOOOOOOO M RECEIVE DIAGNOSTIC RESULTS */ -{0x1C, ALL & ~(A), "RECEIVE DIAGNOSTIC RESULTS"}, - -/* 1D MMMMMMMMMMMM SEND DIAGNOSTIC */ -{0x1D, ALL, "SEND DIAGNOSTIC"}, - -/* 1E OO OM OO PREVENT ALLOW MEDIUM REMOVAL */ -{0x1E, D|T|W|R|O|M, "PREVENT ALLOW MEDIUM REMOVAL"}, - -/* 1F */ -/* 20 V VV V */ -/* 21 V VV V */ -/* 22 V VV V */ -/* 23 V VV V */ - -/* 24 V VVM SET WINDOW */ -{0x24, S, "SET WINDOW"}, - -/* 25 M M M READ CAPACITY */ -{0x25, D|W|O, "READ CAPACITY"}, -/* 25 M READ CD RECORDED CAPACITY */ -{0x25, R, "READ CD RECORDED CAPACITY"}, -/* 25 O GET WINDOW */ -{0x25, S, "GET WINDOW"}, - -/* 26 V VV */ -/* 27 V VV */ - -/* 28 M MMMM READ(10) */ -{0x28, D|W|R|S|O, "READ(10)"}, -/* 28 O GET MESSAGE(10) */ -{0x28, C, "GET MESSAGE(10)"}, - -/* 29 V VV O READ GENERATION */ -{0x29, O, "READ GENERATION"}, - -/* 2A M MM M WRITE(10) */ -{0x2A, D|W|R|O, "WRITE(10)"}, -/* 2A O SEND(10) */ -{0x2A, S, "SEND(10)"}, -/* 2A O SEND MESSAGE(10) */ -{0x2A, C, "SEND MESSAGE(10)"}, - -/* 2B O OM O SEEK(10) */ -{0x2B, D|W|R|O, "SEEK(10)"}, -/* 2B O LOCATE */ -{0x2B, T, "LOCATE"}, -/* 2B O POSITION TO ELEMENT */ -{0x2B, M, "POSITION TO ELEMENT"}, - -/* 2C V O ERASE(10) */ -{0x2C, O, "ERASE(10)"}, - -/* 2D V O O READ UPDATED BLOCK */ -{0x2D, W|O, "READ UPDATED BLOCK"}, - -/* 2E O O O WRITE AND VERIFY(10) */ -{0x2E, D|W|O, "WRITE AND VERIFY(10)"}, - -/* 2F O OO O VERIFY(10) */ -{0x2F, D|W|R|O, "VERIFY(10)"}, - -/* 30 Z ZO Z SEARCH DATA HIGH(10) */ -{0x30, D|W|R|O, "SEARCH DATA HIGH(10)"}, - -/* 31 Z ZO Z SEARCH DATA EQUAL(10) */ -{0x31, D|W|R|O, "SEARCH DATA EQUAL(10)"}, -/* 31 O OBJECT POSITION */ -{0x31, S, "OBJECT POSITION"}, - -/* 32 Z ZO Z SEARCH DATA LOW(10) */ -{0x32, D|W|R|O, "SEARCH DATA LOW(10"}, - -/* 33 O OO O SET LIMITS(10) */ -{0x33, D|W|R|O, "SET LIMITS(10)"}, - -/* 34 O OO O PRE-FETCH */ -{0x34, D|W|R|O, "PRE-FETCH"}, -/* 34 O READ POSITION */ -{0x34, T, "READ POSITION"}, -/* 34 O GET DATA BUFFER STATUS */ -{0x34, S, "GET DATA BUFFER STATUS"}, - -/* 35 O OM O SYNCHRONIZE CACHE */ -{0x35, D|W|R|O, "SYNCHRONIZE CACHE"}, - -/* 36 O OO O LOCK UNLOCK CACHE */ -{0x36, D|W|R|O, "LOCK UNLOCK CACHE"}, - -/* 37 O O READ DEFECT DATA(10) */ -{0x37, D|O, "READ DEFECT DATA(10)"}, - -/* 38 O O MEDIUM SCAN */ -{0x38, W|O, "MEDIUM SCAN"}, - -/* 39 OOOOOOOO COMPARE */ -{0x39, ALL & ~(M|C|A|E), "COMPARE"}, - -/* 3A OOOOOOOO COPY AND VERIFY */ -{0x3A, ALL & ~(M|C|A|E), "COPY AND VERIFY"}, - -/* 3B OOOOOOOOOO O WRITE BUFFER */ -{0x3B, ALL & ~(A), "WRITE BUFFER"}, - -/* 3C OOOOOOOOOO READ BUFFER */ -{0x3C, ALL & ~(A|E),"READ BUFFER"}, - -/* 3D O O UPDATE BLOCK */ -{0x3D, W|O, "UPDATE BLOCK"}, - -/* 3E O OO O READ LONG */ -{0x3E, D|W|R|O, "READ LONG"}, - -/* 3F O O O WRITE LONG */ -{0x3F, D|W|O, "WRITE LONG"}, - -/* 40 OOOOOOOOOO CHANGE DEFINITION */ -{0x40, ALL & ~(A|E),"CHANGE DEFINITION"}, - -/* 41 O WRITE SAME */ -{0x41, D, "WRITE SAME"}, - -/* 42 M READ SUB-CHANNEL */ -{0x42, R, "READ SUB-CHANNEL"}, - -/* 43 M READ TOC/PMA/ATIP {MMC Proposed} */ -{0x43, R, "READ TOC/PMA/ATIP {MMC Proposed}"}, - -/* 44 M REPORT DENSITY SUPPORT */ -{0x44, T, "REPORT DENSITY SUPPORT"}, -/* 44 M READ HEADER */ -{0x44, R, "READ HEADER"}, - -/* 45 O PLAY AUDIO(10) */ -{0x45, R, "PLAY AUDIO(10)"}, - -/* 46 */ - -/* 47 O PLAY AUDIO MSF */ -{0x47, R, "PLAY AUDIO MSF"}, - -/* 48 O PLAY AUDIO TRACK INDEX */ -{0x48, R, "PLAY AUDIO TRACK INDEX"}, - -/* 49 O PLAY TRACK RELATIVE(10) */ -{0x49, R, "PLAY TRACK RELATIVE(10)"}, - -/* 4A */ - -/* 4B O PAUSE/RESUME */ -{0x4B, R, "PAUSE/RESUME"}, - -/* 4C OOOOOOOOOOO LOG SELECT */ -{0x4C, ALL & ~(E), "LOG SELECT"}, - -/* 4D OOOOOOOOOOO LOG SENSE */ -{0x4D, ALL & ~(E), "LOG SENSE"}, - -/* 4E O STOP PLAY/SCAN {MMC Proposed} */ -{0x4E, R, "STOP PLAY/SCAN {MMC Proposed}"}, - -/* 4F */ - -/* 50 O XDWRITE(10) */ -{0x50, D, "XDWRITE(10)"}, - -/* 51 O XPWRITE(10) */ -{0x51, D, "XPWRITE(10)"}, -/* 51 M READ DISC INFORMATION {MMC Proposed} */ -{0x51, R, "READ DISC INFORMATION {MMC Proposed}"}, - -/* 52 O XDREAD(10) */ -{0x52, D, "XDREAD(10)"}, -/* 52 M READ TRACK INFORMATION {MMC Proposed} */ -{0x52, R, "READ TRACK INFORMATION {MMC Proposed}"}, - -/* 53 M RESERVE TRACK {MMC Proposed} */ -{0x53, R, "RESERVE TRACK {MMC Proposed}"}, - -/* 54 O SEND OPC INFORMATION {MMC Proposed} */ -{0x54, R, "SEND OPC INFORMATION {MMC Proposed}"}, - -/* 55 OOO OOOOOOOO MODE SELECT(10) */ -{0x55, ALL & ~(P), "MODE SELECT(10)"}, - -/* 56 MMMOMMMM O RESERVE(10) */ -{0x56, ALL & ~(M|C|A), "RESERVE(10)"}, -/* 56 M RESERVE ELEMENT(10) */ -{0x56, M, "RESERVE ELEMENT(10)"}, - -/* 57 MMMOMMMM O RELEASE(10) */ -{0x57, ALL & ~(M|C|A), "RELEASE(10"}, -/* 57 M RELEASE ELEMENT(10) */ -{0x57, M, "RELEASE ELEMENT(10)"}, - -/* 58 O REPAIR TRACK {MMC Proposed} */ -{0x58, R, "REPAIR TRACK {MMC Proposed}"}, - -/* 59 O READ MASTER CUE {MMC Proposed} */ -{0x59, R, "READ MASTER CUE {MMC Proposed}"}, - -/* 5A OOO OOOOOOOO MODE SENSE(10) */ -{0x5A, ALL & ~(P), "MODE SENSE(10)"}, - -/* 5B M CLOSE TRACK/SESSION {MMC Proposed} */ -{0x5B, R, "CLOSE TRACK/SESSION {MMC Proposed}"}, - -/* 5C O READ BUFFER CAPACITY {MMC Proposed} */ -{0x5C, R, "READ BUFFER CAPACITY {MMC Proposed}"}, - -/* 5D O SEND CUE SHEET {MMC Proposed} */ -{0x5D, R, "SEND CUE SHEET {MMC Proposed}"}, - -/* 5E OOOOOOOOO O PERSISTENT RESERVE IN */ -{0x5E, ALL & ~(C|A),"PERSISTENT RESERVE IN"}, - -/* 5F OOOOOOOOO O PERSISTENT RESERVE OUT */ -{0x5F, ALL & ~(C|A),"PERSISTENT RESERVE OUT"}, - -/* 80 O XDWRITE EXTENDED(16) */ -{0x80, D, "XDWRITE EXTENDED(16)"}, - -/* 81 O REBUILD(16) */ -{0x81, D, "REBUILD(16)"}, - -/* 82 O REGENERATE(16) */ -{0x82, D, "REGENERATE(16)"}, - -/* 83 */ -/* 84 */ -/* 85 */ -/* 86 */ -/* 87 */ -/* 88 MM OO O O READ(16) */ -{0x88, D|T|W|R|O, "READ(16)"}, -/* 89 */ -/* 8A OM O O O WRITE(16) */ -{0x8A, D|T|W|R|O, "WRITE(16)"}, -/* 8B */ -/* 8C */ -/* 8D */ -/* 8E */ -/* 8F */ -/* 90 */ -/* 91 */ -/* 92 */ -/* 93 */ -/* 94 */ -/* 95 */ -/* 96 */ -/* 97 */ -/* 98 */ -/* 99 */ -/* 9A */ -/* 9B */ -/* 9C */ -/* 9D */ -/* XXX KDM ALL for these? op-num.txt defines them for none.. */ -/* 9E SERVICE ACTION IN(16) */ -{0x9E, ALL, "SERVICE ACTION IN(16)"}, -/* 9F SERVICE ACTION OUT(16) */ -{0x9F, ALL, "SERVICE ACTION OUT(16)"}, - -/* A0 OOOOOOOOOOO REPORT LUNS */ -{0xA0, ALL & ~(E), "REPORT LUNS"}, - -/* A1 O BLANK {MMC Proposed} */ -{0xA1, R, "BLANK {MMC Proposed}"}, - -/* A2 O WRITE CD MSF {MMC Proposed} */ -{0xA2, R, "WRITE CD MSF {MMC Proposed}"}, - -/* A3 M MAINTENANCE (IN) */ -{0xA3, A, "MAINTENANCE (IN)"}, - -/* A4 O MAINTENANCE (OUT) */ -{0xA4, A, "MAINTENANCE (OUT)"}, - -/* A5 O M MOVE MEDIUM */ -{0xA5, T|M, "MOVE MEDIUM"}, -/* A5 O PLAY AUDIO(12) */ -{0xA5, R, "PLAY AUDIO(12)"}, - -/* A6 O EXCHANGE MEDIUM */ -{0xA6, M, "EXCHANGE MEDIUM"}, -/* A6 O LOAD/UNLOAD CD {MMC Proposed} */ -{0xA6, R, "LOAD/UNLOAD CD {MMC Proposed}"}, - -/* A7 OO OO OO MOVE MEDIUM ATTACHED */ -{0xA7, D|T|W|R|O|M, "MOVE MEDIUM ATTACHED"}, - -/* A8 O OM O READ(12) */ -{0xA8,D|W|R|O, "READ(12)"}, -/* A8 O GET MESSAGE(12) */ -{0xA8, C, "GET MESSAGE(12)"}, - -/* A9 O PLAY TRACK RELATIVE(12) */ -{0xA9, R, "PLAY TRACK RELATIVE(12)"}, - -/* AA O O O WRITE(12) */ -{0xAA,D|W|O, "WRITE(12)"}, -/* AA O WRITE CD(12) {MMC Proposed} */ -{0xAA, R, "WRITE CD(12) {MMC Proposed}"}, -/* AA O SEND MESSAGE(12) */ -{0xAA, C, "SEND MESSAGE(12)"}, - -/* AB */ - -/* AC O ERASE(12) */ -{0xAC, O, "ERASE(12)"}, - -/* AD */ - -/* AE O O WRITE AND VERIFY(12) */ -{0xAE, W|O, "WRITE AND VERIFY(12)"}, - -/* AF OO O VERIFY(12) */ -{0xAF, W|R|O, "VERIFY(12)"}, - -/* B0 ZO Z SEARCH DATA HIGH(12) */ -{0xB0, W|R|O, "SEARCH DATA HIGH(12)"}, - -/* B1 ZO Z SEARCH DATA EQUAL(12) */ -{0xB1, W|R|O, "SEARCH DATA EQUAL(12)"}, - -/* B2 ZO Z SEARCH DATA LOW(12) */ -{0xB2, W|R|O, "SEARCH DATA LOW(12)"}, - -/* B3 OO O SET LIMITS(12) */ -{0xB3, W|R|O, "SET LIMITS(12)"}, - -/* B4 OO OO OO READ ELEMENT STATUS ATTACHED */ -{0xB4, D|T|W|R|O|M, "READ ELEMENT STATUS ATTACHED"}, - -/* B5 O REQUEST VOLUME ELEMENT ADDRESS */ -{0xB5, M, "REQUEST VOLUME ELEMENT ADDRESS"}, - -/* B6 O SEND VOLUME TAG */ -{0xB6, M, "SEND VOLUME TAG"}, - -/* B7 O READ DEFECT DATA(12) */ -{0xB7, O, "READ DEFECT DATA(12)"}, - -/* B8 O M READ ELEMENT STATUS */ -{0xB8, T|M, "READ ELEMENT STATUS"}, -/* B8 O SET CD SPEED {MMC Proposed} */ -{0xB8, R, "SET CD SPEED {MMC Proposed}"}, - -/* B9 M READ CD MSF {MMC Proposed} */ -{0xB9, R, "READ CD MSF {MMC Proposed}"}, - -/* BA O SCAN {MMC Proposed} */ -{0xBA, R, "SCAN {MMC Proposed}"}, -/* BA M REDUNDANCY GROUP (IN) */ -{0xBA, A, "REDUNDANCY GROUP (IN)"}, - -/* BB O SET CD-ROM SPEED {proposed} */ -{0xBB, R, "SET CD-ROM SPEED {proposed}"}, -/* BB O REDUNDANCY GROUP (OUT) */ -{0xBB, A, "REDUNDANCY GROUP (OUT)"}, - -/* BC O PLAY CD {MMC Proposed} */ -{0xBC, R, "PLAY CD {MMC Proposed}"}, -/* BC M SPARE (IN) */ -{0xBC, A, "SPARE (IN)"}, - -/* BD M MECHANISM STATUS {MMC Proposed} */ -{0xBD, R, "MECHANISM STATUS {MMC Proposed}"}, -/* BD O SPARE (OUT) */ -{0xBD, A, "SPARE (OUT)"}, - -/* BE O READ CD {MMC Proposed} */ -{0xBE, R, "READ CD {MMC Proposed}"}, -/* BE M VOLUME SET (IN) */ -{0xBE, A, "VOLUME SET (IN)"}, - -/* BF O VOLUME SET (OUT) */ -{0xBF, A, "VOLUME SET (OUT)"} + /* + * From: http://www.t10.org/lists/op-num.txt + * Modifications by Kenneth Merry (ken@FreeBSD.ORG) + * and Jung-uk Kim (jkim@FreeBSD.org) + * + * Note: order is important in this table, scsi_op_desc() currently + * depends on the opcodes in the table being in order to save + * search time. + * Note: scanner and comm. devices are carried over from the previous + * version because they were removed in the latest spec. + */ + /* File: OP-NUM.TXT + * + * SCSI Operation Codes + * Numeric Sorted Listing + * as of 3/11/08 + * + * D - DIRECT ACCESS DEVICE (SBC-2) device column key + * .T - SEQUENTIAL ACCESS DEVICE (SSC-2) ----------------- + * . L - PRINTER DEVICE (SSC) M = Mandatory + * . P - PROCESSOR DEVICE (SPC) O = Optional + * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC-2) V = Vendor spec. + * . . R - CD/DVE DEVICE (MMC-3) Z = Obsolete + * . . O - OPTICAL MEMORY DEVICE (SBC-2) + * . . .M - MEDIA CHANGER DEVICE (SMC-2) + * . . . A - STORAGE ARRAY DEVICE (SCC-2) + * . . . .E - ENCLOSURE SERVICES DEVICE (SES) + * . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC) + * . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW) + * . . . . V - AUTOMATION/DRIVE INTERFACE (ADC) + * . . . . .F - OBJECT-BASED STORAGE (OSD) + * OP DTLPWROMAEBKVF Description + * -- -------------- ---------------------------------------------- */ + /* 00 MMMMMMMMMMMMMM TEST UNIT READY */ + { 0x00, ALL, "TEST UNIT READY" }, + /* 01 M REWIND */ + { 0x01, T, "REWIND" }, + /* 01 Z V ZZZZ REZERO UNIT */ + { 0x01, D | W | R | O | M, "REZERO UNIT" }, + /* 02 VVVVVV V */ + /* 03 MMMMMMMMMMOMMM REQUEST SENSE */ + { 0x03, ALL, "REQUEST SENSE" }, + /* 04 M OO FORMAT UNIT */ + { 0x04, D | R | O, "FORMAT UNIT" }, + /* 04 O FORMAT MEDIUM */ + { 0x04, T, "FORMAT MEDIUM" }, + /* 04 O FORMAT */ + { 0x04, L, "FORMAT" }, + /* 05 VMVVVV V READ BLOCK LIMITS */ + { 0x05, T, "READ BLOCK LIMITS" }, + /* 06 VVVVVV V */ + /* 07 OVV O OV REASSIGN BLOCKS */ + { 0x07, D | W | O, "REASSIGN BLOCKS" }, + /* 07 O INITIALIZE ELEMENT STATUS */ + { 0x07, M, "INITIALIZE ELEMENT STATUS" }, + /* 08 MOV O OV READ(6) */ + { 0x08, D | T | W | O, "READ(6)" }, + /* 08 O RECEIVE */ + { 0x08, P, "RECEIVE" }, + /* 08 GET MESSAGE(6) */ + { 0x08, C, "GET MESSAGE(6)" }, + /* 09 VVVVVV V */ + /* 0A OO O OV WRITE(6) */ + { 0x0A, D | T | W | O, "WRITE(6)" }, + /* 0A M SEND(6) */ + { 0x0A, P, "SEND(6)" }, + /* 0A SEND MESSAGE(6) */ + { 0x0A, C, "SEND MESSAGE(6)" }, + /* 0A M PRINT */ + { 0x0A, L, "PRINT" }, + /* 0B Z ZOZV SEEK(6) */ + { 0x0B, D | W | R | O, "SEEK(6)" }, + /* 0B O SET CAPACITY */ + { 0x0B, T, "SET CAPACITY" }, + /* 0B O SLEW AND PRINT */ + { 0x0B, L, "SLEW AND PRINT" }, + /* 0C VVVVVV V */ + /* 0D VVVVVV V */ + /* 0E VVVVVV V */ + /* 0F VOVVVV V READ REVERSE(6) */ + { 0x0F, T, "READ REVERSE(6)" }, + /* 10 VM VVV WRITE FILEMARKS(6) */ + { 0x10, T, "WRITE FILEMARKS(6)" }, + /* 10 O SYNCHRONIZE BUFFER */ + { 0x10, L, "SYNCHRONIZE BUFFER" }, + /* 11 VMVVVV SPACE(6) */ + { 0x11, T, "SPACE(6)" }, + /* 12 MMMMMMMMMMMMMM INQUIRY */ + { 0x12, ALL, "INQUIRY" }, + /* 13 V VVVV */ + /* 13 O VERIFY(6) */ + { 0x13, T, "VERIFY(6)" }, + /* 14 VOOVVV RECOVER BUFFERED DATA */ + { 0x14, T | L, "RECOVER BUFFERED DATA" }, + /* 15 OMO O OOOO OO MODE SELECT(6) */ + { 0x15, ALL & ~(P | R | B | F), "MODE SELECT(6)" }, + /* 16 ZZMZO OOOZ O RESERVE(6) */ + { 0x16, ALL & ~(R | B | V | F | C), "RESERVE(6)" }, + /* 16 Z RESERVE ELEMENT(6) */ + { 0x16, M, "RESERVE ELEMENT(6)" }, + /* 17 ZZMZO OOOZ O RELEASE(6) */ + { 0x17, ALL & ~(R | B | V | F | C), "RELEASE(6)" }, + /* 17 Z RELEASE ELEMENT(6) */ + { 0x17, M, "RELEASE ELEMENT(6)" }, + /* 18 ZZZZOZO Z COPY */ + { 0x18, D | T | L | P | W | R | O | K | S, "COPY" }, + /* 19 VMVVVV ERASE(6) */ + { 0x19, T, "ERASE(6)" }, + /* 1A OMO O OOOO OO MODE SENSE(6) */ + { 0x1A, ALL & ~(P | R | B | F), "MODE SENSE(6)" }, + /* 1B O OOO O MO O START STOP UNIT */ + { 0x1B, D | W | R | O | A | B | K | F, "START STOP UNIT" }, + /* 1B O M LOAD UNLOAD */ + { 0x1B, T | V, "LOAD UNLOAD" }, + /* 1B SCAN */ + { 0x1B, S, "SCAN" }, + /* 1B O STOP PRINT */ + { 0x1B, L, "STOP PRINT" }, + /* 1B O OPEN/CLOSE IMPORT/EXPORT ELEMENT */ + { 0x1B, M, "OPEN/CLOSE IMPORT/EXPORT ELEMENT" }, + /* 1C OOOOO OOOM OOO RECEIVE DIAGNOSTIC RESULTS */ + { 0x1C, ALL & ~(R | B), "RECEIVE DIAGNOSTIC RESULTS" }, + /* 1D MMMMM MMOM MMM SEND DIAGNOSTIC */ + { 0x1D, ALL & ~(R | B), "SEND DIAGNOSTIC" }, + /* 1E OO OOOO O O PREVENT ALLOW MEDIUM REMOVAL */ + { 0x1E, D | T | W | R | O | M | K | F, "PREVENT ALLOW MEDIUM REMOVAL" }, + /* 1F */ + /* 20 V VVV V */ + /* 21 V VVV V */ + /* 22 V VVV V */ + /* 23 V V V V */ + /* 23 O READ FORMAT CAPACITIES */ + { 0x23, R, "READ FORMAT CAPACITIES" }, + /* 24 V VV SET WINDOW */ + { 0x24, S, "SET WINDOW" }, + /* 25 M M M M READ CAPACITY(10) */ + { 0x25, D | W | O | B, "READ CAPACITY(10)" }, + /* 25 O READ CAPACITY */ + { 0x25, R, "READ CAPACITY" }, + /* 25 M READ CARD CAPACITY */ + { 0x25, K, "READ CARD CAPACITY" }, + /* 25 GET WINDOW */ + { 0x25, S, "GET WINDOW" }, + /* 26 V VV */ + /* 27 V VV */ + /* 28 M MOM MM READ(10) */ + { 0x28, D | W | R | O | B | K | S, "READ(10)" }, + /* 28 GET MESSAGE(10) */ + { 0x28, C, "GET MESSAGE(10)" }, + /* 29 V VVO READ GENERATION */ + { 0x29, O, "READ GENERATION" }, + /* 2A O MOM MO WRITE(10) */ + { 0x2A, D | W | R | O | B | K, "WRITE(10)" }, + /* 2A SEND(10) */ + { 0x2A, S, "SEND(10)" }, + /* 2A SEND MESSAGE(10) */ + { 0x2A, C, "SEND MESSAGE(10)" }, + /* 2B Z OOO O SEEK(10) */ + { 0x2B, D | W | R | O | K, "SEEK(10)" }, + /* 2B O LOCATE(10) */ + { 0x2B, T, "LOCATE(10)" }, + /* 2B O POSITION TO ELEMENT */ + { 0x2B, M, "POSITION TO ELEMENT" }, + /* 2C V OO ERASE(10) */ + { 0x2C, R | O, "ERASE(10)" }, + /* 2D O READ UPDATED BLOCK */ + { 0x2D, O, "READ UPDATED BLOCK" }, + /* 2D V */ + /* 2E O OOO MO WRITE AND VERIFY(10) */ + { 0x2E, D | W | R | O | B | K, "WRITE AND VERIFY(10)" }, + /* 2F O OOO VERIFY(10) */ + { 0x2F, D | W | R | O, "VERIFY(10)" }, + /* 30 Z ZZZ SEARCH DATA HIGH(10) */ + { 0x30, D | W | R | O, "SEARCH DATA HIGH(10)" }, + /* 31 Z ZZZ SEARCH DATA EQUAL(10) */ + { 0x31, D | W | R | O, "SEARCH DATA EQUAL(10)" }, + /* 31 OBJECT POSITION */ + { 0x31, S, "OBJECT POSITION" }, + /* 32 Z ZZZ SEARCH DATA LOW(10) */ + { 0x32, D | W | R | O, "SEARCH DATA LOW(10)" }, + /* 33 Z OZO SET LIMITS(10) */ + { 0x33, D | W | R | O, "SET LIMITS(10)" }, + /* 34 O O O O PRE-FETCH(10) */ + { 0x34, D | W | O | K, "PRE-FETCH(10)" }, + /* 34 M READ POSITION */ + { 0x34, T, "READ POSITION" }, + /* 34 GET DATA BUFFER STATUS */ + { 0x34, S, "GET DATA BUFFER STATUS" }, + /* 35 O OOO MO SYNCHRONIZE CACHE(10) */ + { 0x35, D | W | R | O | B | K, "SYNCHRONIZE CACHE(10)" }, + /* 36 Z O O O LOCK UNLOCK CACHE(10) */ + { 0x36, D | W | O | K, "LOCK UNLOCK CACHE(10)" }, + /* 37 O O READ DEFECT DATA(10) */ + { 0x37, D | O, "READ DEFECT DATA(10)" }, + /* 37 O INITIALIZE ELEMENT STATUS WITH RANGE */ + { 0x37, M, "INITIALIZE ELEMENT STATUS WITH RANGE" }, + /* 38 O O O MEDIUM SCAN */ + { 0x38, W | O | K, "MEDIUM SCAN" }, + /* 39 ZZZZOZO Z COMPARE */ + { 0x39, D | T | L | P | W | R | O | K | S, "COMPARE" }, + /* 3A ZZZZOZO Z COPY AND VERIFY */ + { 0x3A, D | T | L | P | W | R | O | K | S, "COPY AND VERIFY" }, + /* 3B OOOOOOOOOOMOOO WRITE BUFFER */ + { 0x3B, ALL, "WRITE BUFFER" }, + /* 3C OOOOOOOOOO OOO READ BUFFER */ + { 0x3C, ALL & ~(B), "READ BUFFER" }, + /* 3D O UPDATE BLOCK */ + { 0x3D, O, "UPDATE BLOCK" }, + /* 3E O O O READ LONG(10) */ + { 0x3E, D | W | O, "READ LONG(10)" }, + /* 3F O O O WRITE LONG(10) */ + { 0x3F, D | W | O, "WRITE LONG(10)" }, + /* 40 ZZZZOZOZ CHANGE DEFINITION */ + { 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" }, + /* 41 O WRITE SAME(10) */ + { 0x41, D, "WRITE SAME(10)" }, + /* 42 O READ SUB-CHANNEL */ + { 0x42, R, "READ SUB-CHANNEL" }, + /* 43 O READ TOC/PMA/ATIP */ + { 0x43, R, "READ TOC/PMA/ATIP" }, + /* 44 M M REPORT DENSITY SUPPORT */ + { 0x44, T | V, "REPORT DENSITY SUPPORT" }, + /* 44 READ HEADER */ + /* 45 O PLAY AUDIO(10) */ + { 0x45, R, "PLAY AUDIO(10)" }, + /* 46 M GET CONFIGURATION */ + { 0x46, R, "GET CONFIGURATION" }, + /* 47 O PLAY AUDIO MSF */ + { 0x47, R, "PLAY AUDIO MSF" }, + /* 48 */ + /* 49 */ + /* 4A M GET EVENT STATUS NOTIFICATION */ + { 0x4A, R, "GET EVENT STATUS NOTIFICATION" }, + /* 4B O PAUSE/RESUME */ + { 0x4B, R, "PAUSE/RESUME" }, + /* 4C OOOOO OOOO OOO LOG SELECT */ + { 0x4C, ALL & ~(R | B), "LOG SELECT" }, + /* 4D OOOOO OOOO OMO LOG SENSE */ + { 0x4D, ALL & ~(R | B), "LOG SENSE" }, + /* 4E O STOP PLAY/SCAN */ + { 0x4E, R, "STOP PLAY/SCAN" }, + /* 4F */ + /* 50 O XDWRITE(10) */ + { 0x50, D, "XDWRITE(10)" }, + /* 51 O XPWRITE(10) */ + { 0x51, D, "XPWRITE(10)" }, + /* 51 O READ DISC INFORMATION */ + { 0x51, R, "READ DISC INFORMATION" }, + /* 52 O XDREAD(10) */ + { 0x52, D, "XDREAD(10)" }, + /* 52 O READ TRACK INFORMATION */ + { 0x52, R, "READ TRACK INFORMATION" }, + /* 53 O RESERVE TRACK */ + { 0x53, R, "RESERVE TRACK" }, + /* 54 O SEND OPC INFORMATION */ + { 0x54, R, "SEND OPC INFORMATION" }, + /* 55 OOO OMOOOOMOMO MODE SELECT(10) */ + { 0x55, ALL & ~(P), "MODE SELECT(10)" }, + /* 56 ZZMZO OOOZ RESERVE(10) */ + { 0x56, ALL & ~(R | B | K | V | F | C), "RESERVE(10)" }, + /* 56 Z RESERVE ELEMENT(10) */ + { 0x56, M, "RESERVE ELEMENT(10)" }, + /* 57 ZZMZO OOOZ RELEASE(10) */ + { 0x57, ALL & ~(R | B | K | V | F | C), "RELEASE(10)" }, + /* 57 Z RELEASE ELEMENT(10) */ + { 0x57, M, "RELEASE ELEMENT(10)" }, + /* 58 O REPAIR TRACK */ + { 0x58, R, "REPAIR TRACK" }, + /* 59 */ + /* 5A OOO OMOOOOMOMO MODE SENSE(10) */ + { 0x5A, ALL & ~(P), "MODE SENSE(10)" }, + /* 5B O CLOSE TRACK/SESSION */ + { 0x5B, R, "CLOSE TRACK/SESSION" }, + /* 5C O READ BUFFER CAPACITY */ + { 0x5C, R, "READ BUFFER CAPACITY" }, + /* 5D O SEND CUE SHEET */ + { 0x5D, R, "SEND CUE SHEET" }, + /* 5E OOOOO OOOO M PERSISTENT RESERVE IN */ + { 0x5E, ALL & ~(R | B | K | V | C), "PERSISTENT RESERVE IN" }, + /* 5F OOOOO OOOO M PERSISTENT RESERVE OUT */ + { 0x5F, ALL & ~(R | B | K | V | C), "PERSISTENT RESERVE OUT" }, + /* 7E OO O OOOO O extended CDB */ + { 0x7E, D | T | R | M | A | E | B | V, "extended CDB" }, + /* 7F O M variable length CDB (more than 16 bytes) */ + { 0x7F, D | F, "variable length CDB (more than 16 bytes)" }, + /* 80 Z XDWRITE EXTENDED(16) */ + { 0x80, D, "XDWRITE EXTENDED(16)" }, + /* 80 M WRITE FILEMARKS(16) */ + { 0x80, T, "WRITE FILEMARKS(16)" }, + /* 81 Z REBUILD(16) */ + { 0x81, D, "REBUILD(16)" }, + /* 81 O READ REVERSE(16) */ + { 0x81, T, "READ REVERSE(16)" }, + /* 82 Z REGENERATE(16) */ + { 0x82, D, "REGENERATE(16)" }, + /* 83 OOOOO O OO EXTENDED COPY */ + { 0x83, D | T | L | P | W | O | K | V, "EXTENDED COPY" }, + /* 84 OOOOO O OO RECEIVE COPY RESULTS */ + { 0x84, D | T | L | P | W | O | K | V, "RECEIVE COPY RESULTS" }, + /* 85 O O O ATA COMMAND PASS THROUGH(16) */ + { 0x85, D | R | B, "ATA COMMAND PASS THROUGH(16)" }, + /* 86 OO OO OOOOOOO ACCESS CONTROL IN */ + { 0x86, ALL & ~(L | R | F), "ACCESS CONTROL IN" }, + /* 87 OO OO OOOOOOO ACCESS CONTROL OUT */ + { 0x87, ALL & ~(L | R | F), "ACCESS CONTROL OUT" }, + /* + * XXX READ(16)/WRITE(16) were not listed for CD/DVE in op-num.txt + * but we had it since r1.40. Do we really want them? + */ + /* 88 MM O O O READ(16) */ + { 0x88, D | T | W | O | B, "READ(16)" }, + /* 89 */ + /* 8A OM O O O WRITE(16) */ + { 0x8A, D | T | W | O | B, "WRITE(16)" }, + /* 8B O ORWRITE */ + { 0x8B, D, "ORWRITE" }, + /* 8C OO O OO O M READ ATTRIBUTE */ + { 0x8C, D | T | W | O | M | B | V, "READ ATTRIBUTE" }, + /* 8D OO O OO O O WRITE ATTRIBUTE */ + { 0x8D, D | T | W | O | M | B | V, "WRITE ATTRIBUTE" }, + /* 8E O O O O WRITE AND VERIFY(16) */ + { 0x8E, D | W | O | B, "WRITE AND VERIFY(16)" }, + /* 8F OO O O O VERIFY(16) */ + { 0x8F, D | T | W | O | B, "VERIFY(16)" }, + /* 90 O O O O PRE-FETCH(16) */ + { 0x90, D | W | O | B, "PRE-FETCH(16)" }, + /* 91 O O O O SYNCHRONIZE CACHE(16) */ + { 0x91, D | W | O | B, "SYNCHRONIZE CACHE(16)" }, + /* 91 O SPACE(16) */ + { 0x91, T, "SPACE(16)" }, + /* 92 Z O O LOCK UNLOCK CACHE(16) */ + { 0x92, D | W | O, "LOCK UNLOCK CACHE(16)" }, + /* 92 O LOCATE(16) */ + { 0x92, T, "LOCATE(16)" }, + /* 93 O WRITE SAME(16) */ + { 0x93, D, "WRITE SAME(16)" }, + /* 93 M ERASE(16) */ + { 0x93, T, "ERASE(16)" }, + /* 94 [usage proposed by SCSI Socket Services project] */ + /* 95 [usage proposed by SCSI Socket Services project] */ + /* 96 [usage proposed by SCSI Socket Services project] */ + /* 97 [usage proposed by SCSI Socket Services project] */ + /* 98 */ + /* 99 */ + /* 9A */ + /* 9B */ + /* 9C */ + /* 9D */ + /* XXX KDM ALL for this? op-num.txt defines it for none.. */ + /* 9E SERVICE ACTION IN(16) */ + { 0x9E, ALL, "SERVICE ACTION IN(16)" }, + /* XXX KDM ALL for this? op-num.txt defines it for ADC.. */ + /* 9F M SERVICE ACTION OUT(16) */ + { 0x9F, ALL, "SERVICE ACTION OUT(16)" }, + /* A0 MMOOO OMMM OMO REPORT LUNS */ + { 0xA0, ALL & ~(R | B), "REPORT LUNS" }, + /* A1 O BLANK */ + { 0xA1, R, "BLANK" }, + /* A1 O O ATA COMMAND PASS THROUGH(12) */ + { 0xA1, D | B, "ATA COMMAND PASS THROUGH(12)" }, + /* A2 OO O O SECURITY PROTOCOL IN */ + { 0xA2, D | T | R | V, "SECURITY PROTOCOL IN" }, + /* A3 OOO O OOMOOOM MAINTENANCE (IN) */ + { 0xA3, ALL & ~(P | R | F), "MAINTENANCE (IN)" }, + /* A3 O SEND KEY */ + { 0xA3, R, "SEND KEY" }, + /* A4 OOO O OOOOOOO MAINTENANCE (OUT) */ + { 0xA4, ALL & ~(P | R | F), "MAINTENANCE (OUT)" }, + /* A4 O REPORT KEY */ + { 0xA4, R, "REPORT KEY" }, + /* A5 O O OM MOVE MEDIUM */ + { 0xA5, T | W | O | M, "MOVE MEDIUM" }, + /* A5 O PLAY AUDIO(12) */ + { 0xA5, R, "PLAY AUDIO(12)" }, + /* A6 O EXCHANGE MEDIUM */ + { 0xA6, M, "EXCHANGE MEDIUM" }, + /* A6 O LOAD/UNLOAD C/DVD */ + { 0xA6, R, "LOAD/UNLOAD C/DVD" }, + /* A7 ZZ O O MOVE MEDIUM ATTACHED */ + { 0xA7, D | T | W | O, "MOVE MEDIUM ATTACHED" }, + /* A7 O SET READ AHEAD */ + { 0xA7, R, "SET READ AHEAD" }, + /* A8 O OOO READ(12) */ + { 0xA8, D | W | R | O, "READ(12)" }, + /* A8 GET MESSAGE(12) */ + { 0xA8, C, "GET MESSAGE(12)" }, + /* A9 O SERVICE ACTION OUT(12) */ + { 0xA9, V, "SERVICE ACTION OUT(12)" }, + /* AA O OOO WRITE(12) */ + { 0xAA, D | W | R | O, "WRITE(12)" }, + /* AA SEND MESSAGE(12) */ + { 0xAA, C, "SEND MESSAGE(12)" }, + /* AB O O SERVICE ACTION IN(12) */ + { 0xAB, R | V, "SERVICE ACTION IN(12)" }, + /* AC O ERASE(12) */ + { 0xAC, O, "ERASE(12)" }, + /* AC O GET PERFORMANCE */ + { 0xAC, R, "GET PERFORMANCE" }, + /* AD O READ DVD STRUCTURE */ + { 0xAD, R, "READ DVD STRUCTURE" }, + /* AE O O O WRITE AND VERIFY(12) */ + { 0xAE, D | W | O, "WRITE AND VERIFY(12)" }, + /* AF O OZO VERIFY(12) */ + { 0xAF, D | W | R | O, "VERIFY(12)" }, + /* B0 ZZZ SEARCH DATA HIGH(12) */ + { 0xB0, W | R | O, "SEARCH DATA HIGH(12)" }, + /* B1 ZZZ SEARCH DATA EQUAL(12) */ + { 0xB1, W | R | O, "SEARCH DATA EQUAL(12)" }, + /* B2 ZZZ SEARCH DATA LOW(12) */ + { 0xB2, W | R | O, "SEARCH DATA LOW(12)" }, + /* B3 Z OZO SET LIMITS(12) */ + { 0xB3, D | W | R | O, "SET LIMITS(12)" }, + /* B4 ZZ OZO READ ELEMENT STATUS ATTACHED */ + { 0xB4, D | T | W | R | O, "READ ELEMENT STATUS ATTACHED" }, + /* B5 OO O O SECURITY PROTOCOL OUT */ + { 0xB5, D | T | R | V, "SECURITY PROTOCOL OUT" }, + /* B5 O REQUEST VOLUME ELEMENT ADDRESS */ + { 0xB5, M, "REQUEST VOLUME ELEMENT ADDRESS" }, + /* B6 O SEND VOLUME TAG */ + { 0xB6, M, "SEND VOLUME TAG" }, + /* B6 O SET STREAMING */ + { 0xB6, R, "SET STREAMING" }, + /* B7 O O READ DEFECT DATA(12) */ + { 0xB7, D | O, "READ DEFECT DATA(12)" }, + /* B8 O OZOM READ ELEMENT STATUS */ + { 0xB8, T | W | R | O | M, "READ ELEMENT STATUS" }, + /* B9 O READ CD MSF */ + { 0xB9, R, "READ CD MSF" }, + /* BA O O OOMO REDUNDANCY GROUP (IN) */ + { 0xBA, D | W | O | M | A | E, "REDUNDANCY GROUP (IN)" }, + /* BA O SCAN */ + { 0xBA, R, "SCAN" }, + /* BB O O OOOO REDUNDANCY GROUP (OUT) */ + { 0xBB, D | W | O | M | A | E, "REDUNDANCY GROUP (OUT)" }, + /* BB O SET CD SPEED */ + { 0xBB, R, "SET CD SPEED" }, + /* BC O O OOMO SPARE (IN) */ + { 0xBC, D | W | O | M | A | E, "SPARE (IN)" }, + /* BD O O OOOO SPARE (OUT) */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:26:39 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47E2E106564A; Sun, 1 Mar 2009 16:26:39 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3537D8FC22; Sun, 1 Mar 2009 16:26:39 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21GQdhf048330; Sun, 1 Mar 2009 16:26:39 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GQdw2048329; Sun, 1 Mar 2009 16:26:39 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011626.n21GQdw2048329@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189240 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:26:40 -0000 Author: scottl Date: Sun Mar 1 16:26:38 2009 New Revision: 189240 URL: http://svn.freebsd.org/changeset/base/189240 Log: Merge 181791: SCSI_DELAY is specified in milliseconds. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_all.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 16:24:57 2009 (r189239) +++ stable/7/sys/cam/scsi/scsi_all.c Sun Mar 1 16:26:38 2009 (r189240) @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); #endif /* !_KERNEL */ /* - * This is the default number of seconds we wait for devices to settle + * This is the default number of milliseconds we wait for devices to settle * after a SCSI bus reset. */ #ifndef SCSI_DELAY From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:28:18 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0301E106564A; Sun, 1 Mar 2009 16:28:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA3FD8FC13; Sun, 1 Mar 2009 16:28:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21GSH5P048423; Sun, 1 Mar 2009 16:28:17 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GSH8g048420; Sun, 1 Mar 2009 16:28:17 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011628.n21GSH8g048420@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189241 - in stable/7/sys: . cam/scsi contrib/pf dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:28:18 -0000 Author: scottl Date: Sun Mar 1 16:28:17 2009 New Revision: 189241 URL: http://svn.freebsd.org/changeset/base/189241 Log: Merge 186371: Fix refcount locking in cd, pass, and sg periphs. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_cd.c stable/7/sys/cam/scsi/scsi_pass.c stable/7/sys/cam/scsi/scsi_sg.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 16:26:38 2009 (r189240) +++ stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 16:28:17 2009 (r189241) @@ -996,12 +996,6 @@ cdopen(struct disk *dp) return (error); } - /* Closes aren't symmetrical with opens, so fix up the refcounting. */ - if (softc->flags & CD_FLAG_OPEN) - cam_periph_release(periph); - else - softc->flags |= CD_FLAG_OPEN; - /* * Check for media, and set the appropriate flags. We don't bail * if we don't have media, but then we don't allow anything but the @@ -1011,7 +1005,15 @@ cdopen(struct disk *dp) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdopen\n")); cam_periph_unhold(periph); - cam_periph_unlock(periph); + + /* Closes aren't symmetrical with opens, so fix up the refcounting. */ + if ((softc->flags & CD_FLAG_OPEN) == 0) { + softc->flags |= CD_FLAG_OPEN; + cam_periph_unlock(periph); + } else { + cam_periph_unlock(periph); + cam_periph_release(periph); + } return (0); } Modified: stable/7/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_pass.c Sun Mar 1 16:26:38 2009 (r189240) +++ stable/7/sys/cam/scsi/scsi_pass.c Sun Mar 1 16:28:17 2009 (r189241) @@ -345,13 +345,13 @@ passopen(struct cdev *dev, int flags, in if ((softc->flags & PASS_FLAG_OPEN) == 0) { softc->flags |= PASS_FLAG_OPEN; + cam_periph_unlock(periph); } else { /* Device closes aren't symmertical, so fix up the refcount */ + cam_periph_unlock(periph); cam_periph_release(periph); } - cam_periph_unlock(periph); - return (error); } Modified: stable/7/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_sg.c Sun Mar 1 16:26:38 2009 (r189240) +++ stable/7/sys/cam/scsi/scsi_sg.c Sun Mar 1 16:28:17 2009 (r189241) @@ -400,13 +400,13 @@ sgopen(struct cdev *dev, int flags, int if ((softc->flags & SG_FLAG_OPEN) == 0) { softc->flags |= SG_FLAG_OPEN; + cam_periph_unlock(periph); } else { /* Device closes aren't symmetrical, fix up the refcount. */ + cam_periph_unlock(periph); cam_periph_release(periph); } - cam_periph_unlock(periph); - return (error); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:31:35 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E282D1065670; Sun, 1 Mar 2009 16:31:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D00F28FC1D; Sun, 1 Mar 2009 16:31:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21GVZ9M048599; Sun, 1 Mar 2009 16:31:35 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GVZho048598; Sun, 1 Mar 2009 16:31:35 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011631.n21GVZho048598@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189242 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:31:36 -0000 Author: scottl Date: Sun Mar 1 16:31:35 2009 New Revision: 189242 URL: http://svn.freebsd.org/changeset/base/189242 Log: Merge 182433: Fix locking mistake in the da driver. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_da.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_da.c Sun Mar 1 16:28:17 2009 (r189241) +++ stable/7/sys/cam/scsi/scsi_da.c Sun Mar 1 16:31:35 2009 (r189242) @@ -674,18 +674,19 @@ daopen(struct disk *dp) softc->disk->d_fwheads = softc->params.heads; softc->disk->d_devstat->block_size = softc->params.secsize; softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; - } - - if (error == 0) { + if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_PREVENT); - } else { + } else softc->flags &= ~DA_FLAG_OPEN; - cam_periph_release(periph); - } + cam_periph_unhold(periph); cam_periph_unlock(periph); + + if (error != 0) { + cam_periph_release(periph); + } return (error); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:41:49 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3204C106564A; Sun, 1 Mar 2009 16:41:49 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F2498FC12; Sun, 1 Mar 2009 16:41:49 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21Gfmf8048859; Sun, 1 Mar 2009 16:41:48 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21Gfmqc048858; Sun, 1 Mar 2009 16:41:48 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011641.n21Gfmqc048858@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189243 - in stable/7/sys: . contrib/pf dev/arcmsr dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:41:49 -0000 Author: scottl Date: Sun Mar 1 16:41:48 2009 New Revision: 189243 URL: http://svn.freebsd.org/changeset/base/189243 Log: Merge 188844: Fix pseudo-scsi parameters so that more than one i/o can be queued at a time. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/arcmsr/arcmsr.c stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/7/sys/dev/arcmsr/arcmsr.c Sun Mar 1 16:31:35 2009 (r189242) +++ stable/7/sys/dev/arcmsr/arcmsr.c Sun Mar 1 16:41:48 2009 (r189243) @@ -2150,7 +2150,8 @@ static void arcmsr_action(struct cam_sim spi->sync_offset=32; spi->bus_width=MSG_EXT_WDTR_BUS_16_BIT; scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; - spi->valid = CTS_SPI_VALID_SYNC_RATE + spi->valid = CTS_SPI_VALID_DISC + | CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET | CTS_SPI_VALID_BUS_WIDTH; scsi->valid = CTS_SCSI_VALID_TQ; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:43:46 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3212C106567B; Sun, 1 Mar 2009 16:43:46 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F33D8FC14; Sun, 1 Mar 2009 16:43:46 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21GhkUi048956; Sun, 1 Mar 2009 16:43:46 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GhkPu048955; Sun, 1 Mar 2009 16:43:46 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011643.n21GhkPu048955@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189244 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/ciss dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:43:47 -0000 Author: scottl Date: Sun Mar 1 16:43:45 2009 New Revision: 189244 URL: http://svn.freebsd.org/changeset/base/189244 Log: Merge 188845: Fix pseudo-scsi parameters so that more than 2 commands will be queued to the device at once. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/ciss/ciss.c stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/ciss/ciss.c ============================================================================== --- stable/7/sys/dev/ciss/ciss.c Sun Mar 1 16:41:48 2009 (r189243) +++ stable/7/sys/dev/ciss/ciss.c Sun Mar 1 16:43:45 2009 (r189244) @@ -2696,8 +2696,8 @@ ciss_cam_action(struct cam_sim *sim, uni { struct ccb_trans_settings *cts = &ccb->cts; int bus, target; - struct ccb_trans_settings_spi *spi = - &cts->xport_specific.spi; + struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; + struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; bus = cam_sim_bus(sim); target = cts->ccb_h.target_id; @@ -2712,6 +2712,9 @@ ciss_cam_action(struct cam_sim *sim, uni spi->valid = CTS_SPI_VALID_DISC; spi->flags = CTS_SPI_FLAGS_DISC_ENB; + scsi->valid = CTS_SCSI_VALID_TQ; + scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; + cts->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 16:50:49 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 024C81065794; Sun, 1 Mar 2009 16:50:49 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B68B98FC22; Sun, 1 Mar 2009 16:50:46 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21GokNW049198; Sun, 1 Mar 2009 16:50:46 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GokYf049195; Sun, 1 Mar 2009 16:50:46 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903011650.n21GokYf049195@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 16:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189246 - in stable/7/sys: . contrib/pf dev/ata dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 16:50:51 -0000 Author: scottl Date: Sun Mar 1 16:50:46 2009 New Revision: 189246 URL: http://svn.freebsd.org/changeset/base/189246 Log: Merge 188840: Add DDF metadata support, found commonly on motherboards with Adaptec branding. For Entertainment Purposes Only! Added: stable/7/sys/dev/ata/ata-raid-ddf.h - copied unchanged from r188840, head/sys/dev/ata/ata-raid-ddf.h Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ata/ata-raid.c stable/7/sys/dev/ata/ata-raid.h stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Copied: stable/7/sys/dev/ata/ata-raid-ddf.h (from r188840, head/sys/dev/ata/ata-raid-ddf.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/ata/ata-raid-ddf.h Sun Mar 1 16:50:46 2009 (r189246, copy of r188840, head/sys/dev/ata/ata-raid-ddf.h) @@ -0,0 +1,333 @@ +/*- + * Copyright (c) 2008 Scott Long + * 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, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef ATA_RAID_DDF_H +#define ATA_RAID_DDF_H + +/* Definitions from the SNIA DDF spec, rev 1.2 */ + +#define DDF_HEADER_LENGTH 512 +struct ddf_header { + uint32_t Signature; +#define DDF_HEADER_SIGNATURE 0xde11de11 + uint32_t CRC; + uint8_t DDF_Header_GUID[24]; + uint8_t DDF_rev[8]; + uint32_t Sequence_Number; + uint32_t TimeStamp; + uint8_t Open_Flag; +#define DDF_HEADER_CLOSED 0x00 +#define DDF_HEADER_OPENED_MASK 0x0f +#define DDF_HEADER_OPEN_ANCHOR 0xff + uint8_t Foreign_Flag; + uint8_t Diskgrouping; + uint8_t pad1[13]; + uint8_t Header_ext[32]; + uint64_t Primary_Header_LBA; + uint64_t Secondary_Header_LBA; + uint8_t Header_Type; +#define DDF_HEADER_ANCHOR 0x00 +#define DDF_HEADER_PRIMARY 0x01 +#define DDF_HEADER_SECONDARY 0x02 + uint8_t pad2[3]; + uint32_t WorkSpace_Length; + uint64_t WorkSpace_LBA; + uint16_t Max_PD_Entries; + uint16_t Max_VD_Entries; + uint16_t Max_Partitions; + uint16_t Configuration_Record_Length; + uint16_t Max_Primary_Element_Entries; + uint8_t pad3[54]; + uint32_t cd_section; /* Controller_Data_Section */ + uint32_t cd_length; /* Controller_Data_Section_Length */ + uint32_t pdr_section; /* Physical_Drive_Records_Section */ + uint32_t pdr_length; /* Physical_Drive_Records_Length */ + uint32_t vdr_section; /* Virtual_Drive_Records_Section */ + uint32_t vdr_length; /* Virtual_Drive_Records_Length */ + uint32_t cr_section; /* Configuration_Records_Section */ + uint32_t cr_length; /* Configuration_Records_Length */ + uint32_t pdd_section; /* Physical_Drive_Data_Section */ + uint32_t pdd_length; /* Physical_Drive_Data_Length */ + uint32_t bbmlog_section; /* BBM_Log_Section */ + uint32_t bbmlog_length; /* BBM_Log_Section_Length */ + uint32_t Diagnostic_Space; + uint32_t Diagnostic_Space_Length; + uint32_t Vendor_Specific_Logs; + uint32_t Vendor_Specific_Logs_Length; + uint8_t pad4[256]; +} __packed; + +struct ddf_cd_record { + uint32_t Signature; +#define DDF_CONTROLLER_DATA_SIGNATURE 0xad111111 + uint32_t CRC; + uint8_t Controller_GUID[24]; + struct { + uint16_t Vendor_ID; + uint16_t Device_ID; + uint16_t SubVendor_ID; + uint16_t SubDevice_ID; + } Controller_Type __packed; + uint8_t Product_ID[16]; + uint8_t pad1[8]; + uint8_t Controller_Data[448]; +} __packed; + +struct ddf_device_scsi { + uint8_t Lun; + uint8_t Id; + uint8_t Channel; + uint8_t Path_Flags; +#define DDF_DEVICE_SCSI_FLAG_BROKEN (1 << 7) +} __packed; + +struct ddf_device_sas { + uint64_t Initiator_Path; +} __packed; + +union ddf_pathinfo { + struct { + struct ddf_device_scsi Path0; + struct ddf_device_scsi Path1; + uint8_t pad[10]; + } __packed scsi; + struct { + struct ddf_device_sas Path0; + struct ddf_device_sas Path1; + uint8_t Path0_Flags; + uint8_t Path1_Flags; +#define DDF_DEVICE_SAS_FLAG_BROKEN (1 << 7) + } __packed sas; +} __packed; + +struct ddf_pd_entry { + uint8_t PD_GUID[24]; + uint32_t PD_Reference; + uint16_t PD_Type; +#define DDF_PDE_GUID_FORCE (1 << 0) +#define DDF_PDE_PARTICIPATING (1 << 1) +#define DDF_PDE_GLOBAL_SPARE (1 << 2) +#define DDF_PDE_CONFIG_SPARE (1 << 3) +#define DDF_PDE_FOREIGN (1 << 4) +#define DDF_PDE_LEGACY (1 << 5) +#define DDF_PDE_TYPE_MASK (0x0f << 12) +#define DDF_PDE_UNKNOWN (0x00 << 12) +#define DDF_PDE_SCSI (0x01 << 12) +#define DDF_PDE_SAS (0x02 << 12) +#define DDF_PDE_SATA (0x03 << 12) +#define DDF_PDE_FC (0x04 << 12) + uint16_t PD_State; +#define DDF_PDE_ONLINE (1 << 0) +#define DDF_PDE_FAILED (1 << 1) +#define DDF_PDE_REBUILD (1 << 2) +#define DDF_PDE_TRANSITION (1 << 3) +#define DDF_PDE_PFA (1 << 4) +#define DDF_PDE_UNRECOVERED (1 << 5) +#define DDF_PDE_MISSING (1 << 6) + uint64_t Configured_Size; + union ddf_pathinfo Path_Information; + uint8_t pad1[6]; +} __packed; + +struct ddf_pd_record { + uint32_t Signature; +#define DDF_PDR_SIGNATURE 0x22222222 + uint32_t CRC; + uint16_t Populated_PDEs; + uint16_t Max_PDE_Supported; + uint8_t pad1[52]; + struct ddf_pd_entry entry[0]; +} __packed; + +struct ddf_vd_entry { + uint8_t VD_GUID[24]; + uint16_t VD_Number; + uint8_t pad1[2]; + uint16_t VD_Type; +#define DDF_VDE_SHARED (1 << 0) +#define DDF_VDE_ENFORCE_GROUP (1 << 1) +#define DDF_VDE_UNICODE_NAME (1 << 2) +#define DDF_VDE_OWNER_ID_VALID (1 << 3) + uint16_t Controller_GUID_CRC; + uint8_t VD_State; +#define DDF_VDE_OPTIMAL 0x00 +#define DDF_VDE_DEGRADED 0x01 +#define DDF_VDE_DELETED 0x02 +#define DDF_VDE_MISSING 0x03 +#define DDF_VDE_FAILED 0x04 +#define DDF_VDE_PARTIAL 0x05 +#define DDF_VDE_STATE_MASK 0x07 +#define DDF_VDE_MORPH (1 << 3) +#define DDF_VDE_DIRTY (1 << 4) + uint8_t Init_State; +#define DDF_VDE_UNINTIALIZED 0x00 +#define DDF_VDE_INIT_QUICK 0x01 +#define DDF_VDE_INIT_FULL 0x02 +#define DDF_VDE_INIT_MASK 0x03 +#define DDF_VDE_UACCESS_RW 0x00 +#define DDF_VDE_UACCESS_RO 0x80 +#define DDF_VDE_UACCESS_BLOCKED 0xc0 +#define DDF_VDE_UACCESS_MASK 0xc0 + uint8_t pad2[14]; + uint8_t VD_Name[16]; +} __packed; + +struct ddf_vd_record { + uint32_t Signature; +#define DDF_VD_RECORD_SIGNATURE 0xdddddddd + uint32_t CRC; + uint16_t Populated_VDEs; + uint16_t Max_VDE_Supported; + uint8_t pad1[52]; + struct ddf_vd_entry entry[0]; +} __packed; + +#define DDF_CR_INVALID 0xffffffff + +struct ddf_vdc_record { + uint32_t Signature; +#define DDF_VDCR_SIGNATURE 0xeeeeeeee + uint32_t CRC; + uint8_t VD_GUID[24]; + uint32_t Timestamp; + uint32_t Sequence_Number; + uint8_t pad1[24]; + uint16_t Primary_Element_Count; + uint8_t Stripe_Size; + uint8_t Primary_RAID_Level; +#define DDF_VDCR_RAID0 0x00 +#define DDF_VDCR_RAID1 0x01 +#define DDF_VDCR_RAID3 0x03 +#define DDF_VDCR_RAID4 0x04 +#define DDF_VDCR_RAID5 0x05 +#define DDF_VDCR_RAID6 0x06 +#define DDF_VDCR_RAID1E 0x11 +#define DDF_VDCR_SINGLE 0x0f +#define DDF_VDCR_CONCAT 0x1f +#define DDF_VDCR_RAID5E 0x15 +#define DDF_VDCR_RAID5EE 0x25 + uint8_t RLQ; + uint8_t Secondary_Element_Count; + uint8_t Secondary_Element_Seq; + uint8_t Secondary_RAID_Level; + uint64_t Block_Count; + uint64_t VD_Size; + uint8_t pad2[8]; + uint32_t Associated_Spares[8]; + uint64_t Cache_Flags; +#define DDF_VDCR_CACHE_WB (1 << 0) +#define DDF_VDCR_CACHE_WB_ADAPTIVE (1 << 1) +#define DDF_VDCR_CACHE_RA (1 << 2) +#define DDF_VDCR_CACHE_RA_ADAPTIVE (1 << 3) +#define DDF_VDCR_CACHE_WCACHE_NOBATTERY (1 << 4) +#define DDF_VDCR_CACHE_WCACHE_ALLOW (1 << 5) +#define DDF_VDCR_CACHE_RCACHE_ALLOW (1 << 6) +#define DDF_VDCR_CACHE_VENDOR (1 << 7) + uint8_t BG_Rate; + uint8_t pad3[3]; + uint8_t pad4[52]; + uint8_t pad5[192]; + uint8_t V0[32]; + uint8_t V1[32]; + uint8_t V2[16]; + uint8_t V3[16]; + uint8_t Vendor_Scratch[32]; + uint32_t Physical_Disk_Sequence[0]; +} __packed; + +struct ddf_vuc_record { + uint32_t Signature; +#define DDF_VUCR_SIGNATURE 0x88888888 + uint32_t CRC; + uint8_t VD_GUID[24]; +} __packed; + +struct ddf_sa_entry { + uint8_t VD_GUID[24]; + uint16_t Secondary_Element; + uint8_t rsrvd2[6]; +} __packed; + +struct ddf_sa_record { + uint32_t Signature; +#define DDF_SA_SIGNATURE 0x55555555 + uint32_t CRC; + uint32_t Timestamp; + uint8_t pad1[7]; + uint8_t Spare_Type; +#define DDF_SAR_TYPE_DEDICATED (1 << 0) +#define DDF_SAR_TYPE_REVERTIBLE (1 << 1) +#define DDF_SAR_TYPE_ACTIVE (1 << 2) +#define DDF_SAR_TYPE_ENCL_AFFINITY (1 << 3) + uint16_t Populated_SAEs; + uint16_t MAX_SAE_Supported; + uint8_t pad2[8]; + struct ddf_sa_entry entry[0]; +} __packed; + +struct ddf_pdd_record { + uint32_t Signature; +#define DDF_PDD_SIGNATURE 0x33333333 + uint32_t CRC; + uint8_t PD_GUID[24]; + uint32_t PD_Reference; + uint8_t Forced_Ref_Flag; +#define DDF_PDD_FORCED_REF 0x01 + uint8_t Forced_PD_GUID_Flag; +#define DDF_PDD_FORCED_GUID 0x01 + uint8_t Vendor_Scratch[32]; + uint8_t pad2[442]; +} __packed; + +struct ddf_bbm_entry { + uint64_t Defective_Block_Start; + uint32_t Spare_Block_Offset; + uint16_t Remapped_Count; + uint8_t pad[2]; +}; + +struct ddf_bbm_log { + uint32_t Signature; +#define DDF_BBML_SIGNATURE 0xabadb10c + uint32_t CRC; + uint16_t Entry_Count; + uint32_t Spare_Block_Count; + uint8_t pad1[10]; + uint64_t First_Spare_LBA; + uint64_t Mapped_Block_Entry[0]; +} __packed; + +struct ddf_vendor_log { + uint32_t Signature; +#define DDF_VENDOR_LOG_SIGNATURE 0x01dbeef0 + uint32_t CRC; + uint64_t Log_Owner; + uint8_t pad1[16]; +} __packed; + +#endif Modified: stable/7/sys/dev/ata/ata-raid.c ============================================================================== --- stable/7/sys/dev/ata/ata-raid.c Sun Mar 1 16:47:49 2009 (r189245) +++ stable/7/sys/dev/ata/ata-raid.c Sun Mar 1 16:50:46 2009 (r189246) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -65,6 +66,7 @@ static int ata_raid_read_metadata(device static int ata_raid_write_metadata(struct ar_softc *rdp); static int ata_raid_wipe_metadata(struct ar_softc *rdp); static int ata_raid_adaptec_read_meta(device_t dev, struct ar_softc **raidp); +static int ata_raid_ddf_read_meta(device_t dev, struct ar_softc **raidp); static int ata_raid_hptv2_read_meta(device_t dev, struct ar_softc **raidp); static int ata_raid_hptv2_write_meta(struct ar_softc *rdp); static int ata_raid_hptv3_read_meta(device_t dev, struct ar_softc **raidp); @@ -93,6 +95,7 @@ static char * ata_raid_flags(struct ar_s /* debugging only */ static void ata_raid_print_meta(struct ar_softc *meta); static void ata_raid_adaptec_print_meta(struct adaptec_raid_conf *meta); +static void ata_raid_ddf_print_meta(uint8_t *meta); static void ata_raid_hptv2_print_meta(struct hptv2_raid_conf *meta); static void ata_raid_hptv3_print_meta(struct hptv3_raid_conf *meta); static void ata_raid_intel_print_meta(struct intel_raid_conf *meta); @@ -1407,6 +1410,10 @@ ata_raid_read_metadata(device_t subdisk) if (ata_raid_lsiv2_read_meta(subdisk, ata_raid_arrays)) return 0; + /* DDF (used by Adaptec, maybe others) */ + if (ata_raid_ddf_read_meta(subdisk, ata_raid_arrays)) + return 0; + /* if none of the above matched, try FreeBSD native format */ return ata_raid_promise_read_meta(subdisk, ata_raid_arrays, 1); } @@ -1679,6 +1686,338 @@ adaptec_out: return retval; } +static uint64_t +ddfbe64toh(uint64_t val) +{ + return (be64toh(val)); +} + +static uint32_t +ddfbe32toh(uint32_t val) +{ + return (be32toh(val)); +} + +static uint16_t +ddfbe16toh(uint16_t val) +{ + return (be16toh(val)); +} + +static uint64_t +ddfle64toh(uint64_t val) +{ + return (le64toh(val)); +} + +static uint32_t +ddfle32toh(uint32_t val) +{ + return (le32toh(val)); +} + +static uint16_t +ddfle16toh(uint16_t val) +{ + return (le16toh(val)); +} + +static int +ata_raid_ddf_read_meta(device_t dev, struct ar_softc **raidp) +{ + struct ata_raid_subdisk *ars; + device_t parent = device_get_parent(dev); + struct ddf_header *hdr; + struct ddf_pd_record *pdr; + struct ddf_pd_entry *pde = NULL; + struct ddf_vd_record *vdr; + struct ddf_pdd_record *pdd; + struct ddf_sa_record *sa = NULL; + struct ddf_vdc_record *vdcr = NULL; + struct ddf_vd_entry *vde = NULL; + struct ar_softc *raid; + uint64_t pri_lba; + uint32_t pd_ref, pd_pos; + uint8_t *meta, *cr; + int hdr_len, vd_state = 0, pd_state = 0; + int i, disk, array, retval = 0; + uintptr_t max_cr_addr; + uint64_t (*ddf64toh)(uint64_t) = NULL; + uint32_t (*ddf32toh)(uint32_t) = NULL; + uint16_t (*ddf16toh)(uint16_t) = NULL; + + ars = device_get_softc(dev); + raid = NULL; + + /* Read in the anchor header */ + if (!(meta = malloc(DDF_HEADER_LENGTH, M_AR, M_NOWAIT | M_ZERO))) + return ENOMEM; + + if (ata_raid_rw(parent, DDF_LBA(parent), + meta, DDF_HEADER_LENGTH, ATA_R_READ)) { + if (testing || bootverbose) + device_printf(parent, "DDF read metadata failed\n"); + goto ddf_out; + } + + /* + * Check if this is a DDF RAID struct. Note the apparent "flexibility" + * regarding endianness. + */ + hdr = (struct ddf_header *)meta; + if (be32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { + ddf64toh = ddfbe64toh; + ddf32toh = ddfbe32toh; + ddf16toh = ddfbe16toh; + } else if (le32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { + ddf64toh = ddfle64toh; + ddf32toh = ddfle32toh; + ddf16toh = ddfle16toh; + } else + goto ddf_out; + + if (hdr->Header_Type != DDF_HEADER_ANCHOR) { + if (testing || bootverbose) + device_printf(parent, "DDF check1 failed\n"); + goto ddf_out; + } + + pri_lba = ddf64toh(hdr->Primary_Header_LBA); + hdr_len = ddf32toh(hdr->cd_section) + ddf32toh(hdr->cd_length); + hdr_len = max(hdr_len,ddf32toh(hdr->pdr_section)+ddf32toh(hdr->pdr_length)); + hdr_len = max(hdr_len,ddf32toh(hdr->vdr_section)+ddf32toh(hdr->vdr_length)); + hdr_len = max(hdr_len,ddf32toh(hdr->cr_section) +ddf32toh(hdr->cr_length)); + hdr_len = max(hdr_len,ddf32toh(hdr->pdd_section)+ddf32toh(hdr->pdd_length)); + if (testing || bootverbose) + device_printf(parent, "DDF pri_lba= %llu length= %d blocks\n", + (unsigned long long)pri_lba, hdr_len); + if ((pri_lba + hdr_len) > DDF_LBA(parent)) { + device_printf(parent, "DDF exceeds length of disk\n"); + goto ddf_out; + } + + /* Don't need the anchor anymore, read the rest of the metadata */ + free(meta, M_AR); + if (!(meta = malloc(hdr_len * DEV_BSIZE, M_AR, M_NOWAIT | M_ZERO))) + return ENOMEM; + + if (ata_raid_rw(parent, pri_lba, meta, hdr_len * DEV_BSIZE, ATA_R_READ)) { + if (testing || bootverbose) + device_printf(parent, "DDF read full metadata failed\n"); + goto ddf_out; + } + + /* Check that we got a Primary Header */ + hdr = (struct ddf_header *)meta; + if ((ddf32toh(hdr->Signature) != DDF_HEADER_SIGNATURE) || + (hdr->Header_Type != DDF_HEADER_PRIMARY)) { + if (testing || bootverbose) + device_printf(parent, "DDF check2 failed\n"); + goto ddf_out; + } + + if (testing || bootverbose) + ata_raid_ddf_print_meta(meta); + + if ((hdr->Open_Flag >= 0x01) && (hdr->Open_Flag <= 0x0f)) { + device_printf(parent, "DDF Header open, possibly corrupt metadata\n"); + goto ddf_out; + } + + pdr = (struct ddf_pd_record*)(meta + ddf32toh(hdr->pdr_section)*DEV_BSIZE); + vdr = (struct ddf_vd_record*)(meta + ddf32toh(hdr->vdr_section)*DEV_BSIZE); + cr = (uint8_t *)(meta + ddf32toh(hdr->cr_section)*DEV_BSIZE); + pdd = (struct ddf_pdd_record*)(meta + ddf32toh(hdr->pdd_section)*DEV_BSIZE); + + /* Verify the Physical Disk Device Record */ + if (ddf32toh(pdd->Signature) != DDF_PDD_SIGNATURE) { + device_printf(parent, "Invalid PD Signature\n"); + goto ddf_out; + } + pd_ref = ddf32toh(pdd->PD_Reference); + pd_pos = -1; + + /* Verify the Physical Disk Record and make sure the disk is usable */ + if (ddf32toh(pdr->Signature) != DDF_PDR_SIGNATURE) { + device_printf(parent, "Invalid PDR Signature\n"); + goto ddf_out; + } + for (i = 0; i < ddf16toh(pdr->Populated_PDEs); i++) { + if (ddf32toh(pdr->entry[i].PD_Reference) != pd_ref) + continue; + pde = &pdr->entry[i]; + pd_state = ddf16toh(pde->PD_State); + } + if ((pde == NULL) || + ((pd_state & DDF_PDE_ONLINE) == 0) || + (pd_state & (DDF_PDE_FAILED|DDF_PDE_MISSING|DDF_PDE_UNRECOVERED))) { + device_printf(parent, "Physical disk not usable\n"); + goto ddf_out; + } + + /* Parse out the configuration record, look for spare and VD records. + * While DDF supports a disk being part of more than one array, and + * thus having more than one VDCR record, that feature is not supported + * by ATA-RAID. Therefore, the first record found takes precedence. + */ + max_cr_addr = (uintptr_t)cr + ddf32toh(hdr->cr_length) * DEV_BSIZE - 1; + for ( ; (uintptr_t)cr < max_cr_addr; + cr += ddf16toh(hdr->Configuration_Record_Length) * DEV_BSIZE) { + switch (ddf32toh(((uint32_t *)cr)[0])) { + case DDF_VDCR_SIGNATURE: + vdcr = (struct ddf_vdc_record *)cr; + goto cr_found; + break; + case DDF_VUCR_SIGNATURE: + /* Don't care about this record */ + break; + case DDF_SA_SIGNATURE: + sa = (struct ddf_sa_record *)cr; + goto cr_found; + break; + case DDF_CR_INVALID: + /* A record was deliberately invalidated */ + break; + default: + device_printf(parent, "Invalid CR signature found\n"); + } + } +cr_found: + if ((vdcr == NULL) /* && (sa == NULL) * Spares not supported yet */) { + device_printf(parent, "No usable configuration record found\n"); + goto ddf_out; + } + + if (vdcr != NULL) { + if (vdcr->Secondary_Element_Count != 1) { + device_printf(parent, "Unsupported multi-level Virtual Disk\n"); + goto ddf_out; + } + + /* Find the Virtual Disk Entry for this array */ + if (ddf32toh(vdr->Signature) != DDF_VD_RECORD_SIGNATURE) { + device_printf(parent, "Invalid VDR Signature\n"); + goto ddf_out; + } + for (i = 0; i < ddf16toh(vdr->Populated_VDEs); i++) { + if (bcmp(vdr->entry[i].VD_GUID, vdcr->VD_GUID, 24)) + continue; + vde = &vdr->entry[i]; + vd_state = vde->VD_State & DDF_VDE_STATE_MASK; + } + if ((vde == NULL) || + ((vd_state != DDF_VDE_OPTIMAL) && (vd_state != DDF_VDE_DEGRADED))) { + device_printf(parent, "Unusable Virtual Disk\n"); + goto ddf_out; + } + for (i = 0; i < ddf16toh(hdr->Max_Primary_Element_Entries); i++) { + uint32_t pd_tmp; + + pd_tmp = ddf32toh(vdcr->Physical_Disk_Sequence[i]); + if ((pd_tmp == 0x00000000) || (pd_tmp == 0xffffffff)) + continue; + if (pd_tmp == pd_ref) { + pd_pos = i; + break; + } + } + if (pd_pos == -1) { + device_printf(parent, "Physical device not part of array\n"); + goto ddf_out; + } + } + + /* now convert DDF metadata into our generic form */ + for (array = 0; array < MAX_ARRAYS; array++) { + if (!raidp[array]) { + raid = (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, + M_NOWAIT | M_ZERO); + if (!raid) { + device_printf(parent, "failed to allocate metadata storage\n"); + goto ddf_out; + } + } else + raid = raidp[array]; + + if (raid->format && (raid->format != AR_F_DDF_RAID)) + continue; + + if (raid->magic_0 && (raid->magic_0 != crc32(vde->VD_GUID, 24))) + continue; + + if (!raidp[array]) { + raidp[array] = raid; + + switch (vdcr->Primary_RAID_Level) { + case DDF_VDCR_RAID0: + raid->magic_0 = crc32(vde->VD_GUID, 24); + raid->magic_1 = ddf16toh(vde->VD_Number); + raid->type = AR_T_RAID0; + raid->interleave = 1 << vdcr->Stripe_Size; + raid->width = ddf16toh(vdcr->Primary_Element_Count); + break; + + case DDF_VDCR_RAID1: + raid->magic_0 = crc32(vde->VD_GUID, 24); + raid->magic_1 = ddf16toh(vde->VD_Number); + raid->type = AR_T_RAID1; + raid->width = 1; + break; + + default: + device_printf(parent, "DDF unsupported RAID type 0x%02x\n", + vdcr->Primary_RAID_Level); + free(raidp[array], M_AR); + raidp[array] = NULL; + goto ddf_out; + } + + raid->format = AR_F_DDF_RAID; + raid->generation = ddf32toh(vdcr->Sequence_Number); + raid->total_disks = ddf16toh(vdcr->Primary_Element_Count); + raid->total_sectors = ddf64toh(vdcr->VD_Size); + raid->heads = 255; + raid->sectors = 63; + raid->cylinders = raid->total_sectors / (63 * 255); + raid->offset_sectors = 0; + raid->rebuild_lba = 0; + raid->lun = array; + strncpy(raid->name, vde->VD_Name, + min(sizeof(raid->name), sizeof(vde->VD_Name))); + + /* clear out any old info */ + if (raid->generation) { + for (disk = 0; disk < raid->total_disks; disk++) { + raid->disks[disk].dev = NULL; + raid->disks[disk].flags = 0; + } + } + } + if (ddf32toh(vdcr->Sequence_Number) >= raid->generation) { + int disk_number = pd_pos; + + raid->disks[disk_number].dev = parent; + + /* Adaptec appears to not set vdcr->Block_Count, yet again in + * gross violation of the spec. + */ + raid->disks[disk_number].sectors = ddf64toh(vdcr->Block_Count); + if (raid->disks[disk_number].sectors == 0) + raid->disks[disk_number].sectors=ddf64toh(pde->Configured_Size); + raid->disks[disk_number].flags = + (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); + ars->raid[raid->volume] = raid; + ars->disk_number[raid->volume] = disk_number; + retval = 1; + } + break; + } + +ddf_out: + free(meta, M_AR); + return retval; +} + /* Highpoint V2 RocketRAID Metadata */ static int ata_raid_hptv2_read_meta(device_t dev, struct ar_softc **raidp) @@ -4258,6 +4597,7 @@ ata_raid_format(struct ar_softc *rdp) switch (rdp->format) { case AR_F_FREEBSD_RAID: return "FreeBSD PseudoRAID"; case AR_F_ADAPTEC_RAID: return "Adaptec HostRAID"; + case AR_F_DDF_RAID: return "DDF"; case AR_F_HPTV2_RAID: return "HighPoint v2 RocketRAID"; case AR_F_HPTV3_RAID: return "HighPoint v3 RocketRAID"; case AR_F_INTEL_RAID: return "Intel MatrixRAID"; @@ -4414,6 +4754,71 @@ ata_raid_adaptec_print_meta(struct adapt printf("=================================================\n"); } +static void +ata_raid_ddf_print_meta(uint8_t *meta) +{ + struct ddf_header *hdr; + struct ddf_cd_record *cd; + struct ddf_pd_record *pdr; + struct ddf_pd_entry *pde; + struct ddf_vd_record *vdr; + struct ddf_vd_entry *vde; + struct ddf_pdd_record *pdd; + uint64_t (*ddf64toh)(uint64_t) = NULL; + uint32_t (*ddf32toh)(uint32_t) = NULL; + uint16_t (*ddf16toh)(uint16_t) = NULL; + uint8_t *cr; + char *r; + + /* Check if this is a DDF RAID struct */ + hdr = (struct ddf_header *)meta; + if (be32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { + ddf64toh = ddfbe64toh; + ddf32toh = ddfbe32toh; + ddf16toh = ddfbe16toh; + } else { + ddf64toh = ddfle64toh; + ddf32toh = ddfle32toh; + ddf16toh = ddfle16toh; + } + + hdr = (struct ddf_header*)meta; + cd = (struct ddf_cd_record*)(meta + ddf32toh(hdr->cd_section) *DEV_BSIZE); + pdr = (struct ddf_pd_record*)(meta + ddf32toh(hdr->pdr_section)*DEV_BSIZE); + vdr = (struct ddf_vd_record*)(meta + ddf32toh(hdr->vdr_section)*DEV_BSIZE); + cr = (uint8_t *)(meta + ddf32toh(hdr->cr_section) * DEV_BSIZE); + pdd = (struct ddf_pdd_record*)(meta + ddf32toh(hdr->pdd_section)*DEV_BSIZE); + pde = NULL; + vde = NULL; + + printf("********* ATA DDF Metadata *********\n"); + printf("**** Header ****\n"); + r = (char *)&hdr->DDF_rev[0]; + printf("DDF_rev= %8.8s Sequence_Number= 0x%x Open_Flag= 0x%x\n", r, + ddf32toh(hdr->Sequence_Number), hdr->Open_Flag); + printf("Primary Header LBA= %llu Header_Type = 0x%x\n", + (unsigned long long)ddf64toh(hdr->Primary_Header_LBA), + hdr->Header_Type); + printf("Max_PD_Entries= %d Max_VD_Entries= %d Max_Partitions= %d " + "CR_Length= %d\n", ddf16toh(hdr->Max_PD_Entries), + ddf16toh(hdr->Max_VD_Entries), ddf16toh(hdr->Max_Partitions), + ddf16toh(hdr->Configuration_Record_Length)); + printf("CD= %d:%d PDR= %d:%d VDR= %d:%d CR= %d:%d PDD= %d%d\n", + ddf32toh(hdr->cd_section), ddf32toh(hdr->cd_length), + ddf32toh(hdr->pdr_section), ddf32toh(hdr->pdr_length), + ddf32toh(hdr->vdr_section), ddf32toh(hdr->vdr_length), + ddf32toh(hdr->cr_section), ddf32toh(hdr->cr_length), + ddf32toh(hdr->pdd_section), ddf32toh(hdr->pdd_length)); + printf("**** Controler Data ****\n"); + r = (char *)&cd->Product_ID[0]; + printf("Product_ID: %16.16s\n", r); + printf("Vendor 0x%x, Device 0x%x, SubVendor 0x%x, Sub_Device 0x%x\n", + ddf16toh(cd->Controller_Type.Vendor_ID), + ddf16toh(cd->Controller_Type.Device_ID), + ddf16toh(cd->Controller_Type.SubVendor_ID), + ddf16toh(cd->Controller_Type.SubDevice_ID)); +} + static char * ata_raid_hptv2_type(int type) { Modified: stable/7/sys/dev/ata/ata-raid.h ============================================================================== --- stable/7/sys/dev/ata/ata-raid.h Sun Mar 1 16:47:49 2009 (r189245) +++ stable/7/sys/dev/ata/ata-raid.h Sun Mar 1 16:50:46 2009 (r189246) @@ -76,7 +76,8 @@ struct ar_softc { #define AR_F_SII_RAID 0x0800 #define AR_F_SIS_RAID 0x1000 #define AR_F_VIA_RAID 0x2000 -#define AR_F_FORMAT_MASK 0x3fff +#define AR_F_DDF_RAID 0x4000 +#define AR_F_FORMAT_MASK 0x7fff u_int generation; u_int64_t total_sectors; @@ -164,6 +165,9 @@ struct adaptec_raid_conf { u_int32_t dummy_9[62]; } __packed; +/* DDF Information. Metadata definitions are in another file */ +#define DDF_LBA(dev) \ + (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) /* Highpoint V2 RocketRAID Metadata */ #define HPTV2_LBA(dev) 9 From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 22:37:35 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13954106564A; Sun, 1 Mar 2009 22:37:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAE3E8FC1A; Sun, 1 Mar 2009 22:37:34 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21MbYVF056029; Sun, 1 Mar 2009 22:37:34 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21MbYkf056028; Sun, 1 Mar 2009 22:37:34 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200903012237.n21MbYkf056028@svn.freebsd.org> From: Scott Long Date: Sun, 1 Mar 2009 22:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189253 - in stable/7/sys: . cam/scsi contrib/pf dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 22:37:35 -0000 Author: scottl Date: Sun Mar 1 22:37:34 2009 New Revision: 189253 URL: http://svn.freebsd.org/changeset/base/189253 Log: Merge 186882: Implement kern.cam.cd.retry_count to aid with disk- recovery tools. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_cd.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 22:10:51 2009 (r189252) +++ stable/7/sys/cam/scsi/scsi_cd.c Sun Mar 1 22:37:34 2009 (r189253) @@ -292,6 +292,9 @@ static struct periph_driver cddriver = PERIPHDRIVER_DECLARE(cd, cddriver); +#ifndef CD_DEFAULT_RETRY +#define CD_DEFAULT_RETRY 4 +#endif #ifndef CHANGER_MIN_BUSY_SECONDS #define CHANGER_MIN_BUSY_SECONDS 5 #endif @@ -299,11 +302,15 @@ PERIPHDRIVER_DECLARE(cd, cddriver); #define CHANGER_MAX_BUSY_SECONDS 15 #endif +static int cd_retry_count = CD_DEFAULT_RETRY; static int changer_min_busy_seconds = CHANGER_MIN_BUSY_SECONDS; static int changer_max_busy_seconds = CHANGER_MAX_BUSY_SECONDS; SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, "CD Changer"); +SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW, + &cd_retry_count, 0, "Normal I/O retry count"); +TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count); SYSCTL_INT(_kern_cam_cd_changer, OID_AUTO, min_busy_seconds, CTLFLAG_RW, &changer_min_busy_seconds, 0, "Minimum changer scheduling quantum"); TUNABLE_INT("kern.cam.cd.changer.min_busy_seconds", &changer_min_busy_seconds); @@ -1454,7 +1461,7 @@ cdstart(struct cam_periph *periph, union devstat_start_transaction_bio(softc->disk->d_devstat, bp); scsi_read_write(&start_ccb->csio, - /*retries*/4, + /*retries*/cd_retry_count, /* cbfcnp */ cddone, MSG_SIMPLE_Q_TAG, /* read */bp->bio_cmd == BIO_READ, From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 22:48:18 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFDF01065676; Sun, 1 Mar 2009 22:48:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23718FC1C; Sun, 1 Mar 2009 22:48:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21MmIoA056436; Sun, 1 Mar 2009 22:48:18 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21MmIgg056435; Sun, 1 Mar 2009 22:48:18 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903012248.n21MmIgg056435@svn.freebsd.org> From: Robert Watson Date: Sun, 1 Mar 2009 22:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189255 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 22:48:19 -0000 Author: rwatson Date: Sun Mar 1 22:48:18 2009 New Revision: 189255 URL: http://svn.freebsd.org/changeset/base/189255 Log: Merge r187686 from head to stable/7: When a statically linked binary is executed (or at least, one without an interpreter definition in its program header), set the auxiliary ELF argument AT_BASE to 0 rather than to the address that we would have mapped the interpreter at if there had been one. The ELF ABI specifications appear to be ambiguous as to the desired behavior in this situation, as they define AT_BASE as the base address of the interpreter, but do not mention what to do if there is none. On Solaris, AT_BASE will be set to the base address of the static binary if there is no interpreter, and on Linux, AT_BASE is set to 0. We go with the Linux semantics as they are of more immediate utility and allow the early runtime environment to know that the kernel has not mapped an interpreter, but because AT_PHDR points at the ELF header for the running binary, it is still possible to retrieve all required mapping information when the process starts should it be required. Either approach would be preferable to our current behavior of passing a pointer to an unmapped region of user memory as AT_BASE. Sponsored by: Google Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/imgact_elf.c Modified: stable/7/sys/kern/imgact_elf.c ============================================================================== --- stable/7/sys/kern/imgact_elf.c Sun Mar 1 22:40:15 2009 (r189254) +++ stable/7/sys/kern/imgact_elf.c Sun Mar 1 22:48:18 2009 (r189255) @@ -830,7 +830,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i uprintf("ELF interpreter %s not found\n", interp); return (error); } - } + } else + addr = 0; /* * Construct auxargs table (used by the fixup routine) From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 23:17:51 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ADAC1065672; Sun, 1 Mar 2009 23:17:51 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DA118FC12; Sun, 1 Mar 2009 23:17:51 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21NHp4f058162; Sun, 1 Mar 2009 23:17:51 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21NHpuB058160; Sun, 1 Mar 2009 23:17:51 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903012317.n21NHpuB058160@svn.freebsd.org> From: Robert Watson Date: Sun, 1 Mar 2009 23:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189258 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 23:17:52 -0000 Author: rwatson Date: Sun Mar 1 23:17:51 2009 New Revision: 189258 URL: http://svn.freebsd.org/changeset/base/189258 Log: Merge r188313 from head to stable/7: Change various routines that are responsible for transforming audit event IDs based on arguments to return au_event_t rather than int. Obtained from: TrustedBSD Project Sponsored by: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_bsm_klib.c stable/7/sys/security/audit/audit_private.h Modified: stable/7/sys/security/audit/audit_bsm_klib.c ============================================================================== --- stable/7/sys/security/audit/audit_bsm_klib.c Sun Mar 1 22:52:41 2009 (r189257) +++ stable/7/sys/security/audit/audit_bsm_klib.c Sun Mar 1 23:17:51 2009 (r189258) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2008 Apple Inc. + * Copyright (c) 1999-2009 Apple Inc. * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * @@ -345,7 +345,7 @@ audit_flags_and_error_to_openevent(int o /* * Convert a MSGCTL command to a specific event. */ -int +au_event_t audit_msgctl_to_event(int cmd) { @@ -368,7 +368,7 @@ audit_msgctl_to_event(int cmd) /* * Convert a SEMCTL command to a specific event. */ -int +au_event_t audit_semctl_to_event(int cmd) { @@ -412,7 +412,7 @@ audit_semctl_to_event(int cmd) /* * Convert a command for the auditon() system call to a audit event. */ -int +au_event_t auditon_command_event(int cmd) { Modified: stable/7/sys/security/audit/audit_private.h ============================================================================== --- stable/7/sys/security/audit/audit_private.h Sun Mar 1 22:52:41 2009 (r189257) +++ stable/7/sys/security/audit/audit_private.h Sun Mar 1 23:17:51 2009 (r189258) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2005 Apple Inc. + * Copyright (c) 1999-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -305,10 +305,10 @@ void au_evclassmap_insert(au_event_t e au_class_t au_event_class(au_event_t event); au_event_t audit_ctlname_to_sysctlevent(int name[], uint64_t valid_arg); au_event_t audit_flags_and_error_to_openevent(int oflags, int error); -int audit_msgctl_to_event(int cmd); -int audit_semctl_to_event(int cmr); +au_event_t audit_msgctl_to_event(int cmd); +au_event_t audit_semctl_to_event(int cmr); void audit_canon_path(struct thread *td, char *path, char *cpath); -int auditon_command_event(int cmd); +au_event_t auditon_command_event(int cmd); /* * Audit trigger events notify user space of kernel audit conditions From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 1 23:32:27 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF7651065670; Sun, 1 Mar 2009 23:32:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB9CE8FC16; Sun, 1 Mar 2009 23:32:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n21NWRZF058475; Sun, 1 Mar 2009 23:32:27 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21NWRL8058474; Sun, 1 Mar 2009 23:32:27 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903012332.n21NWRL8058474@svn.freebsd.org> From: Robert Watson Date: Sun, 1 Mar 2009 23:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189259 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 23:32:28 -0000 Author: rwatson Date: Sun Mar 1 23:32:27 2009 New Revision: 189259 URL: http://svn.freebsd.org/changeset/base/189259 Log: Merge r188315 from head to stable/7: Set the lower bound on queue size for an audit pipe to 1 instead of 0, as an audit pipe with a queue length of 0 is less useful. Obtained from: TrustedBSD Project Sponsored by: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_pipe.c Modified: stable/7/sys/security/audit/audit_pipe.c ============================================================================== --- stable/7/sys/security/audit/audit_pipe.c Sun Mar 1 23:17:51 2009 (r189258) +++ stable/7/sys/security/audit/audit_pipe.c Sun Mar 1 23:32:27 2009 (r189259) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Robert N. M. Watson - * Copyright (c) 2008 Apple, Inc. + * Copyright (c) 2008-2009 Apple, Inc. * All rights reserved. * * This software was developed by Robert Watson for the TrustedBSD Project. @@ -76,7 +76,7 @@ static MALLOC_DEFINE(M_AUDIT_PIPE_PRESEL * Audit pipe buffer parameters. */ #define AUDIT_PIPE_QLIMIT_DEFAULT (128) -#define AUDIT_PIPE_QLIMIT_MIN (0) +#define AUDIT_PIPE_QLIMIT_MIN (1) #define AUDIT_PIPE_QLIMIT_MAX (1024) /* From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 2 16:55:20 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47C1D1065670; Mon, 2 Mar 2009 16:55:20 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 330018FC18; Mon, 2 Mar 2009 16:55:20 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n22GtKlp081078; Mon, 2 Mar 2009 16:55:20 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22GtKL5081077; Mon, 2 Mar 2009 16:55:20 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200903021655.n22GtKL5081077@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Mon, 2 Mar 2009 16:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189281 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipsec X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 16:55:21 -0000 Author: vanhu Date: Mon Mar 2 16:55:19 2009 New Revision: 189281 URL: http://svn.freebsd.org/changeset/base/189281 Log: MFC: Remove remain <= MHLEN restriction in m_makespace(), which caused assert with big packets PR: kern/124609 Submitted by: fabien.thomas@netasq.com Approved by: gnn(mentor) Obtained from: NetBSD Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netipsec/ipsec_mbuf.c Modified: stable/7/sys/netipsec/ipsec_mbuf.c ============================================================================== --- stable/7/sys/netipsec/ipsec_mbuf.c Mon Mar 2 15:22:01 2009 (r189280) +++ stable/7/sys/netipsec/ipsec_mbuf.c Mon Mar 2 16:55:19 2009 (r189281) @@ -73,66 +73,67 @@ m_makespace(struct mbuf *m0, int skip, i */ remain = m->m_len - skip; /* data to move */ if (hlen > M_TRAILINGSPACE(m)) { - struct mbuf *n; + struct mbuf *n0, *n, **np; + int todo, len, done, alloc; + + n0 = NULL; + np = &n0; + alloc = 0; + done = 0; + todo = remain; + while (todo > 0) { + if (todo > MHLEN) { + n = m_getcl(M_DONTWAIT, m->m_type, 0); + len = MCLBYTES; + } + else { + n = m_get(M_DONTWAIT, m->m_type); + len = MHLEN; + } + if (n == NULL) { + m_freem(n0); + return NULL; + } + *np = n; + np = &n->m_next; + alloc++; + len = min(todo, len); + memcpy(n->m_data, mtod(m, char *) + skip + done, len); + n->m_len = len; + done += len; + todo -= len; + } - /* XXX code doesn't handle clusters XXX */ - IPSEC_ASSERT(remain < MLEN, ("remainder too big: %u", remain)); - /* - * Not enough space in m, split the contents - * of m, inserting new mbufs as required. - * - * NB: this ignores mbuf types. - */ - MGET(n, M_DONTWAIT, MT_DATA); - if (n == NULL) - return (NULL); - n->m_next = m->m_next; /* splice new mbuf */ - m->m_next = n; - ipsec4stat.ips_mbinserted++; if (hlen <= M_TRAILINGSPACE(m) + remain) { - /* - * New header fits in the old mbuf if we copy - * the remainder; just do the copy to the new - * mbuf and we're good to go. - */ - memcpy(mtod(n, caddr_t), - mtod(m, caddr_t) + skip, remain); - n->m_len = remain; m->m_len = skip + hlen; *off = skip; - } else { - /* - * No space in the old mbuf for the new header. - * Make space in the new mbuf and check the - * remainder'd data fits too. If not then we - * must allocate an additional mbuf (yech). - */ - n->m_len = 0; - if (remain + hlen > M_TRAILINGSPACE(n)) { - struct mbuf *n2; - - MGET(n2, M_DONTWAIT, MT_DATA); - /* NB: new mbuf is on chain, let caller free */ - if (n2 == NULL) - return (NULL); - n2->m_len = 0; - memcpy(mtod(n2, caddr_t), - mtod(m, caddr_t) + skip, remain); - n2->m_len = remain; - /* splice in second mbuf */ - n2->m_next = n->m_next; - n->m_next = n2; - ipsec4stat.ips_mbinserted++; - } else { - memcpy(mtod(n, caddr_t) + hlen, - mtod(m, caddr_t) + skip, remain); - n->m_len += remain; + if (n0 != NULL) { + *np = m->m_next; + m->m_next = n0; } - m->m_len -= remain; - n->m_len += hlen; + } + else { + n = m_get(M_DONTWAIT, m->m_type); + if (n == NULL) { + m_freem(n0); + return NULL; + } + alloc++; + + if ((n->m_next = n0) == NULL) + np = &n->m_next; + n0 = n; + + *np = m->m_next; + m->m_next = n0; + + n->m_len = hlen; + m->m_len = skip; + m = n; /* header is at front ... */ *off = 0; /* ... of new mbuf */ } + ipsec4stat.ips_mbinserted++; } else { /* * Copy the remainder to the back of the mbuf From owner-svn-src-stable-7@FreeBSD.ORG Tue Mar 3 07:56:43 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 421B31065672; Tue, 3 Mar 2009 07:56:43 +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 2F3C78FC13; Tue, 3 Mar 2009 07:56:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n237uh1v002126; Tue, 3 Mar 2009 07:56:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n237uh0Z002124; Tue, 3 Mar 2009 07:56:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200903030756.n237uh0Z002124@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Mar 2009 07:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189297 - stable/7/sbin/atacontrol X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 07:56:43 -0000 Author: mav Date: Tue Mar 3 07:56:42 2009 New Revision: 189297 URL: http://svn.freebsd.org/changeset/base/189297 Log: MFC rev. 186079, 188829, 188922, 188959. Sync with HEAD. Modified: stable/7/sbin/atacontrol/ (props changed) stable/7/sbin/atacontrol/atacontrol.8 stable/7/sbin/atacontrol/atacontrol.c Modified: stable/7/sbin/atacontrol/atacontrol.8 ============================================================================== --- stable/7/sbin/atacontrol/atacontrol.8 Tue Mar 3 07:01:57 2009 (r189296) +++ stable/7/sbin/atacontrol/atacontrol.8 Tue Mar 3 07:56:42 2009 (r189297) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2008 +.Dd February 21, 2009 .Dt ATACONTROL 8 .Os .Sh NAME @@ -63,6 +63,7 @@ .Nm .Ic mode .Ar device +.Op Ar mode .Nm .Ic info .Ar channel @@ -94,7 +95,7 @@ The .Ar channel argument is the ATA channel device (e.g., ata0) on which to operate. The following commands are supported: -.Bl -tag -width "rebuild" +.Bl -tag -width ".Ic addspare" .It Ic attach Attach an ATA .Ar channel . @@ -162,9 +163,13 @@ Rebuild a RAID1 array on a RAID capable .It Ic status Get the status of an ATA RAID. .It Ic mode -Without the mode argument, the current transfer modes of the +Without the +.Ar mode +argument, the current transfer mode of the device are printed. -If the mode argument is given, the ATA driver +If the +.Ar mode +argument is given, the ATA driver is asked to change the transfer mode to the one given. The ATA driver will reject modes that are not supported by the hardware. @@ -175,9 +180,7 @@ Modes are given like case does not matter. .Pp Currently supported modes are: -.Cm PIO0 , PIO1 , PIO2 , PIO3 , PIO4 , -.Cm WDMA2 , -.Cm UDMA2 +.Cm BIOSPIO , PIO0 , PIO1 , PIO2 , PIO3 , PIO4 , WDMA2 , UDMA2 (alias .Cm UDMA33 ) , .Cm UDMA4 @@ -185,18 +188,19 @@ Currently supported modes are: .Cm UDMA66 ) , .Cm UDMA5 (alias -.Cm UDMA100 ) -and +.Cm UDMA100 ) , .Cm UDMA6 (alias -.Cm UDMA133 ) . -The device name and manufacture/version strings are shown. +.Cm UDMA133 ) , +.Cm SATA150 , SATA300 , USB , USB1 , USB2 +and +.Cm BIOSDMA . .It Ic cap Show detailed info about the device on .Ar device . .It Ic spindown Set or report timeout after which the -.Ar device +.Ar device will be spun down. To arm the timeout the device needs at least one more request after setting the timeout. @@ -205,6 +209,7 @@ No further actions are needed in this ca .It Ic info Show info about the attached devices on the .Ar channel . +The device name and manufacture/version strings are shown. .It Ic list Show info about all attached devices on all active controllers. .El @@ -312,7 +317,7 @@ If the system has a pure software array RAID controller, then shut the system down, make sure that the disk that was still working is moved to the bootable position (channel 0 or whatever the BIOS allows the system to boot from) and the blank disk -is placed in the secondary position, then boot the system into +is placed in the secondary position, then boot the system into single-user mode and issue the command: .Pp .Dl "atacontrol addspare ar0 ad6" Modified: stable/7/sbin/atacontrol/atacontrol.c ============================================================================== --- stable/7/sbin/atacontrol/atacontrol.c Tue Mar 3 07:01:57 2009 (r189296) +++ stable/7/sbin/atacontrol/atacontrol.c Tue Mar 3 07:56:42 2009 (r189297) @@ -82,6 +82,11 @@ str2mode(char *str) if (!strcasecmp(str, "UDMA100")) return ATA_UDMA5; if (!strcasecmp(str, "UDMA6")) return ATA_UDMA6; if (!strcasecmp(str, "UDMA133")) return ATA_UDMA6; + if (!strcasecmp(str, "SATA150")) return ATA_SA150; + if (!strcasecmp(str, "SATA300")) return ATA_SA300; + if (!strcasecmp(str, "USB")) return ATA_USB; + if (!strcasecmp(str, "USB1")) return ATA_USB1; + if (!strcasecmp(str, "USB2")) return ATA_USB2; if (!strcasecmp(str, "BIOSDMA")) return ATA_DMA; return -1; } @@ -127,11 +132,11 @@ param_print(struct ata_params *parm) printf("<%.40s/%.8s> ", parm->model, parm->revision); if (parm->satacapabilities && parm->satacapabilities != 0xffff) { if (parm->satacapabilities & ATA_SATA_GEN2) - printf("Serial ATA II\n"); + printf("SATA revision 2.x\n"); else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("Serial ATA v1.0\n"); + printf("SATA revision 1.x\n"); else - printf("Unknown serial ATA version\n"); + printf("Unknown SATA revision\n"); } else printf("ATA/ATAPI revision %d\n", version(parm->version_major)); @@ -152,11 +157,11 @@ cap_print(struct ata_params *parm) printf("Protocol "); if (parm->satacapabilities && parm->satacapabilities != 0xffff) { if (parm->satacapabilities & ATA_SATA_GEN2) - printf("Serial ATA II\n"); + printf("SATA revision 2.x\n"); else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("Serial ATA v1.0\n"); + printf("SATA revision 1.x\n"); else - printf("Unknown serial ATA version\n"); + printf("Unknown SATA revision\n"); } else printf("ATA/ATAPI revision %d\n", version(parm->version_major)); @@ -364,6 +369,8 @@ main(int argc, char **argv) fd = open_dev(argv[2], O_RDONLY); if (argc == 4) { mode = str2mode(argv[3]); + if (mode == -1) + errx(1, "unknown mode"); if (ioctl(fd, IOCATASMODE, &mode) < 0) warn("ioctl(IOCATASMODE)"); } From owner-svn-src-stable-7@FreeBSD.ORG Tue Mar 3 08:14:43 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D90106564A; Tue, 3 Mar 2009 08:14:43 +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 A3D1E8FC16; Tue, 3 Mar 2009 08:14:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n238Ehj5002625; Tue, 3 Mar 2009 08:14:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n238Ehxk002622; Tue, 3 Mar 2009 08:14:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200903030814.n238Ehxk002622@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Mar 2009 08:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189299 - in stable/7/sys: . contrib/pf dev/ata dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 08:14:44 -0000 Author: mav Date: Tue Mar 3 08:14:43 2009 New Revision: 189299 URL: http://svn.freebsd.org/changeset/base/189299 Log: MFC rev. 188700, 188731, 188733. Make core dumping to ad not to freeze even if interrupts, not disabled for some reason (noticed on SMP), stealing our events. ata_interrupt() does not need to return anything. It is not it's business to report request completion, expecially when it is not reliable. PR: kern/114370, kern/115801 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ata/ata-all.c stable/7/sys/dev/ata/ata-all.h stable/7/sys/dev/ata/ata-queue.c stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/ata/ata-all.c ============================================================================== --- stable/7/sys/dev/ata/ata-all.c Tue Mar 3 07:58:01 2009 (r189298) +++ stable/7/sys/dev/ata/ata-all.c Tue Mar 3 08:14:43 2009 (r189299) @@ -140,7 +140,7 @@ ata_attach(device_t dev) return ENXIO; } if ((error = bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL, - (driver_intr_t *)ata_interrupt, ch, &ch->ih))) { + ata_interrupt, ch, &ch->ih))) { device_printf(dev, "unable to setup interrupt\n"); return error; } @@ -312,7 +312,7 @@ ata_resume(device_t dev) return error; } -int +void ata_interrupt(void *data) { struct ata_channel *ch = (struct ata_channel *)data; @@ -347,11 +347,10 @@ ata_interrupt(void *data) mtx_unlock(&ch->state_mtx); ATA_LOCKING(ch->dev, ATA_LF_UNLOCK); ata_finish(request); - return 1; + return; } } while (0); mtx_unlock(&ch->state_mtx); - return 0; } /* Modified: stable/7/sys/dev/ata/ata-all.h ============================================================================== --- stable/7/sys/dev/ata/ata-all.h Tue Mar 3 07:58:01 2009 (r189298) +++ stable/7/sys/dev/ata/ata-all.h Tue Mar 3 08:14:43 2009 (r189299) @@ -534,7 +534,7 @@ int ata_detach(device_t dev); int ata_reinit(device_t dev); int ata_suspend(device_t dev); int ata_resume(device_t dev); -int ata_interrupt(void *data); +void ata_interrupt(void *data); int ata_device_ioctl(device_t dev, u_long cmd, caddr_t data); int ata_identify(device_t dev); void ata_default_registers(device_t dev); Modified: stable/7/sys/dev/ata/ata-queue.c ============================================================================== --- stable/7/sys/dev/ata/ata-queue.c Tue Mar 3 07:58:01 2009 (r189298) +++ stable/7/sys/dev/ata/ata-queue.c Tue Mar 3 08:14:43 2009 (r189299) @@ -214,8 +214,10 @@ ata_start(device_t dev) if (dumping) { mtx_unlock(&ch->state_mtx); mtx_unlock(&ch->queue_mtx); - while (!ata_interrupt(ch)) + while (ch->running) { + ata_interrupt(ch); DELAY(10); + } return; } } From owner-svn-src-stable-7@FreeBSD.ORG Tue Mar 3 16:56:15 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6032A10657A7; Tue, 3 Mar 2009 16:56:15 +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 4C4648FC18; Tue, 3 Mar 2009 16:56:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n23GuFFI016008; Tue, 3 Mar 2009 16:56:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23GuFMW016007; Tue, 3 Mar 2009 16:56:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903031656.n23GuFMW016007@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Mar 2009 16:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189307 - in stable/7/sys: . boot/i386/btx/btx contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 16:56:17 -0000 Author: jhb Date: Tue Mar 3 16:56:15 2009 New Revision: 189307 URL: http://svn.freebsd.org/changeset/base/189307 Log: MFC: Use a clean slate of register state when executing hardware interrupt handlers to avoid leaking values into the upper 16-bits of general purpose registers when executing these routines. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/i386/btx/btx/btx.S stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/7/sys/boot/i386/btx/btx/btx.S Tue Mar 3 16:38:59 2009 (r189306) +++ stable/7/sys/boot/i386/btx/btx/btx.S Tue Mar 3 16:56:15 2009 (r189307) @@ -36,6 +36,7 @@ /* * Fields in %eflags. */ + .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag @@ -455,6 +456,18 @@ intx31: pushl $-1 # Dummy int no for * -0x3c %fs * -0x40 %ds * -0x44 %es + * -0x48 zero %eax (hardware int only) + * -0x4c zero %ecx (hardware int only) + * -0x50 zero %edx (hardware int only) + * -0x54 zero %ebx (hardware int only) + * -0x58 zero %esp (hardware int only) + * -0x5c zero %ebp (hardware int only) + * -0x60 zero %esi (hardware int only) + * -0x64 zero %edi (hardware int only) + * -0x68 zero %gs (hardware int only) + * -0x6c zero %fs (hardware int only) + * -0x70 zero %ds (hardware int only) + * -0x74 zero %es (hardware int only) */ int_hw: cld # String ops inc pusha # Save gp regs @@ -467,12 +480,15 @@ int_hw: cld # String ops inc pushl %ds # address popl %es # data leal 0x44(%esp,1),%esi # Base of frame + movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer movl -0x14(%esi),%eax # Get Int no cmpl $-1,%eax # Hardware interrupt? - jne intusr.2 # Yes + jne intusr.1 # Yes /* - * v86 calls save the btx_v86 pointer on the real mode stack and read the - * address and flags from the btx_v86 structure. + * v86 calls save the btx_v86 pointer on the real mode stack and read + * the address and flags from the btx_v86 structure. For interrupt + * handler invocations (VM86 INTx requests), disable interrupts, + * tracing, and alignment checking while the handler runs. */ movl $MEM_USR,%ebx # User base movl %ebx,%edx # address @@ -482,35 +498,36 @@ int_hw: cld # String ops inc movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr movl V86_ADDR(%edx),%eax # Get int no/address movl V86_CTL(%edx),%edx # Get control flags + movl -0x08(%esi),%ebx # Save user flags in %ebx + testl $V86F_ADDR,%edx # Segment:offset? + jnz intusr.4 # Yes + andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, + # and alignment checking for + # interrupt handler jmp intusr.3 # Skip hardware interrupt /* - * Hardware interrupts store a NULL btx_v86 pointer and use the address - * (interrupt number) from the stack with empty flags. Also, we clear - * the segment registers for the interrupt handler. + * Hardware interrupts store a NULL btx_v86 pointer and use the + * address (interrupt number) from the stack with empty flags. Also, + * push a dummy frame of zeros onto the stack for all the general + * purpose and segment registers and clear %eflags. This gives the + * hardware interrupt handler a clean slate. */ -intusr.2: xorl %edx,%edx # Control flags +intusr.1: xorl %edx,%edx # Control flags movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr - movl %edx,-0x38(%esi) # Real mode %gs of 0 - movl %edx,-0x3c(%esi) # Real mode %fs of 0 - movl %edx,-0x40(%esi) # Real mode %ds of 0 - movl %edx,-0x44(%esi) # Real mode %es of 0 + movl $12,%ecx # Frame is 12 dwords +intusr.2: pushl $0x0 # Fill frame + loop intusr.2 # with zeros + movl $PSL_RESERVED_DEFAULT,%ebx # Set clean %eflags /* - * %eax now holds either the interrupt number or segment:offset of function. - * %edx now holds the V86F_* flags. - * - * For interrupt handler invocations (either hardware interrupts or VM86 - * INTx requests) we also disable interrupts, tracing, and alignment checking - * while the handler runs. + * Look up real mode IDT entry for hardware interrupts and VM86 INTx + * requests. */ -intusr.3: movl -0x08(%esi),%ebx # Save user flags in %ebx - testl $V86F_ADDR,%edx # Segment:offset? - jnz intusr.4 # Yes - shll $0x2,%eax # Scale +intusr.3: shll $0x2,%eax # Scale movl (%eax),%eax # Load int vector - andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, - # and alignment checking for - # interrupt handler jmp intusr.5 # Skip CALLF test +/* + * Panic if V86F_CALLF isn't set with V86F_ADDR. + */ intusr.4: testl $V86F_CALLF,%edx # Far call? jnz intusr.5 # Ok movl %edx,0x30(%esp,1) # Place VM86 flags in int no @@ -522,6 +539,11 @@ intusr.4: testl $V86F_CALLF,%edx # Far popl %gs popal # Restore gp regs jmp ex_noc # Panic +/* + * %eax now holds the segment:offset of the function. + * %ebx now holds the %eflags to pass to real mode. + * %edx now holds the V86F_* flags. + */ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode # target /* @@ -536,8 +558,7 @@ intusr.5: movw %bx,MEM_ESPR-0x12 # Pass rep # from btx_v86 movsl # to kernel stack popl %esi # Restore -intusr.6: movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer - movl -0x08(%esi),%ebx # Copy user flags to real +intusr.6: movl -0x08(%esi),%ebx # Copy user flags to real movl %ebx,MEM_ESPR-0x0c # mode return trampoline movl $rret_tramp,%ebx # Set return trampoline movl %ebx,MEM_ESPR-0x10 # CS:IP @@ -611,9 +632,16 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movb $SEL_TSS,%cl # Set task ltr %cx # register /* - * Now we are back in protected mode. Copy the registers off of the real - * mode stack onto the kernel stack. Also, initialize all the seg regs on - * the kernel stack. + * Now we are back in protected mode. The kernel stack frame set up + * before entering real mode is still intact. For hardware interrupts, + * leave the frame unchanged. + */ + cmpl $0,MEM_ESPR-0x08 # Leave saved regs unchanged + jz rret_tramp.3 # for hardware ints +/* + * For V86 calls, copy the registers off of the real mode stack onto + * the kernel stack as we want their updated values. Also, initialize + * the segment registers on the kernel stack. * * Note that the %esp in the kernel stack after this is garbage, but popa * ignores it, so we don't have to fix it up. @@ -624,20 +652,17 @@ rret_tramp.1: xorl %ecx,%ecx # Zero movl $8,%ecx # Copy GP regs from rep # real mode stack movsl # to kernel stack - popl %esi # Restore movl $SEL_UDATA,%eax # Selector for data seg regs movl $4,%ecx # Initialize %ds, rep # %es, %fs, and stosl # %gs /* - * If this was a V86 call, copy the saved seg regs on the real mode stack - * back over to the btx_v86 structure. Also, conditionally update the saved - * eflags on the kernel stack based on the flags from the user. + * For V86 calls, copy the saved seg regs on the real mode stack back + * over to the btx_v86 structure. Also, conditionally update the + * saved eflags on the kernel stack based on the flags from the user. */ movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr - jecxz rret_tramp.3 # Skip for hardware ints leal V86_GS(%ecx),%edi # %edi => btx_v86 seg regs - pushl %esi # Save leal MEM_ESPR-0x2c,%esi # %esi => real mode seg regs xchgl %ecx,%edx # Save btx_v86 ptr movl $4,%ecx # Copy seg regs From owner-svn-src-stable-7@FreeBSD.ORG Wed Mar 4 01:50:01 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2EF5106566C; Wed, 4 Mar 2009 01:50:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFFFD8FC26; Wed, 4 Mar 2009 01:50:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n241o0ki027494; Wed, 4 Mar 2009 01:50:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n241o0KX027491; Wed, 4 Mar 2009 01:50:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903040150.n241o0KX027491@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Mar 2009 01:50:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189334 - in stable/7/sys: amd64/conf i386/conf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 01:50:02 -0000 Author: yongari Date: Wed Mar 4 01:50:00 2009 New Revision: 189334 URL: http://svn.freebsd.org/changeset/base/189334 Log: Enable ale(4) in GENERIC. Modified: stable/7/sys/amd64/conf/GENERIC stable/7/sys/i386/conf/GENERIC Modified: stable/7/sys/amd64/conf/GENERIC ============================================================================== --- stable/7/sys/amd64/conf/GENERIC Wed Mar 4 01:47:50 2009 (r189333) +++ stable/7/sys/amd64/conf/GENERIC Wed Mar 4 01:50:00 2009 (r189334) @@ -193,7 +193,7 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device age # Attansic/Atheros L1 Gigabit Ethernet -#device ale # Atheros AR8121/AR8113/AR8114 Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet Modified: stable/7/sys/i386/conf/GENERIC ============================================================================== --- stable/7/sys/i386/conf/GENERIC Wed Mar 4 01:47:50 2009 (r189333) +++ stable/7/sys/i386/conf/GENERIC Wed Mar 4 01:50:00 2009 (r189334) @@ -204,7 +204,7 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device age # Attansic/Atheros L1 Gigabit Ethernet -#device ale # Atheros AR8121/AR8113/AR8114 Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet From owner-svn-src-stable-7@FreeBSD.ORG Wed Mar 4 20:26:39 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5095106566B; Wed, 4 Mar 2009 20:26:39 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A16648FC29; Wed, 4 Mar 2009 20:26:39 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n24KQdHY052140; Wed, 4 Mar 2009 20:26:39 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24KQdkK052139; Wed, 4 Mar 2009 20:26:39 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200903042026.n24KQdkK052139@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 4 Mar 2009 20:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189370 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 20:26:40 -0000 Author: netchild Date: Wed Mar 4 20:26:39 2009 New Revision: 189370 URL: http://svn.freebsd.org/changeset/base/189370 Log: MFC r188572: Fix an edge-case of the linux readdir: We need the size of a linux dirent structure, not the size of a pointer to it. PR: 131099 Submitted by: Andreas Kies Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_file.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_file.c ============================================================================== --- stable/7/sys/compat/linux/linux_file.c Wed Mar 4 18:36:48 2009 (r189369) +++ stable/7/sys/compat/linux/linux_file.c Wed Mar 4 20:26:39 2009 (r189370) @@ -438,7 +438,7 @@ getdents_common(struct thread *td, struc /* readdir(2) case. Always struct dirent. */ if (is64bit) return (EINVAL); - nbytes = sizeof(linux_dirent); + nbytes = sizeof(*linux_dirent); justone = 1; } else justone = 0; From owner-svn-src-stable-7@FreeBSD.ORG Wed Mar 4 21:38:16 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA612106566B; Wed, 4 Mar 2009 21:38: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 B861B8FC0A; Wed, 4 Mar 2009 21:38:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n24LcG14053992; Wed, 4 Mar 2009 21:38:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24LcGkS053991; Wed, 4 Mar 2009 21:38:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903042138.n24LcGkS053991@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Mar 2009 21:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189375 - stable/7/share/mk X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 21:38:17 -0000 Author: jhb Date: Wed Mar 4 21:38:16 2009 New Revision: 189375 URL: http://svn.freebsd.org/changeset/base/189375 Log: MFC: Handle an additional layer of nesting for kernel modules to make it easier to compile 8.x kernels with modules on 7. Modified: stable/7/share/mk/ (props changed) stable/7/share/mk/bsd.kmod.mk Modified: stable/7/share/mk/bsd.kmod.mk ============================================================================== --- stable/7/share/mk/bsd.kmod.mk Wed Mar 4 21:22:39 2009 (r189374) +++ stable/7/share/mk/bsd.kmod.mk Wed Mar 4 21:38:16 2009 (r189375) @@ -2,7 +2,7 @@ # Search for kernel source tree in standard places. .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ - /sys /usr/src/sys + ${.CURDIR}/../../../../.. /sys /usr/src/sys .if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) SYSDIR= ${_dir} .endif From owner-svn-src-stable-7@FreeBSD.ORG Thu Mar 5 07:42:48 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 282D1106564A; Thu, 5 Mar 2009 07:42:48 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA8A48FC0A; Thu, 5 Mar 2009 07:42:47 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n257gld7066378; Thu, 5 Mar 2009 07:42:47 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n257gljY066376; Thu, 5 Mar 2009 07:42:47 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903050742.n257gljY066376@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 5 Mar 2009 07:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189393 - stable/7/sys/netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 07:42:48 -0000 Author: luigi Date: Thu Mar 5 07:42:47 2009 New Revision: 189393 URL: http://svn.freebsd.org/changeset/base/189393 Log: Merge a couple of changes from HEAD, plus fix a potential warning. In detail: + we used SYSCTL_LONG to show a 64-bit variable. For the time being just remove the variable from the list of sysctl-exported values. Unfortunately our SYSCTL macros do not do proper type checking of the arguments so we might have some more bugs of this kind across the codebase; + fw_debug has not been used for ages, so remove it; + gcc 4.2.4 tells me that src_ip.s_addr may be not initialized, so make sure it is. I need to check what is the status of this field in head. Modified: stable/7/sys/netinet/ip_dummynet.c stable/7/sys/netinet/ip_fw2.c Modified: stable/7/sys/netinet/ip_dummynet.c ============================================================================== --- stable/7/sys/netinet/ip_dummynet.c Thu Mar 5 06:26:08 2009 (r189392) +++ stable/7/sys/netinet/ip_dummynet.c Thu Mar 5 07:42:47 2009 (r189393) @@ -160,8 +160,10 @@ SYSCTL_DECL(_net_inet_ip); SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, hash_size, CTLFLAG_RW, &dn_hash_size, 0, "Default hash table size"); +#if 0 /* curr_time is 64 bit */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, curr_time, CTLFLAG_RD, &curr_time, 0, "Current tick"); +#endif SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, ready_heap, CTLFLAG_RD, &ready_heap.size, 0, "Size of ready heap"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, extract_heap, Modified: stable/7/sys/netinet/ip_fw2.c ============================================================================== --- stable/7/sys/netinet/ip_fw2.c Thu Mar 5 06:26:08 2009 (r189392) +++ stable/7/sys/netinet/ip_fw2.c Thu Mar 5 07:42:47 2009 (r189393) @@ -146,7 +146,6 @@ struct table_entry { u_int32_t value; }; -static int fw_debug = 1; static int autoinc_step = 100; /* bounded to 1..1000 in add_rule() */ extern int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); @@ -162,8 +161,6 @@ SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, on CTLFLAG_RW | CTLFLAG_SECURE3, &fw_one_pass, 0, "Only do a single pass through ipfw when using dummynet(4)"); -SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, - &fw_debug, 0, "Enable printing of debug ip_fw statements"); SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, verbose, CTLFLAG_RW | CTLFLAG_SECURE3, &fw_verbose, 0, "Log matches to ipfw rules"); @@ -2208,6 +2205,7 @@ ipfw_chk(struct ip_fw_args *args) return (IP_FW_PASS); /* accept */ dst_ip.s_addr = 0; /* make sure it is initialized */ + src_ip.s_addr = 0; /* make sure it is initialized */ pktlen = m->m_pkthdr.len; args->f_id.fib = M_GETFIB(m); /* note mbuf not altered) */ proto = args->f_id.proto = 0; /* mark f_id invalid */ From owner-svn-src-stable-7@FreeBSD.ORG Thu Mar 5 15:46:57 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD46310656C7; Thu, 5 Mar 2009 15:46: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 EECE78FD81; Thu, 5 Mar 2009 15:46:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n25FkfpR086868; Thu, 5 Mar 2009 15:46:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25FkfBS086867; Thu, 5 Mar 2009 15:46:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051546.n25FkfBS086867@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 15:46:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189402 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 15:47:01 -0000 Author: jhb Date: Thu Mar 5 15:46:41 2009 New Revision: 189402 URL: http://svn.freebsd.org/changeset/base/189402 Log: MFC: Don't throw away the upper 32-bits of the HT MSI address window. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/pci/pci.c Modified: stable/7/sys/dev/pci/pci.c ============================================================================== --- stable/7/sys/dev/pci/pci.c Thu Mar 5 15:33:04 2009 (r189401) +++ stable/7/sys/dev/pci/pci.c Thu Mar 5 15:46:41 2009 (r189402) @@ -554,7 +554,7 @@ pci_read_extcap(device_t pcib, pcicfgreg addr = REG(ptr + PCIR_HTMSI_ADDRESS_HI, 4); addr <<= 32; - addr = REG(ptr + PCIR_HTMSI_ADDRESS_LO, + addr |= REG(ptr + PCIR_HTMSI_ADDRESS_LO, 4); if (addr != MSI_INTEL_ADDR_BASE) device_printf(pcib, From owner-svn-src-stable-7@FreeBSD.ORG Thu Mar 5 17:54:28 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E975310656C0; Thu, 5 Mar 2009 17:54:28 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6EF08FC18; Thu, 5 Mar 2009 17:54:28 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n25HsSaJ095099; Thu, 5 Mar 2009 17:54:28 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25HsSp7095098; Thu, 5 Mar 2009 17:54:28 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200903051754.n25HsSp7095098@svn.freebsd.org> From: Maksim Yevmenkin Date: Thu, 5 Mar 2009 17:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189413 - stable/7/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 17:54:29 -0000 Author: emax Date: Thu Mar 5 17:54:28 2009 New Revision: 189413 URL: http://svn.freebsd.org/changeset/base/189413 Log: MFC r183057 Add missing prototypes for uuid_enc,dec_le,be() functions. Pointy hat goes to me. Modified: stable/7/include/ (props changed) stable/7/include/uuid.h Modified: stable/7/include/uuid.h ============================================================================== --- stable/7/include/uuid.h Thu Mar 5 16:56:16 2009 (r189412) +++ stable/7/include/uuid.h Thu Mar 5 17:54:28 2009 (r189413) @@ -54,6 +54,10 @@ void uuid_from_string(const char *, uuid uint16_t uuid_hash(const uuid_t *, uint32_t *); int32_t uuid_is_nil(const uuid_t *, uint32_t *); void uuid_to_string(const uuid_t *, char **, uint32_t *); +void uuid_enc_le(void *, const uuid_t *); +void uuid_dec_le(const void *, uuid_t *); +void uuid_enc_be(void *, const uuid_t *); +void uuid_dec_be(const void *, uuid_t *); __END_DECLS #endif /* _UUID_H_ */ From owner-svn-src-stable-7@FreeBSD.ORG Thu Mar 5 18:03:46 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9088010656CE; Thu, 5 Mar 2009 18:03:46 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CDD48FC12; Thu, 5 Mar 2009 18:03:46 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n25I3kSI095355; Thu, 5 Mar 2009 18:03:46 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25I3kEn095351; Thu, 5 Mar 2009 18:03:46 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200903051803.n25I3kEn095351@svn.freebsd.org> From: Maksim Yevmenkin Date: Thu, 5 Mar 2009 18:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189414 - in stable/7/usr.sbin/bluetooth: . btpand sdpd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 18:03:47 -0000 Author: emax Date: Thu Mar 5 18:03:46 2009 New Revision: 189414 URL: http://svn.freebsd.org/changeset/base/189414 Log: MFC r187938 Add btpand(8) daemon from NetBSD. This daemon provides support for Bluetooth Network Access Point (NAP), Group Ad-hoc Network (GN) and Personal Area Network User (PANU) profiles. MFC r188013 Fix client mode. Pick up service availability changes. MFC r188014 Hook up btpand(8) to the build Obtained from: NetBSD Added: stable/7/usr.sbin/bluetooth/btpand/ - copied from r187938, head/usr.sbin/bluetooth/btpand/ Modified: stable/7/usr.sbin/bluetooth/ (props changed) stable/7/usr.sbin/bluetooth/Makefile stable/7/usr.sbin/bluetooth/btpand/btpand.c stable/7/usr.sbin/bluetooth/btpand/btpand.h stable/7/usr.sbin/bluetooth/btpand/server.c stable/7/usr.sbin/bluetooth/sdpd/ (props changed) Modified: stable/7/usr.sbin/bluetooth/Makefile ============================================================================== --- stable/7/usr.sbin/bluetooth/Makefile Thu Mar 5 17:54:28 2009 (r189413) +++ stable/7/usr.sbin/bluetooth/Makefile Thu Mar 5 18:03:46 2009 (r189414) @@ -6,6 +6,7 @@ SUBDIR= \ bt3cfw \ bthidcontrol \ bthidd \ + btpand \ hccontrol \ hcsecd \ hcseriald \ Modified: stable/7/usr.sbin/bluetooth/btpand/btpand.c ============================================================================== --- head/usr.sbin/bluetooth/btpand/btpand.c Fri Jan 30 22:23:21 2009 (r187938) +++ stable/7/usr.sbin/bluetooth/btpand/btpand.c Thu Mar 5 18:03:46 2009 (r189414) @@ -54,8 +54,8 @@ uint16_t service_class; bdaddr_t local_bdaddr; /* -d */ bdaddr_t remote_bdaddr; /* -a */ -uint16_t l2cap_psm = 15; /* -p */ -int l2cap_mode = 0; /* -m */ +uint16_t l2cap_psm; /* -p */ +int l2cap_mode; /* -m */ int server_limit; /* -n */ @@ -177,6 +177,9 @@ main(int argc, char *argv[]) if (interface_name == NULL) interface_name = "/dev/tap"; + if (l2cap_psm == 0) + l2cap_psm = L2CAP_PSM_BNEP; + if (bdaddr_any(&remote_bdaddr) && server_limit == 0) { if (service_class == SDP_SERVICE_CLASS_PANU) server_limit = 1; Modified: stable/7/usr.sbin/bluetooth/btpand/btpand.h ============================================================================== --- head/usr.sbin/bluetooth/btpand/btpand.h Fri Jan 30 22:23:21 2009 (r187938) +++ stable/7/usr.sbin/bluetooth/btpand/btpand.h Thu Mar 5 18:03:46 2009 (r189414) @@ -51,6 +51,10 @@ #define L2CAP_PSM_INVALID(psm) (((psm) & 0x0101) != 0x0001) #endif +#ifndef L2CAP_PSM_BNEP +#define L2CAP_PSM_BNEP 15 +#endif + typedef struct channel channel_t; typedef struct pfilter pfilter_t; typedef struct mfilter mfilter_t; Modified: stable/7/usr.sbin/bluetooth/btpand/server.c ============================================================================== --- head/usr.sbin/bluetooth/btpand/server.c Fri Jan 30 22:23:21 2009 (r187938) +++ stable/7/usr.sbin/bluetooth/btpand/server.c Thu Mar 5 18:03:46 2009 (r189414) @@ -1,4 +1,4 @@ -/* $NetBSD: server.c,v 1.1 2008/08/17 13:20:57 plunky Exp $ */ +/* $NetBSD: server.c,v 1.2 2009/01/24 17:29:28 plunky Exp $ */ /*- * Copyright (c) 2008 Iain Hibbert @@ -28,11 +28,12 @@ /* $FreeBSD$ */ #include -__RCSID("$NetBSD: server.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); +__RCSID("$NetBSD: server.c,v 1.2 2009/01/24 17:29:28 plunky Exp $"); #include #include +#include #include #include #include @@ -42,7 +43,7 @@ __RCSID("$NetBSD: server.c,v 1.1 2008/08 static struct event server_ev; static int server_fd; -static int server_load; +static int server_avail; static void * server_ss; static uint32_t server_handle; @@ -73,13 +74,13 @@ server_update(int count) log_debug("count %d", count); - server_load = (count - 1) * 100 / server_limit; - log_info("server_load: %d%%", server_load); + server_avail = UINT8_MAX - (count - 1) * UINT8_MAX / server_limit; + log_info("Service Availability: %d/%d", server_avail, UINT8_MAX); - if (server_load > 99 && server_fd != -1) + if (server_avail == 0 && server_fd != -1) server_close(); - if (server_load < 100 && server_fd == -1) + if (server_avail > 0 && server_fd == -1) server_open(); if (service_name) @@ -257,19 +258,9 @@ server_register(void) } memset(&p, 0, sizeof(p)); - p.psm = l2cap_psm; - - if (server_load < 1) p.load_factor = 0; - else if (server_load <= 17) p.load_factor = 1; - else if (server_load <= 33) p.load_factor = 2; - else if (server_load <= 50) p.load_factor = 3; - else if (server_load <= 67) p.load_factor = 4; - else if (server_load <= 83) p.load_factor = 5; - else if (server_load <= 99) p.load_factor = 6; - else p.load_factor = 7; - - if (l2cap_mode != 0) p.security_description = 0x0001; + p.load_factor = server_avail; + p.security_description = (l2cap_mode == 0 ? 0x0000 : 0x0001); if (server_handle) rv = sdp_change_service(server_ss, server_handle, From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 6 01:27:51 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FF1B1065680; Fri, 6 Mar 2009 01:27:51 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CA3C8FC08; Fri, 6 Mar 2009 01:27:51 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n261Rpon004161; Fri, 6 Mar 2009 01:27:51 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n261Rpqe004160; Fri, 6 Mar 2009 01:27:51 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200903060127.n261Rpqe004160@svn.freebsd.org> From: Maksim Yevmenkin Date: Fri, 6 Mar 2009 01:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189425 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netgraph/bluetooth/socket X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Mar 2009 01:27:52 -0000 Author: emax Date: Fri Mar 6 01:27:51 2009 New Revision: 189425 URL: http://svn.freebsd.org/changeset/base/189425 Log: MFC r188132 Allow unprivileged users to run l2ping(8). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Modified: stable/7/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c ============================================================================== --- stable/7/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Thu Mar 5 21:18:10 2009 (r189424) +++ stable/7/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Fri Mar 6 01:27:51 2009 (r189425) @@ -948,11 +948,6 @@ ng_btsocket_l2cap_raw_control(struct soc ng_l2cap_l2ca_ping_ip *ip = NULL; ng_l2cap_l2ca_ping_op *op = NULL; - if (!(pcb->flags & NG_BTSOCKET_L2CAP_RAW_PRIVILEGED)) { - error = EPERM; - break; - } - if ((p->echo_size != 0 && p->echo_data == NULL) || p->echo_size > NG_L2CAP_MAX_ECHO_SIZE) { error = EINVAL; From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 6 01:34:31 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25BB2106566B; Fri, 6 Mar 2009 01:34:31 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 110DA8FC08; Fri, 6 Mar 2009 01:34:31 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n261YUAb004379; Fri, 6 Mar 2009 01:34:30 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n261YURs004375; Fri, 6 Mar 2009 01:34:30 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200903060134.n261YURs004375@svn.freebsd.org> From: Maksim Yevmenkin Date: Fri, 6 Mar 2009 01:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189426 - in stable/7: usr.bin/bluetooth/rfcomm_sppd usr.sbin/bluetooth/hcsecd usr.sbin/bluetooth/hcseriald usr.sbin/bluetooth/rfcomm_pppd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Mar 2009 01:34:31 -0000 Author: emax Date: Fri Mar 6 01:34:30 2009 New Revision: 189426 URL: http://svn.freebsd.org/changeset/base/189426 Log: MFC r188130 Clenup code a bit and do not call fork(2) before dameon(3) where not needed. Modified: stable/7/usr.bin/bluetooth/rfcomm_sppd/ (props changed) stable/7/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c stable/7/usr.sbin/bluetooth/hcsecd/ (props changed) stable/7/usr.sbin/bluetooth/hcsecd/hcsecd.c stable/7/usr.sbin/bluetooth/hcseriald/ (props changed) stable/7/usr.sbin/bluetooth/hcseriald/hcseriald.c stable/7/usr.sbin/bluetooth/rfcomm_pppd/ (props changed) stable/7/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c Modified: stable/7/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c ============================================================================== --- stable/7/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c Fri Mar 6 01:27:51 2009 (r189425) +++ stable/7/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c Fri Mar 6 01:34:30 2009 (r189426) @@ -281,22 +281,8 @@ main(int argc, char *argv[]) } /* Became daemon if required */ - if (background) { - switch (fork()) { - case -1: - err(1, "Could not fork()"); - /* NOT REACHED */ - - case 0: - exit(0); - /* NOT REACHED */ - - default: - if (daemon(0, 0) < 0) - err(1, "Could not daemon()"); - break; - } - } + if (background && daemon(0, 0) < 0) + err(1, "Could not daemon()"); openlog(SPPD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "Starting on %s...", (tty != NULL)? tty : "stdin/stdout"); Modified: stable/7/usr.sbin/bluetooth/hcsecd/hcsecd.c ============================================================================== --- stable/7/usr.sbin/bluetooth/hcsecd/hcsecd.c Fri Mar 6 01:27:51 2009 (r189425) +++ stable/7/usr.sbin/bluetooth/hcsecd/hcsecd.c Fri Mar 6 01:34:30 2009 (r189426) @@ -128,9 +128,8 @@ main(int argc, char *argv[]) (void * const) &filter, sizeof(filter)) < 0) err(1, "Could not set HCI socket filter"); - if (detach) - if (daemon(0, 0) < 0) - err(1, "Could not daemon()ize"); + if (detach && daemon(0, 0) < 0) + err(1, "Could not daemon()ize"); openlog(HCSECD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON); Modified: stable/7/usr.sbin/bluetooth/hcseriald/hcseriald.c ============================================================================== --- stable/7/usr.sbin/bluetooth/hcseriald/hcseriald.c Fri Mar 6 01:27:51 2009 (r189425) +++ stable/7/usr.sbin/bluetooth/hcseriald/hcseriald.c Fri Mar 6 01:34:30 2009 (r189426) @@ -101,23 +101,10 @@ main(int argc, char *argv[]) /* Open device */ n = open_device(device, speed, name); - if (detach) { - pid_t pid = fork(); - - if (pid == (pid_t) -1) { - syslog(LOG_ERR, "Could not fork(). %s (%d)", - strerror(errno), errno); - exit(1); - } - - if (pid != 0) - exit(0); - - if (daemon(0, 0) < 0) { - syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", - strerror(errno), errno); - exit(1); - } + if (detach && daemon(0, 0) < 0) { + syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", + strerror(errno), errno); + exit(1); } /* Write PID file */ Modified: stable/7/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c ============================================================================== --- stable/7/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c Fri Mar 6 01:27:51 2009 (r189425) +++ stable/7/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c Fri Mar 6 01:34:30 2009 (r189426) @@ -166,22 +166,10 @@ main(int argc, char *argv[]) openlog(RFCOMM_PPPD, LOG_PID | LOG_PERROR | LOG_NDELAY, LOG_USER); - if (detach) { - pid = fork(); - if (pid == (pid_t) -1) { - syslog(LOG_ERR, "Could not fork(). %s (%d)", - strerror(errno), errno); - exit(1); - } - - if (pid != 0) - exit(0); - - if (daemon(0, 0) < 0) { - syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", - strerror(errno), errno); - exit(1); - } + if (detach && daemon(0, 0) < 0) { + syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", + strerror(errno), errno); + exit(1); } s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM); From owner-svn-src-stable-7@FreeBSD.ORG Sat Mar 7 20:39:43 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21EAE1065670; Sat, 7 Mar 2009 20:39:43 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BB198FC12; Sat, 7 Mar 2009 20:39:43 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n27Kdhd9062246; Sat, 7 Mar 2009 20:39:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27Kdg2q062234; Sat, 7 Mar 2009 20:39:42 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200903072039.n27Kdg2q062234@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 7 Mar 2009 20:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189498 - in stable/7: share/mk sys sys/conf sys/contrib/pf sys/dev/ath/ath_hal sys/dev/cxgb sys/powerpc/include sys/powerpc/powerpc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2009 20:39:43 -0000 Author: nwhitehorn Date: Sat Mar 7 20:39:42 2009 New Revision: 189498 URL: http://svn.freebsd.org/changeset/base/189498 Log: MFC r188860,188879,188923,188951: Altivec support for PowerPC. Added: stable/7/sys/powerpc/include/altivec.h - copied unchanged from r188860, head/sys/powerpc/include/altivec.h stable/7/sys/powerpc/powerpc/altivec.c - copied unchanged from r188860, head/sys/powerpc/powerpc/altivec.c Modified: stable/7/share/mk/ (props changed) stable/7/share/mk/bsd.cpu.mk stable/7/sys/ (props changed) stable/7/sys/conf/files.powerpc stable/7/sys/conf/kern.mk stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/powerpc/include/pcb.h stable/7/sys/powerpc/include/pcpu.h stable/7/sys/powerpc/powerpc/genassym.c stable/7/sys/powerpc/powerpc/machdep.c stable/7/sys/powerpc/powerpc/swtch.S stable/7/sys/powerpc/powerpc/trap.c stable/7/sys/powerpc/powerpc/trap_subr.S Modified: stable/7/share/mk/bsd.cpu.mk ============================================================================== --- stable/7/share/mk/bsd.cpu.mk Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/share/mk/bsd.cpu.mk Sat Mar 7 20:39:42 2009 (r189498) @@ -109,6 +109,8 @@ _CPUCFLAGS = -march=armv5te -D__XSCALE__ . else _CPUCFLAGS = -mcpu=${CPUTYPE} . endif +. elif ${MACHINE_ARCH} == "powerpc" +_CPUCFLAGS = -mcpu=${CPUTYPE} . endif # Set up the list of CPU features based on the CPU type. This is an Modified: stable/7/sys/conf/files.powerpc ============================================================================== --- stable/7/sys/conf/files.powerpc Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/conf/files.powerpc Sat Mar 7 20:39:42 2009 (r189498) @@ -34,6 +34,7 @@ dev/syscons/scterm-sc.c optional sc dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_powerpc.c optional uart kern/syscalls.c optional ktr +powerpc/powerpc/altivec.c standard powerpc/powerpc/atomic.S standard powerpc/powerpc/autoconf.c standard powerpc/powerpc/bcopy.c standard Modified: stable/7/sys/conf/kern.mk ============================================================================== --- stable/7/sys/conf/kern.mk Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/conf/kern.mk Sat Mar 7 20:39:42 2009 (r189498) @@ -78,9 +78,10 @@ INLINE_LIMIT?= 8000 # # For PowerPC we tell gcc to use floating point emulation. This avoids using # floating point registers for integer operations which it has a tendency to do. +# Also explicitly disable Altivec instructions inside the kernel. # .if ${MACHINE_ARCH} == "powerpc" -CFLAGS+= -msoft-float +CFLAGS+= -msoft-float -mno-altivec INLINE_LIMIT?= 15000 .endif Copied: stable/7/sys/powerpc/include/altivec.h (from r188860, head/sys/powerpc/include/altivec.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/powerpc/include/altivec.h Sat Mar 7 20:39:42 2009 (r189498, copy of r188860, head/sys/powerpc/include/altivec.h) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2008 Nathan Whitehorn + * 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 _MACHINE_ALTIVEC_H_ +#define _MACHINE_ALTIVEC_H_ + +void enable_vec(struct thread *); +void save_vec(struct thread *); + +#endif /* _MACHINE_ALTIVEC_H_ */ + Modified: stable/7/sys/powerpc/include/pcb.h ============================================================================== --- stable/7/sys/powerpc/include/pcb.h Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/include/pcb.h Sat Mar 7 20:39:42 2009 (r189498) @@ -49,12 +49,21 @@ struct pcb { copyin/copyout */ int pcb_flags; #define PCB_FPU 1 /* Process had FPU initialized */ +#define PCB_VEC 2 /* Process had Altivec initialized */ struct fpu { double fpr[32]; double fpscr; /* FPSCR stored as double for easier access */ } pcb_fpu; /* Floating point processor */ unsigned int pcb_fpcpu; /* which CPU had our FPU stuff. */ + struct vec { + uint32_t vr[32][4]; + register_t vrsave; + register_t spare[2]; + register_t vscr; + } pcb_vec __attribute__((aligned(16))); /* Vector processor */ + unsigned int pcb_veccpu; /* which CPU had our vector + stuff. */ }; #ifdef _KERNEL Modified: stable/7/sys/powerpc/include/pcpu.h ============================================================================== --- stable/7/sys/powerpc/include/pcpu.h Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/include/pcpu.h Sat Mar 7 20:39:42 2009 (r189498) @@ -39,6 +39,7 @@ struct pmap; int pc_inside_intr; \ struct pmap *pc_curpmap; /* current pmap */ \ struct thread *pc_fputhread; /* current fpu user */ \ + struct thread *pc_vecthread; /* current vec user */ \ register_t pc_tempsave[CPUSAVE_LEN]; \ register_t pc_disisave[CPUSAVE_LEN]; \ register_t pc_dbsave[CPUSAVE_LEN]; Copied: stable/7/sys/powerpc/powerpc/altivec.c (from r188860, head/sys/powerpc/powerpc/altivec.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/powerpc/powerpc/altivec.c Sat Mar 7 20:39:42 2009 (r189498, copy of r188860, head/sys/powerpc/powerpc/altivec.c) @@ -0,0 +1,152 @@ +/*- + * Copyright (C) 1996 Wolfgang Solfrank. + * Copyright (C) 1996 TooLs GmbH. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $NetBSD: fpu.c,v 1.5 2001/07/22 11:29:46 wiz Exp $ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include + +void +enable_vec(struct thread *td) +{ + int msr; + struct pcb *pcb; + struct trapframe *tf; + + pcb = td->td_pcb; + tf = trapframe(td); + + /* + * Save the thread's Altivec CPU number, and set the CPU's current + * vector thread + */ + td->td_pcb->pcb_veccpu = PCPU_GET(cpuid); + PCPU_SET(vecthread, td); + + /* + * Enable the vector unit for when the thread returns from the + * exception. If this is the first time the unit has been used by + * the thread, initialise the vector registers and VSCR to 0, and + * set the flag to indicate that the vector unit is in use. + */ + tf->srr1 |= PSL_VEC; + if (!(pcb->pcb_flags & PCB_VEC)) { + memset(&pcb->pcb_vec, 0, sizeof pcb->pcb_vec); + pcb->pcb_flags |= PCB_VEC; + } + + /* + * Temporarily enable the vector unit so the registers + * can be restored. + */ + msr = mfmsr(); + mtmsr(msr | PSL_VEC); + isync(); + + /* + * Restore VSCR by first loading it into a vector and then into VSCR. + * (this needs to done before loading the user's vector registers + * since we need to use a scratch vector register) + */ + __asm __volatile("vxor 0,0,0; lvewx 0,0,%0; mtvscr 0" \ + :: "b"(&pcb->pcb_vec.vscr)); + +#define LVX(n) __asm ("lvx " #n ",0,%0" \ + :: "b"(&pcb->pcb_vec.vr[n])); + LVX(0); LVX(1); LVX(2); LVX(3); + LVX(4); LVX(5); LVX(6); LVX(7); + LVX(8); LVX(9); LVX(10); LVX(11); + LVX(12); LVX(13); LVX(14); LVX(15); + LVX(16); LVX(17); LVX(18); LVX(19); + LVX(20); LVX(21); LVX(22); LVX(23); + LVX(24); LVX(25); LVX(26); LVX(27); + LVX(28); LVX(29); LVX(30); LVX(31); +#undef LVX + + isync(); + mtmsr(msr); +} + +void +save_vec(struct thread *td) +{ + int msr; + struct pcb *pcb; + + pcb = td->td_pcb; + + /* + * Temporarily re-enable the vector unit during the save + */ + msr = mfmsr(); + mtmsr(msr | PSL_VEC); + isync(); + + /* + * Save the vector registers and VSCR to the PCB + */ +#define STVX(n) __asm ("stvx %1,0,%0" \ + :: "b"(pcb->pcb_vec.vr[n]), "n"(n)); + STVX(0); STVX(1); STVX(2); STVX(3); + STVX(4); STVX(5); STVX(6); STVX(7); + STVX(8); STVX(9); STVX(10); STVX(11); + STVX(12); STVX(13); STVX(14); STVX(15); + STVX(16); STVX(17); STVX(18); STVX(19); + STVX(20); STVX(21); STVX(22); STVX(23); + STVX(24); STVX(25); STVX(26); STVX(27); + STVX(28); STVX(29); STVX(30); STVX(31); +#undef STVX + + __asm __volatile("mfvscr 0; stvewx 0,0,%0" :: "b"(&pcb->pcb_vec.vscr)); + + /* + * Disable vector unit again + */ + isync(); + mtmsr(msr); + + /* + * Clear the current vec thread and pcb's CPU id + * XXX should this be left clear to allow lazy save/restore ? + */ + pcb->pcb_veccpu = INT_MAX; + PCPU_SET(vecthread, NULL); +} + Modified: stable/7/sys/powerpc/powerpc/genassym.c ============================================================================== --- stable/7/sys/powerpc/powerpc/genassym.c Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/powerpc/genassym.c Sat Mar 7 20:39:42 2009 (r189498) @@ -136,6 +136,7 @@ ASSYM(PCB_USR, offsetof(struct pcb, pcb_ ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); ASSYM(PCB_FPU, PCB_FPU); +ASSYM(PCB_VEC, PCB_VEC); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); Modified: stable/7/sys/powerpc/powerpc/machdep.c ============================================================================== --- stable/7/sys/powerpc/powerpc/machdep.c Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/powerpc/machdep.c Sat Mar 7 20:39:42 2009 (r189498) @@ -103,6 +103,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -252,7 +253,6 @@ extern void *dsitrap, *dsisize; extern void *decrint, *decrsize; extern void *extint, *extsize; extern void *dblow, *dbsize; -extern void *vectrap, *vectrapsize; void powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, void *mdp) @@ -343,7 +343,7 @@ powerpc_init(u_int startkernel, u_int en bcopy(&trapcode, (void *)EXC_SC, (size_t)&trapsize); bcopy(&trapcode, (void *)EXC_TRC, (size_t)&trapsize); bcopy(&trapcode, (void *)EXC_FPA, (size_t)&trapsize); - bcopy(&vectrap, (void *)EXC_VEC, (size_t)&vectrapsize); + bcopy(&trapcode, (void *)EXC_VEC, (size_t)&trapsize); bcopy(&trapcode, (void *)EXC_VECAST, (size_t)&trapsize); bcopy(&trapcode, (void *)EXC_THRM, (size_t)&trapsize); bcopy(&trapcode, (void *)EXC_BPT, (size_t)&trapsize); @@ -652,7 +652,21 @@ grab_mcontext(struct thread *td, mcontex memcpy(mcp->mc_fpreg, pcb->pcb_fpu.fpr, 32*sizeof(double)); } - /* XXX Altivec context ? */ + /* + * Repeat for Altivec context + */ + + if (pcb->pcb_flags & PCB_VEC) { + KASSERT(td == curthread, + ("get_mcontext: fp save not curthread")); + critical_enter(); + save_vec(td); + critical_exit(); + mcp->mc_flags |= _MC_AV_VALID; + mcp->mc_vscr = pcb->pcb_vec.vscr; + mcp->mc_vrsave = pcb->pcb_vec.vrsave; + memcpy(mcp->mc_avec, pcb->pcb_vec.vr, sizeof(mcp->mc_avec)); + } mcp->mc_len = sizeof(*mcp); @@ -706,7 +720,17 @@ set_mcontext(struct thread *td, const mc memcpy(pcb->pcb_fpu.fpr, mcp->mc_fpreg, 32*sizeof(double)); } - /* XXX Altivec context? */ + if (mcp->mc_flags & _MC_AV_VALID) { + if ((pcb->pcb_flags & PCB_VEC) != PCB_VEC) { + critical_enter(); + enable_vec(td); + critical_exit(); + } + pcb->pcb_vec.vscr = mcp->mc_vscr; + pcb->pcb_vec.vrsave = mcp->mc_vrsave; + memcpy(pcb->pcb_vec.vr, mcp->mc_avec, sizeof(mcp->mc_avec)); + } + return (0); } Modified: stable/7/sys/powerpc/powerpc/swtch.S ============================================================================== --- stable/7/sys/powerpc/powerpc/swtch.S Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/powerpc/swtch.S Sat Mar 7 20:39:42 2009 (r189498) @@ -94,8 +94,16 @@ ENTRY(cpu_switch) andi. %r6, %r6, PCB_FPU beq .L1 bl save_fpu - mr %r3,%r14 /* restore old thread ptr */ + .L1: + lwz %r6,PCB_FLAGS(%r5) + /* Save Altivec context if needed */ + andi. %r6, %r6, PCB_VEC + beq .L2 + bl save_vec + +.L2: + mr %r3,%r14 /* restore old thread ptr */ bl pmap_deactivate /* Deactivate the current pmap */ mr %r3,%r15 /* Get new thread ptr */ @@ -108,12 +116,20 @@ ENTRY(cpu_switch) lwz %r6, PCB_FLAGS(%r17) /* Restore FPU context if needed */ andi. %r6, %r6, PCB_FPU - beq .L2 + beq .L3 mr %r3,%r15 /* Pass curthread to enable_fpu */ bl enable_fpu +.L3: + lwz %r6, PCB_FLAGS(%r17) + /* Restore Altivec context if needed */ + andi. %r6, %r6, PCB_VEC + beq .L4 + mr %r3,%r15 /* Pass curthread to enable_vec */ + bl enable_vec + /* thread to restore is in r3 */ -.L2: +.L4: mr %r3,%r17 /* Recover PCB ptr */ lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */ mr %r2,%r12 Modified: stable/7/sys/powerpc/powerpc/trap.c ============================================================================== --- stable/7/sys/powerpc/powerpc/trap.c Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/powerpc/trap.c Sat Mar 7 20:39:42 2009 (r189498) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -188,24 +189,16 @@ trap(struct trapframe *frame) enable_fpu(td); break; -#ifdef ALTIVEC case EXC_VEC: - if ((vecthread = PCPU_GET(vecthread)) != NULL) { - KASSERT(vecthread != td, - ("altivec already enabled")); - save_vec(vecthread); - } - PCPU_SET(vecthread, td); - td->td_pcb->pcb_veccpu = PCPU_GET(cpuid); + KASSERT((td->td_pcb->pcb_flags & PCB_VEC) != PCB_VEC, + ("Altivec already enabled for thread")); enable_vec(td); - frame->srr1 |= PSL_VEC; break; -#else - case EXC_VEC: + case EXC_VECAST: + printf("Vector assist exception!\n"); sig = SIGILL; break; -#endif /* ALTIVEC */ case EXC_ALI: if (fix_unaligned(td, frame) != 0) Modified: stable/7/sys/powerpc/powerpc/trap_subr.S ============================================================================== --- stable/7/sys/powerpc/powerpc/trap_subr.S Sat Mar 7 19:54:30 2009 (r189497) +++ stable/7/sys/powerpc/powerpc/trap_subr.S Sat Mar 7 20:39:42 2009 (r189498) @@ -79,13 +79,13 @@ /* * FRAME_SETUP assumes: * SPRG1 SP (1) + * SPRG3 trap type * savearea r28-r31,DAR,DSISR (DAR & DSISR only for DSI traps) * r28 LR * r29 CR * r30 scratch * r31 scratch * r1 kernel stack - * LR trap type (from calling address, mask with 0xff00) * SRR0/1 as at start of trap */ #define FRAME_SETUP(savearea) \ @@ -146,8 +146,7 @@ lwz %r31,(savearea+CPUSAVE_SRR1)(%r2); /* saved SRR1 */ \ mfxer %r3; \ mfctr %r4; \ - mflr %r5; \ - andi. %r5,%r5,0xff00; /* convert LR to exc # */ \ + mfsprg3 %r5; \ stw %r3, FRAME_XER+8(1); /* save xer/ctr/exc */ \ stw %r4, FRAME_CTR+8(1); \ stw %r5, FRAME_EXC+8(1); \ @@ -245,18 +244,10 @@ GLOBAL(dbstk) .globl CNAME(trapcode),CNAME(trapsize) CNAME(trapcode): mtsprg1 %r1 /* save SP */ - GET_CPUINFO(%r1) - stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) /* free r28-r31 */ - stw %r29,(PC_TEMPSAVE+CPUSAVE_R29)(%r1) - stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1) - stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1) - mfsprg1 %r1 /* restore SP, in case of branch */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ -/* Test whether we already had PR set */ - mfsrr1 %r31 - mtcr %r31 - bla s_trap /* LR & 0xff00 is exception # */ + mflr %r1 /* Save the old LR in r1 */ + mtsprg2 %r1 /* And then in SPRG2 */ + li %r1, 0x20 /* How to get the vector from LR */ + bla generictrap /* LR & SPRG3 is exception # */ CNAME(trapsize) = .-CNAME(trapcode) /* @@ -277,10 +268,15 @@ CNAME(alitrap): mfsprg1 %r1 /* restore SP, in case of branch */ mflr %r28 /* save LR */ mfcr %r29 /* save CR */ -/* Test whether we already had PR set */ + + /* Put our exception vector in SPRG3 */ + li %r31, EXC_ALI + mtsprg3 %r31 + + /* Test whether we already had PR set */ mfsrr1 %r31 mtcr %r31 - bla s_trap /* LR & 0xff00 is exception # */ + bla s_trap CNAME(alisize) = .-CNAME(alitrap) /* @@ -345,6 +341,11 @@ CNAME(dsisize) = .-CNAME(dsitrap) * Preamble code for DSI/ISI traps */ disitrap: + /* Write the trap vector to SPRG3 by computing LR & 0xff00 */ + mflr %r1 + andi. %r1,%r1,0xff00 + mtsprg3 %r1 + GET_CPUINFO(%r1) lwz %r30,(PC_DISISAVE+CPUSAVE_R28)(%r1) stw %r30,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) @@ -397,6 +398,47 @@ realtrap: mtcr %r1 mfsprg1 %r1 /* restore SP (might have been overwritten) */ + bf 17,k_trap /* branch if PSL_PR is false */ + GET_CPUINFO(%r1) + lwz %r1,PC_CURPCB(%r1) + RESTORE_KERN_SRS(%r30,%r31) /* enable kernel mapping */ + ba s_trap + +/* + * generictrap does some standard setup for trap handling to minimize + * the code that need be installed in the actual vectors. It expects + * the following conditions. + * + * R1 - Trap vector = LR & (0xff00 | R1) + * SPRG1 - Original R1 contents + * SPRG2 - Original LR + */ + +generictrap: + /* Save R1 for computing the exception vector */ + mtsprg3 %r1 + + /* Save interesting registers */ + GET_CPUINFO(%r1) + stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) /* free r28-r31 */ + stw %r29,(PC_TEMPSAVE+CPUSAVE_R29)(%r1) + stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1) + stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1) + mfsprg1 %r1 /* restore SP, in case of branch */ + mfsprg2 %r28 /* save LR */ + mfcr %r29 /* save CR */ + + /* Compute the exception vector from the link register */ + mfsprg3 %r31 + ori %r31,%r31,0xff00 + mflr %r30 + and %r30,%r30,%r31 + mtsprg3 %r30 + + /* Test whether we already had PR set */ + mfsrr1 %r31 + mtcr %r31 + s_trap: bf 17,k_trap /* branch if PSL_PR is false */ GET_CPUINFO(%r1) @@ -445,14 +487,6 @@ CNAME(asttrapexit): FRAME_LEAVE(PC_TEMPSAVE) rfi -/* - * Temporary: vector-unavailable traps are directed to vector-assist traps - */ - .globl CNAME(vectrap),CNAME(vectrapsize) -CNAME(vectrap): - ba EXC_VECAST -CNAME(vectrapsize) = .-CNAME(vectrap) - #if defined(KDB) /* * Deliberate entry to dbtrap @@ -480,6 +514,14 @@ CNAME(ppc_db_trap): * Now the kdb trap catching code. */ dbtrap: + /* Write the trap vector to SPRG3 by computing LR & 0xff00 */ + mflr %r1 + andi. %r1,%r1,0xff00 + mtsprg3 %r1 + + lis %r1,(tmpstk+TMPSTKSZ-16)@ha /* get new SP */ + addi %r1,%r1,(tmpstk+TMPSTKSZ-16)@l + FRAME_SETUP(PC_DBSAVE) /* Call C trap code: */ addi %r3,%r1,8 @@ -517,16 +559,19 @@ CNAME(dblow): mfcr %r29 /* save CR in r29 */ mfsrr1 %r1 mtcr %r1 - GET_CPUINFO(%r1) bf 17,1f /* branch if privileged */ - stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) /* free r28 */ - mfsprg2 %r28 /* r29 holds cr ... */ - stw %r28,(PC_TEMPSAVE+CPUSAVE_R29)(%r1) /* free r29 */ - stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1) /* free r30 */ - stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1) /* free r31 */ - mflr %r28 /* save LR */ - bla u_trap + + /* Unprivileged case */ + mtcr %r29 /* put the condition register back */ + mfsprg2 %r29 /* ... and r29 */ + mflr %r1 /* save LR */ + mtsprg2 %r1 /* And then in SPRG2 */ + li %r1, 0 /* How to get the vector from LR */ + + bla generictrap /* and we look like a generic trap */ 1: + /* Privileged, so drop to KDB */ + GET_CPUINFO(%r1) stw %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */ mfsprg2 %r28 /* r29 holds cr... */ stw %r28,(PC_DBSAVE+CPUSAVE_R29)(%r1) /* free r29 */