Where is the BIOS stored?

From http://en.wikipedia.org/wiki/BIOS:

BIOS software is stored on a non-volatile ROM chip on the motherboard. ... In modern computer systems, the BIOS contents are stored on a flash memory chip so that the contents can be rewritten without removing the chip from the motherboard. This allows BIOS software to be easily upgraded to add new features or fix bugs, but can make the computer vulnerable to BIOS rootkits.

Since ROM means Read-Only Memory, why can the BIOS contents be rewritten?

Does the "flash memory chip" mean the same as the "non-volatile ROM", both meaning where BIOS is stored?


Solution 1:

To add to Varaquilex's answer, the BIOS software is stored in an Electrically Erasable and Programmable ROM (EEPROM) which enables firmware updates to be performed electronically. Very old BIOS chips were actually UV-EPROM chips which required erasing with UV light exposure before they could be reprogrammed.


Edit: As has been pointed out in the comments, even earlier than that single use Programmable ROM (PROM) chips were sometimes used which could not be reprogrammed at all once configured and required complete replacement to upgrade (although this was rarely required).

Solution 2:

ROM is read only, so why is the BIOS contents can be rewritten?

BIOS program itself is stored in an EEPROM (which can be [E]lectrically [E]rasable and [P]rogrammable) or a flash-memory. So the read-only here is about the chip being non-volatile. The contents of the memory stays when the power is cut off, unlike volatile RAM. The ROM being EEP helps the BIOS can be re-written or updated. Back then for such operations, you had to remove the BIOS chip from the board, put a new one (if its not PROM or EPROM), or if its EPROM you have to get it to the manufacturer and let them re-program the chip and re-attach it to the board. After the current advances, thanks to EEPROMs, you do not have to remove chip to do such operations, you just make the computer do the job electrically.


Does the "flash memory chip" mean the same as the "non-volatile ROM", both meaning where BIOS is stored?

from Wikipedia:

Flash memory is an electronic non-volatile computer storage medium that can be electrically erased and reprogrammed.

Flash memory was developed from EEPROM (electrically erasable programmable read-only memory). There are two main types of flash memory, which are named after the NAND and NOR logic gates. The internal characteristics of the individual flash memory cells exhibit characteristics similar to those of the corresponding gates. Whereas EPROMs had to be completely erased before being rewritten, NAND type flash memory may be written and read in blocks (or pages) which are generally much smaller than the entire device. NOR type flash allows a single machine word (byte) to be written—to an erased location—or read independently.

EEPROM and flash memory do not refer to same thing: they are two similar memory types as one is developed from the other and contain different type/configuration of MOS transistors. However, they are the memory where BIOS program resides.


To address another misconception I want to mention this CMOS-BIOS relationship:

The BIOS settings are stored in the CMOS chip (which is kept on power via the battery on the motherboard). That is why the BIOS is reset when you remove the battery and re-attach it. The same program runs but the settings are defaulted. See this answer for a detailed view of memories used during the booting process.

Edit

To extend the CMOS-BIOS topic, thanks to @Andon M. Coleman, I want to add his comment to the answer:

It is worth mentioning that the BIOS settings do not have to be stored in volatile CMOS memory. There are plenty of embedded systems that store their settings in NVRAM. The only reason PCs have gotten away with using volatile CMOS over all these years is that they already had a battery to keep the internal real-time clock ticking while the power is off (recall that when you pressed the power switch on a PC-AT, it literally cut all power off to the motherboard). This meant that cheaper volatile memory could be used to store system settings. So it is mostly for historical purposes.