Use aliases for console device selection

git-svn-id: svn://coreboot.org/openbios/openbios-devel@413 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2009-01-17 10:15:13 +00:00
parent 95183db81e
commit f5f46f28f5
3 changed files with 35 additions and 9 deletions

View File

@@ -318,6 +318,7 @@ void
ob_zs_init(uint64_t base, uint64_t offset, int intr, int slave, int keyboard)
{
char nodebuff[256];
phandle_t aliases;
ob_new_obio_device("zs", "serial");
@@ -348,8 +349,21 @@ ob_zs_init(uint64_t base, uint64_t offset, int intr, int slave, int keyboard)
(int)offset & 0xffffffff);
if (keyboard) {
REGISTER_NODE_METHODS(escc_keyboard, nodebuff);
aliases = find_dev("/aliases");
set_property(aliases, "keyboard", nodebuff, strlen(nodebuff) + 1);
} else {
REGISTER_NODE_METHODS(escc, nodebuff);
aliases = find_dev("/aliases");
snprintf(nodebuff, sizeof(nodebuff), "/obio/zs@0,%x:a",
(int)offset & 0xffffffff);
set_property(aliases, "ttya", nodebuff, strlen(nodebuff) + 1);
snprintf(nodebuff, sizeof(nodebuff), "/obio/zs@0,%x:b",
(int)offset & 0xffffffff);
set_property(aliases, "ttyb", nodebuff, strlen(nodebuff) + 1);
}
}

View File

@@ -907,24 +907,26 @@ ob_nvram_init(uint64_t base, uint64_t offset)
if (nographic) {
obp_stdin = PROMDEV_TTYA;
obp_stdout = PROMDEV_TTYA;
stdin = "/obio/zs@0,100000:a";
stdout = "/obio/zs@0,100000:a";
stdin = "ttya";
stdout = "ttya";
} else {
obp_stdin = PROMDEV_KBD;
obp_stdout = PROMDEV_SCREEN;
stdin = "/obio/zs@0,0:a";
stdout = "/iommu/sbus/SUNW,tcx";
stdin = "keyboard";
stdout = "screen";
}
push_str("/");
fword("find-device");
push_str(stdin);
fword("pathres-resolve-aliases");
fword("encode-string");
push_str("stdin-path");
fword("property");
push_str(stdout);
fword("pathres-resolve-aliases");
fword("encode-string");
push_str("stdout-path");
fword("property");

View File

@@ -89,9 +89,11 @@ ob_le_init(unsigned int slot, unsigned long leoffset, unsigned long dmaoffset)
uint16_t graphic_depth;
static void
ob_tcx_init(unsigned int slot)
ob_tcx_init(unsigned int slot, const char *path)
{
push_str("/iommu/sbus/SUNW,tcx");
phandle_t chosen, aliases;
push_str(path);
fword("find-device");
PUSH(slot);
@@ -277,6 +279,14 @@ ob_tcx_init(unsigned int slot)
push_str("tcx-8-bit");
fword("property");
}
chosen = find_dev("/chosen");
push_str(path);
fword("open-dev");
set_int_property(chosen, "screen", POP());
aliases = find_dev("/aliases");
set_property(aliases, "screen", path, strlen(path) + 1);
}
static void
@@ -373,7 +383,7 @@ sbus_probe_slot_ss5(unsigned int slot, uint64_t base)
// OpenBIOS and Qemu don't know how to do Sbus probing
switch(slot) {
case 3: // SUNW,tcx
ob_tcx_init(slot);
ob_tcx_init(slot, "/iommu/sbus/SUNW,tcx");
break;
case 4:
// SUNW,CS4231
@@ -395,7 +405,7 @@ sbus_probe_slot_ss10(unsigned int slot, uint64_t base)
// OpenBIOS and Qemu don't know how to do Sbus probing
switch(slot) {
case 2: // SUNW,tcx
ob_tcx_init(slot);
ob_tcx_init(slot, "/iommu/sbus/SUNW,tcx");
break;
case 0xf: // le, esp, bpp, power-management
ob_macio_init(slot, base, 0);
@@ -413,7 +423,7 @@ sbus_probe_slot_ss600mp(unsigned int slot, uint64_t base)
// OpenBIOS and Qemu don't know how to do Sbus probing
switch(slot) {
case 2: // SUNW,tcx
ob_tcx_init(slot);
ob_tcx_init(slot, "/iommu/sbus/SUNW,tcx");
break;
case 0xf: // le, esp, bpp, power-management
#ifdef CONFIG_DRIVER_ESP