[OpenBIOS] [PATCH 12/14] tcx.fs: move framebuffer mapping over from C to tcx.fs
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Thu Aug 8 00:51:16 CEST 2013
Finally we can now fix up setup_video() so that it has no knowledge of fixed
addresse but simply refers to the underlying Forth variables as per the
specification. Touch up various places as a result of this, but we can now
remove the bogus openbios-video-addr and just use frame-buffer-adr instead.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
openbios-devel/arch/sparc32/console.c | 18 ------------------
openbios-devel/arch/sparc32/openbios.c | 3 +--
openbios-devel/drivers/pci.c | 8 ++++----
openbios-devel/drivers/tcx.fs | 11 +++++++----
openbios-devel/drivers/vga.fs | 2 --
openbios-devel/drivers/vga_vbe.c | 10 +---------
openbios-devel/forth/device/display.fs | 1 -
openbios-devel/include/drivers/drivers.h | 1 -
openbios-devel/include/libopenbios/video.h | 3 +--
openbios-devel/libopenbios/video_common.c | 7 ++-----
10 files changed, 16 insertions(+), 48 deletions(-)
diff --git a/openbios-devel/arch/sparc32/console.c b/openbios-devel/arch/sparc32/console.c
index dc0b524..f3d1fad 100644
--- a/openbios-devel/arch/sparc32/console.c
+++ b/openbios-devel/arch/sparc32/console.c
@@ -15,24 +15,6 @@
#ifdef CONFIG_DEBUG_CONSOLE
/* ******************************************************************
- * simple polling video/keyboard console functions
- * ****************************************************************** */
-
-#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
-
-#define VMEM_BASE 0x00800000ULL
-#define VMEM_SIZE (1024*768*1)
-
-unsigned char *vmem;
-
-void tcx_init(uint64_t base)
-{
- vmem = (unsigned char *)ofmem_map_io(base + VMEM_BASE, VMEM_SIZE);
-}
-
-#endif
-
-/* ******************************************************************
* common functions, implementing simple concurrent console
* ****************************************************************** */
diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c
index 542ca80..a97482d 100644
--- a/openbios-devel/arch/sparc32/openbios.c
+++ b/openbios-devel/arch/sparc32/openbios.c
@@ -863,7 +863,7 @@ arch_init( void )
#endif
#ifdef CONFIG_DRIVER_SBUS
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
- setup_video(hwdef->tcx_base + 0x00800000ULL, (unsigned long)vmem);
+ setup_video();
#endif
ob_sbus_init(hwdef->iommu_base + 0x1000ULL, qemu_machine_type);
#endif
@@ -956,7 +956,6 @@ int openbios(void)
CONFIG_SERIAL_SPEED);
#endif
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
- tcx_init(hwdef->tcx_base);
kbd_init(hwdef->ms_kb_base);
#endif
#endif
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c
index 368d7b5..fbc3c8e 100644
--- a/openbios-devel/drivers/pci.c
+++ b/openbios-devel/drivers/pci.c
@@ -361,11 +361,11 @@ ob_pci_map_in(int *idx)
#if defined(CONFIG_OFMEM)
ofmem_claim_phys(phys, size, 0);
-#if defined(CONFIG_SPARC64)
- /* Fix virtual address on SPARC64 somewhere else */
- virt = ofmem_claim_virt(0xfe000000ULL, size, 0);
-#else
+#if defined(CONFIG_PPC)
+ /* For some reason PPC gets upset when virt != phys for map-in... */
virt = ofmem_claim_virt(phys, size, 0);
+#else
+ virt = ofmem_claim_virt(-1, size, size);
#endif
ofmem_map(phys, virt, size, ofmem_arch_io_translation_mode(phys));
diff --git a/openbios-devel/drivers/tcx.fs b/openbios-devel/drivers/tcx.fs
index 2e50c83..2ae1c4e 100644
--- a/openbios-devel/drivers/tcx.fs
+++ b/openbios-devel/drivers/tcx.fs
@@ -20,13 +20,11 @@ fcode-version3
then
;
-" openbios-video-addr" (find-xt) cell+ value openbios-video-addr-xt
" openbios-video-width" (find-xt) cell+ value openbios-video-width-xt
" openbios-video-height" (find-xt) cell+ value openbios-video-height-xt
" depth-bits" (find-xt) cell+ value depth-bits-xt
" line-bytes" (find-xt) cell+ value line-bytes-xt
-: openbios-video-addr openbios-video-addr-xt @ ;
: openbios-video-width openbios-video-width-xt @ ;
: openbios-video-height openbios-video-height-xt @ ;
: depth-bits depth-bits-xt @ ;
@@ -139,6 +137,7 @@ h# 1 constant /tcx-off13-8
-1 value tcx-dac
-1 value /tcx-dac
+-1 value fb-addr
: dac! ( data reg# -- )
>r dup 2dup bljoin r> tcx-dac + l!
@@ -160,8 +159,12 @@ h# 1 constant /tcx-off13-8
tcx-off-dac /tcx-dac do-map-in to tcx-dac
;
+: fb-map
+ tcx-off-fb h# c0000 do-map-in to fb-addr
+;
+
: map-regs
- dac-map
+ dac-map fb-map
;
external
@@ -182,7 +185,7 @@ headerless
: qemu-tcx-driver-install ( -- )
tcx-dac -1 = if
map-regs
- openbios-video-addr to frame-buffer-adr
+ fb-addr to frame-buffer-adr
default-font set-font
frame-buffer-adr encode-int " address" property
diff --git a/openbios-devel/drivers/vga.fs b/openbios-devel/drivers/vga.fs
index bf2ae60..d359923 100644
--- a/openbios-devel/drivers/vga.fs
+++ b/openbios-devel/drivers/vga.fs
@@ -19,13 +19,11 @@ fcode-version3
then
;
-" openbios-video-addr" (find-xt) cell+ value openbios-video-addr-xt
" openbios-video-width" (find-xt) cell+ value openbios-video-width-xt
" openbios-video-height" (find-xt) cell+ value openbios-video-height-xt
" depth-bits" (find-xt) cell+ value depth-bits-xt
" line-bytes" (find-xt) cell+ value line-bytes-xt
-: openbios-video-addr openbios-video-addr-xt @ ;
: openbios-video-width openbios-video-width-xt @ ;
: openbios-video-height openbios-video-height-xt @ ;
: depth-bits depth-bits-xt @ ;
diff --git a/openbios-devel/drivers/vga_vbe.c b/openbios-devel/drivers/vga_vbe.c
index 02fbfb4..fc1fffd 100644
--- a/openbios-devel/drivers/vga_vbe.c
+++ b/openbios-devel/drivers/vga_vbe.c
@@ -54,18 +54,10 @@
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;
int size;
- phys = fb;
-
-#if defined(CONFIG_SPARC64)
- /* Fix virtual address on SPARC64 somewhere else */
- fb = 0xfe000000ULL;
-#endif
-
- setup_video(phys, fb);
+ setup_video();
#if 0
ph = find_dev(path);
diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs
index 8a895d6..5779ca8 100644
--- a/openbios-devel/forth/device/display.fs
+++ b/openbios-devel/forth/device/display.fs
@@ -51,7 +51,6 @@ create color-palette 100 cells allot
0 value display-ih
\ internal values
-0 value openbios-video-addr
0 value openbios-video-height
0 value openbios-video-width
diff --git a/openbios-devel/include/drivers/drivers.h b/openbios-devel/include/drivers/drivers.h
index d139ace..66c4ab7 100644
--- a/openbios-devel/include/drivers/drivers.h
+++ b/openbios-devel/include/drivers/drivers.h
@@ -46,7 +46,6 @@ static inline int is_newworld(void)
int ob_sbus_init(uint64_t base, int machine_id);
/* arch/sparc32/console.c */
-void tcx_init(uint64_t base);
void kbd_init(uint64_t base);
#endif
#ifdef CONFIG_DRIVER_IDE
diff --git a/openbios-devel/include/libopenbios/video.h b/openbios-devel/include/libopenbios/video.h
index 5e9abb7..8c32858 100644
--- a/openbios-devel/include/libopenbios/video.h
+++ b/openbios-devel/include/libopenbios/video.h
@@ -19,7 +19,7 @@
#define VGA_DEFAULT_LINEBYTES (VGA_DEFAULT_WIDTH*((VGA_DEFAULT_DEPTH+7)/8))
-void setup_video(phys_addr_t phys, ucell virt);
+void setup_video(void);
unsigned long video_get_color(int col_ind);
void video_set_color(int ind, unsigned long color);
void video_mask_blit(void);
@@ -28,7 +28,6 @@ void video_fill_rect(void);
extern struct video_info {
volatile ihandle_t *ih;
- volatile phys_addr_t mphys;
volatile ucell *mvirt;
volatile ucell *rb, *w, *h, *depth;
diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c
index db9e0a2..51596e8 100644
--- a/openbios-devel/libopenbios/video_common.c
+++ b/openbios-devel/libopenbios/video_common.c
@@ -214,7 +214,7 @@ video_fill_rect(void)
}
}
-void setup_video(phys_addr_t phys, ucell virt)
+void setup_video()
{
/* Make everything inside the video_info structure point to the
values in the Forth dictionary. Hence everything is always in
@@ -222,12 +222,10 @@ void setup_video(phys_addr_t phys, ucell virt)
phandle_t options;
char buf[6];
- video.mphys = phys;
-
feval("['] display-ih cell+");
video.ih = cell2pointer(POP());
- feval("['] openbios-video-addr cell+");
+ feval("['] frame-buffer-adr cell+");
video.mvirt = cell2pointer(POP());
feval("['] openbios-video-width cell+");
video.w = cell2pointer(POP());
@@ -260,7 +258,6 @@ void setup_video(phys_addr_t phys, ucell virt)
feval("to (romfont-width)");
/* Initialise the structure */
- VIDEO_DICT_VALUE(video.mvirt) = virt;
VIDEO_DICT_VALUE(video.w) = VGA_DEFAULT_WIDTH;
VIDEO_DICT_VALUE(video.h) = VGA_DEFAULT_HEIGHT;
VIDEO_DICT_VALUE(video.depth) = VGA_DEFAULT_DEPTH;
--
1.7.10.4
More information about the OpenBIOS
mailing list