j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: 2009-01-06 21:27:01 +0100 (Tue, 06 Jan 2009) New Revision: 361
Modified: openbios-devel/arch/sparc64/tree.fs openbios-devel/drivers/esp.c openbios-devel/drivers/ide.c Log: Support cd/cdrom and hd/disk aliases on all architectures
Modified: openbios-devel/arch/sparc64/tree.fs =================================================================== --- openbios-devel/arch/sparc64/tree.fs 2009-01-06 19:06:58 UTC (rev 360) +++ openbios-devel/arch/sparc64/tree.fs 2009-01-06 20:27:01 UTC (rev 361) @@ -47,50 +47,3 @@ : close ;
finish-device - -: ?devalias ( alias-str alias-len device-str device-len -- - \ alias-str alias-len false | true ) - active-package >r - " /aliases" find-device - \ 2dup ." Checking " type - 2dup find-dev if \ check if device exists - drop - 2over find-dev if \ do we already have an alias? - \ ." alias exists" cr - drop 2drop false - else - \ ." device exists" cr - encode-string - 2swap property - true - then - else - \ ." device doesn't exist" cr - 2drop false - then - r> active-package! - ; - -:noname - " hd" - " /pci/isa/ide0/disk@0" ?devalias not if - " /pci/isa/ide0/disk@1" ?devalias not if - " /pci/isa/ide1/disk@0" ?devalias not if - " /pci/isa/ide1/disk@1" ?devalias not if - 2drop ." No disk found." cr - then - then - then - then - - " cdrom" - " /pci/isa/ide0/cdrom@0" ?devalias not if - " /pci/isa/ide0/cdrom@1" ?devalias not if - " /pci/isa/ide1/cdrom@0" ?devalias not if - " /pci/isa/ide1/cdrom@1" ?devalias not if - 2drop ." No cdrom found" cr - then - then - then - then -; SYSTEM-initializer
Modified: openbios-devel/drivers/esp.c =================================================================== --- openbios-devel/drivers/esp.c 2009-01-06 19:06:58 UTC (rev 360) +++ openbios-devel/drivers/esp.c 2009-01-06 20:27:01 UTC (rev 361) @@ -42,7 +42,7 @@
typedef struct sd_private { unsigned int bs; - const char *media_str; + const char *media_str[2]; uint32_t sectors; uint8_t media; uint8_t id; @@ -74,7 +74,8 @@ { printk("SCSI DRIVE @%lx:\n", (unsigned long)drive); printk("id: %d\n", drive->id); - printk("media: %s\n", drive->media_str); + printk("media: %s\n", drive->media_str[0]); + printk("media: %s\n", drive->media_str[1]); printk("model: %s\n", drive->model); printk("sectors: %d\n", drive->sectors); printk("present: %d\n", drive->present); @@ -183,7 +184,7 @@ static unsigned int inquiry(esp_private_t *esp, sd_private_t *sd) { - const char *media = "UNKNOWN"; + const char *media[2] = { "UNKNOWN", "UNKNOWN"};
// Setup command = Inquiry memset(esp->buffer, 0, 7); @@ -202,13 +203,16 @@
switch (sd->media) { case TYPE_DISK: - media = "disk"; + media[0] = "disk"; + media[1] = "hd"; break; case TYPE_ROM: - media = "cdrom"; + media[0] = "cdrom"; + media[1] = "cd"; break; } - sd->media_str = media; + sd->media_str[0] = media[0]; + sd->media_str[1] = media[1]; memcpy(sd->model, &esp->buffer[16], 16); sd->model[17] = '\0';
@@ -406,6 +410,7 @@ static void add_alias(const char *device, const char *alias) { + DPRINTF("add_alias dev "%s" = alias "%s"\n", device, alias); push_str("/aliases"); fword("find-device"); push_str(device); @@ -517,11 +522,15 @@ counter_ptr = &diskcount; } if (*counter_ptr == 0) { - add_alias(nodebuff, esp->sd[id].media_str); + add_alias(nodebuff, esp->sd[id].media_str[0]); + add_alias(nodebuff, esp->sd[id].media_str[1]); } - snprintf(aliasbuff, sizeof(aliasbuff), "%s%d", esp->sd[id].media_str, - *counter_ptr); + snprintf(aliasbuff, sizeof(aliasbuff), "%s%d", + esp->sd[id].media_str[0], *counter_ptr); add_alias(nodebuff, aliasbuff); + snprintf(aliasbuff, sizeof(aliasbuff), "%s%d", + esp->sd[id].media_str[1], *counter_ptr); + add_alias(nodebuff, aliasbuff); snprintf(aliasbuff, sizeof(aliasbuff), "sd(0,%d,0)", id); add_alias(nodebuff, aliasbuff); snprintf(aliasbuff, sizeof(aliasbuff), "sd(0,%d,0)@0,0", id);
Modified: openbios-devel/drivers/ide.c =================================================================== --- openbios-devel/drivers/ide.c 2009-01-06 19:06:58 UTC (rev 360) +++ openbios-devel/drivers/ide.c 2009-01-06 20:27:01 UTC (rev 361) @@ -1415,11 +1415,15 @@ cd_found = 1; set_property(aliases, "cd", nodebuff, strlen(nodebuff) + 1); + set_property(aliases, "cdrom", + nodebuff, strlen(nodebuff) + 1); } if (drive->media == ide_media_disk && !hd_found) { hd_found = 1; set_property(aliases, "hd", nodebuff, strlen(nodebuff) + 1); + set_property(aliases, "disk", + nodebuff, strlen(nodebuff) + 1); } } }