@@ -489,6 +489,7 @@ config MACH_LOONGSON64
select LOONGSON_MC146818
select ZONE_DMA32
select NUMA
+ select HAVE_ARCH_HEAD_FILES
help
This enables the support of Loongson-2/3 family of machines.
@@ -1112,6 +1113,10 @@ config SCHED_OMIT_FRAME_POINTER
bool
default y
+config HAVE_ARCH_HEAD_FILES
+ bool
+ default n
+
#
# Select some configuration options automatically based on user selections.
#
@@ -263,7 +263,9 @@ load-y = $(CONFIG_PHYSICAL_START)
endif
entry-y = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux)
+ifndef CONFIG_HAVE_ARCH_HEAD_FILES
cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
+endif
drivers-$(CONFIG_PCI) += arch/mips/pci/
#
@@ -10,7 +10,11 @@
#ifndef _ASM_ADDRSPACE_H
#define _ASM_ADDRSPACE_H
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/spaces.h>
+#else
#include <spaces.h>
+#endif
/*
* Configure language
@@ -9,7 +9,11 @@
#ifndef _ASM_CACHE_H
#define _ASM_CACHE_H
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/kmalloc.h>
+#else
#include <kmalloc.h>
+#endif
#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
@@ -12,7 +12,11 @@
#include <asm/cpu.h>
#include <asm/cpu-info.h>
#include <asm/isa-rev.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/cpu-feature-overrides.h>
+#else
#include <cpu-feature-overrides.h>
+#endif
#define __ase(ase) (cpu_data[0].ases & (ase))
#define __isa(isa) (cpu_data[0].isa_level & (isa))
@@ -14,7 +14,11 @@
#define _ASM_FIXMAP_H
#include <asm/page.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/spaces.h>
+#else
#include <spaces.h>
+#endif
#ifdef CONFIG_HIGHMEM
#include <linux/threads.h>
#include <asm/kmap_types.h>
@@ -14,7 +14,11 @@
#include <linux/spinlock.h>
#include <asm/io.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/irq.h>
+#else
#include <irq.h>
+#endif
/* i8259A PIC registers */
#define PIC_MASTER_CMD 0x20
@@ -31,8 +31,13 @@
#include <asm/processor.h>
#include <asm/string.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/ioremap.h>
+#include <mach/mangle-port.h>
+#else
#include <ioremap.h>
#include <mangle-port.h>
+#endif
/*
* Raw operations are never swapped in software. OTOH values that raw
@@ -15,7 +15,11 @@
#include <asm/mipsmtregs.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/irq.h>
+#else
#include <irq.h>
+#endif
#define IRQ_STACK_SIZE THREAD_SIZE
#define IRQ_STACK_START (IRQ_STACK_SIZE - 16)
@@ -11,6 +11,10 @@
#ifndef _ASM_MC146818RTC_H
#define _ASM_MC146818RTC_H
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/mc146818rtc.h>
+#else
#include <mc146818rtc.h>
+#endif
#endif /* _ASM_MC146818RTC_H */
@@ -9,8 +9,12 @@
#include <asm/page.h>
#ifdef CONFIG_NEED_MULTIPLE_NODES
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/mmzone.h>
+#else
# include <mmzone.h>
#endif
+#endif
#ifndef pa_to_nid
#define pa_to_nid(addr) 0
@@ -9,7 +9,11 @@
#ifndef _ASM_PAGE_H
#define _ASM_PAGE_H
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/spaces.h>
+#else
#include <spaces.h>
+#endif
#include <linux/const.h>
#include <linux/kernel.h>
#include <asm/mipsregs.h>
@@ -8,7 +8,11 @@
#ifndef __ASM_TOPOLOGY_H
#define __ASM_TOPOLOGY_H
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/topology.h>
+#else
#include <topology.h>
+#endif
#include <linux/smp.h>
#ifdef CONFIG_SMP
@@ -9,7 +9,11 @@
#ifndef _ASM_WAR_H
#define _ASM_WAR_H
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/war.h>
+#else
#include <war.h>
+#endif
/*
* Work around certain R4000 CPU errata (as implemented by GCC):
@@ -24,7 +24,11 @@
#include <asm/mipsregs.h>
#include <asm/stackframe.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/kernel-entry-init.h>
+#else
#include <kernel-entry-init.h>
+#endif
/*
* For the moment disable interrupts, mark the kernel mode and
@@ -56,5 +56,5 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
#
platform-$(CONFIG_MACH_LOONGSON64) += loongson64/
-cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
+cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/loongson64/include -mno-branch-likely
load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
@@ -15,9 +15,9 @@
*/
#include <linux/export.h>
#include <asm/bootinfo.h>
-#include <loongson.h>
-#include <boot_param.h>
-#include <workarounds.h>
+#include <mach/loongson.h>
+#include <mach/boot_param.h>
+#include <mach/workarounds.h>
u32 cpu_clock_freq;
EXPORT_SYMBOL(cpu_clock_freq);
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/boot_param.h
rename to arch/mips/loongson64/include/mach/boot_param.h
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
rename to arch/mips/loongson64/include/mach/cpu-feature-overrides.h
new file mode 100644
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <asm/mach-generic/ioremap.h>
similarity index 96%
rename from arch/mips/include/asm/mach-loongson64/irq.h
rename to arch/mips/loongson64/include/mach/irq.h
@@ -2,7 +2,7 @@
#ifndef __ASM_MACH_LOONGSON64_IRQ_H_
#define __ASM_MACH_LOONGSON64_IRQ_H_
-#include <boot_param.h>
+#include <mach/boot_param.h>
/* cpu core interrupt numbers */
#define MIPS_CPU_IRQ_BASE 56
@@ -36,5 +36,5 @@
extern void fixup_irqs(void);
extern void loongson3_ipi_interrupt(struct pt_regs *regs);
-#include_next <irq.h>
+#include <asm/mach-generic/irq.h>
#endif /* __ASM_MACH_LOONGSON64_IRQ_H_ */
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
rename to arch/mips/loongson64/include/mach/kernel-entry-init.h
new file mode 100644
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <asm/mach-generic/kmalloc.h>
similarity index 99%
rename from arch/mips/include/asm/mach-loongson64/loongson.h
rename to arch/mips/loongson64/include/mach/loongson.h
@@ -10,7 +10,7 @@
#include <linux/io.h>
#include <linux/init.h>
#include <linux/irq.h>
-#include <boot_param.h>
+#include <mach/boot_param.h>
/* machine-specific reboot/halt operation */
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/loongson_hwmon.h
rename to arch/mips/loongson64/include/mach/loongson_hwmon.h
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/loongson_regs.h
rename to arch/mips/loongson64/include/mach/loongson_regs.h
new file mode 100644
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <asm/mach-generic/mangle-port.h>
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/mc146818rtc.h
rename to arch/mips/loongson64/include/mach/mc146818rtc.h
similarity index 96%
rename from arch/mips/include/asm/mach-loongson64/mmzone.h
rename to arch/mips/loongson64/include/mach/mmzone.h
@@ -9,7 +9,7 @@
#ifndef _ASM_MACH_LOONGSON64_MMZONE_H
#define _ASM_MACH_LOONGSON64_MMZONE_H
-#include <boot_param.h>
+#include <mach/boot_param.h>
#define NODE_ADDRSPACE_SHIFT 44
#define NODE0_ADDRSPACE_OFFSET 0x000000000000UL
#define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/pci.h
rename to arch/mips/loongson64/include/mach/pci.h
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/spaces.h
rename to arch/mips/loongson64/include/mach/spaces.h
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/topology.h
rename to arch/mips/loongson64/include/mach/topology.h
new file mode 100644
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <asm/mach-generic/war.h>
similarity index 100%
rename from arch/mips/include/asm/mach-loongson64/workarounds.h
rename to arch/mips/loongson64/include/mach/workarounds.h
@@ -11,7 +11,7 @@
#include <asm/cacheflush.h>
#include <asm/fw/fw.h>
-#include <loongson.h>
+#include <mach/loongson.h>
static void __init mips_nmi_setup(void)
{
@@ -1,6 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/loongson.h>
+#include <mach/irq.h>
+#else
#include <loongson.h>
#include <irq.h>
+#endif
#include <linux/interrupt.h>
#include <linux/init.h>
@@ -24,7 +24,7 @@
#include <asm/mc146818-time.h>
#include <asm/time.h>
#include <asm/wbflush.h>
-#include <boot_param.h>
+#include <mach/boot_param.h>
static struct pglist_data prealloc__node_data[MAX_NUMNODES];
unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
@@ -5,9 +5,9 @@
*/
#include <linux/pci.h>
-#include <pci.h>
-#include <loongson.h>
-#include <boot_param.h>
+#include <mach/pci.h>
+#include <mach/loongson.h>
+#include <mach/boot_param.h>
static struct resource loongson_pci_mem_resource = {
.name = "pci memory space",
@@ -10,9 +10,9 @@
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <asm/bootinfo.h>
-#include <boot_param.h>
-#include <loongson_hwmon.h>
-#include <workarounds.h>
+#include <mach/boot_param.h>
+#include <mach/loongson_hwmon.h>
+#include <mach/workarounds.h>
static int __init loongson3_platform_init(void)
{
@@ -12,7 +12,7 @@
#include <asm/i8259.h>
#include <asm/mipsregs.h>
-#include <loongson.h>
+#include <mach/loongson.h>
static unsigned int __maybe_unused cached_master_mask; /* i8259A */
static unsigned int __maybe_unused cached_slave_mask;
@@ -12,8 +12,8 @@
#include <asm/idle.h>
#include <asm/reboot.h>
-#include <loongson.h>
-#include <boot_param.h>
+#include <mach/loongson.h>
+#include <mach/boot_param.h>
static inline void loongson_reboot(void)
{
@@ -9,7 +9,7 @@
#include <asm/wbflush.h>
#include <asm/bootinfo.h>
-#include <loongson.h>
+#include <mach/loongson.h>
static void wbflush_loongson(void)
{
@@ -17,9 +17,9 @@
#include <asm/clock.h>
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>
-#include <loongson.h>
-#include <loongson_regs.h>
-#include <workarounds.h>
+#include <mach/loongson.h>
+#include <mach/loongson_regs.h>
+#include <mach/workarounds.h>
#include "smp.h"
@@ -10,7 +10,7 @@
#include <asm/time.h>
#include <asm/hpet.h>
-#include <loongson.h>
+#include <mach/loongson.h>
void __init plat_time_init(void)
{
@@ -12,8 +12,8 @@
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
-#include <irq.h>
-#include <loongson.h>
+#include <mach/irq.h>
+#include <mach/loongson.h>
#include "op_impl.h"
#define LOONGSON3_PERFCNT_OVERFLOW (1ULL << 63)
@@ -24,7 +24,7 @@
*/
#include <linux/pci.h>
-#include <boot_param.h>
+#include <mach/boot_param.h>
static void print_fixup_info(const struct pci_dev *pdev)
{
@@ -5,7 +5,7 @@
#include <asm/mips-boards/bonito64.h>
-#include <loongson.h>
+#include <mach/loongson.h>
#define PCI_ACCESS_READ 0
#define PCI_ACCESS_WRITE 1
@@ -17,7 +17,11 @@
#include <linux/platform_device.h>
#include <linux/bitops.h>
#include <asm/types.h>
+#ifdef CONFIG_HAVE_ARCH_HEAD_FILES
+#include <mach/loongson.h>
+#else
#include <loongson.h>
+#endif
#define STLS2F_N_GPIO 4
#define STLS3A_N_GPIO 16
@@ -6,10 +6,10 @@
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
-#include <loongson.h>
-#include <boot_param.h>
-#include <loongson_hwmon.h>
-#include <loongson_regs.h>
+#include <mach/loongson.h>
+#include <mach/boot_param.h>
+#include <mach/loongson_hwmon.h>
+#include <mach/loongson_regs.h>
static int csr_temp_enable = 0;
Currently some header files are referenced with pathname prefix, like irq.h which is located at both these two pathes: arch/mips/include/asm/mach-generic/ arch/mips/include/asm/mach-xxx/ C code reference these header files without pathname such as there is header file with the same filename in another different path. We encounter problem if arch/mips/kvm/irq.h file is locally reference. Now header files specified with platform are moved to directory arch/mips/xxx/include/mach directory, and which is referenced with <mach/yyy.h> method. Signed-off-by: bibo <maobibo@loongson.cn> --- arch/mips/Kconfig | 5 +++++ arch/mips/Makefile | 2 ++ arch/mips/include/asm/addrspace.h | 4 ++++ arch/mips/include/asm/cache.h | 4 ++++ arch/mips/include/asm/cpu-features.h | 4 ++++ arch/mips/include/asm/fixmap.h | 4 ++++ arch/mips/include/asm/i8259.h | 4 ++++ arch/mips/include/asm/io.h | 5 +++++ arch/mips/include/asm/irq.h | 4 ++++ arch/mips/include/asm/mc146818rtc.h | 4 ++++ arch/mips/include/asm/mmzone.h | 4 ++++ arch/mips/include/asm/page.h | 4 ++++ arch/mips/include/asm/topology.h | 4 ++++ arch/mips/include/asm/war.h | 4 ++++ arch/mips/kernel/head.S | 4 ++++ arch/mips/loongson64/Platform | 2 +- arch/mips/loongson64/env.c | 6 +++--- .../asm/mach-loongson64 => loongson64/include/mach}/boot_param.h | 0 .../include/mach}/cpu-feature-overrides.h | 0 arch/mips/loongson64/include/mach/ioremap.h | 2 ++ .../asm/mach-loongson64 => loongson64/include/mach}/irq.h | 4 ++-- .../include/mach}/kernel-entry-init.h | 0 arch/mips/loongson64/include/mach/kmalloc.h | 2 ++ .../asm/mach-loongson64 => loongson64/include/mach}/loongson.h | 2 +- .../mach-loongson64 => loongson64/include/mach}/loongson_hwmon.h | 0 .../mach-loongson64 => loongson64/include/mach}/loongson_regs.h | 0 arch/mips/loongson64/include/mach/mangle-port.h | 2 ++ .../asm/mach-loongson64 => loongson64/include/mach}/mc146818rtc.h | 0 .../asm/mach-loongson64 => loongson64/include/mach}/mmzone.h | 2 +- .../asm/mach-loongson64 => loongson64/include/mach}/pci.h | 0 .../asm/mach-loongson64 => loongson64/include/mach}/spaces.h | 0 .../asm/mach-loongson64 => loongson64/include/mach}/topology.h | 0 arch/mips/loongson64/include/mach/war.h | 2 ++ .../asm/mach-loongson64 => loongson64/include/mach}/workarounds.h | 0 arch/mips/loongson64/init.c | 2 +- arch/mips/loongson64/irq.c | 5 +++++ arch/mips/loongson64/numa.c | 2 +- arch/mips/loongson64/pci.c | 6 +++--- arch/mips/loongson64/platform.c | 6 +++--- arch/mips/loongson64/pm.c | 2 +- arch/mips/loongson64/reset.c | 4 ++-- arch/mips/loongson64/setup.c | 2 +- arch/mips/loongson64/smp.c | 6 +++--- arch/mips/loongson64/time.c | 2 +- arch/mips/oprofile/op_model_loongson3.c | 4 ++-- arch/mips/pci/fixup-loongson3.c | 2 +- arch/mips/pci/ops-loongson3.c | 2 +- drivers/gpio/gpio-loongson.c | 4 ++++ drivers/platform/mips/cpu_hwmon.c | 8 ++++---- 49 files changed, 109 insertions(+), 32 deletions(-) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/boot_param.h (100%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/cpu-feature-overrides.h (100%) create mode 100644 arch/mips/loongson64/include/mach/ioremap.h rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/irq.h (96%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/kernel-entry-init.h (100%) create mode 100644 arch/mips/loongson64/include/mach/kmalloc.h rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/loongson.h (99%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/loongson_hwmon.h (100%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/loongson_regs.h (100%) create mode 100644 arch/mips/loongson64/include/mach/mangle-port.h rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/mc146818rtc.h (100%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/mmzone.h (96%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/pci.h (100%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/spaces.h (100%) rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/topology.h (100%) create mode 100644 arch/mips/loongson64/include/mach/war.h rename arch/mips/{include/asm/mach-loongson64 => loongson64/include/mach}/workarounds.h (100%)