Does the BIOS have some sort of generic 'drivers'

How does the BIOS control I/O devices without any form of drivers?

For example how is an image displayed whilst the computer is booting if the BIOS doesn't have any drivers for the graphics card.

Is there some sort of generic driver that is standard across all BIOSs and hardware that allows the BIOS to perform basic functions no matter what hardware is installed.

Any help would be appreciated.

Thanks.


Solution 1:

Does the BIOS have some sort of generic 'drivers'

How does the BIOS control I/O devices without any form of drivers?

Standards. All components implement a basic interface, and the BIOS is programmed to use that. Of course because it is a basic interface (that’s what the ‘B’ in BIOS stands for), it can not take advantage of the hardware’s full capabilities; that is left to software to implement via drivers which can access the hardware directly.

Originally, the BIOS manufacturers created a set of APIs that devices were expected to use if they wanted to be compatible. They did this via “interrupts” which is a way for a device to, well, interrupt the program to let it know that something happened and vice versa.

For example how is an image displayed whilst the computer is booting if the BIOS doesn't have any drivers for the graphics card.

In the case of pre-boot display, the video-adapter’s firmware implements VESA (Video Electronics Standards Association) which is a standard that was created to simplify access to display hardware. The BIOS knows how to access the video-hardware using the standard functions provided. It is somewhat similar to how DirectX was implemented as a higher-level API to hardware so that programmers didn’t have to account for every single hardware configuration.

Is there some sort of generic driver that is standered accross all BIOSs and hardware that allows the BIOS to perform basic functions no matter what hardware is installed.

Sort of. It’s not a driver, but a standard API; a set of programming functions that can be used to do basic things like initialize a device or input and output data.

If manufacturers want to sell their products, they will need to make sure that they at least implement the standard APIs so that they will be compatible. That way, the system can detect the hardware and in the case of boot-critical devices, they can access them at a basic level until a software driver that knows how to access them fully can be loaded.

Solution 2:

The BIOS in a PC was meant to fufill a similar function as the BIOS in an 8-bit CP/M system, popular before the PC took over in the mid-80's. The BIOS was intended to contain a minimal bootloader and hardware-dependent low-level routines to do input and output to a few devices (screen, disk, tape, COM port). Knowledge to do this was built into the ROM - no driver needed, and of course, no additional hardware supported by this ROM. (Things like power management and ACPI came much later, in the 90's, after the PC had established itself as an ubiquitous platform.)

(The CP/M "filesystem" was in a component loaded off disk called the BDOS - likewise, knowledge of the FAT filesystem and it's interfaces is in (at least one of) two hidden files MSDOS.SYS or IO.SYS - not part of the BIOS ROM.)

However ... The PC BIOS, unlike CP/M, did support the notion of "Option ROMS" which could be included on an expansion card. So there was at least a minimal mechanism to extend the BIOS. Video cards starting with CGA (MDA, CGA's predecessor, may have done it too) would have an option ROM that extended or added I/O functions to the BIOS interface. (This is why you see an NVidia message before your BIOS boots.) So did hard controllers and SCSI cards. All of these still do. Many older network cards have a socket for a boot ROM.

Keep in mind also that PC clone manufacturers that arose in the 80's very quickly decided not to provide only a compatible BIOS interface, but ended up having to copy the PC platform as a whole, including all of the low level hardware such as the timer chip, interrupt controller, etc. (This was relatively easy since little of it was IBM proprietary.) This was because the BIOS was slow to do things and programmers accessed the hardware directly, particularly for games.

Thus, between option ROMs and this consensus of standard hardware that forms the PC platform, as well as the fact it's been kept backwards compatible throughout the evolution of the PC, something wishing to use the display without a driver can:

  • use standard BIOS interfaces, which may be "hooked" by an option ROM in the video hardware
  • or make assumptions about what hardware is in the system and access basic hardware directly

All PC display hardware still works in a "VGA compatible" mode upon boot. The original IBM VGA adapter had modes compatible with earlier EGA, CGA, and MDA cards. All this means is that something running from the BIOS or outside of an OS can assume it can still read and write the same memory connected to the display now as it could in 1985, through convention.