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: [EMAIL PROTECTED] LINUX - the choice of the GNU generation
--- linux/drivers/char/console.c Mon May 28 09:03:04 2001 +++ linux/drivers/char/console.c Sun May 27 12:01:15 2001 @@ -2379,6 +2379,8 @@ if (conswitchp) display_desc = conswitchp->con_startup(); if (!display_desc) { + printk("WARNING: CONSOLE: no console driver initialized/available +!\n"); + fg_console = 0; return; } --- linux/drivers/video/vgacon.c Sat May 26 23:13:23 2001 +++ linux/drivers/video/vgacon.c Mon May 28 09:40:42 2001 @@ -170,162 +170,228 @@ spin_unlock_irqrestore(&vga_lock, flags); } +/* + * Reorganized by Pdoru (Doru Petrescu [EMAIL PROTECTED]) + * + Added test to check the presence of vram/vcard before + * allocating any I/O resource + * + Added WARNING message if no VGA/EGA/MDA/CGA card was detected + * + * + * - vgacon_config_adapter() is called by vgacon_detect_adapter() + * - vgacon_detect_adapter() is called by vgacon_startup() + * - vgacon_startup() is called from console.c ... + * + * ** vgacon_startup() + * - see if we open a VGA console or just a DUMMY console untill + * the FrameBuffer console initialize + * - calls vgacon_detect_adapter() to attempt to detect a graphics card + * - warn if none was found + * + * ** vgacon_detect_adapter() + * - is this a monocrome video mode (mode 7) ? + * - YES: probes for EGA_MONO or MDA + * - NO: probes for EGA_COLOR or VGA_COLOR or CGA + * + * ** vgacon_config_adapter() + * - FIRST check to see if there is any VIDEO MEMORY present + * - generic configuration + * - per VIDEO_TYPE configuration + */ + +static const char __init *vgacon_config_adapter( + unsigned char video_type, + unsigned long vram_base, + unsigned long vram_end + ) { + + volatile u16 *p = (volatile u16 *) VGA_MAP_MEM(vram_base); + u16 saved1, saved2; + int ok = 0; + + + /* + * BEFORE we go any further, + * FIRST make sure there is a graphics card present. + * Are there smarter methods around? + */ + + saved1 = scr_readw(p); + saved2 = scr_readw(p + 1); + + scr_writew(0xAA55, p); + scr_writew(0x55AA, p + 1); + if (scr_readw(p) == 0xAA55) ok++; + if (scr_readw(p + 1) == 0x55AA) ok++; + + scr_writew(0x55AA, p); + scr_writew(0xAA55, p + 1); + if (scr_readw(p) == 0x55AA) ok++; + if (scr_readw(p + 1) == 0xAA55) ok++; + + scr_writew(saved1, p); + scr_writew(saved2, p + 1); + + if (ok < 4) return NULL; /* something is wrong with the video memory ... */ + + /* OK, it passed the test .... Huston, we have a video card ... */ + + + /* Generic VGA/EGA/MDA/CGA configuration part ... */ + + vga_vram_base = VGA_MAP_MEM( vram_base ); + vga_vram_end = VGA_MAP_MEM( vram_end ); + vga_video_type = video_type; + + vga_video_num_lines = ORIG_VIDEO_LINES; + vga_video_num_columns = ORIG_VIDEO_COLS; + + if ( vga_video_type == VIDEO_TYPE_EGAM || + vga_video_type == VIDEO_TYPE_MDA ) { + vga_can_do_color = 0; + vga_video_port_reg = 0x3b4; + vga_video_port_val = 0x3b5; + }else{ + vga_can_do_color = 1; + vga_video_port_reg = 0x3d4; + vga_video_port_val = 0x3d5; + } + + if (vga_video_type == VIDEO_TYPE_EGAC + || vga_video_type == VIDEO_TYPE_VGAC + || vga_video_type == VIDEO_TYPE_EGAM) { + vga_hardscroll_enabled = vga_hardscroll_user_enable; + vga_default_font_height = ORIG_VIDEO_POINTS; + vga_video_font_height = ORIG_VIDEO_POINTS; + /* This may be suboptimal but is a safe bet - go with it */ + video_scan_lines = vga_video_font_height * vga_video_num_lines; + } + video_font_height = vga_video_font_height; + + + /* Per adapter configuration part */ + + if (vga_video_type == VIDEO_TYPE_EGAM) { + static struct resource ega_console_resource = { "ega", 0x3B0, 0x3BF }; + request_resource(&ioport_resource, &ega_console_resource); + return "EGA+"; + } /* endif VIDEO_TYPE_EGAM */ + else + + if (vga_video_type == VIDEO_TYPE_MDA) { + static struct resource mda1_console_resource = { "mda", 0x3B0, 0x3BB }; + static struct resource mda2_console_resource = { "mda", 0x3BF, 0x3BF }; + vga_video_font_height = vga_default_font_height = 14; + + request_resource(&ioport_resource, &mda1_console_resource); + request_resource(&ioport_resource, &mda2_console_resource); + return "*MDA"; + } /* endif VIDEO_TYPE_MDA */ + else + + if (vga_video_type == VIDEO_TYPE_CGA) { + static struct resource cga_console_resource = { "cga", 0x3D4, 0x3D5 }; + vga_video_font_height = vga_default_font_height = 8; + request_resource(&ioport_resource, &cga_console_resource); + return "*CGA"; + } /* endif VIDEO_TYPE_CGA */ + else + + if (vga_video_type == VIDEO_TYPE_EGAC) { + static struct resource ega_console_resource = { "ega", 0x3C0, 0x3DF }; + request_resource(&ioport_resource, &ega_console_resource); + return "EGA"; + } /* endif VIDEO_TYPE_EGAC */ + else + + if (vga_video_type == VIDEO_TYPE_VGAC) { + int i; + static struct resource vga_console_resource = { "vga+", 0x3C0, 0x3DF }; + request_resource(&ioport_resource, &vga_console_resource); + + /* since we've got a VGA adapter, configure it a little more ... */ +#ifdef VGA_CAN_DO_64KB + /* + * get 64K rather than 32K of video RAM. + * This doesn't actually work on all "VGA" + * controllers (it seems like setting MM=01 + * and COE=1 isn't necessarily a good idea) + */ + vga_vram_base = 0xa0000; + vga_vram_end = 0xb0000; + outb_p (6, 0x3ce) ; + outb_p (6, 0x3cf) ; +#endif + + /* + * Normalise the palette registers, to point + * the 16 screen colours to the first 16 + * DAC entries. + */ + + for (i=0; i<16; i++) { + inb_p (0x3da) ; + outb_p (i, 0x3c0) ; + outb_p (i, 0x3c0) ; + } + outb_p (0x20, 0x3c0) ; + + /* now set the DAC registers back to their + * default values */ + + for (i=0; i<16; i++) { + outb_p (color_table[i], 0x3c8) ; + outb_p (default_red[i], 0x3c9) ; + outb_p (default_grn[i], 0x3c9) ; + outb_p (default_blu[i], 0x3c9) ; + } + return "VGA+"; + } /* end if VIDEO_TYPE_VGAC */ + + return NULL; /* imposible case ... */ +} + +static const char __init *vgacon_detect_adapter(void) +{ + /* Is this a monochrome display ? */ + if (ORIG_VIDEO_MODE == 7) { + if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) + return vgacon_config_adapter( VIDEO_TYPE_EGAM, 0xb0000, 0xb8000 ); + else return vgacon_config_adapter( VIDEO_TYPE_MDA, 0xb0000, 0xb2000 ); + } + + /* Then it is color display ! */ + if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { + if (!ORIG_VIDEO_ISVGA) + return vgacon_config_adapter( VIDEO_TYPE_EGAC, 0xb8000, 0xc0000 ); + else return vgacon_config_adapter( VIDEO_TYPE_VGAC, 0xb8000, 0xc0000 ); + } + + /* our last hope is to be a CGA ... */ + return vgacon_config_adapter( VIDEO_TYPE_CGA, 0xb8000, 0xba000 ); +} + static const char __init *vgacon_startup(void) { - const char *display_desc = NULL; - u16 saved1, saved2; - volatile u16 *p; + const char *display_desc = NULL; - if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) { - no_vga: + if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) { +no_vga: #ifdef CONFIG_DUMMY_CONSOLE - conswitchp = &dummy_con; - return conswitchp->con_startup(); + conswitchp = &dummy_con; + return conswitchp->con_startup(); #else - return NULL; + return NULL; #endif - } - - - vga_video_num_lines = ORIG_VIDEO_LINES; - vga_video_num_columns = ORIG_VIDEO_COLS; - - if (ORIG_VIDEO_MODE == 7) /* Is this a monochrome display? */ - { - vga_vram_base = 0xb0000; - vga_video_port_reg = 0x3b4; - vga_video_port_val = 0x3b5; - if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) - { - static struct resource ega_console_resource = { "ega", 0x3B0, 0x3BF }; - vga_video_type = VIDEO_TYPE_EGAM; - vga_vram_end = 0xb8000; - display_desc = "EGA+"; - request_resource(&ioport_resource, &ega_console_resource); - } - else - { - static struct resource mda1_console_resource = { "mda", 0x3B0, 0x3BB }; - static struct resource mda2_console_resource = { "mda", 0x3BF, 0x3BF }; - vga_video_type = VIDEO_TYPE_MDA; - vga_vram_end = 0xb2000; - display_desc = "*MDA"; - request_resource(&ioport_resource, &mda1_console_resource); - request_resource(&ioport_resource, &mda2_console_resource); - vga_video_font_height = 14; - } - } - else /* If not, it is color. */ - { - vga_can_do_color = 1; - vga_vram_base = 0xb8000; - vga_video_port_reg = 0x3d4; - vga_video_port_val = 0x3d5; - if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) - { - int i; - - vga_vram_end = 0xc0000; - - if (!ORIG_VIDEO_ISVGA) { - static struct resource ega_console_resource = { "ega", 0x3C0, 0x3DF }; - vga_video_type = VIDEO_TYPE_EGAC; - display_desc = "EGA"; - request_resource(&ioport_resource, &ega_console_resource); - } else { - static struct resource vga_console_resource = { "vga+", 0x3C0, 0x3DF }; - vga_video_type = VIDEO_TYPE_VGAC; - display_desc = "VGA+"; - request_resource(&ioport_resource, &vga_console_resource); - -#ifdef VGA_CAN_DO_64KB - /* - * get 64K rather than 32K of video RAM. - * This doesn't actually work on all "VGA" - * controllers (it seems like setting MM=01 - * and COE=1 isn't necessarily a good idea) - */ - vga_vram_base = 0xa0000; - vga_vram_end = 0xb0000; - outb_p (6, 0x3ce) ; - outb_p (6, 0x3cf) ; -#endif - - /* - * Normalise the palette registers, to point - * the 16 screen colours to the first 16 - * DAC entries. - */ - - for (i=0; i<16; i++) { - inb_p (0x3da) ; - outb_p (i, 0x3c0) ; - outb_p (i, 0x3c0) ; - } - outb_p (0x20, 0x3c0) ; - - /* now set the DAC registers back to their - * default values */ - - for (i=0; i<16; i++) { - outb_p (color_table[i], 0x3c8) ; - outb_p (default_red[i], 0x3c9) ; - outb_p (default_grn[i], 0x3c9) ; - outb_p (default_blu[i], 0x3c9) ; - } - } - } - else - { - static struct resource cga_console_resource = { "cga", 0x3D4, 0x3D5 }; - vga_video_type = VIDEO_TYPE_CGA; - vga_vram_end = 0xba000; - display_desc = "*CGA"; - request_resource(&ioport_resource, &cga_console_resource); - vga_video_font_height = 8; - } - } - - vga_vram_base = VGA_MAP_MEM(vga_vram_base); - vga_vram_end = VGA_MAP_MEM(vga_vram_end); - - /* - * Find out if there is a graphics card present. - * Are there smarter methods around? - */ - p = (volatile u16 *)vga_vram_base; - saved1 = scr_readw(p); - saved2 = scr_readw(p + 1); - scr_writew(0xAA55, p); - scr_writew(0x55AA, p + 1); - if (scr_readw(p) != 0xAA55 || scr_readw(p + 1) != 0x55AA) { - scr_writew(saved1, p); - scr_writew(saved2, p + 1); - goto no_vga; - } - scr_writew(0x55AA, p); - scr_writew(0xAA55, p + 1); - if (scr_readw(p) != 0x55AA || scr_readw(p + 1) != 0xAA55) { - scr_writew(saved1, p); - scr_writew(saved2, p + 1); - goto no_vga; - } - scr_writew(saved1, p); - scr_writew(saved2, p + 1); - - if (vga_video_type == VIDEO_TYPE_EGAC - || vga_video_type == VIDEO_TYPE_VGAC - || vga_video_type == VIDEO_TYPE_EGAM) { - vga_hardscroll_enabled = vga_hardscroll_user_enable; - vga_default_font_height = ORIG_VIDEO_POINTS; - vga_video_font_height = ORIG_VIDEO_POINTS; - /* This may be suboptimal but is a safe bet - go with it */ - video_scan_lines = - vga_video_font_height * vga_video_num_lines; - } - video_font_height = vga_video_font_height; + } - return display_desc; + display_desc = vgacon_detect_adapter(); + + if (display_desc == NULL) { + printk("WARNING: No VGA/EGA/MDA/CGA video adapter detected => VGA CONSOLE +disabled\n"); + goto no_vga; + } + + return display_desc; } static void vgacon_init(struct vc_data *c, int init)