Skip to content

Commit 32ec465

Browse files
Rongronggg9tsbogend
authored andcommitted
MIPS: Loongson2ef: Use pcibios_align_resource() to block io range
Loongson2ef reserves io range below 0x4000 (LOONGSON_PCI_IO_START) while ISA-mode only IDE controller on the south bridge still has a hard dependency on ISA IO ports. The reservation was done by lifting loongson_pci_io_resource.start onto 0x4000. Prior to commit ae81aad ("MIPS: PCI: Use pci_enable_resources()"), the arch specific pcibios_enable_resources() did not check if the resources were claimed, which diverges from what PCI core checks, effectively hiding the fact that IDE IO resources were not properly within the resource tree. After starting to use pcibios_enable_resources() from PCI core, enabling IDE controller fails: pata_cs5536 0000:00:0e.2: BAR 0 [io 0x01f0-0x01f7]: not claimed; can't enable device pata_cs5536 0000:00:0e.2: probe with driver pata_cs5536 failed with error -22 MIPS PCI code already has support for enforcing lower bounds using PCIBIOS_MIN_IO in pcibios_align_resource() without altering the IO window start address itself. Make Loongson2ef PCI code use PCIBIOS_MIN_IO too. Fixes: ae81aad ("MIPS: PCI: Use pci_enable_resources()") Cc: stable@vger.kernel.org Tested-by: Beiyan Yun <root@infi.wang> Tested-by: Yao Zi <me@ziyao.cc> Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com> Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 6a00c04 commit 32ec465

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • arch/mips/loongson2ef/common

arch/mips/loongson2ef/common/pci.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static struct resource loongson_pci_mem_resource = {
1717

1818
static struct resource loongson_pci_io_resource = {
1919
.name = "pci io space",
20-
.start = LOONGSON_PCI_IO_START,
20+
.start = 0x00000000UL, /* See loongson2ef_pcibios_init(). */
2121
.end = IO_SPACE_LIMIT,
2222
.flags = IORESOURCE_IO,
2323
};
@@ -77,6 +77,15 @@ void __init loongson2ef_pcibios_init(void)
7777
{
7878
setup_pcimap();
7979

80+
/*
81+
* ISA-mode only IDE controllers have a hard dependency on ISA IO ports.
82+
*
83+
* Claim them by setting PCI IO space to start at 0x00000000, and set
84+
* PCIBIOS_MIN_IO to prevent non-legacy PCI devices from touching
85+
* reserved regions.
86+
*/
87+
PCIBIOS_MIN_IO = LOONGSON_PCI_IO_START;
88+
8089
loongson_pci_controller.io_map_base = mips_io_port_base;
8190
register_pci_controller(&loongson_pci_controller);
8291
}

0 commit comments

Comments
 (0)