|[ Team LiB ]|
The BIOS starts to work as soon as you switch your system on. When all modern Intel microprocessors start to work, they immediately set themselves up in real mode and look at a special memory location that is exactly 16 bytes short of the top of the 1MB real-mode addressing range—absolute address 0FFFF0(hex). This location holds a special program instruction, a jump that points to another address where the BIOS code actually begins.
The term cold boot describes the process of starting your computer and loading its operating system by turning the power on. If your computer is running, you cold boot by first switching it off and then back on.
Warm boot describes the process of restarting your computer and loading its operating system anew after it has already been running and has booted up at least once before. You start a warm boot by giving the infamous "three-finger salute" by pressing the Ctrl, Alt, and Delete keys at the same time.
Finally, hot boot describes what you get when you slide a piece of footwear into your oven in a mistaken attempt at the preparation of filet of sole. The term is not used to describe the computer bootup process.
At the operating system level, a cold boot and a warm boot are essentially the same. Your computer starts from the beginning and loads the operating system from scratch. A warm boot or switching your computer off for a cold boot signals the microprocessor to reset itself to its "turn-on" condition, erasing the contents of its registers. The microprocessor then loads or reloads the operating system.
The important difference between a cold and warm boot is not what happens to your operating system but the effect on your computer's internal circuits. A cold boot automatically restores all the circuits in your computer to their original, default condition, whether they are on the motherboard or the expansion boards, because it cuts off their electrical supply. It also wipes away everything in its memory for a fresh start. A warm boot does not affect the supply of electricity to your computer's circuitry, so memory and the boards installed in your computer are not wiped clean, although some of the contents get overwritten as your operating system reloads.
Because a warm boot does not automatically restore all the expansion boards in your computer to their initial conditions, it sometimes does not solve software problems. For example, your modem may not release the telephone line (hang up) at the end of your Internet session. A warm boot may leave the modem connected, but a cold boot will ensure the modem disconnects and releases your telephone line.
Unless the boards in your computer follow the Plug-and-Play standard that specifies a standard reset condition, your computer has no way of telling the state of each board in your computer after a warm boot. It makes no attempt to find out and just takes what it gets. Ordinarily such blind acceptance is not a problem. If, however, some odd state of an expansion board caused your computer to crash, a warm boot will not solve the problem. For example, sometimes video boards will come up in odd states with strange screen displays after a crash that's followed by a warm boot. Cold-booting your computer again usually eliminates such problems.
Your computer also behaves differently during the cold- and warm-booting processes. During a cold boot, your computer runs through its Power-On Self Test (POST) procedure to test all its circuitry. During a warm boot, your computer sidesteps POST under the assumption that it has already booted up once, so its circuitry must be working properly.
Your computer must somehow distinguish between a cold and warm boot to decide whether to run its POST diagnostics. To sort things out, your computer uses its normal memory, which it does not wipe out during a warm boot. Each time your computer boots up, it plants a special two-byte signature in memory. When your system boots, it looks for the signature. If it find the signature, it knows it has been booted at least once since you turned on the power, so it does not need to run through POST. When it fails to find the signature, it runs its diagnostics as part of the cold-boot process. Note that if something in your system changes the signature bytes—as crashing programs sometimes do—your computer will run through a cold boot even though you haven't turned it off.
The signature bytes have the value 1234(hex). Because they are stored in Intel little endian format (that is, the least significant byte comes first), they appear in memory as the sequence 34 12.
Programs can also initiate a warm or cold boot simply by jumping to the appropriate section of BIOS code. However, because some expansion boards don't automatically reset when your computer runs through the cold-boot BIOS code, anomalies may persist after such a program-initiated cold boot. For example, your video board may place itself into an odd state, and a complete reset may not unlock it. For this reason, some programs instruct you to turn your computer off and back on during the installation process to guarantee all the hardware in your system properly resets.
Power-On Self Test
Every time your computer switches on, the BIOS immediately takes command. Its first duty is to run through a series of diagnostic routines (system checks) called the Power-On Self Test routine, or POST. This ensures every part of your computer's hardware is functioning properly before you trust your time and data to it. One by one, the POST routine checks the circuits of your system board and memory, the keyboard, your disks, and each expansion board. After the BIOS makes sure the system is operating properly, it initializes the electronics so that they are ready for the first program to load.
The BIOS tests are relatively simple. The BIOS sends data to a port or register and then looks to see the results. If it receives expected results, the BIOS assumes all is well. If it finds a problem, however, it reports the failure as well as it can. If the display system is working, it posts an error-code number on your monitor screen. (The limited amount of memory available prevents the BIOS from storing an elaborate—that is, understandable—message for all the hundreds of possible error conditions.) If your computer is so ill that the display system will not even work, the BIOS sends out a coded series of beeps through your system's loudspeaker.
Many BIOSs also write the code numbers of the ongoing tests to input/output port 80(hex). Special diagnostic boards that plug into a vacant expansion slot can monitor this test procedure and show the test progress and failure. Repair technicians often use such diagnostic boards when servicing systems.
Displaying an error code on your monitor screen presupposes that at least part of your computer (and a major part at that) is operating properly—namely, the display system. If your video board or monitor is not functioning and you don't have a diagnostic board, the error code display is useless. Consequently, most BIOSs also generate error identifications that are independent of the display system.
Instead of visual displays, they use audible error codes played through the small speaker system that is standard equipment in all computers. Because the speaker system links to your computer at a rudimentary level—only a single amplifier chip stands between the speaker and its associated input/output port—the basic computer speaker will always function except during the most dire failures, such as a nonworking microprocessor. (Note that this basic computer speaker is separate from the sound board or multimedia sound system present in most new computers.) These audible error messages take the form of beeps from the system speaker. Consequently, they are usually termed beep codes.
As computers have become more complex, the systems of beep codes have become correspondingly elaborate. Some sound more elaborate than a Mayday call from a sinking ocean liner. Ever BIOS-maker uses its own coding scheme for these aural error warnings. Usually a single short beep means your computer is okay; anything else warns of an error.
Should your computer start with a continuous beep that won't stop until you switch the power off, your computer has a major problem, most likely with its power or logic system. Oftentimes a defective expansion board or an improperly inserted expansion board will elicit such an unending beep. It can also result from a bad microprocessor or other motherboard problem. If you encounter a beep that won't end, check your expansion boards first. Ensure that all are seated properly and then remove them one by one or en masse until the beep quiets down. (Be sure to switch off your computer before you add or remove an expansion board.)
After the actual testing of your computer and its associated circuitry is complete, its BIOS begins to execute initialization routines that configure the various options inside your computer. Exactly what happens next depends on the design of the BIOS. A conventional BIOS merely looks for add-in BIOS routines, initializes devices using the routines already in the BIOS, and starts the disk bootup.
Every computer assumes that many of its peripherals are loaded with specific data values when it starts up. That is, all the default operating values are loaded by the BIOS, so your timer knows what to time and the speaker knows the frequency at which to beep. The serial ports are set to their default speed. A Plug-and-Play system like those of nearly all new computers runs through a more structured initialization process that amounts to completely setting up system resources each time the computer boots. The "Plug-and-Play" section, later in this chapter, gives a step-by-step outline of this BIOS boot procedure.
By design, the basic computer BIOS knows how to search beyond the confines of the system board. It knows how to locate the extra instructions and data that get added in with some expansion boards. Although some computers require you to replace the BIOS firmware with new chips to add new features, the computer BIOS was designed to be extendible. That is, the full extent of the BIOS is not forever cast in the silicon of the firmware. The extendible BIOS is capable of accepting additional code as its own, creating one integrated whole. Rather than replacing the BIOS chips, this extendibility means that you can add more firmware containing it own BIOS routines to your computer. The BIOS incorporates the new routines into itself.
The key to making the BIOS extendible is itself an extra firmware routine that enables the BIOS to look for add-in code. During the initialization process, the BIOS code reads through the address range looking for code stored on add-in boards. If it finds a valid section of code, it adds those instructions to the BIOS repertory. New interrupt routines may be added, for instance, or the function of existing routines may be changed.
The routine to extend the BIOS works as follows: Following the actual testing portion of the Power-On Self Test, after basic system board functions have been initialized (for example, the interrupt vectors have been loaded into RAM), the resident BIOS code instructs the computer to check through its ROM memory for the occurrence of the special preamble bytes that mark the beginning of add-in BIOS routines. The original IBM BIOS searches for these preamble bytes in the absolute address range 0C8000(hex) to 0F4000(hex); newer BIOSs check the range from 0C0000(hex) to 0EFFFF(hex). Either of these subsets of the full, reserved, high memory range—that is, 0A0000(hex) to 0FFFFF(hex)—exclude the areas used by video memory and the BIOS itself to prevent confusing data with preamble bytes.
If the BIOS finds the special preamble bytes, it verifies that the subsequent section of code is a legitimate BIOS extension by performing a form of cyclical redundancy check on the specified number of 512 byte blocks. The values of each byte in the block are totaled using Modulo 0100(hex) addition—the effect is the same as dividing the sum of all the bytes by 4096. A remainder of zero indicates that the extension BIOS contains valid code.
The preamble bytes take a specific form. Two bytes indicate the beginning of an extension code section—055(hex) followed by 0AA(hex). Immediately following the two-byte preamble bytes is a third byte that quantifies the length of the additional BIOS. The number represents the number of blocks, 512-bytes long, needed to hold the extra code. Plug-and-Play peripherals have a more structured header that follows the preamble bytes.
After a valid section of code is identified, system control (BIOS program execution) jumps to the fourth byte in the extension BIOS and performs any functions specified there in machine language. Typically, these instructions tell the BIOS how to install the extra code. Finally, when the instructions in the extension BIOS have been completed, control returns to the resident BIOS. The system then continues to search for additional blocks of extension BIOS. When it finally completes its search by reaching the absolute address 0F4000(hex), it starts the process of booting up your computer from disk.
The ROM or Flash memory chips containing this extra BIOS code do not have to be present on the system board. The memory locations used also are accessible on the expansion bus. This feature allows new chips that add to the BIOS to be part of expansion boards that slide into the computer. The code necessary to control the expansion accessory loads automatically whenever the system boots up.
Multiple sections of this add-on code fit into any computer, limited only by the address range available. One complication is that no two sections of code can occupy the same memory area. As a result, the makers of conventional ISA expansion boards typically incorporate jumpers, DIP switches, or EEPROM memory on their products to allow you to reassign the addresses used by their BIOS extensions and avoid conflicts. Plug-and-Play designs have made this conflict resolution automatic during the setup process.
Initial Program Load
Once the BIOS of your computer has completed all its tests, checked for additional BIOS code, and set up all the devices it knows about, it yields control over to your operating system. In older computers, the operating system simply takes over and brings your computer to life. In a Plug-and-Play system, the operating system continues the initialization of the devices inside and connected to your computer. In effect, the Plug-and-Play system completes the BIOS configuration process.
In either case, whether your BIOS completes the initialization of your system or transfers control to the operating system to complete the process, somehow your operating system must load. Your computer must know enough about your disks—floppy, hard, and CD-ROM—to be able to find the operating system and get its code running. The process of getting the operating system started is called the Initial Program Load (IPL).
The IPL procedure originally was a design expedient. When the first computer was created, ROM chips, like all other parts of computers, were expensive. The computer's designers opted to use as little ROM as possible to get the system started. They added a short code routine at the end of the BIOS test procedure that told the BIOS to read the first sector from your computer's floppy disk (the only drive in the first personal computers). This first sector is sometimes called the boot sector because of its function.
In modern computers, the BIOS is smart enough to look to your hard disk as well as floppy drive, and sometimes even to your CD-ROM drive, to find a boot sector. Many BIOSs allow you to select which of these are searched for and in what order. If the BIOS finds executable code there, it loads that code into memory and executes it. If it finds no executable code or no available disk, the BIOS complains and does nothing because it doesn't know how to do anything else.
The small amount of code used by the IPL routine is unforgiving. It searches only the first physical sector on your disks. It looks for sectors rather than clusters or allocation units because at this point it doesn't know what operating system you have and how it organizes disk storage. The BIOS must know how to find the first physical sector on the disk; consequently it requires a BIOS extension associated with the disk to tell it how to make the required access. A disk drive that uses only a software device driver will be invisible to the BIOS and the IPL routines, and consequently such a disk cannot boot the system.
The code in the boot sector is also short and to the point because it has to fit into the confines of a single sector. This code tells your computer how to find the rest of the operating system. Once it locates the main operating system, the boot sector code starts loading that code into memory and yields control to it. The operating system takes command and completes the process of booting your computer.
One of the gravest shortcomings of legacy computers—old computers built in pre-Pentium days—was that their ISA expansion bus lacked automatic configuration procedures. You were left to adjust settings and configure software yourself. And each of the dozens of settings you had to make brought its own potential for error. Putting even one jumper in the wrong place or throwing the wrong switch was often sufficient to turn two thousand dollars of computer into a noisy desk ornament.
To eliminate such setup problems and shift the tedious job of system configuration to someone (or something) better equipped to deal with it, the computer industry developed the Plug-and-Play initiative. The idea was to make your computer responsible for configuring itself. After all, computers specialize in taking over jobs that you find tedious. The goal was to create computers with no switches, no jumpers, and no headaches. So far, they've achieved two out of three, a pretty good average.
The straightforward goal belies the arduous journey in reaching today's reasonably successful automatic configuration systems. Making Plug-and-Play work required changes in every computer's BIOS, expansion bus, expansion boards, and operating system. The universal adoption of Plug-and-Play was a lengthy transition, one dragged on as compliant products slowly coursed into the market.
The idea behind the Plug-and-Play initiative was to shift responsibility for remembering and assigning setup options from you to your computer system. After all, your computer likely has a better memory than you do, and it doesn't mind running through a checkup procedure however many times as is needed.
The first stab at a Plug-and-Play specification appeared with the original Intel/Microsoft specification for ISA on May 28, 1993. That effort inspired other companies to join in. Related standards are being developed to extend Plug-and-Play to other troubling configuration processes, particularly SCSI expansion. Compaq Computer Corporation and Phoenix Technologies joined Intel to develop a BIOS specification for Plug-and-Play, first released November 1, 1993.
Toshiba joined Intel and Microsoft to come up with a system to move power-management responsibilities to the operating system. Because configuring the host system was an important part of power management, they extended their specification to embrace setting up all computer accessories, not just power, with one of its foundations being the Plug-and-Play specification. They called the result the Advanced Configuration and Power Interface (ACPI), first published in December 1996. The next major revision of the specification was Revision 2.0, published on July 27, 2000, as a 450-page tome covering the intimate details of the design of new computers. A minor revision on March 31, 2002, brought the standard up to its current version, Revision 2.0a.
ACPI is neither a hardware nor software specification. Rather, it details the interface between the two. That makes it not only function like the BIOS, but the specification also details how the BIOS works with hardware and software to configure your computer. Although it is not a BIOS in itself, the specification details how your computer's BIOS must operate. To wear a Windows logo, new computers must conform to the current ACPI version.
ACPI doesn't replace Plug-and-Play but instead builds upon it. The basic Plug-and-Play system still takes care of configuring your system, but ACPI gives it new commands and versatility. The automatic configuration process is still termed Plug-and-Play (or, by those who have less faith in its reliability, Plug-and-Pray).
For automatic configuration to work properly, it requires all three elements of the system written to its standards—the computer and its BIOS, the operating system, and the expansion boards and peripherals attached to the computer. Any older device that does not conform to the various Plug-and-Play standards is considered to be a legacy device. The Plug-and-Play system attempts to accommodate legacy devices, but it cannot resolve all conflicts between them. Developers see the ultimate solution as being attrition. As time goes by, old noncompliant products will fade from the market. To accelerate the demise of legacy products, Intel and Microsoft have written support for ISA out of their most recent system standards, although many people still insist on at least one ISA slot in their newest computers.
Expansion Board Support
The basic Plug-and-Play procedure is a three-step process that lends itself to automation: First, the Plug-and-Play BIOS directs your system to check what resources each expansion device needs. Next, the BIOS coordinates the assignments to avoid conflicts. Finally, it tells your system and software which choices it has made.
The configuration process calls upon specific hardware features of ACPI-compliant expansion boards. Most importantly, each board is able to deactivate itself so that it does not respond to the normal control signals inside your computer. The board disconnects itself from all system resources so that when it is inactive it cannot possibly cause conflicts.
In addition, each ACPI-compliant board has several new onboard registers that are reached through a standardized set of three I/O port addresses so that the BIOS or operating system can control the configuration of the board. These ports are designated Address, Write Data, and Read Data.
The Address port functions as a pointer that expands the number of control registers directly accessible to your system without stealing more system resources. Loading a register number in the Address port makes that register available for reading or writing through the Write Data and Read Data ports.
The ACPI specification explicitly defines eight card control registers and reserves two large ranges—one of 24 registers for future elaboration of the standard and the other a 16-port range that board-makers can assign to their own purposes. In addition, the specification allows cards to be configured as multiple logical devices, and it assigns ports for their control. The Address port allows the Write Data port to select which of the logical devices is active and the resources used by each.
ACPI-compliant expansion boards act in one of two ways, depending on whether they are needed for booting the system. Boards that are required for bootup (that is, display adapters and disk controllers) start up active. That is, they come online exactly like conventional expansion boards using the resources assigned them as power-on defaults. They will grab the resources that they need, participate in the normal Power-On Self Test procedure, and let you operate your computer normally. They may also cause the same old resource allocation problems, as will any conventional expansion boards that don't support Plug-and-Play or ACPI. The other Plug-and-Play devices (those not needed in booting your computer) automatically deactivate themselves when your system comes on, waiting to be told what configuration to use by your operating system.
ACPI-compliant boards not required during bootup normally start up inactive. They do nothing until specifically activated, typically by the ACPI-compliant operating system.
Every ACPI-compliant board has specific circuitry for managing its configuration. This circuitry operates independently from the normal functions of the board. Unlike the functional circuits on the board that can be disconnected from the bus interface, the Plug-and-Play circuits always monitor the signals on the bus. However, the Plug-and-Play circuitry operates in one of four states—Wait for Key, Isolation, Configuration, and Sleep—without regard for whether the functional circuitry is active or inactive.
All ACPI-compliant boards, whether active or inactive, boot up in their Wait for Key state, in which they refuse to respond until they receive an explicit command called an initiation key. This key is not a simple password but rather a precisely defined 32-step interaction between the host system and each board. All 32 steps must be completed successfully before the board can be set up.
Once a board has been singled out with the initiation key, the BIOS can interrogate it individually and determine whether it is required for booting up the system and what system resources it requires. The BIOS allocates the needed resources to boot devices. If a board is not required to boot the system, however, the BIOS bows out, leaving resource assignment to the operating system. The BIOS only needs to get the system going well enough that the operating system can load and take over.
Plug-and-Play boards on the legacy ISA bus use a different process. They are isolated using card select numbers, assigned by the BIOS. Once each board is uniquely identified, it can be automatically configured by the BIOS (if it is required for booting the system) or by the operating system.
The ACPI configuration process and the ability to isolate individual boards hold advantages beyond automatic resource allocation. The greatly enlarge the potential capacity of storing firmware on each board.
In pre–Plug-and-Play days, the BIOS scanned each expansion board for additional BIOS code. That code had to fit in a tight range of addresses, and the code contained on each board could not overlap. Using Plug-and-Play technology, the BIOS scans each board in isolation, so conflicts between boards are not a problem.
The Plug-and-Play BIOS scans for additional code exactly like a pre–Plug-and-Play BIOS, looking for the special add-in ROM signature—the two-byte code 055(hex) followed by 0AA(hex)—that indicates a block of add-in BIOS code follows. The firmware on Plug-and-Play boards adds a pointer that immediately follows this signature to indicate the location of an expansion header in the BIOS code or a chain of several headers. Each header is identified by a special four-byte preamble—024(hex), 050(hex), 06E(hex), or 050(hex)—that corresponds to the ASCII characters $PnP.
The ACPI scheme allows the ROM on each expansion board to hold interface and driver code for multiple operating systems, each coded by its own expansion header. An operating system can identify the code that applies specifically to it by reading the headers.
The ACPI specification allows each board-maker a generous apportionment of the available memory and port addresses. Each board can use up to four noncontiguous ranges of memory base addresses for BIOS code and up to eight noncontiguous base addresses for input/output ports. In addition, a board can use from zero to two separate interrupt levels and up to two DMA channels. Each manufacturer determines the number of resources that a given board can use. Which it uses, however, is a matter left to the board-maker.
As this is written, the current ACPI specification is version 2.0a, and it runs over 500 pages long. You can download a copy from a Web site devoted to it, www.acpi.info.
|[ Team LiB ]|