Author: mcayland Date: Mon Aug 19 09:40:33 2013 New Revision: 1215 URL: http://tracker.coreboot.org/trac/openbios/changeset/1215
Log: tcx.fs: move framebuffer mapping over from C to tcx.fs
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@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc32/console.c trunk/openbios-devel/arch/sparc32/openbios.c trunk/openbios-devel/arch/x86/openbios.c trunk/openbios-devel/drivers/pci.c trunk/openbios-devel/drivers/tcx.fs trunk/openbios-devel/drivers/vga.fs trunk/openbios-devel/drivers/vga_vbe.c trunk/openbios-devel/forth/device/display.fs trunk/openbios-devel/include/drivers/drivers.h trunk/openbios-devel/include/libopenbios/video.h trunk/openbios-devel/libopenbios/video_common.c
Modified: trunk/openbios-devel/arch/sparc32/console.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/console.c Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/arch/sparc32/console.c Mon Aug 19 09:40:33 2013 (r1215) @@ -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 * ****************************************************************** */
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/arch/sparc32/openbios.c Mon Aug 19 09:40:33 2013 (r1215) @@ -846,7 +846,7 @@ #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 @@ -939,7 +939,6 @@ CONFIG_SERIAL_SPEED); #endif #ifdef CONFIG_DEBUG_CONSOLE_VIDEO - tcx_init(hwdef->tcx_base); kbd_init(hwdef->ms_kb_base); #endif #endif
Modified: trunk/openbios-devel/arch/x86/openbios.c ============================================================================== --- trunk/openbios-devel/arch/x86/openbios.c Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/arch/x86/openbios.c Mon Aug 19 09:40:33 2013 (r1215) @@ -62,7 +62,7 @@ ob_floppy_init("/isa", "floppy0", 0x3f0, 0); #endif #ifdef CONFIG_XBOX - setup_video(0x3C00000, phys_to_virt(0x3C00000)); + setup_video();
/* Force video to 32-bit depth */ VIDEO_DICT_VALUE(video.depth) = 32;
Modified: trunk/openbios-devel/drivers/pci.c ============================================================================== --- trunk/openbios-devel/drivers/pci.c Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/drivers/pci.c Mon Aug 19 09:40:33 2013 (r1215) @@ -361,11 +361,11 @@ #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));
Modified: trunk/openbios-devel/drivers/tcx.fs ============================================================================== --- trunk/openbios-devel/drivers/tcx.fs Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/drivers/tcx.fs Mon Aug 19 09:40:33 2013 (r1215) @@ -22,13 +22,11 @@ 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 @ ; @@ -141,6 +139,7 @@
-1 value tcx-dac -1 value /tcx-dac +-1 value fb-addr
: dac! ( data reg# -- )
r dup 2dup bljoin r> tcx-dac + l!
@@ -162,8 +161,12 @@ 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 @@ -184,7 +187,7 @@ : 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
Modified: trunk/openbios-devel/drivers/vga.fs ============================================================================== --- trunk/openbios-devel/drivers/vga.fs Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/drivers/vga.fs Mon Aug 19 09:40:33 2013 (r1215) @@ -21,13 +21,11 @@ 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 @ ;
Modified: trunk/openbios-devel/drivers/vga_vbe.c ============================================================================== --- trunk/openbios-devel/drivers/vga_vbe.c Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/drivers/vga_vbe.c Mon Aug 19 09:40:33 2013 (r1215) @@ -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);
Modified: trunk/openbios-devel/forth/device/display.fs ============================================================================== --- trunk/openbios-devel/forth/device/display.fs Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/forth/device/display.fs Mon Aug 19 09:40:33 2013 (r1215) @@ -51,7 +51,6 @@ 0 value display-ih
\ internal values -0 value openbios-video-addr 0 value openbios-video-height 0 value openbios-video-width
Modified: trunk/openbios-devel/include/drivers/drivers.h ============================================================================== --- trunk/openbios-devel/include/drivers/drivers.h Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/include/drivers/drivers.h Mon Aug 19 09:40:33 2013 (r1215) @@ -46,7 +46,6 @@ 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
Modified: trunk/openbios-devel/include/libopenbios/video.h ============================================================================== --- trunk/openbios-devel/include/libopenbios/video.h Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/include/libopenbios/video.h Mon Aug 19 09:40:33 2013 (r1215) @@ -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 @@
extern struct video_info { volatile ihandle_t *ih; - volatile phys_addr_t mphys; volatile ucell *mvirt; volatile ucell *rb, *w, *h, *depth;
Modified: trunk/openbios-devel/libopenbios/video_common.c ============================================================================== --- trunk/openbios-devel/libopenbios/video_common.c Mon Aug 19 09:40:29 2013 (r1214) +++ trunk/openbios-devel/libopenbios/video_common.c Mon Aug 19 09:40:33 2013 (r1215) @@ -214,7 +214,7 @@ } }
-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 @@ 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 @@ 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;