This means we can remove this code from vga_vbe_init() and move it in to the generic display system. As part of this, we alter the "input" and "output" words so that they update the stdin/stdout handles under /chosen.
While we are here, fix up the various architectures so that they don't call "input" and "output" themselves - this is now handled by the Forth console.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/ppc/qemu/init.c | 18 ------------------ openbios-devel/arch/sparc32/openbios.c | 29 ----------------------------- openbios-devel/arch/sparc64/openbios.c | 18 ------------------ openbios-devel/drivers/vga_vbe.c | 10 +--------- openbios-devel/forth/admin/iocontrol.fs | 26 ++++++++++++++++++++++++++ openbios-devel/forth/device/display.fs | 8 ++++++++ 6 files changed, 35 insertions(+), 74 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/init.c b/openbios-devel/arch/ppc/qemu/init.c index 345fc69..54ac6f2 100644 --- a/openbios-devel/arch/ppc/qemu/init.c +++ b/openbios-devel/arch/ppc/qemu/init.c @@ -870,18 +870,6 @@ arch_of_init(void) fword("find-device");
push_str(stdin_path); - fword("open-dev"); - fword("encode-int"); - push_str("stdin"); - fword("property"); - - push_str(stdout_path); - fword("open-dev"); - fword("encode-int"); - push_str("stdout"); - fword("property"); - - push_str(stdin_path); fword("pathres-resolve-aliases"); push_str("input-device"); fword("$setenv"); @@ -891,12 +879,6 @@ arch_of_init(void) push_str("output-device"); fword("$setenv");
- push_str(stdin_path); - fword("input"); - - push_str(stdout_path); - fword("output"); - #if 0 if(getbool("tty-interface?") == 1) #endif diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c index 40948d1..b5735f9 100644 --- a/openbios-devel/arch/sparc32/openbios.c +++ b/openbios-devel/arch/sparc32/openbios.c @@ -748,7 +748,6 @@ static void setup_stdio(void) { char nographic; const char *stdin, *stdout; - phandle_t chosen;
fw_cfg_read(FW_CFG_NOGRAPHIC, &nographic, 1); if (nographic) { @@ -763,31 +762,6 @@ static void setup_stdio(void) 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"); @@ -796,9 +770,6 @@ static void setup_stdio(void) push_str("output-device"); fword("$setenv");
- push_str(stdin); - fword("input"); - obp_stdin_path = stdin; obp_stdout_path = stdout; } diff --git a/openbios-devel/arch/sparc64/openbios.c b/openbios-devel/arch/sparc64/openbios.c index b1e5f47..51d181f 100644 --- a/openbios-devel/arch/sparc64/openbios.c +++ b/openbios-devel/arch/sparc64/openbios.c @@ -505,30 +505,12 @@ void arch_nvram_get(char *data) }
push_str(stdin_path); - fword("open-dev"); - fword("encode-int"); - push_str("stdin"); - fword("property"); - - push_str(stdout_path); - fword("open-dev"); - fword("encode-int"); - push_str("stdout"); - fword("property"); - - push_str(stdin_path); push_str("input-device"); fword("$setenv");
push_str(stdout_path); push_str("output-device"); fword("$setenv"); - - push_str(stdin_path); - fword("input"); - - push_str(stdout_path); - fword("output"); }
void arch_nvram_put(char *data) diff --git a/openbios-devel/drivers/vga_vbe.c b/openbios-devel/drivers/vga_vbe.c index c03dbc7..02fbfb4 100644 --- a/openbios-devel/drivers/vga_vbe.c +++ b/openbios-devel/drivers/vga_vbe.c @@ -55,7 +55,7 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size, unsigned long rom, uint32_t rom_size) { phys_addr_t phys; - phandle_t ph, chosen, aliases; + phandle_t ph; int size;
phys = fb; @@ -73,14 +73,6 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size, ph = get_cur_dev(); #endif
- chosen = find_dev("/chosen"); - push_str(path); - fword("open-dev"); - set_int_property(chosen, "display", POP()); - - aliases = find_dev("/aliases"); - set_property(aliases, "screen", path, strlen(path) + 1); - if (rom_size >= 8) { const char *p;
diff --git a/openbios-devel/forth/admin/iocontrol.fs b/openbios-devel/forth/admin/iocontrol.fs index 0268ab3..b0f578f 100644 --- a/openbios-devel/forth/admin/iocontrol.fs +++ b/openbios-devel/forth/admin/iocontrol.fs @@ -36,6 +36,19 @@ variable stdin close-dev then stdin ! + + \ update /chosen + " /chosen" find-package if + >r stdin @ encode-int " stdin" r> (property) + then + +[IFDEF] CONFIG_SPARC32 + \ update stdin-path properties + \ (this isn't part of the IEEE1275 spec but needed by older Solaris) + " /" find-package if + >r stdin @ get-instance-path encode-string " stdin-path" r> (property) + then +[THEN] ;
: output ( dev-str dev-len -- ) @@ -57,6 +70,19 @@ variable stdin \ close old stdout stdout @ ?dup if close-dev then stdout ! + + \ update /chosen + " /chosen" find-package if + >r stdout @ encode-int " stdout" r> (property) + then + +[IFDEF] CONFIG_SPARC32 + \ update stdout-path properties + \ (this isn't part of the IEEE1275 spec but needed by older Solaris) + " /" find-package if + >r stdout @ get-instance-path encode-string " stdout-path" r> (property) + then +[THEN] ;
: io ( dev-str dev-len -- ) diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs index 6d77dfa..8a895d6 100644 --- a/openbios-devel/forth/device/display.fs +++ b/openbios-devel/forth/device/display.fs @@ -356,6 +356,14 @@ defer fb8-invertrect
my-self to display-ih
+ \ set /chosen display property + my-self active-package 0 to my-self + " /chosen" (find-dev) 0<> if + active-package! + display-ih encode-int " display" property + then + active-package! to my-self + \ set defer functions to 8bit versions
['] fb8-draw-character to draw-character