1) IO (ports) / MMIO. IO ports are in/out instructions, whereas MMIO has memory semantics.
Everything starts with IO ports. Older devices (most ISA, many PCI) are entirely implemented with IO ports - including some notably important devices like the PS/2 controller or VGA device. But the key here is the PCI controller - it needs one specific IO port command (0xcf8 bit 31) to enable itself as MMIO and from there set up all other MMIO devices. So you need at least a few IO port accesses to bootstrap any MMIO access.
It's certainly a legacy feature, much like real/protected mode. And it shows you how legacy cruft builds up: two decades ago, it was "better" to disable MMIO by default to avoid risk of breaking OSes that didn't know that PCI could overlay memory. PCIe finally switched to default-enabled, but only more recent OSes know how to use PCIe.
2) PIO (Programmed IO) / DMA. PIO is a mode of storage controllers which speak the ATA command set (basically, IDE controllers). PIO works by directly reading transferred bytes out of a register, whereas DMA works by setting up a command then waiting for an interrupt to be delivered.
"Small" pieces of code tend to use PIO mode because it's much simpler to set up. Especially for firmware (BIOS/EFI) or bootloaders, which run with interrupts disabled and thus would get no advantage from the more complicated DMA mode. So: you need PIO for the first few seconds of the virtual machine's life, until it can bootstrap itself up to more advanced IO modes.
从一个国外网站摘的
阅读(1886) | 评论(0) | 转发(0) |