Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/vga_vbe.c | 9 +-------- openbios-devel/libopenbios/video_common.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/openbios-devel/drivers/vga_vbe.c b/openbios-devel/drivers/vga_vbe.c index 2f845e7..c03dbc7 100644 --- a/openbios-devel/drivers/vga_vbe.c +++ b/openbios-devel/drivers/vga_vbe.c @@ -55,8 +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, options; - char buf[6]; + phandle_t ph, chosen, aliases; int size;
phys = fb; @@ -82,12 +81,6 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size, aliases = find_dev("/aliases"); set_property(aliases, "screen", path, strlen(path) + 1);
- options = find_dev("/options"); - snprintf(buf, sizeof(buf), FMT_ucell, VIDEO_DICT_VALUE(video.w) / FONT_WIDTH); - set_property(options, "screen-#columns", buf, strlen(buf) + 1); - snprintf(buf, sizeof(buf), FMT_ucell, VIDEO_DICT_VALUE(video.h) / FONT_HEIGHT); - set_property(options, "screen-#rows", buf, strlen(buf) + 1); - if (rom_size >= 8) { const char *p;
diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c index 6f93157..db9e0a2 100644 --- a/openbios-devel/libopenbios/video_common.c +++ b/openbios-devel/libopenbios/video_common.c @@ -15,6 +15,7 @@ */
#include "config.h" +#include "libc/vsprintf.h" #include "libopenbios/bindings.h" #include "libopenbios/fontdata.h" #include "libopenbios/ofmem.h" @@ -218,6 +219,8 @@ void setup_video(phys_addr_t phys, ucell virt) /* Make everything inside the video_info structure point to the values in the Forth dictionary. Hence everything is always in sync. */ + phandle_t options; + char buf[6];
video.mphys = phys;
@@ -277,4 +280,11 @@ void setup_video(phys_addr_t phys, ucell virt) VIDEO_DICT_VALUE(video.rb) = (w * ((d + 7) / 8)); } #endif + + /* Setup screen-#rows/screen-#columns */ + options = find_dev("/options"); + snprintf(buf, sizeof(buf), FMT_ucell, VIDEO_DICT_VALUE(video.w) / FONT_WIDTH); + set_property(options, "screen-#columns", buf, strlen(buf) + 1); + snprintf(buf, sizeof(buf), FMT_ucell, VIDEO_DICT_VALUE(video.h) / FONT_HEIGHT); + set_property(options, "screen-#rows", buf, strlen(buf) + 1); }