Author: blueswirl Date: Sun Aug 8 22:03:38 2010 New Revision: 844 URL: http://tracker.coreboot.org/trac/openbios/changeset/844
Log: sparc32: move stdio setup to openbios.c
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/arch/sparc32/boot.h trunk/openbios-devel/arch/sparc32/openbios.c trunk/openbios-devel/drivers/obio.c trunk/openbios-devel/include/drivers/drivers.h
Modified: trunk/openbios-devel/arch/sparc32/boot.h ============================================================================== --- trunk/openbios-devel/arch/sparc32/boot.h Sun Aug 8 21:54:06 2010 (r843) +++ trunk/openbios-devel/arch/sparc32/boot.h Sun Aug 8 22:03:38 2010 (r844) @@ -31,6 +31,8 @@ // romvec.c extern struct linux_arguments_v0 obp_arg; extern const void *romvec; +extern const char *obp_stdin_path, *obp_stdout_path; +extern char obp_stdin, obp_stdout;
// openbios.c extern int qemu_machine_type;
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Sun Aug 8 21:54:06 2010 (r843) +++ trunk/openbios-devel/arch/sparc32/openbios.c Sun Aug 8 22:03:38 2010 (r844) @@ -140,6 +140,65 @@ fword("property"); }
+static void setup_stdio(void) +{ + char nographic; + const char *stdin, *stdout; + phandle_t chosen; + + fw_cfg_read(FW_CFG_NOGRAPHIC, &nographic, 1); + if (nographic) { + obp_stdin = PROMDEV_TTYA; + obp_stdout = PROMDEV_TTYA; + stdin = "ttya"; + stdout = "ttya"; + } else { + obp_stdin = PROMDEV_KBD; + obp_stdout = PROMDEV_SCREEN; + 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"); + + chosen = find_dev("/chosen"); + push_str(stdin); + fword("open-dev"); + set_int_property(chosen, "stdin", POP()); + + chosen = find_dev("/chosen"); + push_str(stdout); + fword("open-dev"); + set_int_property(chosen, "stdout", POP()); + + push_str(stdin); + push_str("input-device"); + fword("$setenv"); + + push_str(stdout); + push_str("output-device"); + fword("$setenv"); + + push_str(stdin); + fword("input"); + + obp_stdin_path = stdin; + obp_stdout_path = stdout; +} + static void init_memory(void) { memory = malloc(MEMORY_SIZE); @@ -180,6 +239,7 @@ #endif device_end();
+ setup_stdio(); /* Initialiase openprom romvec */ romvec = init_openprom();
Modified: trunk/openbios-devel/drivers/obio.c ============================================================================== --- trunk/openbios-devel/drivers/obio.c Sun Aug 8 21:54:06 2010 (r843) +++ trunk/openbios-devel/drivers/obio.c Sun Aug 8 22:03:38 2010 (r844) @@ -638,15 +638,12 @@ static void ob_nvram_init(uint64_t base, uint64_t offset) { - const char *stdin, *stdout; unsigned int i; - char nographic; uint16_t machine_id; const struct cpudef *cpu; const struct machdef *mach; char buf[256]; uint32_t temp; - phandle_t chosen;
ob_new_obio_device("eeprom", NULL);
@@ -679,7 +676,6 @@ for(;;); }
- fw_cfg_read(FW_CFG_NOGRAPHIC, &nographic, 1); graphic_depth = fw_cfg_read_i16(FW_CFG_SUN4M_DEPTH);
// Add /idprom @@ -829,57 +825,6 @@
fword("finish-device"); } - - if (nographic) { - obp_stdin = PROMDEV_TTYA; - obp_stdout = PROMDEV_TTYA; - stdin = "ttya"; - stdout = "ttya"; - } else { - obp_stdin = PROMDEV_KBD; - obp_stdout = PROMDEV_SCREEN; - 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"); - - chosen = find_dev("/chosen"); - push_str(stdin); - fword("open-dev"); - set_int_property(chosen, "stdin", POP()); - - chosen = find_dev("/chosen"); - push_str(stdout); - fword("open-dev"); - set_int_property(chosen, "stdout", POP()); - - push_str(stdin); - push_str("input-device"); - fword("$setenv"); - - push_str(stdout); - push_str("output-device"); - fword("$setenv"); - - push_str(stdin); - fword("input"); - - obp_stdin_path = stdin; - obp_stdout_path = stdout; }
static void
Modified: trunk/openbios-devel/include/drivers/drivers.h ============================================================================== --- trunk/openbios-devel/include/drivers/drivers.h Sun Aug 8 21:54:06 2010 (r843) +++ trunk/openbios-devel/include/drivers/drivers.h Sun Aug 8 22:03:38 2010 (r844) @@ -84,10 +84,6 @@ unsigned long ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map); void ob_intr(int intr);
-/* arch/sparc32/romvec.c */ -extern const char *obp_stdin_path, *obp_stdout_path; -extern char obp_stdin, obp_stdout; - /* arch/sparc32/boot.c */ extern uint32_t kernel_image; extern uint32_t kernel_size;