Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Realize that I am NOT asking about how MMIO (memory mapped input/output) is set up, but asking how it is mapped, I.e, what maps it exactly? Not what is mapped to what, I can Google a memory map for that.

What I want to know is, such as once you first power on the computer, what exactly "maps" the memory, or how does that work?

Basically, what sets up the memory or "maps" it for certain purposes?

I had originally thought it was boot firmware, like BIOS or EFI/UEFI, but another user on another site told me it had to do with a memory controller. Is that true?

But how, if in more detail, if not too much to ask? Thanks very much to any who clarify!

share|improve this question
The "mapping" is done in hardware, specifically an address decoder. The specific address or range of addresses that correspond to a device generates a CS (chip select) signal for that device. – sawdust May 15 '13 at 2:36
Not clear enough. – Dinosaur pawz May 15 '13 at 2:59

There are a few steps. First, the BIOS discovers all the devices on the system. Then it interrogates each device to decide whether the BIOS will set that device up and, if so, determine how much memory address space, if any, the device needs. The BIOS then assigns space to each device and program's the address decoder by writing to its BAR (base address register).

In sum, the BIOS:

  1. Discovers the device's BARs (base address register). Each device can have up to six BARs.

  2. For each BAR, asks the BAR how much address space it needs.

  3. Assigns the BAR a block of address space.

  4. Programs the BAR with the base address of the chosen block of memory address space.

The device's address decoder now responds to reads and writes inside that block of address space. From then on, when the CPU (or any device in the system capable of DMA) reads from or writes to any address inside that range, the device will respond to the request.

Note that no memory is assigned to the device. The memory is on the device. It's memory address space that's assigned to the device.

You can, of course, find the process detailed on Wikipedia's PCI configuration space page.

share|improve this answer
So I was right; it is the firmware that does it. Thanks! – Dinosaur pawz May 15 '13 at 5:44
This is a PC-centric answer that describes only how PCI sets up memory mapping for a card. PCI is a bus for cards that are "plug and play", and designed to be self configuring. More often, devices are assigned their addresses when the motherboard or SBC or SoC is designed, and then hardwired (or programmed into an FPGA) into an address decoder. Integrated devices simply don't need dynamic assignment of their addresses like a PCI card. – sawdust May 15 '13 at 9:25
It was a PC-centric question. – David Schwartz May 15 '13 at 16:48
I like sawdust's answer better; he/she shouls have elaborated better. – Dinosaur pawz May 16 '13 at 23:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.