Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jun 2009 10:08:46 +0100
From:      Bruce Simpson <bms@incunabulum.net>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-stable-7@freebsd.org, svn-src-stable@freebsd.org, Alexander Motin <mav@freebsd.org>, src-committers@freebsd.org, Bruce Simpson <bms@freebsd.org>, svn-src-all@freebsd.org
Subject:   Re: svn commit: r192033 - stable/7/sys/dev/ata
Message-ID:  <4A2F781E.8010803@incunabulum.net>
In-Reply-To: <200906090946.46103.jhb@freebsd.org>
References:  <200905130255.n4D2tMQZ040010@svn.freebsd.org> <200906081050.41020.jhb@freebsd.org> <4A2E3C26.9040903@incunabulum.net> <200906090946.46103.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080009090909010804080902
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

John Baldwin wrote:
>> As far as I know the regression / panic still happens in 7.2 -- I nearly 
>> did an 'installkernel' on that box w/o thinking...
>>     
> Yes.  The same patch will apply to 7-stable though it will have to be applied 
> to ata-chipset.c instead.
>   

Here is that patch reworked, which I'm about to test shortly. I see the 
fuzz confused patch(1).

... After manual fixup, I am now up and running with this modified 
patch. Thanks John!

Not sure why it didn't work in 8.x, though.

cheers
BMS

--------------080009090909010804080902
Content-Type: text/plain;
 name="ata_ali_releng7.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ata_ali_releng7.patch"

--- ata-chipset.c.orig	2009-06-01 23:05:07.000000000 +0100
+++ ata-chipset.c	2009-06-10 09:54:02.000000000 +0100
@@ -198,6 +198,9 @@
 static int ata_check_80pin(device_t dev, int mode);
 static int ata_mode2idx(int mode);
 
+struct ali_sata_resources {
+	struct resource *bars[4];
+};
 
 /*
  * generic ATA support functions
@@ -1094,6 +1097,8 @@
 ata_ali_chipinit(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
+    struct ali_sata_resources *res;
+    int i, rid;
 
     if (ata_setup_interrupt(dev))
 	return ENXIO;
@@ -1108,6 +1113,22 @@
 	if ((ctlr->chip->chipid == ATA_ALI_5288) &&
 	    (ata_ahci_chipinit(dev) != ENXIO))
             return 0;
+
+	/* Allocate resources for later use by channel attach routines. */
+	res = malloc(sizeof(struct ali_sata_resources), M_TEMP, M_WAITOK);
+	for (i = 0; i < 4; i++) {
+		rid = PCIR_BAR(i);
+		res->bars[i] = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
+		    RF_ACTIVE);
+		if (res->bars[i] == NULL) {
+			device_printf(dev, "Failed to allocate BAR %d\n", i);
+			for (i--; i >=0; i--)
+				bus_release_resource(dev, SYS_RES_IOPORT,
+				    PCIR_BAR(i), res->bars[i]);
+			free(res, M_TEMP);
+		}
+	}
+	ctlr->chipset_data = res;
 	break;
 
     case ALINEW:
@@ -1162,20 +1183,18 @@
     device_t parent = device_get_parent(dev);
     struct ata_pci_controller *ctlr = device_get_softc(parent);
     struct ata_channel *ch = device_get_softc(dev);
+    struct ali_sata_resources *res;
     struct resource *io = NULL, *ctlio = NULL;
     int unit01 = (ch->unit & 1), unit10 = (ch->unit & 2);
-    int i, rid;
-		
-    rid = PCIR_BAR(0) + (unit01 ? 8 : 0);
-    io = bus_alloc_resource_any(parent, SYS_RES_IOPORT, &rid, RF_ACTIVE);
-    if (!io)
-	return ENXIO;
+    int i;
 
-    rid = PCIR_BAR(1) + (unit01 ? 8 : 0);
-    ctlio = bus_alloc_resource_any(parent, SYS_RES_IOPORT, &rid, RF_ACTIVE);
-    if (!ctlio) {
-	bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
-	return ENXIO;
+    res = ctlr->chipset_data;
+    if (unit01) {
+	    io = res->bars[2];
+	    ctlio = res->bars[3];
+    } else {
+	    io = res->bars[0];
+	    ctlio = res->bars[1];
     }
 		
     for (i = ATA_DATA; i <= ATA_COMMAND; i ++) {


--------------080009090909010804080902--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A2F781E.8010803>