[OpenBIOS] [PATCH 14/14] vga: remove vga_vbe_init() and vga_vbe.c

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Thu Aug 8 00:51:18 CEST 2013


Since the VBE initialisation is now done as part of the Forth driver, this can
now be completely removed. The tiny bit of code remaining for ROM detection is
moved into pci.c.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/drivers/build.xml |    1 -
 openbios-devel/drivers/pci.c     |   33 +++++++++++-----
 openbios-devel/drivers/vga_vbe.c |   78 --------------------------------------
 3 files changed, 24 insertions(+), 88 deletions(-)
 delete mode 100644 openbios-devel/drivers/vga_vbe.c

diff --git a/openbios-devel/drivers/build.xml b/openbios-devel/drivers/build.xml
index 5d7e769..bd91335 100644
--- a/openbios-devel/drivers/build.xml
+++ b/openbios-devel/drivers/build.xml
@@ -17,7 +17,6 @@
   <object source="obio.c"   condition="DRIVER_OBIO"/>
   <object source="vga_load_regs.c" condition="DRIVER_VGA"/>
   <object source="vga_set_mode.c" condition="DRIVER_VGA"/>
-  <object source="vga_vbe.c" condition="DRIVER_VGA"/>
   <object source="macio.c" condition="DRIVER_MACIO"/>
   <object source="pc_kbd.c" condition="DRIVER_PC_KBD"/>
   <object source="pc_serial.c" condition="DRIVER_PC_SERIAL"/>
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c
index fbc3c8e..a900ae9 100644
--- a/openbios-devel/drivers/pci.c
+++ b/openbios-devel/drivers/pci.c
@@ -803,15 +803,30 @@ int macio_keylargo_config_cb (const pci_config_t *config)
 
 int vga_config_cb (const pci_config_t *config)
 {
-	if (config->assigned[0] != 0x00000000) {
-            vga_vbe_init(config->path,
-                         pci_bus_addr_to_host_addr(config->assigned[0] & ~0x0000000F),
-                         config->sizes[0],
-                         pci_bus_addr_to_host_addr(config->assigned[1] & ~0x0000000F),
-                         config->sizes[1]);
-
-	    /* Currently we don't read FCode from the hardware but execute it directly */
-	    feval("['] vga-driver-fcode 2 cells + 1 byte-load");
+        unsigned long rom;
+        uint32_t rom_size, size;
+        phandle_t ph;
+
+        if (config->assigned[0] != 0x00000000) {
+            setup_video();
+
+            rom = pci_bus_addr_to_host_addr(config->assigned[1] & ~0x0000000F);
+            rom_size = config->sizes[1];
+
+            ph = get_cur_dev();
+
+            if (rom_size >= 8) {
+                const char *p;
+
+                p = (const char *)rom;
+                if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') {
+                    size = *(uint32_t*)(p + 4);
+                    set_property(ph, "driver,AAPL,MacOS,PowerPC", p + 8, size);
+                }
+            }
+
+            /* Currently we don't read FCode from the hardware but execute it directly */
+            feval("['] vga-driver-fcode 2 cells + 1 byte-load");
 
 #ifdef CONFIG_MOL
 	    /* Install special words for Mac On Linux */
diff --git a/openbios-devel/drivers/vga_vbe.c b/openbios-devel/drivers/vga_vbe.c
deleted file mode 100644
index fc1fffd..0000000
--- a/openbios-devel/drivers/vga_vbe.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *  Copyright (c) 2004-2005 Fabrice Bellard
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License V2
- *   as published by the Free Software Foundation
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- *   MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "kernel/kernel.h"
-#include "libopenbios/bindings.h"
-#include "drivers/pci.h"
-#include "drivers/drivers.h"
-#include "libopenbios/fontdata.h"
-#include "asm/io.h"
-#include "libc/vsprintf.h"
-#include "drivers/vga.h"
-#include "libopenbios/video.h"
-#include "libopenbios/ofmem.h"
-
-/* VGA init. We use the Bochs VESA VBE extensions  */
-#define VBE_DISPI_INDEX_ID              0x0
-#define VBE_DISPI_INDEX_XRES            0x1
-#define VBE_DISPI_INDEX_YRES            0x2
-#define VBE_DISPI_INDEX_BPP             0x3
-#define VBE_DISPI_INDEX_ENABLE          0x4
-#define VBE_DISPI_INDEX_BANK            0x5
-#define VBE_DISPI_INDEX_VIRT_WIDTH      0x6
-#define VBE_DISPI_INDEX_VIRT_HEIGHT     0x7
-#define VBE_DISPI_INDEX_X_OFFSET        0x8
-#define VBE_DISPI_INDEX_Y_OFFSET        0x9
-#define VBE_DISPI_INDEX_NB              0xa
-
-#define VBE_DISPI_ID0                   0xB0C0
-#define VBE_DISPI_ID1                   0xB0C1
-#define VBE_DISPI_ID2                   0xB0C2
-
-#define VBE_DISPI_DISABLED              0x00
-#define VBE_DISPI_ENABLED               0x01
-#define VBE_DISPI_LFB_ENABLED           0x40
-#define VBE_DISPI_NOCLEARMEM            0x80
-
-
-void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size,
-                  unsigned long rom, uint32_t rom_size)
-{
-	phandle_t ph;
-	int size;
-
-	setup_video();
-
-#if 0
-    ph = find_dev(path);
-#else
-    ph = get_cur_dev();
-#endif
-
-	if (rom_size >= 8) {
-                const char *p;
-
-                p = (const char *)rom;
-		if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') {
-			size = *(uint32_t*)(p + 4);
-			set_property(ph, "driver,AAPL,MacOS,PowerPC",
-				     p + 8, size);
-		}
-	}
-}
-- 
1.7.10.4




More information about the OpenBIOS mailing list