@@ -274,8 +274,6 @@ the PCI device by calling pci_enable_device(). This will:
274274 o allocate an IRQ (if BIOS did not).
275275
276276NOTE: pci_enable_device() can fail! Check the return value.
277- NOTE2: Also see pci_enable_device_bars() below. Drivers can
278- attempt to enable only a subset of BARs they need.
279277
280278[ OS BUG: we don't check resource allocations before enabling those
281279 resources. The sequence would make more sense if we called
@@ -605,40 +603,7 @@ device lists. This is still possible but discouraged.
605603
606604
607605
608- 10. pci_enable_device_bars() and Legacy I/O Port space
609- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
610-
611- Large servers may not be able to provide I/O port resources to all PCI
612- devices. I/O Port space is only 64KB on Intel Architecture[1] and is
613- likely also fragmented since the I/O base register of PCI-to-PCI
614- bridge will usually be aligned to a 4KB boundary[2]. On such systems,
615- pci_enable_device() and pci_request_region() will fail when
616- attempting to enable I/O Port regions that don't have I/O Port
617- resources assigned.
618-
619- Fortunately, many PCI devices which request I/O Port resources also
620- provide access to the same registers via MMIO BARs. These devices can
621- be handled without using I/O port space and the drivers typically
622- offer a CONFIG_ option to only use MMIO regions
623- (e.g. CONFIG_TULIP_MMIO). PCI devices typically provide I/O port
624- interface for legacy OSes and will work when I/O port resources are not
625- assigned. The "PCI Local Bus Specification Revision 3.0" discusses
626- this on p.44, "IMPLEMENTATION NOTE".
627-
628- If your PCI device driver doesn't need I/O port resources assigned to
629- I/O Port BARs, you should use pci_enable_device_bars() instead of
630- pci_enable_device() in order not to enable I/O port regions for the
631- corresponding devices. In addition, you should use
632- pci_request_selected_regions() and pci_release_selected_regions()
633- instead of pci_request_regions()/pci_release_regions() in order not to
634- request/release I/O port regions for the corresponding devices.
635-
636- [1] Some systems support 64KB I/O port space per PCI segment.
637- [2] Some PCI-to-PCI bridges support optional 1KB aligned I/O base.
638-
639-
640-
641- 11. MMIO Space and "Write Posting"
606+ 10. MMIO Space and "Write Posting"
642607~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
643608
644609Converting a driver from using I/O Port space to using MMIO space
0 commit comments