开发者

How are instructions dispatched to devices in a computer?

This is my mental image of what happens and I am hoping for some corrections, clarifications and maybe even more details.

Basically, when the computer is powered on, the BIOS loads all devices on the PCI bus and makes them available at a certain pre-determined addresses. The same occurs with the PCI-express bus.

So each device can receive commands because drivers know where to look for them on the bus address wise?

Am I further correct in assuming that if you want to send instructions to your sound card that the driver tells the CPU(s) to broadcast the instructions on the appropriate bus and the correct device at the specified address will pick up the instructions a开发者_Go百科nd do its thing?

Is this visualization correct? Is video done differently due to the amount of data involved?


Most new bus systems have a probing mechanism, where the system can ask for all the devices to identify themselves and their position on the bus, and then the OS can map those identifications to device drivers, which can then specify the other resources they need. USB, PCI, PCI-Express, AGP, Firewire, SATA, Infiniband and Lightport all do this. It doesn't necessarily work precisely by 'addresses' though, it can be through a different bus controller mode, or even by a completely separate bus. For example, RAM chips have an SPI interface to configure them, while the actual data moves on some other interconnect. I had an embedded system at work that used SPI to configure the bus access to the flash disk that held the operating system... that was a really annoying device to make boot.

While the BIOS in a PC does actually set up all the PCI devices, most newer operating systems will immediately redo the process from scratch. EFI firmware in Intel-based Macs (and many servers) therefore only sets up what it actually needs to load the OS kernel, and leaves the rest for the OS. That's why Windows needs BootCamp or a HAL disk to actually boot on a Mac or a high-end server. Windows does the PCI probing quite late on ordinary PCs, and does need the BIOS setup for a while, but on Macs and some server systems it needs a different HAL loaded to do the hardware scan immediately.

If you want to really understand this stuff, reading the Linux kernel is extremely instructive, especially as to the differences between PCs and other systems.


Graphiccards are connected to the AGP bus which is handeld by the north bridge, PCI devices as well as ATA devices are connected to the south bridge. A nice introduction is here


Yes, you could use this simplification to imagine on a coarse scale how it works. And it works also the same with video.

Of course, if you get into the details, you'll find it a bit more complicated because there are several techniques involved and every device can in theory work a bit different. Be prepared to face IRQ, DMA, different memory mappings, etc...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜