Shehan Jayasinghe
Shehan Jayasinghe

Reputation: 49

How does the a CPU know the physical address range of a peripheral device?

For instance, how does it know that all addresses between:

0xXXXXXX and 0xYYYYYY

map to the RAM / Graphics Card / Monitor / etc...

on the motherboard?

Upvotes: 3

Views: 1183

Answers (1)

Pepito
Pepito

Reputation: 131

It does not know exactly everything you listed.

What's the key to all this is that a CPU never goes alone inside a silicon chip. There are indeed a lot of specialized hardware circuits called peripherals that compose every processor.

What it does know then, is the location on its memory space of every peripheral internal to the chip/SoC. For obvious reasons, as it is wired that way by the chip designer (Intel, Freescale, AMD, ...)

By extension, the external RAM being controlled by an internal peripheral (the DRAM controller), it does also know the address of the external DRAM. Same goes for the external peripherals on a PCIe bus, as they are driven by a PCIe controller. And so on.

However, the processor itself does not know what's on the PCIe bus, that's the job of the drivers and the operating system to have the awareness of all this. A lot of our computer stuffs are wired on a PCIe bus at some point. Through a companion chip, or directly, ... To identify precisely what's present on this bus, and what driver to load for each of these peripheral, there's a handshake of identifiers exchanged between the OS and the peripherals. So that the OS can know at what address resides the GPU, the USB bus, the SATA bus, etc.

Upvotes: 2

Related Questions