Date: Sun, 14 Jun 2009 11:01:19 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 164327 for review Message-ID: <200906141101.n5EB1IAx095561@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164327 Change 164327 by mav@mav_mavbook on 2009/06/14 11:00:31 Allow maximum speed to be controlled via loader tunable. Limit default for for my onboard JMicron HBA's external port, which is not really eSATA capable. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#28 edit .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#13 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#28 (text+ko) ==== @@ -510,6 +510,15 @@ ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); + /* 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; + resource_int_value(device_get_name(dev), + device_get_unit(dev), "sata_rev", &ch->sata_rev); mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -1517,8 +1526,16 @@ ATA_OUTL(ch->r_mem, AHCI_P_SCTL, ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER | ATA_SC_DET_RESET); DELAY(50000); + if (ch->sata_rev == 1) + val = ATA_SC_SPD_SPEED_GEN1; + else if (ch->sata_rev == 2) + val = ATA_SC_SPD_SPEED_GEN2; + else if (ch->sata_rev == 3) + val = ATA_SC_SPD_SPEED_GEN3; + else + val = 0; ATA_OUTL(ch->r_mem, AHCI_P_SCTL, - ATA_SC_DET_IDLE | ATA_SC_SPD_SPEED_GEN1 | ((ch->pm_level > 0) ? 0 : + ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 : (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))); DELAY(50000); return (ahci_sata_connect(ch)); ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#13 (text+ko) ==== @@ -338,6 +338,7 @@ uint32_t caps; /* Controller capabilities */ 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]; struct mtx mtx; /* state lock */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906141101.n5EB1IAx095561>