[OpenBIOS] [commit] r1370 - trunk/openbios-devel/drivers

repository service svn at openbios.org
Mon Jan 4 13:03:38 CET 2016


Author: mcayland
Date: Mon Jan  4 13:03:37 2016
New Revision: 1370
URL: http://tracker.coreboot.org/trac/openbios/changeset/1370

Log:
ide: reference IDE channels by phandle, not device name

Otherwise when two device nodes have the same name property we are unable
to distinguish between them.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Reviewed-by: Alexander Graf <agraf at suse.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/drivers/ide.c
   trunk/openbios-devel/drivers/ide.h

Modified: trunk/openbios-devel/drivers/ide.c
==============================================================================
--- trunk/openbios-devel/drivers/ide.c	Mon Jan  4 13:03:34 2016	(r1369)
+++ trunk/openbios-devel/drivers/ide.c	Mon Jan  4 13:03:37 2016	(r1370)
@@ -73,13 +73,13 @@
 	channels = chan;
 }
 
-static struct ide_channel *ide_seek_channel(const char *name)
+static struct ide_channel *ide_seek_channel(phandle_t ph)
 {
 	struct ide_channel *current;
 
 	current = channels;
 	while (current) {
-		if (!strcmp(current->name, name))
+		if (current->ph == ph)
 			return current;
 		current = current->next;
 	}
@@ -1247,11 +1247,10 @@
 static void
 ob_ide_open(int *idx)
 {
-	int ret=1, len;
+	int ret=1;
 	phandle_t ph;
 	struct ide_drive *drive;
 	struct ide_channel *chan;
-	char *idename;
 	int unit;
 
 	fword("my-unit");
@@ -1260,9 +1259,8 @@
 	fword("my-parent");
 	fword("ihandle>phandle");
 	ph=(phandle_t)POP();
-	idename=get_property(ph, "name", &len);
 
-	chan = ide_seek_channel(idename);
+	chan = ide_seek_channel(ph);
 	drive = &chan->drives[unit];
 	*(struct ide_drive **)idx = drive;
 
@@ -1380,9 +1378,6 @@
 
 		chan = malloc(sizeof(struct ide_channel));
 
-		snprintf(chan->name, sizeof(chan->name),
-			 DEV_NAME, current_channel);
-
 		chan->mmio = 0;
 
 		for (j = 0; j < 8; j++)
@@ -1426,6 +1421,8 @@
                          current_channel);
 		REGISTER_NAMED_NODE_PHANDLE(ob_ide_ctrl, nodebuff, dnode);
 
+		chan->ph = dnode;
+
 #if !defined(CONFIG_PPC) && !defined(CONFIG_SPARC64)
 		props[0]=14; props[1]=0;
 		set_property(dnode, "interrupts",
@@ -1552,9 +1549,6 @@
 
 		chan = malloc(sizeof(struct ide_channel));
 
-		snprintf(chan->name, sizeof(chan->name),
-			 DEV_NAME, current_channel);
-
 		chan->mmio = addr + MACIO_IDE_OFFSET + i * MACIO_IDE_SIZE;
 
 		chan->obide_inb = macio_ide_inb;
@@ -1594,6 +1588,8 @@
                          current_channel);
 		REGISTER_NAMED_NODE_PHANDLE(ob_ide_ctrl, nodebuff, dnode);
 
+		chan->ph = dnode;
+
 		set_property(dnode, "compatible", (is_oldworld() ?
 			     "heathrow-ata" : "keylargo-ata"), 13);
 

Modified: trunk/openbios-devel/drivers/ide.h
==============================================================================
--- trunk/openbios-devel/drivers/ide.h	Mon Jan  4 13:03:34 2016	(r1369)
+++ trunk/openbios-devel/drivers/ide.h	Mon Jan  4 13:03:37 2016	(r1370)
@@ -167,7 +167,7 @@
 
 struct ide_channel {
 
-	char name[32];
+	phandle_t ph;
 	struct ide_channel *next;
 
 	/*



More information about the OpenBIOS mailing list