Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Nov 2011 17:57:21 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227000 - in head/sys/dev/ata: . chipsets
Message-ID:  <201111011757.pA1HvLMf077606@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Tue Nov  1 17:57:21 2011
New Revision: 227000
URL: http://svn.freebsd.org/changeset/base/227000

Log:
  In r225931 I've missed the only other driver using the pointer returned
  by rman_get_virtual(9) to access device registers sparc64 currently cares
  about.
  Ideally ata(4) should just be converted to access these using bus_space(9)
  read/write functions instead as there's really no reason to do it the
  former way. However, this part of ata-siliconimage.c should go away in
  favor of siis(4) sooner or later anyway and I don't have the hardware to
  actually test the SX4 bits of ata-promise.c.
  Also ideally the other architectures should also properly handle the
  BUS_SPACE_MAP_LINEAR flag of bus_space_map(9) so this code wouldn't need
  to be #ifdef'ed.

Modified:
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/chipsets/ata-promise.c
  head/sys/dev/ata/chipsets/ata-siliconimage.c

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Tue Nov  1 17:18:57 2011	(r226999)
+++ head/sys/dev/ata/ata-pci.c	Tue Nov  1 17:57:21 2011	(r227000)
@@ -153,10 +153,20 @@ ata_pci_detach(device_t dev)
     }
     if (ctlr->chipdeinit != NULL)
 	ctlr->chipdeinit(dev);
-    if (ctlr->r_res2)
+    if (ctlr->r_res2) {
+#ifdef __sparc64__
+	bus_space_unmap(rman_get_bustag(ctlr->r_res2),
+	    rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2));
+#endif
 	bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
-    if (ctlr->r_res1)
+    }
+    if (ctlr->r_res1) {
+#ifdef __sparc64__
+	bus_space_unmap(rman_get_bustag(ctlr->r_res1),
+	    rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1));
+#endif
 	bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1);
+    }
 
     return 0;
 }
@@ -775,7 +785,6 @@ driver_t ata_pcichannel_driver = {
 
 DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, 0, 0);
 
-
 /*
  * misc support fucntions
  */
@@ -936,4 +945,3 @@ ata_mode2idx(int mode)
 	return (mode & ATA_MODE_MASK) + 5;
     return (mode & ATA_MODE_MASK) - ATA_PIO0;
 }
-

Modified: head/sys/dev/ata/chipsets/ata-promise.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-promise.c	Tue Nov  1 17:18:57 2011	(r226999)
+++ head/sys/dev/ata/chipsets/ata-promise.c	Tue Nov  1 17:57:21 2011	(r227000)
@@ -94,7 +94,6 @@ static void ata_promise_next_hpkt(struct
 #define PR_SATA		0x40
 #define PR_SATA2	0x80
 
-
 /*
  * Promise chipset support functions
  */
@@ -250,6 +249,14 @@ ata_promise_chipinit(device_t dev)
 						    &ctlr->r_rid1, RF_ACTIVE)))
 	    goto failnfree;
 
+#ifdef __sparc64__
+	if (ctlr->chip->cfg2 == PR_SX4X &&
+	    !bus_space_map(rman_get_bustag(ctlr->r_res1),
+	    rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1),
+	    BUS_SPACE_MAP_LINEAR, NULL))
+		goto failnfree;
+#endif
+
 	ctlr->r_type2 = SYS_RES_MEMORY;
 	ctlr->r_rid2 = PCIR_BAR(3);
 	if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,

Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-siliconimage.c	Tue Nov  1 17:18:57 2011	(r226999)
+++ head/sys/dev/ata/chipsets/ata-siliconimage.c	Tue Nov  1 17:57:21 2011	(r227000)
@@ -80,7 +80,6 @@ static void ata_siiprb_dmainit(device_t 
 #define SII_BUG		0x04
 #define SII_4CH		0x08
 
-
 /*
  * Silicon Image Inc. (SiI) (former CMD) chipset support functions
  */
@@ -141,6 +140,17 @@ ata_sii_chipinit(device_t dev)
 	    bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,ctlr->r_res1);
 	    return ENXIO;
 	}
+#ifdef __sparc64__
+	if (!bus_space_map(rman_get_bustag(ctlr->r_res2),
+	    rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2),
+	    BUS_SPACE_MAP_LINEAR, NULL)) {
+	    	bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,
+		    ctlr->r_res1);
+		bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2,
+		    ctlr->r_res2);
+		return (ENXIO);
+	}
+#endif
 	ctlr->ch_attach = ata_siiprb_ch_attach;
 	ctlr->ch_detach = ata_siiprb_ch_detach;
 	ctlr->reset = ata_siiprb_reset;
@@ -432,7 +442,6 @@ ata_sii_setmode(device_t dev, int target
 	return (mode);
 }
 
-
 struct ata_siiprb_dma_prdentry {
     u_int64_t addr;
     u_int32_t count;



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