From 4d00f04203182270c2d0409722ac0546385922bc Mon Sep 17 00:00:00 2001 From: Kazutaka YOKOTA Date: Mon, 10 Jan 2000 08:49:49 +0000 Subject: [PATCH] Rework the algorithm to detect MDA/CGA/EGA/VGA cards, so that the vga driver won't be fooled to believe it has a CGA card when in fact it is a VGA card. --- sys/dev/fb/vga.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 530484feea58..485b0744b978 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -962,28 +962,34 @@ probe_adapters(void) * type detected. */ #ifndef VGA_NO_BIOS - switch ((rtcin(RTC_EQUIPMENT) >> 4) & 3) { /* bit 4 and 5 */ - case 0: - /* EGA/VGA */ + if (*(u_int32_t *)BIOS_PADDRTOVADDR(0x4a8)) { + /* EGA/VGA BIOS is present */ fill_adapter_param(readb(BIOS_PADDRTOVADDR(0x488)) & 0x0f, biosadapter); - break; - case 1: - /* CGA 40x25 */ - /* FIXME: switch to the 80x25 mode? XXX */ - biosadapter[V_ADP_PRIMARY] = adapter_init_value[DCC_CGA40]; - biosadapter[V_ADP_SECONDARY] = adapter_init_value[DCC_MONO]; - break; - case 2: - /* CGA 80x25 */ - biosadapter[V_ADP_PRIMARY] = adapter_init_value[DCC_CGA80]; - biosadapter[V_ADP_SECONDARY] = adapter_init_value[DCC_MONO]; - break; - case 3: - /* MDA */ - biosadapter[V_ADP_PRIMARY] = adapter_init_value[DCC_MONO]; - biosadapter[V_ADP_SECONDARY] = adapter_init_value[DCC_CGA80]; - break; + } else { + switch ((rtcin(RTC_EQUIPMENT) >> 4) & 3) { /* bit 4 and 5 */ + case 0: + /* EGA/VGA: shouldn't be happening */ + fill_adapter_param(readb(BIOS_PADDRTOVADDR(0x488)) & 0x0f, + biosadapter); + break; + case 1: + /* CGA 40x25 */ + /* FIXME: switch to the 80x25 mode? XXX */ + biosadapter[V_ADP_PRIMARY] = adapter_init_value[DCC_CGA40]; + biosadapter[V_ADP_SECONDARY] = adapter_init_value[DCC_MONO]; + break; + case 2: + /* CGA 80x25 */ + biosadapter[V_ADP_PRIMARY] = adapter_init_value[DCC_CGA80]; + biosadapter[V_ADP_SECONDARY] = adapter_init_value[DCC_MONO]; + break; + case 3: + /* MDA */ + biosadapter[V_ADP_PRIMARY] = adapter_init_value[DCC_MONO]; + biosadapter[V_ADP_SECONDARY] = adapter_init_value[DCC_CGA80]; + break; + } } #else /* assume EGA/VGA? XXX */