Before you start
Objectives: Learn the difference between BIOS and CMOS. Also, learn how our PC starts.
Prerequisites: no prerequisites.
Key terms: device, chip, cpu, memory, parameter, motherboard, battery, post, load, data, power, address, software, firmware
ROM vs RAM
To enable our CPU to communicate with other devices on our motherboard, we implement a special chip on the motherboard called a ROM chip. ROM stands for Read Only Memory, and this kind of chip retains it’s contents even if the system is powered off. In contrast to ROM, a RAM chip loses it’s contents when the PC’s turned off. ROM chips that are installed on the motherboard contain programs that were burned into that ROM, that allow the CPU to communicate the with various devices attached to the motherboard. These devices include the keyboard, disk drives, memory, etc. Those programs stored on the ROM Chip are collectively referred to as theBasic Input/Output Services or BIOS chip.
BIOS
BIOS is the collection of programs contained in the ROM chip. We often refer to BIOS as the BIOS chip, but BIOS is not really the chip itself, it’s the software inside that’s really the BIOS. Most of the ROM chips that we use in a PC system for the BIOS are about 64K in size though there is 384k address space available for the BIOS to use. The CPU can read information from the ROM chip the same way it reads information from RAM. BIOS is not rewritable and it is an example of firmware. We should check for BIOS updates from manufacturers frequently. Updating the BIOS (called flashing the BIOS) makes new features available, such as allowing the BIOS to recognize newer hardware devices. Some motherboards have two BIOS chips, one for the main BIOS and a second for a backup.
Device Categories
Devices that are connected to or are part of the motherboard can be categorized into three different categories. We have devices that have no configurable parameters and aren’t likely to ever be replaced. We have devices that have configurable parameters or that are likely to be changed from time to time. And we have custom devices that may or may not be present in any given system. Devices that have no configurable parameters can be handled by the BIOS alone. These parameters don’t change so nothing has to be changed in the programming that allows the CPU to communicate with that given device. Keyboard is an example of such device. We don’t have to set anything in the BIOS to support these devices. Devices that may have configurable parameters or may be upgraded or changed from time to time, can’t actually be handled by the BIOS alone because the presence of the device or the quantities or parameters may change from system to system. For example, we may have 4 gigabytes of RAM on one machine, and 16 gigabytes on another machine. The same thing is with disk drives. We may have a hard drive installed in the system that has 40 gigabytes, and we could also have a 2 terabyte drive. If we had just the BIOS alone, theoretically if we changed anything on the system, we would have to have a new BIOS chip that supported the parameters associated with our new devices, because the BIOS isn’t rewritable. We can’t change anything in it. Instead of that, PCs use a second RAM chip in conjunction with the ROM chip that can be written to and read from. This is called the Complimentary Metal Oxide Semiconductor, or the CMOS.
CMOS
BIOS and CMOS work together, but they do different things. The BIOS contains programs that the CPU needs to communicate with the various devices on the motherboard. The BIOS can’t be rewritten. It’s ROM or Read Only Memory. CMOS on the other hand is RAM or Random Access Memory. The CMOS contains the parameters for programs in BIOS in order to access certain devices. When we add a new hard drive into the system, it will probably have different parameters than the one that was in our PC before. In that case, we actually update the CMOS, the Random Access Memory chip, with the new parameters for the new hard drive. To change the data stored in CMOS memory we can use a CMOS editor program that is part of our BIOS. When the CPU needs to access our new hard drive, it loads the appropriate programs from the BIOS, and those programs then check the CMOS for parameters of that new hard drive. BIOS and CMOS are sometimes called just the CMOS or just the BIOS. But remember, we can’t access the BIOS directly to change anything, we’re actually changing parameters in the CMOS. The CMOS also is where our system clock runs. Our operating system pulls time from the CMOS. CMOS chips are usually 64K in size and just like any other Random Access Memory chip, the data in the CMOS is not persistent. Remember that with the BIOS, the read only chip, we’re talking about persistent data. If we shut the system off and turn it back on, the content of the BIOS is intact. CMOS on the other hand will lose it’s contents if it loses power, and because of that the CMOS has to have a constant supply of electrical current to keep it’s data intact. To do that, we have to use a battery. On older systems it was 5 volts, and on newer systems it’s 3.3 volts. This battery keeps the contents of the CMOS chip intact while the system is shut down. The CMOS battery can be a low-voltage dry cell, lithium mounted on the motherboard, or even AA batteries in a housing clipped on a wall inside of the case. The electric current is about 1 millionth of an amp and can provide effective power for years. Most systems use some kind of on board battery, shown on picture below.
Image 293.1 – CMOS Battery
Newer systems build the battery into the CMOS itself, so we won’t find a separate battery in that case. If the voltage of the battery drops significantly, we may lose CMOS settings every time we power-off or power-on our computer. If a CMOS battery fails, replace it and afterwards reenter the CMOS information. During the computer’s startup procedure, we can press one or more keys to open a CMOS editor so we can change the data stored in CMOS memory. This CMOS setup program is part of the BIOS program. The key or keys we press to open the CMOS editor depend on the BIOS manufacturer. The easiest way to find out which key to press is to read the screen as it boots or to consult the motherboard documentation. The most common keys are Delete, Insert, F1, and F2. We can edit CMOS settings to change the boot device order, to enable or disable motherboard devices, to add a password to the setup program to prevent unauthorized access, to configure processor or memory settings (such as when you need to set operating speeds or when you want to overclock hardware settings), and to manually configure device properties for legacy devices. If we set a BIOS password and then forget it, we won’t be able to edit CMOS settings. To remove the password for most motherboards, move or remove an appropriate jumper, and then replace it after a specific period of time. Removing the battery also works, but that will remove all CMOS data, not just the BIOS password.
Custom Devices
The third category of devices that may or may not be present in any given PC system are custom devices. These include variety of different types of devices and device models that can be inserted in the expansion slots of a given PC. The problem with this category of devices is the fact that there’s no way to build a BIOS ROM chip or a CMOS RAM chip that’s extensive enough to accommodate every type of device that we could possibly put in the PC. Our PC system can use one of two strategies to allow the CPU to communicate with these types of devices. The first strategy is to put a BIOS chip on the device itself. This is done with devices such as SCSI boards that allow us to connect SCSI devices to the PC. These types of devices have their own ROM chip and it’s called an Option ROM. Video boards also use this strategy. The second strategy is to use device drivers. This is the more common strategy. In this case we are not using the BIOS anymore to address these devices. Instead we use a device driver, which is a piece of software that’s loaded by the operating system itself that tells the CPU how to address the attached device.
Boot Process
One of the main jobs of the BIOS is to help us start the system. Several different processes occur when we first turn the computer on. First the power is supplied to the CPU. The processor, the CPU, is hard coded to look at a special memory address for code that it can execute. This memory address contains a pointer which tells the processor where to find the BIOS program. The next process that occurs is that the CPU loads the BIOS program. The first BIOS process that occurs is POST or Power On Self Test. POST first verifies the integrity of the BIOS code. If the integrity of the BIOS code is good, it then looks for the BIOS on the video card. This allows a display signal to be sent to our monitor so we can see what’s happening during the power on process. Once that’s done it checks for other BIOS programs, such as hard disk controllers and loads those. The last process that occurs during POST is device check. The POST program goes through the system and checks all of the basic devices that are needed for the system to run. Such devices are memory, the keyboard and so on. We can notice when the POST checks our memory when we turn on our PC. We can see the memory counter up in the top left corner of the screen. That’s the POST testing our memory, seeing how much memory is installed in the system. After the POST tests are complete the BIOS identifies other system devices. It uses the information contained in CMOS chip, and information supplied by the devices themselves to identify and configure hardware devices. At this point that our plug-and-play devices are allocated system resources. The BIOS then searches for a boot drive using the boot order specified in the CMOS Setup Program. We can go into CMOS Setup Program and specify which device we want to boot from. Options can be DVD drive first, hard drive first, floppy drive first, flash drive. etc. The BIOS will search for boot device using configured boot order. On the boot device the BIOS searches for the master boot loader and then loads the boot loader program. At this point the BIOS stops controlling the system as control is then passed to the boot loader program. The boot loader program is configured to locate and load an operating system of our boot device, whether it’s a CD, DVD or hard disk. It will try to find the operating system and load its kernel. As the operating system loads, additional steps are taken to load additional programs and configure devices for use by the operating system.
Example CMOS Configuration
To enter the BIOS or CMOS configuration, we have to press certain key(s) while the system is booting. Most of the time the key which we need to press is displayed in the bottom of the screen while the PC is booting. As we mentioned, usual keys are Delete, F2, F1, Insert, Esc, etc. In our case we have to press the F2 key. The following screen will appear.
Example CMOS Screen
We are now in the CMOS setup program. Once inside we can select various parameters and change them. The process for changing these parameters varies from system to system. In our case we can select an item that has a triangle next to it by pressing Enter, and if we want to go back we use the Esc key. If a parameter doesn’t have a triangle next to it, we can simply use the “+” or the “-” key to change values. Notice that we have several tabs on the top of the screen. To change between those tabs we can use the left and right arrow keys. When we have made all the changes that we want, we have to go to the Exit tab in our case.
Exit Tab
Here we have several different choices. We can save the changes we have made and then exit the CMOS setup program, we can exit without saving changes, load defaults, discard changes without exiting, and save changes without exiting.
Typical reasons to change CMOS settings are to change the boot device order, to enable or disable devices on motherboard, to configure CPU or RAM settings, etc.
Remember
The CPU itself can’t directly access other devices that are installed on the motherboard. To do that, we have to have software. That software is stored in the basic input/output system or BIOS of the motherboard. These programs allow the CPU to communicate with other devices. For some devices we have to use the CMOS chip to store various parameters that the software and the BIOS need for the CPU to access them. There’s also a third category of devices that need device drivers or else they need their own BIOS loaded into the system in order for the CPU to use them. When it comes to boot order, CPU gets power and loads BIOS. The first BIOS process that occurs is POST. The BIOS then searches for a boot drive using the boot order specified in the CMOS Setup Program. On the boot device the BIOS searches for the master boot loader and then loads the boot loader program. At this point the BIOS stops controlling the system as control is then passed to the boot loader program. The boot loader program is configured to locate and load an operating system of our boot device.