From yoichi@alcoholic.geiin.org  Mon May 22 15:23:57 2006
Return-Path: <yoichi@alcoholic.geiin.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1498416AF62
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 May 2006 15:23:57 +0000 (UTC)
	(envelope-from yoichi@alcoholic.geiin.org)
Received: from alcoholic.geiin.org (59x87x89x234.ap59.ftth.ucom.ne.jp [59.87.89.234])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B861343DBF
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 May 2006 15:22:28 +0000 (GMT)
	(envelope-from yoichi@alcoholic.geiin.org)
Received: by alcoholic.geiin.org (Postfix, from userid 1001)
	id 4C6AF1EEE3; Tue, 23 May 2006 00:22:26 +0900 (JST)
Message-Id: <20060522152226.4C6AF1EEE3@alcoholic.geiin.org>
Date: Tue, 23 May 2006 00:22:26 +0900 (JST)
From: Yoichi NAKAYAMA <yoichi@FreeBSD.org>
Reply-To: Yoichi NAKAYAMA <yoichi@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         97624
>Category:       kern
>Synopsis:       [ata] [patch] enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sos
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 22 15:30:20 GMT 2006
>Closed-Date:    Mon Sep 18 19:03:41 GMT 2006
>Last-Modified:  Mon Sep 18 19:03:41 GMT 2006
>Originator:     Yoichi NAKAYAMA
>Release:        FreeBSD 6.1-RELEASE i386
>Organization:
Geiin.org
>Environment:
>Description:
I bought motherboard ASUS N4L-VM DH but its serial-ATA RAID disk was not
recognized by 6.1-RELEASE kernel.
pciconf -l -v shows following entry:
none2@pci0:31:2:	class=0x010400 card=0x27c68086 chip=0x27c68086 rev=0x02 hdr=0x00
    vendor   = 'Intel Corporation'
    class    = mass storage
    subclass = RAID

I've added following entry, and the device is working now.

>How-To-Repeat:

>Fix:
diff from cvs head:

Index: ata-chipset.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-chipset.c,v
retrieving revision 1.162
diff -u -c -r1.162 ata-chipset.c
*** ata-chipset.c	11 May 2006 10:43:08 -0000	1.162
--- ata-chipset.c	22 May 2006 15:06:12 -0000
***************
*** 1595,1600 ****
--- 1595,1601 ----
       { ATA_I82801GB_R1, 0, AHCI, 0x00, ATA_SA300, "ICH7" },
       { ATA_I82801GB_M,  0, AHCI, 0x00, ATA_SA300, "ICH7" },
       { ATA_I82801GB_AH, 0, AHCI, 0x00, ATA_SA300, "ICH7" },
+      { ATA_I82801GH_M,  0, AHCI, 0x00, ATA_SA300, "ICH7" },
       { ATA_I31244,      0,    0, 0x00, ATA_SA150, "31244" },
       { 0, 0, 0, 0, 0, 0}};
      char buffer[64]; 
Index: ata-pci.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-pci.h,v
retrieving revision 1.64
diff -u -c -r1.64 ata-pci.h
*** ata-pci.h	13 Mar 2006 14:01:37 -0000	1.64
--- ata-pci.h	22 May 2006 15:06:12 -0000
***************
*** 153,158 ****
--- 153,159 ----
  #define ATA_I82801GB_R1         0x27c38086
  #define ATA_I82801GB_AH         0x27c18086
  #define ATA_I82801GB_M          0x27c58086
+ #define ATA_I82801GH_M          0x27c68086
  #define ATA_I31244              0x32008086
  
  #define ATA_ITE_ID              0x1283


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Wed May 24 12:24:06 UTC 2006 
Responsible-Changed-Why:  
One more patch for Soren. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97624 

From: Yoichi Nakayama <yoichi@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org,sos@FreeBSD.org
Cc: freebsd-bugs@FreeBSD.org
Subject: Re: kern/97624: enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
Date: Tue, 30 May 2006 00:12:40 +0900

 I met problem on booting when SATA RAID1 Volume is in
 Status:Degraded (after disconnecting one disk in the array).
 The patched kernel based on SMP/GENERIC both panic as:
 
 6.1R GENERIC kernel (patched):
   Fatal trap 12: page fault while in kernel mode
   fault virtual address   = 0xf4c3b8d8
   fault code              = supervisor read, page not present
   instruction pointer     = 0x20:0xc083fa56
   stack pointer           = 0x28:0xc0c20bfc
   frame pointer           = 0x28:0xc0c20c40
   code segment            = base 0x0, limit 0xfffff, type 0x1b
                           = DPL 0, pres 1, def32 1, gran 1
   processor eflags        = interrupt enabled, resume, IOPL = 0
   current process         = 0 (swapper)
   trap number             = 12
   panic: page fault
 
 6.1R SMP kernel (patched):
   Fatal trap 12: page fault while in kernel mode
   fault virtual address   = 0xf4d988d8
   fault code              = supervisor read, page not present
   instruction pointer     = 0x20:0xc0847e06
   stack pointer           = 0x28:0xc0c20bfc
   frame pointer           = 0x28:0xc0c20c40
   code segment            = base 0x0, limit 0xfffff, type 0x1b
                           = DPL 0, pres 1, def32 1, gran 1
   processor eflags        = interrupt enabled, resume, IOPL = 0
   current process         = 0 (swapper)
   trap number             = 12
   panic: page fault
 
 If I "Reset Disks to Non-RAID" then "Create RAID Volume" with
 Intel(R) Matrix Storage Managaer, the panic disappears.
 
 Original 6.1R GENERIC kernel doesn't get panic nor recognize
 SATA disks.
 
 Motherboard: ASUS N4L-VM DH (ICH7M-DH)
 CPU: Intel Core Duo T2300
 
 Is the problem general (known?) problem or special to this
 controller?
 
 Regards,
 -- 
 Yoichi NAKAYAMA

From: Yoichi Nakayama <yoichi@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org,sos@FreeBSD.org
Cc: freebsd-bugs@FreeBSD.org
Subject: Re: kern/97624: enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
Date: Tue, 30 May 2006 22:01:29 +0900

 I got following trace with SMP kernel:
 
 Stopped at      generic_bcopy+9x1a:      repe movsl      (%esi),%es:(%edi)
 db> trace
 Tracing pid 0 tid 0 td 0xc0993300
 generic_bcopy(c4ed7380,c097bf20) at generic_bcopy+0x1a
 ata_raid_read_metadata(c4ed7380,c4ed7380,c0c20c84,c066c96c,c4ed7380) at ata_raid_read_metadata+0x18b
 ata_raid_subdisk_attach(c4ed7380) at ata_raid_subdisk_attach+0x33
 device_attach(c4ed7380,c4ed7480,c4ed7380,c4d81180,0) at device_attach+0x58
 device_probe_and_attach(c4ed7380) at device_probe_and_attach+0xc4
 bus_generic_attach(c4ed7780,c4ed7780,c0893bcd,e,c4ed7480) at bus_generic_attach+0x16
 ad_attach(c4ed7780) at ad_attach+0x2c8
 device_attach(c4ed7780,c0c20d28,c4ed7780,0,c4ec9000) at device_attach+0x58
 device_probe_and_attach(c4ed7780) at device_probe_and_attach+0xc4
 bus_generic_attach(c4d5e800,c4d5e800,ffffffff,e,c4ed7780) at bus_generic_attach+0x16
 ata_identify(c4d5e800) at ata_identify+0x1c8
 ata_boot_attach(0) at ata_boot_attach+0x5a
 run_interrupt_driven_config_hooks(0,c1ec00,c1e000,0,c0447455) at run_interrupt_driven_config_hooks+0x18
 riven_config_hooks+0x18
 mi_startup() at mi_startup+0x96
 begin() at begin+0x2c

From: Yoichi Nakayama <yoichi@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org,
	sos@FreeBSD.org
Cc: freebsd-bugs@FreeBSD.org
Subject: Re: kern/97624: enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
Date: Sun, 23 Jul 2006 12:55:20 +0900

 At Tue, 30 May 2006 22:01:29 +0900,
 Yoichi Nakayama wrote:
 > Stopped at      generic_bcopy+9x1a:      repe movsl      (%esi),%es:(%edi)
 > db> trace
 > Tracing pid 0 tid 0 td 0xc0993300
 > generic_bcopy(c4ed7380,c097bf20) at generic_bcopy+0x1a
 > ata_raid_read_metadata(c4ed7380,c4ed7380,c0c20c84,c066c96c,c4ed7380) at ata_raid_read_metadata+0x18b
 
 I've upgraded FreeBSD to current and it stops at the same position.
 It is stopped in "clear out any old info" loop.
 
 In verbose boot, ata_raid_intel_print_meta() nomally shows:
  disk 0 at disk_idx 0x00000000
  disk 1 at disk_idx 0x00000001
 But with degraded mode (call "atacontrol detach" for one of the disks
 in RAID1 volume and reboot makes the raid volume degraded mode):
  disk 0 at disk_idx 0x00000000
  disk 1 at disk_idx 0x01000001 <== BIOS tells it is "Offline Member"
 
 Should we apply some mask to map->disk_idx[disk]?
 Regards,
 -- 
 Yoichi NAKAYAMA

From: Yoichi NAKAYAMA <yoichi@geiin.org>
To: FreeBSD-gnats-submit@FreeBSD.org, sos@FreeBSD.org
Cc:  
Subject: Re: kern/97624: enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
Date: Fri, 28 Jul 2006 12:57:33 +0900

 At Sun, 23 Jul 2006 12:55:20 +0900,
 Yoichi Nakayama wrote:
 > In verbose boot, ata_raid_intel_print_meta() nomally shows:
 >  disk 0 at disk_idx 0x00000000
 >  disk 1 at disk_idx 0x00000001
 > But with degraded mode (call "atacontrol detach" for one of the disks
 > in RAID1 volume and reboot makes the raid volume degraded mode):
 >  disk 0 at disk_idx 0x00000000
 >  disk 1 at disk_idx 0x01000001 <== BIOS tells it is "Offline Member"
 > 
 > Should we apply some mask to map->disk_idx[disk]?
 
 I've read dmraid code for linux and found it uses
 lower 16bit only. But I don't know why since I
 could not find specification of metadata format.
 
 Regards,
 -- 
 Yoichi NAKAYAMA

From: Yoichi Nakayama <yoichi@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org,sos@FreeBSD.org
Cc:  
Subject: Re: kern/97624: enable SATA RAID on ASUS N4L-VM DH (ICH7M-DH)
Date: Fri, 18 Aug 2006 12:07:40 +0900

 I found support of my chip is included in
   ata-chipset.c Revision 1.169 / ata-pci.h Revision 1.69
   Add support for the ICH8 and ESB2 chips, also add a few other missing ICH7 parts.
 and confirmed that it does work. So close this PR, please.
 
 # I've posted seperate PR on the problem I wrote
 # in the followup of this PR(detach disk will cause panic):
 # http://www.freebsd.org/cgi/query-pr.cgi?pr=102211
 
 Thanks,
 -- 
 Yoichi NAKAYAMA
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Sep 18 19:01:38 UTC 2006 
State-Changed-Why:  
Closed as pr originators request 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97624 
>Unformatted:
