From owner-FreeBSD-users-jp@jp.FreeBSD.org Mon Jan  9 13:09:51 2006
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id k0949po20644;
	Mon, 9 Jan 2006 13:09:51 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from zaku.oni.gr.jp (root@zaku.oni.gr.jp [2001:2c0:447::1])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet6 id k0949W920632
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 9 Jan 2006 13:09:33 +0900 (JST)
	(envelope-from oniuda@oni.gr.jp)
Received: from localhost (oniuda@localhost [IPv6:::1])
	by zaku.oni.gr.jp (8.13.3/8.13.3) with ESMTP id k0949UvB005218
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 9 Jan 2006 13:09:30 +0900 (JST)
	(envelope-from oniuda@oni.gr.jp)
Message-Id: <20060109.130929.78757377.oniuda@oni.gr.jp>
To: FreeBSD-users-jp@jp.FreeBSD.org
From: Koh-ichi Oniuda (=?iso-2022-jp?B?GyRCNTRAOEVEOUAwbBsoQg==?=)
 <oniuda@oni.gr.jp>
X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Mon_Jan__9_13_09_29_2006_162)--"
Content-Transfer-Encoding: 7bit
Reply-To: FreeBSD-users-jp@jp.FreeBSD.org
Precedence: list
Date: Mon, 09 Jan 2006 13:09:29 +0900
X-Sequence: FreeBSD-users-jp 89053
Subject: [FreeBSD-users-jp 89053] Dell PowerEdge 830 install on SATA
Sender: owner-FreeBSD-users-jp@jp.FreeBSD.org
X-Originator: oniuda@oni.gr.jp
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+051217

----Next_Part(Mon_Jan__9_13_09_29_2006_162)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

$B54@8ED$G$9!#(B

$B!!G/Kv$K(BSATA HDD$B$r(B2$BBfF~$l$?(BDELL PowerEdge 830$B$r9XF~$7!"(BFreeBSD 6.0
$B$r%$%s%9%H!<%k$7$h$&$H$7$F$^$7$?$,!"(BSTAT HDD$B$rG'<1$;$:!"%$%s%9%H!<%k(B
$B$G$-$^$;$s$G$7$?!#(B

$B!!F1$8$h$&$K6lO+$5$l$F$kJ}$b$*$i$l$k$h$&$G!"(BGoogle$B$G0J2<$N%-!<%o!<%I(B
$B$G8!:w$9$k$H%Q%C%A$,%R%C%H$7$^$7$?!#(B
$B8!:w%-!<%o!<%I(B: FreeBSD "PowerEdge 830" SATA
$B%Q%C%A(B: http://www.bsdforums.org/forums/showthread.php?t=37304

$B!!$,!">e5-%Q%C%A$r$"$F$F$b!"7k6I(BSATA HDD$B$rG'<1$G$-$^$;$s$G$7$?!#(B

$B8!:w%-!<%o!<%I$r!"F1$8%^%6!<%\!<%I$r;}$D(B850$B$KJQ$($F8!:w$7$F$_$k$H(B
$BK\2H$NJ}$G!"%Q%C%A$,=P$F$$$^$7$?!#7k6I$3$l$G(BSATA HD$B$rG'<1$9$k$3$H(B
$B$,$G$-$^$7$?!#(B

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=221243+0+archive/2005/freebsd-current/20051113.freebsd-current

$B!!$\$/$N=j$G<B:]$KF0$$$F$k%Q%C%A$r:G8e$KIU$1$^$9!#(B

$B!!F1MM$K(BPowerEdge 830 | 850 $B$N(BSATA HDD$B$G6lO+$5$l$F$$$kJ}$N;29M(B
$B$K$J$l$P9,$$$G$9!#(B

---
Oniuda

----Next_Part(Mon_Jan__9_13_09_29_2006_162)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="ata-chipset.patch"

*** /sys/dev/ata/ata-chipset.c.ctm	Fri Dec 30 12:01:17 2005
--- /sys/dev/ata/ata-chipset.c	Fri Jan  6 17:03:22 2006
***************
*** 236,250 ****
  static int
  ata_sata_connect(struct ata_channel *ch)
  {
!     u_int32_t status;
!     int timeout;
  
      /* wait up to 1 second for "connect well" */
      for (timeout = 0; timeout < 100 ; timeout++) {
  	status = ATA_IDX_INL(ch, ATA_SSTATUS);
  	if ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1 ||
! 	    (status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2)
! 	    break;
  	ata_udelay(10000);
      }
      if (timeout >= 100) {
--- 236,270 ----
  static int
  ata_sata_connect(struct ata_channel *ch)
  {
!     u_int32_t status, error;
!     int timeout, device;
!     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(ch->dev));
!     int something_there = 0;
! 
!     if (ctlr->chip->chipid == ATA_I82801GB_S1) {
! 	status = ATA_IDX_INL(ch, ATA_SSTATUS);
! 	error = ATA_IDX_INL(ch, ATA_SERROR);
! 	if (status == (ATA_SS_DET_DEV_PRESENT | ATA_SS_DET_PHY_OFFLINE) ||
! 	    status == (ATA_SS_DET_PHY_ONLINE | ATA_SS_SPD_GEN1 | ATA_SS_IPM_ACTIVE)) {
! 	    /* reset port */
! 	    device = 1 << (ch->unit + 1);
! 	    pci_write_config(ch->dev, 0x92,
! 	   	pci_read_config(ch->dev, 0x92, 2) & ~device, 2);
! 	    pci_write_config(ch->dev, 0x92,
! 		pci_read_config(ch->dev, 0x92, 2) & ~device, 2);
! 	}
!     }
  
      /* wait up to 1 second for "connect well" */
      for (timeout = 0; timeout < 100 ; timeout++) {
  	status = ATA_IDX_INL(ch, ATA_SSTATUS);
+ 	error = ATA_IDX_INL(ch, ATA_SERROR);
+ 	ATA_IDX_OUTL(ch, ATA_SERROR, error);
  	if ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1 ||
! 	     (status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2) {
! 		something_there = 1;
! 		break;
! 	}
  	ata_udelay(10000);
      }
      if (timeout >= 100) {
***************
*** 267,273 ****
      }
      if (bootverbose)
  	device_printf(ch->dev, "SATA connect ready time=%dms\n", timeout * 10);
!     if (timeout < 1000) {
  	if ((ATA_IDX_INB(ch, ATA_CYL_LSB) == ATAPI_MAGIC_LSB) &&
  	    (ATA_IDX_INB(ch, ATA_CYL_MSB) == ATAPI_MAGIC_MSB))
  	    ch->devices = ATA_ATAPI_MASTER;
--- 287,293 ----
      }
      if (bootverbose)
  	device_printf(ch->dev, "SATA connect ready time=%dms\n", timeout * 10);
!     if (something_there || timeout < 1000) {
  	if ((ATA_IDX_INB(ch, ATA_CYL_LSB) == ATAPI_MAGIC_LSB) &&
  	    (ATA_IDX_INB(ch, ATA_CYL_MSB) == ATAPI_MAGIC_MSB))
  	    ch->devices = ATA_ATAPI_MASTER;
***************
*** 1657,1662 ****
--- 1677,1688 ----
  	    /* force all ports active "the legacy way" */
  	    pci_write_config(dev, 0x92, pci_read_config(dev, 0x92, 2) | 0x0f,2);
  
+ 	    if (ctlr->chip->chipid == ATA_I82801GB_S1) {
+ 		/* enable AHCI register compat mode */
+ 		pci_write_config(dev, 0x94, pci_read_config(dev, 0x94, 4) | 1 << 9, 4);
+ 		ATA_OUTL(ctlr->r_res2, 0x0C, ATA_INL(ctlr->r_res2, 0x0C) | 0xf);
+ 	    }
+ 
  	    /* enable AHCI mode */
  	    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_AE);
  
***************
*** 1845,1864 ****
      struct ata_channel *ch = device_get_softc(dev);
      int mask, timeout;
  
!     /* ICH6 has 4 SATA ports as master/slave on 2 channels so deal with pairs */
!     if (ctlr->chip->chipid == ATA_I82801FB_S1 ||
! 	ctlr->chip->chipid == ATA_I82801FB_R1 ||
! 	ctlr->chip->chipid == ATA_I82801FB_M) {
  	mask = (0x0005 << ch->unit);
      }
      else {
! 	/* ICH5 in compat mode has SATA ports as master/slave on 1 channel */
! 	if (pci_read_config(parent, 0x90, 1) & 0x04)
! 	    mask = 0x0003;
  	else {
! 	    mask = (0x0001 << ch->unit);
! 	    /* XXX SOS should be in intel_allocate when we grow it */
! 	    ch->flags |= ATA_NO_SLAVE;
  	}
      }
      pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) & ~mask, 2);
--- 1871,1903 ----
      struct ata_channel *ch = device_get_softc(dev);
      int mask, timeout;
  
!     /* ICH7 has 4 SATA300 ports as master/slave on 2 channels so deal with pairs */
!     if (ctlr->chip->chipid == ATA_I82801GB_S1 ||
! 	ctlr->chip->chipid == ATA_I82801GB_R1 ||
! 	ctlr->chip->chipid == ATA_I82801GB_M  ||
! 	ctlr->chip->chipid == ATA_I82801GB_AH) {
  	mask = (0x0005 << ch->unit);
      }
      else {
!     	/* ICH6 has 4 SATA ports as master/slave on 2 channels so deal with pairs */
! 	if (ctlr->chip->chipid == ATA_I82801FB_S1 ||
! 		ctlr->chip->chipid == ATA_I82801FB_R1 ||
! 		ctlr->chip->chipid == ATA_I82801FB_M  ||
! 		ctlr->chip->chipid == ATA_I82801GB_S1 ||
! 		ctlr->chip->chipid == ATA_I82801GB_R1 ||
! 		ctlr->chip->chipid == ATA_I82801GB_M  ||
! 		ctlr->chip->chipid == ATA_I82801GB_AH) {
! 		mask = (0x0005 << ch->unit);
!     	}
  	else {
! 	/* ICH5 in compat mode has SATA ports as master/slave on 1 channel */
! 		if (pci_read_config(parent, 0x90, 1) & 0x04)
! 		    mask = 0x0003;
! 		else {
! 		    mask = (0x0001 << ch->unit);
! 		    /* XXX SOS should be in intel_allocate when we grow it */
! 		    ch->flags |= ATA_NO_SLAVE;
! 		}
  	}
      }
      pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) & ~mask, 2);

----Next_Part(Mon_Jan__9_13_09_29_2006_162)----
