[OpenBIOS] [commit] r1054 - in trunk/openbios-devel: arch/sparc64 drivers include/arch/sparc64 packages

repository service svn at openbios.org
Sat Apr 28 15:35:01 CEST 2012


Author: mcayland
Date: Sat Apr 28 15:35:00 2012
New Revision: 1054
URL: http://tracker.coreboot.org/trac/openbios/changeset/1054

Log:
SPARC64: Remove majority of the video initialisation hack.

Now that we have OFMEM, as long as we have a PCI bus then we can configure
the address of the framebuffer automatically without having an
architecture-specific hack. The only thing we need to do is override the
virtual address from the OFMEM phys == virt default.

Similarly we can remove all reference to the video memory variables _vmem
and _evmem since the memory is allocated outside of the OpenBIOS image.

This commit also fixes another couple of issues: switch video.c to use virtual
instead of physical addresses for architectures that require it (the default
is the existing behaviour where phys_addr == virt_addr) and also correct the
framebuffer size calculation which was also adding the framebuffer start address
to size of the framebuffer to be mapped.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/arch/sparc64/ldscript
   trunk/openbios-devel/drivers/vga_vbe.c
   trunk/openbios-devel/include/arch/sparc64/io.h
   trunk/openbios-devel/packages/video.c

Modified: trunk/openbios-devel/arch/sparc64/ldscript
==============================================================================
--- trunk/openbios-devel/arch/sparc64/ldscript	Sat Apr 28 15:34:57 2012	(r1053)
+++ trunk/openbios-devel/arch/sparc64/ldscript	Sat Apr 28 15:35:00 2012	(r1054)
@@ -12,7 +12,6 @@
 
 /* 16KB stack */
 STACK_SIZE = 16384;
-VMEM_SIZE = 128 * 1024;
 IOMEM_SIZE = 256 * 1024 + 768 * 1024;
 
 SECTIONS
@@ -51,11 +50,6 @@
 	*(.bss.*)
 	*(COMMON)
 
-	. = ALIGN(4096);
-	_vmem = .;
-	. += VMEM_SIZE;
-        _evmem = .;
-
 	_stack = .;
 	. += STACK_SIZE;
 	. = ALIGN(16);

Modified: trunk/openbios-devel/drivers/vga_vbe.c
==============================================================================
--- trunk/openbios-devel/drivers/vga_vbe.c	Sat Apr 28 15:34:57 2012	(r1053)
+++ trunk/openbios-devel/drivers/vga_vbe.c	Sat Apr 28 15:35:00 2012	(r1054)
@@ -133,7 +133,7 @@
 	int depth = VGA_DEFAULT_DEPTH;
 	int linebytes = VGA_DEFAULT_LINEBYTES;
 
-#if defined(CONFIG_QEMU) && (defined(CONFIG_PPC) || defined(CONFIG_SPARC64))
+#if defined(CONFIG_QEMU) && (defined(CONFIG_PPC) || defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64))
 	int w, h, d;
         w = fw_cfg_read_i16(FW_CFG_ARCH_WIDTH);
         h = fw_cfg_read_i16(FW_CFG_ARCH_HEIGHT);
@@ -144,13 +144,6 @@
 		depth = d;
 		linebytes = (width * ((depth + 7) / 8));
 	}
-#ifdef CONFIG_SPARC64
-#define VGA_VADDR  0xfe000000
-        ofmem_claim_phys(fb, fb_size, 0);
-        ofmem_claim_virt(VGA_VADDR, fb_size, 0);
-        ofmem_map(fb, VGA_VADDR, fb_size, 0x76);
-        fb = VGA_VADDR;
-#endif
 #endif
 
 	vga_vbe_set_mode(width, height, depth);

Modified: trunk/openbios-devel/include/arch/sparc64/io.h
==============================================================================
--- trunk/openbios-devel/include/arch/sparc64/io.h	Sat Apr 28 15:34:57 2012	(r1053)
+++ trunk/openbios-devel/include/arch/sparc64/io.h	Sat Apr 28 15:35:00 2012	(r1054)
@@ -9,7 +9,7 @@
 
 extern unsigned long va_shift; // Set in entry.S
 // Defined in ldscript
-extern char _start, _data, _stack, _estack, _end, _vmem, _evmem, _iomem;
+extern char _start, _data, _stack, _estack, _end, _iomem;
 
 // XXX check use and merge
 #define phys_to_virt(phys) ((void *) ((unsigned long) (phys)))

Modified: trunk/openbios-devel/packages/video.c
==============================================================================
--- trunk/openbios-devel/packages/video.c	Sat Apr 28 15:34:57 2012	(r1053)
+++ trunk/openbios-devel/packages/video.c	Sat Apr 28 15:35:00 2012	(r1054)
@@ -25,6 +25,7 @@
 
 typedef struct osi_fb_info {
     unsigned long mphys;
+    unsigned long mvirt;
     int rb, w, h, depth;
 } osi_fb_info_t;
 
@@ -79,7 +80,7 @@
 		dx = (video.fb.w - width)/2;
 		dy = (video.fb.h - height)/3;
 
-		pp = (char*)video.fb.mphys + dy * video.fb.rb + dx * (video.fb.depth >= 24 ? 4 : 2);
+		pp = (char*)video.fb.mvirt + dy * video.fb.rb + dx * (video.fb.depth >= 24 ? 4 : 2);
 
 		for( y=0 ; y<height; y++, pp += video.fb.rb ) {
 			if( video.fb.depth >= 24 ) {
@@ -121,7 +122,7 @@
 void
 draw_pixel( int x, int y, int colind )
 {
-	char *p = (char*)video.fb.mphys + video.fb.rb * y;
+	char *p = (char*)video.fb.mvirt + video.fb.rb * y;
 	int color, d = video.fb.depth;
 
 	if( x < 0 || y < 0 || x >= video.fb.w || y >=video.fb.h )
@@ -146,7 +147,7 @@
             x + w > video.fb.w || y + h > video.fb.h)
 		return;
 
-	pp = (char*)video.fb.mphys + video.fb.rb * y;
+	pp = (char*)video.fb.mvirt + video.fb.rb * y;
 	for( ; h--; pp += video.fb.rb ) {
 		int ww = w;
 		if( video.fb.depth == 24 || video.fb.depth == 32 ) {
@@ -209,8 +210,8 @@
         }
 	offs = video.fb.rb * height;
 	size = (video.fb.h * video.fb.rb - offs)/16;
-	dest = (int*)video.fb.mphys;
-	src = (int*)(video.fb.mphys + offs);
+	dest = (int*)video.fb.mvirt;
+	src = (int*)(video.fb.mvirt + offs);
 
 	for( i=0; i<size; i++ ) {
 		dest[0] = src[0];
@@ -309,15 +310,21 @@
 /************************************************************************/
 
 void
-init_video( unsigned long fb,  int width, int height, int depth, int rb )
+init_video( unsigned long fb, int width, int height, int depth, int rb )
 {
         int i;
-#ifdef CONFIG_PPC
-        int s, size;
+#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI)
+        int size;
 #endif
 	phandle_t ph=0;
 
-	video.fb.mphys = fb;
+	video.fb.mphys = video.fb.mvirt = fb;
+
+#if defined(CONFIG_SPARC64)
+	/* Fix virtual address on SPARC64 somewhere else */
+	video.fb.mvirt = 0xfe000000;
+#endif 
+
 	video.fb.w = width;
 	video.fb.h = height;
 	video.fb.depth = depth;
@@ -327,18 +334,17 @@
 		set_int_property( ph, "height", video.fb.h );
 		set_int_property( ph, "depth", video.fb.depth );
 		set_int_property( ph, "linebytes", video.fb.rb );
-		set_int_property( ph, "address", video.fb.mphys );
+		set_int_property( ph, "address", video.fb.mvirt );
 	}
 	video.has_video = 1;
 	video.pal = malloc( 256 * sizeof(unsigned long) );
 
-#ifdef CONFIG_PPC
-        s = (video.fb.mphys & 0xfff);
-        size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
+#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI)
+        size = ((video.fb.h * video.fb.rb)  + 0xfff) & ~0xfff;
 
 	ofmem_claim_phys( video.fb.mphys, size, 0 );
-	ofmem_claim_virt( video.fb.mphys, size, 0 );
-	ofmem_map( video.fb.mphys, video.fb.mphys, size, -1 );
+	ofmem_claim_virt( video.fb.mvirt, size, 0 );
+	ofmem_map( video.fb.mphys, video.fb.mvirt, size, ofmem_arch_io_translation_mode(video.fb.mphys) );
 #endif
 
 	for( i=0; i<256; i++ )



More information about the OpenBIOS mailing list