Option ROM

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

An Option ROM typically consists of PC firmware that is called by the BIOS. For example, an adapter card that controls a boot device might contain firmware that is used to connect the device to the system once the Option ROM is loaded.

IBM PC and compatibles[edit]

A common option ROM is the video BIOS found on IBM PC compatible video cards. This is a special case of an option ROM, as it is loaded very early on in the boot process so that output from the power-on self-test (POST) can be displayed. The video BIOS is almost always located in the C000 memory segment, the start of the memory area reserved for option ROMs. Other ROMs can be located from segments C800 all the way up to F400 in early PCs.[1] The final search address was eventually limited to E000[2] in later products. The BIOS Boot Specification (BBS) requires that option ROMs be aligned to 2kB boundaries (e.g. segments C800, C880, C900, C980, etc.). The first two bytes of the ROM must be 55 AA.[3]

After the basic POST checks are complete, the option ROMs are normally initialized. This gives them the chance to hook (intercept) system interrupts, in order to provide increased functionality to the system.

SCSI[edit]

For example, a SCSI controller card may hook INT 13 which is responsible for providing disk services. The Bios Boot Specification stipulates that the hook is typically performed in the Boot Connection Vector (BCV), which is code pointed to by the PnP header of the Option ROM. Once it has done this, any subsequent calls to INT 13h will be "caught" by the SCSI option ROM (or "SCSI BIOS"), allowing it to insert details about any disks that may exist on the SCSI bus. Before it had hooked the interrupt there may have been no disks on the system, but by intercepting the interrupt and altering the values returned, the SCSI BIOS can make all the disks on the SCSI bus visible to the system.

In this particular case, the BIOS itself may call INT 13h to provide a list of possible boot devices to the user, and because the SCSI BIOS has hooked the interrupt the user will be able to choose not only which standard system devices to boot from, but also which SCSI disks as well. This is because, as suggested in Appendix D of the Boot BIOS Specification, the BIOS could populate the IPL table with device and vendor information from INT 13h calls to the different disks, paired with the Hard Disk Number (80h, 81h ...), to allow any Hard Disk Device to be booted from, rather than just the first disk of the first controller to hook INT 13h be bootable, referred to as a BIOS Aware IPL Device (BAID) in the specification.

Multiple controllers can hook INT 13h at once. For instance, after the SCSI controller, an AHCI controller can also hook INT 13h by putting a call to the previous handler, which was stored in the IDT at entry 13h by the SCSI controller, at the end of its own handler, which it then puts in the IDT at entry 13h. If INT 13h is called with DL = 83h, then the controller that assigned a disk range containing 83h will respond, otherwise it will skip and call the previous handler. The first controller to hook INT 13h will see that 0 disks have been installed by checking the byte at 0040:0075h, which resides in the BIOS Data Area (BDA), and if it has 4 disks to enumerate, it will assign the range 80h–83h and store '4' in the BDA.

Network boot ROM[edit]

Another common option ROM is a network boot ROM. This option ROM contains the program required to download the boot code. Network booting ROMs generally work differently than in the SCSI example, as they do not provide any new devices to the system. The original IBM Personal Computer ROMs hooked INT 18H (originally to invoke Cassette BASIC) and INT 19H, as these two interrupts were designated when the boot process is about to begin. INT 19H is called to initiate the boot process, while INT 18H is called when the system tries to boot from all possible devices and none were bootable. Originally, by hooking INT 18H, the system would invoke Cassette BASIC (if present) or try to boot from the network when all other boot devices (floppy drives, hard drives, etc.) had failed. By hooking INT 19H, the system would attempt to boot from the network before any other devices.

BIOS boot specification[edit]

Since these two methods do not offer a large amount of control over the boot process, the BIOS Boot Specification (BBS) was developed. This provided a more standardized approach where an option ROM could be initialized at the start of the boot process, it could inform the BIOS about its functionality, and then it could be called later on in the boot process depending on the order the user had selected.

UEFI Option ROMs[edit]

UEFI BIOS can use legacy option ROMs when a Compatibility Support Module (CSM) is enabled.[4]

In UEFI-only environment (i.e. when CSM is disabled), option ROMs have a different format: a processor-independent EFI Byte Code.[5]

See also[edit]

References[edit]

  1. ^ IBM PC XT Technical Reference
  2. ^ Personal System/2 and Personal Computer BIOS Interface Technical Reference
  3. ^ The execution environment of Etherboot
  4. ^ "UEFI Validation Option ROM Guidance". Microsoft. May 2, 2017.
  5. ^ Max Lee (October 12, 2010). "UEFI Option ROMs and plug-ins" (PDF). Phoenix Technologies.