Where is the BIOS stored?

56

17

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?

Ben

Posted 2014-01-26T16:14:22.110

Reputation: 1 655

1@TomXP411, The analogy is appropriate, why do you say that it isn't? How is it inappropriate? – Pacerier – 2015-04-23T22:51:29.807

2

CMOS contains system settings[BIOS settings] that can be modified by a user[in the BIOS screen]. So, according to http://cpsforum.blogspot.co.uk/2012/06/inside-ur-pc-10-difference-between-bios.html "[calling that screen you enter] CMOS setup is more appropriate than calling [it] BIOS setup." and http://www.bayt.com/en/specialties/q/7459/what-is-the-difference-between-bios-and-cmos/ "BIOS is modified only via flashing of new version." and "The BIOS is a set of instructions which controls motherboards boot process. "

– barlop – 2014-01-26T16:38:46.643

4Except, nobody sets up CMOS. That is like saying you setup the gas tank in a car when you start your car. – Andon M. Coleman – 2014-01-26T22:03:08.103

4ROM is read only, so why can the BIOS contents be rewritten? It’s a misnomer caused by convention. – Synetech – 2014-01-27T02:44:10.277

1Had you read the articles behind the links in Wikipedia which you highlighted in your question, it should have occured to you, that the answer was that flash memory is not an actual ROM. Even though the confusion may be common, in my opinion it is a poor question, because it stems solely from a lack of reading the freely available sources! – I'm with Monica – 2014-01-28T08:20:20.873

1Actually, Andon, the first thing I do in any new computer build is set up my CMOS settings. The car gas tank analogy is completely inappropriate in this context. – TomXP411 – 2014-01-28T21:56:03.800

As to ROM being read-only, that's technically not true any more, but since Flash memory serves the same task as ROM chips did in the old days, the nomenclature is still used. (And really, how often is it it that people flash their BIOS? Most users will never do so.) – TomXP411 – 2014-01-28T22:03:38.720

1

Question featured on How-to-geek. http://www.howtogeek.com/180798/where-is-the-bios-stored/

– dayuloli – 2014-06-07T15:37:55.450

Answers

60

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).

zelanix

Posted 2014-01-26T16:14:22.110

Reputation: 1 134

2Even earlier, And some were non-erasable ROMs/PROMs, which would have to be replaced with new ROMs if you wanted to install a new BIOS. Of course at that time the BIOS was doing less, and changed quite rarely. – keshlam – 2014-01-26T20:20:57.443

Ah, yes. UV-EPROM... Its always fun to pull off the label on UV-EPROM BIOS and see the little window used to reprogram the chip. Literally nobody has the equipment necessary to reprogram them, so I never did understand why they did that on consumer (non-developmental) hardware. You would have to send it into a factory to have this done, at which point the mfg. could have saved money by using standard mask ROM. – Andon M. Coleman – 2014-01-26T22:06:59.543

3@AndonM.Coleman In lower volumes, using EPROMs, or (even earlier) the fuse-type PROMs, may in fact have been cheaper than having a mask ROM cut. For instance, if memory serves, basically all of the early-80s arcade machines had their software on PROMs or EPROMs, even though it would never be changed, because it was cheaper at the intended production volume. – zwol – 2014-01-27T00:02:35.783

1UV-EPROMs (EEPROMs) were never intended for consumer reprogramming AFAIK. When a device goes back to the factory for repair or whatever, it's handy to be able to upgrade the firmware by swapping out or reprogramming the EEPROM. – rossnz – 2014-01-27T00:03:40.413

@rossnz: That was my point though - why spend extra money on programmable ROM if the only way it can be programmed is in the factory. You still have to remove the chip to reprogram it, at which point simply manufacturing the computer with a non-programmable socketed ROM might have been more cost effective. But as Zack points out, it comes down to production volume, which I had not considered. – Andon M. Coleman – 2014-01-27T00:14:24.413

There are stories about a large US restaurant chain that did not allow flash photography in its restaurants because often, when someone took a flash picture, the cash registers stopped working. They later figured out that there was a grille on the side of the register that let in the light of the camera flashes right onto some UV-EPROM chips. (I don't know which chain, and I don't know if it is even true at all, but it could well be...) – Moshe Katz – 2014-01-27T02:23:38.530

1@AndonM.Coleman - Masked ROMs have a substantial one-time setup charge. UV-EPROMs, while more expensive on a per-unit basis, are often cheaper for short-run (< 10K) production. – Eric Brown – 2014-01-27T18:43:08.767

@rossnz an _EE_PROM is an _E_PROM that can be reprogrammed without UV light. The number of Es is significant. – Phil Frost – 2014-01-27T19:30:08.067

What do you mean nobody has the equipment to reprogram an EEPROM? It was easily rigged up with a parallel port and I/O expander - something like an 8255. Regardless, consider the advantage to a manufacturer who discovers a tiny bug which needs to be fixed - UV meant paying overtime to fix existing units, not the delay and cost of sourcing replacements. UV light is not required to Program EPROMs, only to erase them. Stories of erasing a UV eeprom with a camera flash seem rather preposterous - you'd be damaging your eyes with a flash that could do that in any small number of repetitions. – Chris Stratton – 2014-01-27T19:56:09.480

@ChrisStratton: How many consumers or PC repair shops do you know of that have the necessary hardware/software to update the BIOS? Even when UV-EPROM was common, the only people who could reprogram it would be tied very closely to the manufacturer. For a consumer or local repair shop, this would mean handing off the component to a licensed service center. It is not like it is today where you can download and reprogram BIOS images from the Internet or a BBS. Also, you cannot meaningfully reprogram an EPROM without erasing it first. It only takes 1 flipped bit for a BIOS to stop working, BTW. – Andon M. Coleman – 2014-01-27T20:57:49.800

Back in the day, most PC repair/build shops had an EPROM burner - likely not every copy of a bios that went into an XT clone was licensed. These were standard parts, containing a program performing highly standardized functionality - although not what we got, it was hinted copies of the IBM ROMs would work in the machine we purchased. EPROMs when purchased typically came blank, able to be programmed without erasure. You only needed the UV if you made a mistake and wanted to re-write one. Even then, you could turn 1's into 0's without erasure, a fact still exploited by some storage schemes. – Chris Stratton – 2014-01-27T21:06:31.143

@ChrisStratton Have you ever flashed a camera while holding it directly in front of your face? I can still see a very faint shadow of the reflector on a disposable camera I was playing with about a week ago. Camera flashed do in fact damage your eyes. – AJMansfield – 2014-01-28T02:25:13.427

@ChrisStratton: A typical camera flash will not knock loose enough electrons to permanently change an EPROM bit, but many kinds of chips, especially those using dynamic logic, are sensitive to light. Most such chips are enclosed in opaque packages, so light-sensitivity wouldn't be an issue unless they were decapped, but some EPROM-based microcontrollers have quartz windows. – supercat – 2014-01-28T16:09:25.247

Indeed, phototransistor effects leading to a temporary crash are a much more plausible explanation than eeprom cell erasure. Years ago, decapping DRAM chips to make crude cameras was briefly in vogue; I tried it, but without putting real effort into optics (just trying to light/shadow half the array) all I was getting was phototransistor action of the output circuitry. – Chris Stratton – 2014-01-28T16:14:10.260

Takes 20 minutes to reliably erase EPROMs. Emulators exist that are pin compatible & can have programs sent via serial port easing dev. ROMs are dirt cheap compared to the erasable ROMs, and EPROMs suck - take 5 minutes to write to! OTOOH emulators had fun quirks also; I saw a ticket dispenser go haywire because the emulator had enough voltage leaking through the serial port to stop it from blanking when the board was off! Ha ha ha, good times. Electrical faults, broken pins, static, loose wiring, cold solder joints, worn sockets, bad cables, embedded systems: not for the faint of heart. – ggb667 – 2014-01-28T16:20:30.123

40

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.

Varaquilex

Posted 2014-01-26T16:14:22.110

Reputation: 3 620

@pestilence669, What do you mean by "qualifying a loop"? – Pacerier – 2015-04-23T21:52:46.087

@Pacerier That's a good question. I think I meant "terminating." If I wasn't careful to preserve my CX register, REP STOSW & such would wipe my settings. – pestilence669 – 2015-05-19T02:15:45.000

@pestilence669, Is it salvageable? Or does the devices get bricked? – Pacerier – 2015-05-24T21:02:51.143

@Pacerier Yes. In those days, the BIOS itself was in EEPROM, although, some boards would move it to RAM for more speed, so you could only kill the BIOS itself until you reboot. – pestilence669 – 2015-05-31T07:37:27.000

@pestilence669, That's mad... is that true? Why would BIOS be fully migrated to RAM and deleted from the persistent storage? – Pacerier – 2015-11-09T18:39:08.837

@Pacerier, See Shadow RAM (https://support.microsoft.com/en-us/kb/78528). It wasn't deleted, it was a performance optimization. I, however, was using non-protected memory (real) mode... so, I could seriously screw up things. The settings, however, WERE persisted in CMOS.

– pestilence669 – 2015-11-10T20:12:33.690

@pestilence669, What happens if you accidentally bricked the device? Are the PC shop guys able to save it? – Pacerier – 2015-11-11T22:08:43.287

3It 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. – Andon M. Coleman – 2014-01-26T22:22:56.937

1@AndonM.Coleman This is valuable. I'll add this to my answer. Thanks for the insight, I learnt something new :) +1 – Varaquilex – 2014-01-26T23:15:36.567

2Back in the day, 80286 boards used to memory map the CMOS. I found out the hard way by not qualifying a loop properly and wiping my hard drive settings... often. – pestilence669 – 2014-01-28T05:17:05.033

27

As a supplement to the other answers, I like a more visual approach:

BIOS location

This BIOS chip doesn't seem to be particularly well seated in its socket.

The BIOS, including fancy new UEFI BIOSes, are software stored on a chip on the motherboard. The technical details have already been covered by zelanix and Varaquilex.

The chip is is often, but not always, removable for easier servicing. Some motherboards include more than one BIOS, mostly as a sales gimmick, but in some cases the second BIOS helps recover from certain (usually user-caused) problems:

Dual non-removeable BIOS

Charles Burns

Posted 2014-01-26T16:14:22.110

Reputation: 735

@CharlesBurns, Why do you call UEFI EUFI? – Pacerier – 2015-04-23T22:46:17.977

@Pacerier: Apparently I'm a little lisdexic. :) Fixed. – Charles Burns – 2015-04-23T23:09:39.683

@TomXP411, What happens when you update your backup BIOS and had that bricked? – Pacerier – 2015-05-24T16:18:00.513

6That's not a sales gimmick at all... do you know how scary a BIOS update can be? you get all kinds of warnings when you do it, and if you manage to botch the process (and sometimes even if you do everything right), you end up with a bricked PC. Oh, and "BIOS updates are not covered under your manufacturer warranty."

That's why the back up BIOS was invented. It's not about marketing. it's just that little bit of extra safety.

(And yes, I've bricked a computer doing a BIOS update. We had to send the motherboard to the manufacturer to get the BIOS re-flashed.) – TomXP411 – 2014-01-28T22:08:20.793

You make a good point, though BIOS updates are greatly improved in recent years. No longer is it required to boot to DOS and find a floppy drive. In a recent Asus board, for example, the update can be done within Windows or directly from the UEFI BIOS, which reads the file right off of NTFS. This is for motherboards. Manufacturers like 3Ware (no Avago) still expect you to figure out how to fit a 10MB BIOS on a 1.44MB disk image. They provide no backup BIOS. – Charles Burns – 2014-01-28T22:12:45.227

@CharlesBurns tw_cli can do 3ware BIOS updates with the machine booted. – derobert – 2014-01-29T18:50:26.970

@derobert My last BIOS update was an attempt to correct a server that wouldn't boot due to a 3Ware driver update (since 3Ware requires the drivers, software, and firmware match). In that case, the inability to do an update with an unbootable OS made things tricky, and the latest 3Ware CD wouldn't boot (despite the motherboard being on the supported list). But you are totally correct: tw_cli can update the BIOS. I'd forgotten about that. :) – Charles Burns – 2014-01-29T19:00:42.083

7

It may also be worth noting that on most machines before the 80286, data could be read from ROM just as quickly as from RAM, but while RAM bandwidths have improved enormously since the 1980's, commodity-ROM bandwidths have not [fast ROM chips do exist, but increasing the ROM's speed beyond a certain point would increase the price]. Since reading every byte of a BIOS ROM once would only take a fraction of a second, some 80386 machines and most 80486-and-later machines offered an option to copy the BIOS to RAM on start-up. Modern machines take things even further, and actually place the BIOS ROM chips on a bus which is entirely separate from the RAM bus and is much slower. Unlike 80486-era machines which would start out by running from ROM a program which would copy itself to RAM, many newer machines have processors that can't run code from ROM at all. Instead, they have circuitry which on start-up reads certain parts of the ROM into RAM and executes it.

supercat

Posted 2014-01-26T16:14:22.110

Reputation: 1 649

Right, that would explain how a modern BIOS chip can have only 8 or so wires. Modern Flash memory actually uses a serial interface. – TomXP411 – 2014-01-28T22:11:18.127

1

Look at that Wikipedia article as it read in January 2005:

Before 1990 or so BIOSs were held on ROM chips that could not be altered. As their complexity and the need for updates grew, BIOS firmware is stored on EEPROM or flash memory devices that can be upgraded by the user. However, an improperly executed or aborted BIOS update can render the computer or device unusable. To avoid BIOS corruption, some new motherboards have a backup BIOS. Also, most BIOSes have a "boot block" which is a portion of the ROM which runs first and is not updateable. This code will verify that the rest of the BIOS is intact (via checksum, hash, etc.) before jumping to it.

Nowadays, of course, we have a Wikipedia article that confuses people by saying that the chip is "non-volatile ROM" in one breath and that it can be written to in the next. The lesson to learn here is that Wikipedia often isn't very well written, and that articles change, not always for the better.

I suggest reading books. Scott Mueller's Upgrading and Repairing PCs, to pick one of several books, has a whole chapter on the BIOS, that discusses all sorts of things from where the BIOS chip is located to the various sorts (listing four: ROM, PROM, EPROM, and EEPROM) of such chips.

Some quotes:

No matter which type of ROM your system uses, the data stored in a ROM chip is [sic] nonvolatile and remains indefinitely unless intentionally erased or overwritten (in those cases where that is possible). — Upgrading and Repairing PCs, p.373

Virtually all PCs built since 1996 include a flash ROM to store the BIOS. A flash ROM is a type of EEPROM chip you can erase and reprogram directly in the system without special equipment. — Upgrading and Repairing PCs, p.387

Books aren't perfect. One can argue details with Mueller's "first blush" definition of flash memory here, for example. But the good ones are generally proofread and have more coherent explanations than much of Wikipedia has, that at least don't contradict themselves from sentence to sentence.

Presuming a modern PC, and not getting bogged down in how PCs used to work two decades ago:

Your machine's firmware is held on a non-volatile memory chip on the motherboard. It actually holds quite a lot. (The Pm49FL004T mentioned in my answer here holds half a MiB, and as mentioned in my answer here some chipsets are capable of supporting 16MiB of firmware.) It's involved in a lot more than just the system bootstrap, even for protected mode operating systems. Its contents are modifiable, but not as easily as the (volatile) contents of the main system RAM. On EFI systems, the chip not only holds the firmware code and (read-only) data but the values of the non-volatile EFI variables.

JdeBP

Posted 2014-01-26T16:14:22.110

Reputation: 23 855

0

The original ROM was literally manufactured that way at the silicon level. Once they made it electrical programmable by users then a few things:

  1. in many they have a hardware voltage step-up circuit internally that allows 3.3V or 5V to get jumped up internally to 12V to do the actual programming. This is true for the older PROM, EPROM, UVEPROM, oR EEPROM.

  2. If available in older models, UV (Ultra-violet light) eraseable feature allowed the circuits to only enable internal +12V on programming the device, and a UV window allowed the UV light into the chip area, but the UV window had to be covered after programming or the chip would erase under any room flourescent lighting. The UV eraseable was also very fast to erase, much faster than reprogramming the whole chip to 0's or 1's.

In many cases there is a step-up circuit internal to all "programmable" PROMs.

  1. The later EEPROM allowed electrically eraseable, to the EPROM or UVEPROM.

  2. Later Flash technology came along and added different circuit technology (at the transistor level) and higher densities than the older EEPROM.

  3. In almost all cases ever since the original ROM was stopped, almost all BIOS PROMs are suspect in many (25% ?) of computer issues. These later PROMs (which all have some programmable feature) can be damaged or just 'forget' their program over time.

PROMs, no matter how erased or reprogrammed should be handled with care (ESD damage), and aging, or humidity.

In around 1/4 the bad computer cases re-programming a "good" BIOS usually corrects the problem. So, even if your BIOS is "good", it always pays to reflash if possible.

charles

Posted 2014-01-26T16:14:22.110

Reputation: 1

0

Actually, in last days there is more sofisticated system how to store BIOS. Imagine 2 storage banks similar to your flash drive, just smaller. One of them is accessed read only and second is available to be written (to flash new version of the BIOS). Reason for 2 parts is a backup, when writing of new BIOS is not successful. If Flashing of new BIOS succeed this 2 parts will switch and device could be rebooted under new BIOS.

BEWARE: not all kind of devices has this system. Sometimes is a simple small flash memory which is simply overwritten. Usually, you are prompted to backup the electricity and not to interrupt the upgrade process.

In old times of motherboards there was EPROM memory, which could be rewritten after memory was erased by strong light, or later a PROM memory, which could be written just once. Both could be done only by special programming device, so BIOS chip should be removed from the device to be written.

Dee

Posted 2014-01-26T16:14:22.110

Reputation: 240

0

In the original IBM PC the BIOS "ROM" was, I believe, some sort of electrically programmable ("write once") ROM (EPROM). I think it was socketed, but there was no real expectation that it would be "upgraded" in the field. Other computers of the era used something similar.

As systems got more complex it became more advantageous to have the BIOS "field upgradeable" (and without the need to open the box and physically swap the part). So systems began having various types of rewriteable BIOS "ROMs". The advantages were three:

  1. The likelihood of a bug became greater as systems got more complex.
  2. It was attractive to have the ability to upgrade, to incorporate new features.
  3. For motherboards that might be used in several different boxes (perhaps even under different brand names), it was attractive to be able to factory-customize the BIOS for the specific use.

Larger boxes, around the same time as the original IBM PC, also began having some sort of read-only "boot" memory instead of the more primitive "bootstrap loader" technology. Some of these were mask-programmed ROM, some EPROM, some even RAM that was read from a diskette via a small "service processor".

Daniel R Hicks

Posted 2014-01-26T16:14:22.110

Reputation: 5 783

Yes, yll of the chips (except maybe the I/O chips) on PC and XT motherboards were socketed. And it was useful. I had to swap a couple of chips out on XT boards for various reasions.

In fact, some of the early PC's did require BIOS updates, and the original PC actually had an entire programming language in ROM. I seem to recall there were some updates needed to the first generation PC's for diskette drives... – TomXP411 – 2014-01-28T22:12:38.510

@TomXP411 - Yeah, I forgot that the original PC had a BASIC interpreter in ROM. But technically that was in a separate ROM from the BIOS, IIRC. The BASIC had some pretty well documented bugs in the first version, but I don't recall that they shipped an update to fix them -- you just needed to buy a new PC with the updated version. Something like version 1.2. – Daniel R Hicks – 2014-01-28T23:27:33.777

-1

the BIOS is stored in either on CMOS chip or NVRAM, which are small amounts of non-volatile memory on your motherboard (that is, they hold data indefinitely without needing power).

As for what message you get if everything passes the post, on older machines you'll usually get a single beep from your machine if everything checked out.

On newer machines, you won't get anything: you won't see the post, there won't be any messages, beeps, nothing... sort of a "no news is good news" type of deal. If you still want to see the POST run on a newer machine, the key to hit (at least on the computers I've used) is Tab. Hit that a few times right after you turn on the power to see the POST on the screen. Alternatively, there should be an option to have the POST come up on the screen in your BIOS settings.

amar

Posted 2014-01-26T16:14:22.110

Reputation: 1

4You are confusing the bios program with it's settings data. The obvious distinction: remove the backup battery and the program still runs, but its settings are reverted to default. While the settings are battery backed, the program is stored in a "read mostly" memory technology which requires active measures to erase. – Chris Stratton – 2014-01-27T19:59:37.840