summaryrefslogtreecommitdiff
path: root/arch/mips/loongson2ef/common
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/loongson2ef/common')
-rw-r--r--arch/mips/loongson2ef/common/machtype.c3
-rw-r--r--arch/mips/loongson2ef/common/pci.c18
-rw-r--r--arch/mips/loongson2ef/common/setup.c1
3 files changed, 13 insertions, 9 deletions
diff --git a/arch/mips/loongson2ef/common/machtype.c b/arch/mips/loongson2ef/common/machtype.c
index 82f6de49f20f..e635e66d2e6c 100644
--- a/arch/mips/loongson2ef/common/machtype.c
+++ b/arch/mips/loongson2ef/common/machtype.c
@@ -48,8 +48,7 @@ void __init prom_init_machtype(void)
return;
}
p += strlen("machtype=");
- strncpy(str, p, MACHTYPE_LEN);
- str[MACHTYPE_LEN] = '\0';
+ strscpy(str, p);
p = strstr(str, " ");
if (p)
*p = '\0';
diff --git a/arch/mips/loongson2ef/common/pci.c b/arch/mips/loongson2ef/common/pci.c
index 7d9ea51e8c01..0f11392104bf 100644
--- a/arch/mips/loongson2ef/common/pci.c
+++ b/arch/mips/loongson2ef/common/pci.c
@@ -17,7 +17,7 @@ static struct resource loongson_pci_mem_resource = {
static struct resource loongson_pci_io_resource = {
.name = "pci io space",
- .start = LOONGSON_PCI_IO_START,
+ .start = 0x00000000UL, /* See loongson2ef_pcibios_init(). */
.end = IO_SPACE_LIMIT,
.flags = IORESOURCE_IO,
};
@@ -73,15 +73,19 @@ static void __init setup_pcimap(void)
#endif
}
-static int __init pcibios_init(void)
+void __init loongson2ef_pcibios_init(void)
{
setup_pcimap();
+ /*
+ * ISA-mode only IDE controllers have a hard dependency on ISA IO ports.
+ *
+ * Claim them by setting PCI IO space to start at 0x00000000, and set
+ * PCIBIOS_MIN_IO to prevent non-legacy PCI devices from touching
+ * reserved regions.
+ */
+ PCIBIOS_MIN_IO = LOONGSON_PCI_IO_START;
+
loongson_pci_controller.io_map_base = mips_io_port_base;
register_pci_controller(&loongson_pci_controller);
-
-
- return 0;
}
-
-arch_initcall(pcibios_init);
diff --git a/arch/mips/loongson2ef/common/setup.c b/arch/mips/loongson2ef/common/setup.c
index 4fd27f4f90ed..a639e35acce5 100644
--- a/arch/mips/loongson2ef/common/setup.c
+++ b/arch/mips/loongson2ef/common/setup.c
@@ -27,4 +27,5 @@ EXPORT_SYMBOL(__wbflush);
void __init plat_mem_setup(void)
{
+ loongson2ef_pcibios_init();
}