sparc32: move stdio setup to openbios.c

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@844 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2010-08-08 20:03:38 +00:00
parent a1f0883238
commit 09662545a3
4 changed files with 62 additions and 59 deletions

View File

@@ -31,6 +31,8 @@ void cls(void);
// 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;

View File

@@ -140,6 +140,65 @@ static void setup_uuid(void)
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 @@ arch_init( void )
#endif
device_end();
setup_stdio();
/* Initialiase openprom romvec */
romvec = init_openprom();

View File

@@ -638,15 +638,12 @@ id_machine(uint16_t machine_id)
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 @@ ob_nvram_init(uint64_t base, uint64_t offset)
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 @@ ob_nvram_init(uint64_t base, uint64_t offset)
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

View File

@@ -84,10 +84,6 @@ void ob_new_obio_device(const char *name, const char *type);
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;