[OpenBIOS] [PATCH 1/6] pci: move pci_decode_pci_addr() towards the top of pci.c

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Wed Sep 6 21:21:36 CEST 2017


This is in anticipation of using in several other places.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 drivers/pci.c |   48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/pci.c b/drivers/pci.c
index 7d16f3a..88f11c6 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -150,6 +150,30 @@ static unsigned long pci_bus_addr_to_host_addr(int space, uint32_t ba)
     }
 }
 
+static inline void pci_decode_pci_addr(pci_addr addr, int *flags,
+                                       int *space_code, uint32_t *mask)
+{
+    *flags = 0;
+
+    if (addr & 0x01) {
+        *space_code = IO_SPACE;
+        *mask = 0x00000001;
+    } else {
+        if (addr & 0x04) {
+            *space_code = MEMORY_SPACE_64;
+            *flags |= IS_NOT_RELOCATABLE; /* XXX: why not relocatable? */
+        } else {
+            *space_code = MEMORY_SPACE_32;
+        }
+
+        if (addr & 0x08) {
+            *flags |= IS_PREFETCHABLE;
+        }
+
+        *mask = 0x0000000F;
+    }
+}
+
 static void
 ob_pci_open(int *idx)
 {
@@ -648,30 +672,6 @@ int rtl8139_config_cb(const pci_config_t *config)
 	return eth_config_cb(config);
 }
 
-static inline void pci_decode_pci_addr(pci_addr addr, int *flags,
-				       int *space_code, uint32_t *mask)
-{
-    *flags = 0;
-
-	if (addr & 0x01) {
-		*space_code = IO_SPACE;
-		*mask = 0x00000001;
-	} else {
-	    if (addr & 0x04) {
-            *space_code = MEMORY_SPACE_64;
-            *flags |= IS_NOT_RELOCATABLE; /* XXX: why not relocatable? */
-        } else {
-            *space_code = MEMORY_SPACE_32;
-        }
-
-        if (addr & 0x08) {
-            *flags |= IS_PREFETCHABLE;
-        }
-
-        *mask = 0x0000000F;
-	}
-}
-
 /*
  * "Designing PCI Cards and Drivers for Power Macintosh Computers", p. 454
  *
-- 
1.7.10.4




More information about the OpenBIOS mailing list