Re: ATA drives no more seen !

From: Søren Schmidt <sos_at_DeepCore.dk>
Date: Sun, 18 Apr 2004 14:10:46 +0200
Cyrille Lefevre wrote:
> Hi,
> 
> I've updated my cvs tree on April 13, 2004 through cvsup (w/o refuse),
> then I build/install a new world and kernel and Oh! surprise, I can't see
> my ATA drives anymore. the offending messages are :

This is a known problem and is caused by fallout from the latest changes 
to the PCI system. Warner and I are working on a solution.

You can try my take on fixing that (attached patch)..

-Søren

Index: ata/ata-pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-pci.c,v
retrieving revision 1.78
diff -u -r1.78 ata-pci.c
--- ata/ata-pci.c	13 Apr 2004 09:44:20 -0000	1.78
+++ ata/ata-pci.c	18 Apr 2004 01:37:20 -0000
_at__at_ -260,8 +260,8 _at__at_
 
 	case ATA_ALTADDR_RID:
 	    if (ATA_MASTERDEV(dev)) {
-		start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_ALTOFFSET-2;
-		count = 4;
+		start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_ALTOFFSET;
+		count = ATA_ALTIOSIZE;
 		end = start + count - 1;
 	    }
 	    myrid = 0x14 + 8 * unit;
_at__at_ -402,7 +402,7 _at__at_
 	ch->r_io[i].offset = i;
     }
     ch->r_io[ATA_ALTSTAT].res = altio;
-    ch->r_io[ATA_ALTSTAT].offset = 2;
+    ch->r_io[ATA_ALTSTAT].offset = ATA_MASTERDEV(device_get_parent(dev)) ? 0:2;
     ch->r_io[ATA_IDX_ADDR].res = io;
 
     if (ctlr->r_res1) {
Index: pci/pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/pci/pci.c,v
retrieving revision 1.245
diff -u -r1.245 pci.c
--- pci/pci.c	16 Apr 2004 15:01:54 -0000	1.245
+++ pci/pci.c	18 Apr 2004 01:15:26 -0000
_at__at_ -824,6 +824,19 _at__at_
 	 */
 	if (base == 0)
 		return 1;
+
+	/*
+	 * Ignore ATA device entires that are on compatibility addresses.
+	 * Such entries does not contain valid resources as they are at
+	 * fixed positions to be compatible with old ISA requirements.
+	 */
+	if ((pci_get_class(dev) == PCIC_STORAGE) &&
+	    (pci_get_subclass(dev) == PCIS_STORAGE_IDE) &&
+	    (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) &&
+	    !(pci_get_progif(dev) &
+	      (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)))
+		return 1;
+
 	start = base;
 	end = base + (1 << ln2size) - 1;
 	count = 1 << ln2size;
_at__at_ -1458,12 +1471,8 _at__at_
 	int mapsize;
 
 	/*
-	 * Weed out the bogons, and figure out how large the BAR/map
-	 * is.  Note: some devices have been found that are '0' after
-	 * a write of 0xffffffff.  We view these as 'special' and
-	 * allow drivers to allocate whatever they want with them.  So
-	 * far, these BARs have only appeared in certain south bridges
-	 * and ata controllers made by VIA, nVidia and AMD.
+	 * Weed out the bogons, and figure out how large the BAR/map is.
+	 * Note: we must skip these checks on BAR's that are not valid.
 	 */
 	res = NULL;
 	map = pci_read_config(child, *rid, 4);
Received on Sun Apr 18 2004 - 03:10:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:51 UTC