aboutsummaryrefslogtreecommitdiff
path: root/vgasrc
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2012-01-14 16:59:21 -0500
committerKevin O'Connor <kevin@koconnor.net>2012-01-14 17:20:07 -0500
commit97cc354a0223ad4241e657f69dc13ffed2694ee8 (patch)
treee0f5be587fd9e0613e94e9dc6baf90456ffafb40 /vgasrc
parente91ec7c7735eda163efc6ece9ac95e12e8adf497 (diff)
downloadseabios-hppa-97cc354a0223ad4241e657f69dc13ffed2694ee8.zip
seabios-hppa-97cc354a0223ad4241e657f69dc13ffed2694ee8.tar.gz
seabios-hppa-97cc354a0223ad4241e657f69dc13ffed2694ee8.tar.bz2
vgabios: Add cirrus linear framebuffer detection; enable VBE in cirrus.
Extract Cirrus framebuffer address from PCI config space. Enable VBE code for Cirrus cards. Also, rework bochsvga code to use direct PCI accesses instead of calling into the BIOS. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc')
-rw-r--r--vgasrc/bochsvga.c26
-rw-r--r--vgasrc/clext.c10
2 files changed, 13 insertions, 23 deletions
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index d9858c2..b7b1b05 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -5,6 +5,8 @@
#include "config.h" // CONFIG_*
#include "biosvar.h" // SET_BDA
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
+#include "pci.h" // pci_config_readl
+#include "pci_regs.h" // PCI_BASE_ADDRESS_0
static struct bochsvga_mode
{
@@ -76,27 +78,6 @@ static struct bochsvga_mode
{ 0x18c, { MM_DIRECT, 2560, 1600, 32 } },
};
-static inline u32 pci_config_readl(u16 bdf, u16 addr)
-{
- int status;
- u32 val;
-
- addr &= ~3;
-
- asm volatile(
- "int $0x1a\n"
- "cli\n"
- "cld"
- : "=a"(status), "=c"(val)
- : "a"(0xb10a), "b"(bdf), "D"(addr)
- : "cc", "memory");
-
- if ((status >> 16))
- return (u32)-1;
-
- return val;
-}
-
static u16 dispi_get_max_xres(void)
{
u16 en;
@@ -145,7 +126,8 @@ bochsvga_init(void)
u32 lfb_addr;
if (CONFIG_VGA_PCI)
- lfb_addr = pci_config_readl(GET_GLOBAL(VgaBDF), 0x10) & ~0xf;
+ lfb_addr = (pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0)
+ & PCI_BASE_ADDRESS_MEM_MASK);
else
lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index 9bd424e..413add5 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -12,6 +12,8 @@
#include "bregs.h" // struct bregs
#include "vbe.h" // struct vbe_info
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
+#include "pci.h" // pci_config_readl
+#include "pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************
@@ -421,7 +423,7 @@ cirrus_clear_vram(u16 param)
int
clext_set_mode(int mode, int flags)
{
- dprintf(1, "cirrus mode %d\n", mode);
+ dprintf(1, "cirrus mode %x\n", mode);
SET_BDA(vbe_mode, 0);
struct cirrus_mode_s *table_g = cirrus_get_modeentry(mode);
if (table_g) {
@@ -771,6 +773,12 @@ clext_init(void)
return -1;
dprintf(1, "cirrus init 2\n");
+ SET_VGA(VBE_enabled, 1);
+ u32 lfb_addr = 0;
+ if (CONFIG_VGA_PCI)
+ lfb_addr = (pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0)
+ & PCI_BASE_ADDRESS_MEM_MASK);
+ SET_VGA(VBE_framebuffer, lfb_addr);
u16 totalmem = cirrus_get_memsize();
SET_VGA(VBE_total_memory, totalmem * 64 * 1024);
SET_VGA(VBE_win_granularity, 16);