SATA(AHCI mode) - Why an OS needs a AHCI driver, while BIOS can boot from HDD?

6,417

First of all, the BIOS includes a driver for your on-board AHCI controller. And in case the controller is not on-board but on a PCI card, the card will provide a PCI Option ROM containing a BIOS driver for the controller.

If your firmware supports UEFI, it (or the Option ROM) will also include an UEFI driver for the controller.

The same is true for all other components your PC can boot of (i. e. usually USB, CD-ROM, wired network). Other components usually don't have BIOS/UEFI drivers at all.

Operating systems can use the BIOS or UEFI drivers (for example DOS or Windows 95 do so) but most modern operating systems try to avoid the hassle and work around the limitations of the BIOS drivers and instead use their own driver format.

Common limitations of BIOS drivers:

  • usually poor read performance and even poorer write performance
  • only supported if only the first processor/core is activated
  • only work in 16-bit mode (which implies single-tasking and 640KB addressable memory)
  • only work if the A20 gate is cleared (which implies 1MB addressable memory)

Which means that during boot, modern OSes will have to repeatedly switch between 16-bit and 32-bit/64-bit single-tasking mode and repeatedly toggle the A20 gate until they have read the OS kernel and at least the disk driver into high memory (640K is usually not enough today); then they will switch to multi-tasking mode and continue loading the rest of the OS using the now loaded kernel and disk driver.

UEFI limitations are less bad (UEFI drivers run in 64-bit mode, but still require single-tasking mode and only one core activated), but still bad enough so that I don't know any OS that tries to use UEFI drivers after boot - and which is probably also the reason nobody wrote a web browser for pure UEFI (web browsers are inherently multi-threaded and it would be hard to write a well-performing single-threaded web-browser).

Share:
6,417

Related videos on Youtube

user4691
Author by

user4691

Updated on September 18, 2022

Comments

  • user4691
    user4691 over 1 year

    What is the relation between AHCI and SATA? How come an OS cannot operate a SATA controller without an AHCI driver, while the BIOS knows how to boot of a SATA hard disk?

    What are the difference between the SATA controllers, so that they need a specific AHCI driver?

    Does the BIOS has a "driver" inside to operate and boot from a SATA(in AHCI mode) HDD?

    • Frank Thomas
      Frank Thomas over 9 years
      First, a SATA controller may be run in the old ATA mode, using a generic driver, or in AHCI mode, using enhanced drives. Second, the BIOS, because it is "part" of the motherboard, knows your system hardware will support an AHCI mode driver. Third, the OS can be configured to run either an ATA driver OR an AHCI driver, but not both at once. Because the windows installer does not have the same in-depth knowledge of your hardware, it defaults to the driver that will work on the most systems: the ATA driver. You have to manually enable AHCI, and install the driver to use AHCI.
    • Ramhound
      Ramhound over 9 years
      Most current operating systems have AHCI drivers built-in. What exactly is your question? The differences depends on the features of the controllers, you can discover those features, by comparing the different controllers.
    • Frank Thomas
      Frank Thomas over 9 years
      Note that a BIOS is not a traditional operating system kernel so it does not use pluggable "drivers" the way an OS does. its operations are all written into its eprom. Granted some of the EFI shells have some suprising user features (but who wants to browse the web from their bios?), but its still a very different kind of animal.