From owner-p4-projects@FreeBSD.ORG Wed Nov 25 20:13:55 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1B0681065676; Wed, 25 Nov 2009 20:13:55 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1A2A1065670 for ; Wed, 25 Nov 2009 20:13:54 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BF8C68FC15 for ; Wed, 25 Nov 2009 20:13:54 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id nAPKDsRw025571 for ; Wed, 25 Nov 2009 20:13:54 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nAPKDsAY025569 for perforce@freebsd.org; Wed, 25 Nov 2009 20:13:54 GMT (envelope-from mav@freebsd.org) Date: Wed, 25 Nov 2009 20:13:54 GMT Message-Id: <200911252013.nAPKDsAY025569@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 171031 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 20:13:55 -0000 http://p4web.freebsd.org/chv.cgi?CH=171031 Change 171031 by mav@mav_mavbook on 2009/11/25 20:13:23 Make SATA revision really controllable via `camcontrol negotiate`. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#87 edit .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#31 edit .. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#25 edit .. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.h#9 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#87 (text+ko) ==== @@ -776,7 +776,7 @@ struct ahci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ahci_channel *ch = device_get_softc(dev); struct cam_devq *devq; - int rid, error, i; + int rid, error, i, sata_rev = 0; ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); @@ -789,22 +789,22 @@ device_get_unit(dev), "pm_level", &ch->pm_level); if (ch->pm_level > 3) callout_init_mtx(&ch->pm_timer, &ch->mtx, 0); - for (i = 0; i < 16; i++) { - ch->user[i].revision = 0; - ch->user[i].mode = 0; - ch->user[i].bytecount = 8192; - ch->user[i].tags = ch->numslots; - ch->curr[i] = ch->user[i]; - } /* Limit speed for my onboard JMicron external port. * It is not eSATA really. */ if (pci_get_devid(ctlr->dev) == 0x2363197b && pci_get_subvendor(ctlr->dev) == 0x1043 && pci_get_subdevice(ctlr->dev) == 0x81e4 && ch->unit == 0) - ch->sata_rev = 1; + sata_rev = 1; resource_int_value(device_get_name(dev), - device_get_unit(dev), "sata_rev", &ch->sata_rev); + device_get_unit(dev), "sata_rev", &sata_rev); + for (i = 0; i < 16; i++) { + ch->user[i].revision = sata_rev; + ch->user[i].mode = 0; + ch->user[i].bytecount = 8192; + ch->user[i].tags = ch->numslots; + ch->curr[i] = ch->user[i]; + } rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE))) @@ -2075,6 +2075,7 @@ ahci_sata_phy_reset(device_t dev, int quick) { struct ahci_channel *ch = device_get_softc(dev); + int sata_rev; uint32_t val; if (quick) { @@ -2085,11 +2086,12 @@ if (bootverbose) device_printf(dev, "hardware reset ...\n"); - if (ch->sata_rev == 1) + sata_rev = ch->user[ch->pm_present ? 15 : 0].revision; + if (sata_rev == 1) val = ATA_SC_SPD_SPEED_GEN1; - else if (ch->sata_rev == 2) + else if (sata_rev == 2) val = ATA_SC_SPD_SPEED_GEN2; - else if (ch->sata_rev == 3) + else if (sata_rev == 3) val = ATA_SC_SPD_SPEED_GEN3; else val = 0; ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#31 (text+ko) ==== @@ -341,7 +341,7 @@ }; struct ahci_device { - u_int revision; + int revision; int mode; u_int bytecount; u_int tags; @@ -362,7 +362,6 @@ int quirks; int numslots; /* Number of present slots */ int pm_level; /* power management level */ - int sata_rev; /* Maximum allowed SATA generation */ struct ahci_slot slot[AHCI_MAX_SLOTS]; union ccb *hold[AHCI_MAX_SLOTS]; ==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#25 (text+ko) ==== @@ -415,21 +415,21 @@ { struct siis_channel *ch = device_get_softc(dev); struct cam_devq *devq; - int rid, error, i; + int rid, error, i, sata_rev = 0; ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); + resource_int_value(device_get_name(dev), + device_get_unit(dev), "sata_rev", &sata_rev); for (i = 0; i < 16; i++) { - ch->user[i].revision = 0; + ch->user[i].revision = sata_rev; ch->user[i].mode = 0; ch->user[i].bytecount = 8192; ch->user[i].tags = SIIS_MAX_SLOTS; ch->curr[i] = ch->user[i]; } - resource_int_value(device_get_name(dev), - device_get_unit(dev), "sata_rev", &ch->sata_rev); mtx_init(&ch->mtx, "SIIS channel lock", NULL, MTX_DEF); rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -1346,7 +1346,7 @@ siis_reset(device_t dev) { struct siis_channel *ch = device_get_softc(dev); - int i, retry = 0; + int i, retry = 0, sata_rev; uint32_t val; if (bootverbose) @@ -1390,11 +1390,12 @@ /* Disable port interrupts */ ATA_OUTL(ch->r_mem, SIIS_P_IECLR, 0x0000FFFF); /* Set speed limit. */ - if (ch->sata_rev == 1) + sata_rev = ch->user[ch->pm_present ? 15 : 0].revision; + if (sata_rev == 1) val = ATA_SC_SPD_SPEED_GEN1; - else if (ch->sata_rev == 2) + else if (sata_rev == 2) val = ATA_SC_SPD_SPEED_GEN2; - else if (ch->sata_rev == 3) + else if (sata_rev == 3) val = ATA_SC_SPD_SPEED_GEN3; else val = 0; ==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.h#9 (text+ko) ==== @@ -347,7 +347,7 @@ }; struct siis_device { - u_int revision; + int revision; int mode; u_int bytecount; u_int tags; @@ -364,7 +364,6 @@ struct cam_sim *sim; struct cam_path *path; int pm_level; /* power management level */ - int sata_rev; /* Maximum allowed SATA generation */ struct siis_slot slot[SIIS_MAX_SLOTS]; union ccb *hold[SIIS_MAX_SLOTS];