[OpenBIOS] r367 - openbios-devel/drivers

svn at openbios.org svn at openbios.org
Wed Jan 7 16:53:14 CET 2009


Author: blueswirl
Date: 2009-01-07 16:53:14 +0100 (Wed, 07 Jan 2009)
New Revision: 367

Modified:
   openbios-devel/drivers/pci.c
Log:
Create "ranges" property (Laurent Vivier)

Modified: openbios-devel/drivers/pci.c
===================================================================
--- openbios-devel/drivers/pci.c	2009-01-07 15:51:40 UTC (rev 366)
+++ openbios-devel/drivers/pci.c	2009-01-07 15:53:14 UTC (rev 367)
@@ -323,8 +323,46 @@
 	set_property(dev, "reg", (char *)props, ncells * sizeof(cell));
 }
 
+
+static void pci_set_ranges(const pci_config_t *config)
+{
+	phandle_t dev = get_cur_dev();
+	cell props[32];
+	int ncells;
+  	int i;
+	uint32_t mask;
+	int flags;
+	int space_code;
+
+	ncells = 0;
+	for (i = 0; i < 6; i++) {
+		if (!config->assigned[i] || !config->sizes[i])
+			continue;
+
+		/* child address */
+
+		props[ncells++] = 0x00000000;
+
+		/* parent address */
+
+		pci_decode_pci_addr(config->assigned[i],
+				    &flags, &space_code, &mask);
+		pci_encode_phys_addr(props + ncells, flags, space_code,
+				     config->dev, 0x10 + i * 4,
+				     config->assigned[i] & ~mask);
+		ncells += 3;
+
+		/* size */
+
+		props[ncells++] = config->sizes[i];
+  	}
+	set_property(dev, "ranges", (char *)props, ncells * sizeof(cell));
+}
+
 int macio_config_cb (const pci_config_t *config)
 {
+	pci_set_ranges(config);
+
 #ifdef CONFIG_DRIVER_MACIO
 	ob_macio_init(config->path, config->assigned[0] & ~0x0000000F);
 #endif




More information about the OpenBIOS mailing list