PATCH: linux_vga_console (Was: Unable to open an initial console)

From: Doru Petrescu (pdoru@kappa.ro)
Date: Mon May 28 2001 - 02:18:50 EST


So,
Here is what actualy happened:

The problem was that I was unable to open /dev/console or /dev/vcsXX or
/dev/ttyXX
Nothing changed in the configuration, except that I upgraded the kernel.
After some digging I realized that it has nothing to do with the KERNEL
version or the fact it is a SMP matchine.

Further more I notice that there is no VGA adapter listed in /proc/pci
Because I do have an AGP card, I expect it to be listed in /proc/pci and
even more to be detected at boot time. I know linux can work without a VGA
card, but I _HAD_ one and I was not understanding what's happening.

Then, I noticed that /proc/ioports has 2 entries for a 'mda' monocrome
video adapter...

so, now I was thinking:
1. why it detected my VGA as a MDA
2. why was not initializing the console ?!?

After 2h of digging in the code, I finaly realized what is wrong:

1. The video card had probably moved in its slot and was no longer working
   This is why /proc/pci had no entry of a VGA controler
2. At some point the Linux kernel was guessing that I have a MDA controler
3. Then it continued by requesting the 2 IOports ranges, and registered
   them for the MDA card I don't have.
4. Then it proceded to TEST the presence of VIDEO RAM. but since my video
   card was gone fishing, there was aparently no video ram, or at least no
   video ram where the kernel was looking for (since I actualy had a VGA
   not a MDA adapter, and they use different regions to map the video ram)
5. Noticing that there is actualy NO VIDEO RAM at that location, it gives
   up and return NULL, as in 'no VGA/EGA/MDA/CGA video adapter detected'
6. it continues silently, but without any console ...
   It DO NOT DEALOCATE THE IOREGIONS that are not used !!!
   Everything else works, just that my agettys are yelling that they can't
   open /de/vttyXX. and my syslog is full of 'Can't locate module char-major-4'

Eh, finally everything was fixed pretty easly, but opening the computer
and pressing the vcard fermly back into its location. I am amazed that the
computer started in the first place WITHOUT the vcard working.

Now, I wrote a patch to address some of the issues ...
1. it first check for the presence of video ram BEFORE allocating any
resource
2. if you configure your kernel with 'VGA CONSOLE' it will complain that
no VGA/etc adapter was found, and the VGA CONSOLE is disabled.
3. if no COSOLE device is detected/initialized at all, not even the dummy
device, it will complain that no console device was found/initialized.

For people that doesn't use/have a VGA console, and doesn't wan't to see
that warning ... all they have to do is to disable the 'VGA CONSOLE'
option in the configuration. This will also help reducing the kernel size,
since they anyway have no use of that driver ...

If you use the SERIAL CONSOLE as your only CONSOLE driver:
- disable VGA CONSOLE to get rid of one warning, and make your kernel
smaller
- and you should dnot see the second warning about 'no console driver
found' since you have a console driver (serial console)... so there si no
problem. (NOT TESTED... someone please CONFIRM)

the patch will ... patch 2 files:
- linux/dirvers/char/console.c
       + added one line: a printk
- linux/drivers/video/vgacon.c
       + vgacon_startup() was rewritten

the patch is attached,
and is also available via http from:
http://bigD.kappa.ro/~pdoru/patch_linux_vga_console

Best regards,
------
Doru Petrescu
KappaNet - Senior Software Engineer
E-mail: pdoru@kappa.ro LINUX - the choice of the GNU generation



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu May 31 2001 - 21:00:35 EST