Myth
For most of people, BIOS is the flashing screen that shows up when they hit the powre button of their PC. For some, it also means the blue screen that you can adjust settings when you hit ESC (or F12, depending on the brand you purchansed) at the boot-up time.
They are both true, but BIOS does more.
Hardware Initialization
When the power button is pressed, all hardware devices are at default states and they are not ready to be used. Like any other firmwares, BIOS initializes hardware devices one-by-one and allocate resources they require. Most importantly, BIOS needs to initialize components that are specific to a platform, namely CPU, memory and chipset. Without this, a computer will not work at all.
Customization
Not all features are welcomed. Some users want to enable/disable features according to their needs, i.e. enabling system passwords for extra protection and disabling it for ease of use. BIOS usually comes with a setup utility that a user can explicitly change hardware and software settings. This is the most common known BIOS function that general users are aware of.
Standardization
History
When computers were first invented, there were no standard interfaces and software had to be re-written for each different computer architecture, or for each different hardware that was attached to a computer.
BIOS is the short for Basic Input and Output System. The creation of BIOS was meant to provide standard interfaces for the uppper layer programs - more specifically for operation systems (OS) and prossibly for some user applications. In theory, an OS needs not to be re-written as long as it calls standardized BIOS functions, and BIOS will interact with hardware on their behaviors.
On PC, it was done by INT function calls - an OS calls INTx when they want to talk to the hardware; for example, OS calls INT13 for hard-disk accesses and INT10 for drawing texts or graphics on screens.
NOTE: OS like Microsoft DOS provides INT21 for applications, but INT21 calls BIOS INTx functions eventually.
Today
Modern OS no longer heavily relies on BIOS functions to interact with hardware - most of the work is done by device drivers.
It may look like BIOS engineers are losing their jobs; however, the demands for BIOS engineers are more than ever.
What does BIOS do today? It is the same thing in different ways.
BIOS's primary work shifts from doing the hardware interaction (providing INTx functions) to *tell* OS how to the hardware interactions (ACPI tables).
More specifically, BIOS does the two things:
1. Tells OS what resources (IO and memory) are used and used by whom. This gives OS the information what is left for OS (resource conflicts cause system instability).
- E820 Table and ResourceProducer and ResourceConsumer in DSDT table
2. Tells OS what hardware features are available and how to use them - this enables OS to support new features without updates.
- CPU features such as P-State and C-State, and generic features such as battery information and hotkeys.
The above list is not nearly complete. This only gives a bit of tastes what BIOS tells OS. Unfortunately for BIOS engineers, there are *many* industrial specifications that need to be studied in order to fully understand today's PC. Fortunately, 80% of the work has been done in relatively good shape, though the remaining 20% still gives BIOS engineers and kernel engineers a lot of headaches...
Initialization and Interface
Initialization and Interface are coupled tightly (hope this does not surprise you).
When BIOS configures hardware at the boot-time, it sets how chipsets respond to I/O or memory cycles. Telling OS what I/O or memory range should be used are reported via ACPI tables.
Example 1: to enable I/O cycle to a KBC controller, BIOS needs to set the chipset so chipsets forward 60/64 I/O cycles to ISA/LPC bus and to report KBC is using IO 60/64 in DSDT.
Hardware Configuration - PCIE BAR Register |
MCFG Table for OS |
Future BIOS
We are at the concern of a BIOS revolution. The BIOS today and yesterday is now known as *legacy BIOS* and the replacement is known as *UEFI BIOS*. UEFI BIOS does not change the role of legacy BIOS; however it further standardizes BIOS functions and add modern requirements (i.e. security, fast boot-time and more) plus future extendability.
As there are much more than enough articles discuss why UEFI BIOS better is than legacy BIOS, I am not going to repeat it here (or maybe I will in future blog). It is sufficient to know UEFI is not going to change the way we use computers today yet, although some new features such as *Secure Boot* may impact some parts of open-source industry.
No comments:
Post a Comment