Properly detect the presence of a vga device.

This commit is contained in:
Richard Henderson
2011-06-03 17:12:52 -05:00
parent db3b5b6935
commit 7abb12f60e
5 changed files with 2633 additions and 1 deletions

View File

@ -122,6 +122,7 @@ do_console(void)
set_console_alarm();
swpipl(0);
if (have_vga)
{
unsigned short *vga, attr;
vga = pci_mem_base + SEG_CTEXT *16;

1
init.c
View File

@ -59,6 +59,7 @@ static unsigned long page_dir[1024] __attribute__((aligned(PAGE_SIZE)));
struct hwrpb_combine hwrpb __attribute__((aligned(PAGE_SIZE)));
void *last_alloc;
bool have_vga;
static void *
alloc (unsigned long size, unsigned long align)

2610
pci_ids.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -200,6 +200,9 @@ extern unsigned long crb_fixup(unsigned long vptptr, unsigned long hwrpb);
/*
* The Console
*/
extern bool have_vga;
extern void do_console(void);
extern void entInt(void);

19
vgaio.c
View File

@ -7,6 +7,9 @@
#include "protos.h"
#include "ioport.h"
#include "pci.h"
#include "pci_regs.h"
#include "pci_ids.h"
#include "vgatables.h"
#define GET_FARVAR(seg, ofs) (ofs)
@ -554,7 +557,21 @@ vgahw_enable_video_addressing(u8 disable)
void
vgahw_init(void)
{
struct vgamode_s *vmode_g = find_vga_entry(3);
struct vgamode_s *vmode_g;
int bdf, max;
foreachpci(bdf, max)
{
uint16_t class = pci_config_readw(bdf, PCI_CLASS_DEVICE);
if (class == PCI_CLASS_DISPLAY_VGA)
goto found;
}
return;
found:
have_vga = 1;
vmode_g = find_vga_entry(3);
vgahw_sequ_write(0, 1); // Assert sync reset