mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 09:01:34 +00:00
89f579ce99
When building the kernel with W=1 we get a lot of -Wmissing-prototypes warnings, which are trivial in nature and easy to fix - and which may mask some real future bugs if the prototypes get out of sync with the function definition. This patch fixes most of -Wmissing-prototypes warnings which are in the root directory of arch/x86/kernel, not including the subdirectories. These are the warnings fixed in this patch: arch/x86/kernel/signal.c:865:17: warning: no previous prototype for ‘sys32_x32_rt_sigreturn’ [-Wmissing-prototypes] arch/x86/kernel/signal_compat.c:164:6: warning: no previous prototype for ‘sigaction_compat_abi’ [-Wmissing-prototypes] arch/x86/kernel/traps.c:625:46: warning: no previous prototype for ‘sync_regs’ [-Wmissing-prototypes] arch/x86/kernel/traps.c:640:24: warning: no previous prototype for ‘fixup_bad_iret’ [-Wmissing-prototypes] arch/x86/kernel/traps.c:929:13: warning: no previous prototype for ‘trap_init’ [-Wmissing-prototypes] arch/x86/kernel/irq.c:270:28: warning: no previous prototype for ‘smp_x86_platform_ipi’ [-Wmissing-prototypes] arch/x86/kernel/irq.c:301:16: warning: no previous prototype for ‘smp_kvm_posted_intr_ipi’ [-Wmissing-prototypes] arch/x86/kernel/irq.c:314:16: warning: no previous prototype for ‘smp_kvm_posted_intr_wakeup_ipi’ [-Wmissing-prototypes] arch/x86/kernel/irq.c:328:16: warning: no previous prototype for ‘smp_kvm_posted_intr_nested_ipi’ [-Wmissing-prototypes] arch/x86/kernel/irq_work.c:16:28: warning: no previous prototype for ‘smp_irq_work_interrupt’ [-Wmissing-prototypes] arch/x86/kernel/irqinit.c:79:13: warning: no previous prototype for ‘init_IRQ’ [-Wmissing-prototypes] arch/x86/kernel/quirks.c:672:13: warning: no previous prototype for ‘early_platform_quirks’ [-Wmissing-prototypes] arch/x86/kernel/tsc.c:1499:15: warning: no previous prototype for ‘calibrate_delay_is_known’ [-Wmissing-prototypes] arch/x86/kernel/process.c:653:13: warning: no previous prototype for ‘arch_post_acpi_subsys_init’ [-Wmissing-prototypes] arch/x86/kernel/process.c:717:15: warning: no previous prototype for ‘arch_randomize_brk’ [-Wmissing-prototypes] arch/x86/kernel/process.c:784:6: warning: no previous prototype for ‘do_arch_prctl_common’ [-Wmissing-prototypes] arch/x86/kernel/reboot.c:869:6: warning: no previous prototype for ‘nmi_panic_self_stop’ [-Wmissing-prototypes] arch/x86/kernel/smp.c:176:27: warning: no previous prototype for ‘smp_reboot_interrupt’ [-Wmissing-prototypes] arch/x86/kernel/smp.c:260:28: warning: no previous prototype for ‘smp_reschedule_interrupt’ [-Wmissing-prototypes] arch/x86/kernel/smp.c:281:28: warning: no previous prototype for ‘smp_call_function_interrupt’ [-Wmissing-prototypes] arch/x86/kernel/smp.c:291:28: warning: no previous prototype for ‘smp_call_function_single_interrupt’ [-Wmissing-prototypes] arch/x86/kernel/ftrace.c:840:6: warning: no previous prototype for ‘arch_ftrace_update_trampoline’ [-Wmissing-prototypes] arch/x86/kernel/ftrace.c:934:7: warning: no previous prototype for ‘arch_ftrace_trampoline_func’ [-Wmissing-prototypes] arch/x86/kernel/ftrace.c:946:6: warning: no previous prototype for ‘arch_ftrace_trampoline_free’ [-Wmissing-prototypes] arch/x86/kernel/crash.c:114:6: warning: no previous prototype for ‘crash_smp_send_stop’ [-Wmissing-prototypes] arch/x86/kernel/crash.c:351:5: warning: no previous prototype for ‘crash_setup_memmap_entries’ [-Wmissing-prototypes] arch/x86/kernel/crash.c:424:5: warning: no previous prototype for ‘crash_load_segments’ [-Wmissing-prototypes] arch/x86/kernel/machine_kexec_64.c:372:7: warning: no previous prototype for ‘arch_kexec_kernel_image_load’ [-Wmissing-prototypes] arch/x86/kernel/paravirt-spinlocks.c:12:16: warning: no previous prototype for ‘__native_queued_spin_unlock’ [-Wmissing-prototypes] arch/x86/kernel/paravirt-spinlocks.c:18:6: warning: no previous prototype for ‘pv_is_native_spin_unlock’ [-Wmissing-prototypes] arch/x86/kernel/paravirt-spinlocks.c:24:16: warning: no previous prototype for ‘__native_vcpu_is_preempted’ [-Wmissing-prototypes] arch/x86/kernel/paravirt-spinlocks.c:30:6: warning: no previous prototype for ‘pv_is_native_vcpu_is_preempted’ [-Wmissing-prototypes] arch/x86/kernel/kvm.c:258:1: warning: no previous prototype for ‘do_async_page_fault’ [-Wmissing-prototypes] arch/x86/kernel/jailhouse.c:200:6: warning: no previous prototype for ‘jailhouse_paravirt’ [-Wmissing-prototypes] arch/x86/kernel/check.c:91:13: warning: no previous prototype for ‘setup_bios_corruption_check’ [-Wmissing-prototypes] arch/x86/kernel/check.c:139:6: warning: no previous prototype for ‘check_for_bios_corruption’ [-Wmissing-prototypes] arch/x86/kernel/devicetree.c:32:13: warning: no previous prototype for ‘early_init_dt_scan_chosen_arch’ [-Wmissing-prototypes] arch/x86/kernel/devicetree.c:42:13: warning: no previous prototype for ‘add_dtb’ [-Wmissing-prototypes] arch/x86/kernel/devicetree.c:108:6: warning: no previous prototype for ‘x86_of_pci_init’ [-Wmissing-prototypes] arch/x86/kernel/devicetree.c:314:13: warning: no previous prototype for ‘x86_dtb_init’ [-Wmissing-prototypes] arch/x86/kernel/tracepoint.c:16:5: warning: no previous prototype for ‘trace_pagefault_reg’ [-Wmissing-prototypes] arch/x86/kernel/tracepoint.c:22:6: warning: no previous prototype for ‘trace_pagefault_unreg’ [-Wmissing-prototypes] arch/x86/kernel/head64.c:113:22: warning: no previous prototype for ‘__startup_64’ [-Wmissing-prototypes] arch/x86/kernel/head64.c:262:15: warning: no previous prototype for ‘__startup_secondary_64’ [-Wmissing-prototypes] arch/x86/kernel/head64.c:350:12: warning: no previous prototype for ‘early_make_pgtable’ [-Wmissing-prototypes] [ mingo: rewrote the changelog, fixed build errors. ] Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: akataria@vmware.com Cc: akpm@linux-foundation.org Cc: andy.shevchenko@gmail.com Cc: anton@enomsg.org Cc: ard.biesheuvel@linaro.org Cc: bhe@redhat.com Cc: bhelgaas@google.com Cc: bp@alien8.de Cc: ccross@android.com Cc: devicetree@vger.kernel.org Cc: douly.fnst@cn.fujitsu.com Cc: dwmw@amazon.co.uk Cc: dyoung@redhat.com Cc: ebiederm@xmission.com Cc: frank.rowand@sony.com Cc: frowand.list@gmail.com Cc: ivan.gorinov@intel.com Cc: jailhouse-dev@googlegroups.com Cc: jan.kiszka@siemens.com Cc: jgross@suse.com Cc: jroedel@suse.de Cc: keescook@chromium.org Cc: kexec@lists.infradead.org Cc: konrad.wilk@oracle.com Cc: kvm@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-pci@vger.kernel.org Cc: luto@kernel.org Cc: m.mizuma@jp.fujitsu.com Cc: namit@vmware.com Cc: oleg@redhat.com Cc: pasha.tatashin@oracle.com Cc: pbonzini@redhat.com Cc: prarit@redhat.com Cc: pravin.shedge4linux@gmail.com Cc: rajvi.jingar@intel.com Cc: rkrcmar@redhat.com Cc: robh+dt@kernel.org Cc: robh@kernel.org Cc: rostedt@goodmis.org Cc: takahiro.akashi@linaro.org Cc: thomas.lendacky@amd.com Cc: tony.luck@intel.com Cc: up2wing@gmail.com Cc: virtualization@lists.linux-foundation.org Cc: zhe.he@windriver.com Cc: zhong.weidong@zte.com.cn Link: http://lkml.kernel.org/r/1542852249-19820-1-git-send-email-wang.yi59@zte.com.cn Signed-off-by: Ingo Molnar <mingo@kernel.org>
325 lines
6.4 KiB
C
325 lines
6.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Architecture specific OF callbacks.
|
|
*/
|
|
#include <linux/export.h>
|
|
#include <linux/io.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/list.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/of_irq.h>
|
|
#include <linux/libfdt.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/of_pci.h>
|
|
#include <linux/initrd.h>
|
|
|
|
#include <asm/irqdomain.h>
|
|
#include <asm/hpet.h>
|
|
#include <asm/apic.h>
|
|
#include <asm/pci_x86.h>
|
|
#include <asm/setup.h>
|
|
#include <asm/i8259.h>
|
|
#include <asm/prom.h>
|
|
|
|
__initdata u64 initial_dtb;
|
|
char __initdata cmd_line[COMMAND_LINE_SIZE];
|
|
|
|
int __initdata of_ioapic;
|
|
|
|
void __init early_init_dt_scan_chosen_arch(unsigned long node)
|
|
{
|
|
BUG();
|
|
}
|
|
|
|
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
|
|
{
|
|
BUG();
|
|
}
|
|
|
|
void __init add_dtb(u64 data)
|
|
{
|
|
initial_dtb = data + offsetof(struct setup_data, data);
|
|
}
|
|
|
|
/*
|
|
* CE4100 ids. Will be moved to machine_device_initcall() once we have it.
|
|
*/
|
|
static struct of_device_id __initdata ce4100_ids[] = {
|
|
{ .compatible = "intel,ce4100-cp", },
|
|
{ .compatible = "isa", },
|
|
{ .compatible = "pci", },
|
|
{},
|
|
};
|
|
|
|
static int __init add_bus_probe(void)
|
|
{
|
|
if (!of_have_populated_dt())
|
|
return 0;
|
|
|
|
return of_platform_bus_probe(NULL, ce4100_ids, NULL);
|
|
}
|
|
device_initcall(add_bus_probe);
|
|
|
|
#ifdef CONFIG_PCI
|
|
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
|
|
{
|
|
struct device_node *np;
|
|
|
|
for_each_node_by_type(np, "pci") {
|
|
const void *prop;
|
|
unsigned int bus_min;
|
|
|
|
prop = of_get_property(np, "bus-range", NULL);
|
|
if (!prop)
|
|
continue;
|
|
bus_min = be32_to_cpup(prop);
|
|
if (bus->number == bus_min)
|
|
return np;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static int x86_of_pci_irq_enable(struct pci_dev *dev)
|
|
{
|
|
u32 virq;
|
|
int ret;
|
|
u8 pin;
|
|
|
|
ret = pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
|
|
if (ret)
|
|
return ret;
|
|
if (!pin)
|
|
return 0;
|
|
|
|
virq = of_irq_parse_and_map_pci(dev, 0, 0);
|
|
if (virq == 0)
|
|
return -EINVAL;
|
|
dev->irq = virq;
|
|
return 0;
|
|
}
|
|
|
|
static void x86_of_pci_irq_disable(struct pci_dev *dev)
|
|
{
|
|
}
|
|
|
|
void x86_of_pci_init(void)
|
|
{
|
|
pcibios_enable_irq = x86_of_pci_irq_enable;
|
|
pcibios_disable_irq = x86_of_pci_irq_disable;
|
|
}
|
|
#endif
|
|
|
|
static void __init dtb_setup_hpet(void)
|
|
{
|
|
#ifdef CONFIG_HPET_TIMER
|
|
struct device_node *dn;
|
|
struct resource r;
|
|
int ret;
|
|
|
|
dn = of_find_compatible_node(NULL, NULL, "intel,ce4100-hpet");
|
|
if (!dn)
|
|
return;
|
|
ret = of_address_to_resource(dn, 0, &r);
|
|
if (ret) {
|
|
WARN_ON(1);
|
|
return;
|
|
}
|
|
hpet_address = r.start;
|
|
#endif
|
|
}
|
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
|
|
static void __init dtb_cpu_setup(void)
|
|
{
|
|
struct device_node *dn;
|
|
u32 apic_id, version;
|
|
int ret;
|
|
|
|
version = GET_APIC_VERSION(apic_read(APIC_LVR));
|
|
for_each_of_cpu_node(dn) {
|
|
ret = of_property_read_u32(dn, "reg", &apic_id);
|
|
if (ret < 0) {
|
|
pr_warn("%pOF: missing local APIC ID\n", dn);
|
|
continue;
|
|
}
|
|
generic_processor_info(apic_id, version);
|
|
}
|
|
}
|
|
|
|
static void __init dtb_lapic_setup(void)
|
|
{
|
|
struct device_node *dn;
|
|
struct resource r;
|
|
unsigned long lapic_addr = APIC_DEFAULT_PHYS_BASE;
|
|
int ret;
|
|
|
|
dn = of_find_compatible_node(NULL, NULL, "intel,ce4100-lapic");
|
|
if (dn) {
|
|
ret = of_address_to_resource(dn, 0, &r);
|
|
if (WARN_ON(ret))
|
|
return;
|
|
lapic_addr = r.start;
|
|
}
|
|
|
|
/* Did the boot loader setup the local APIC ? */
|
|
if (!boot_cpu_has(X86_FEATURE_APIC)) {
|
|
if (apic_force_enable(lapic_addr))
|
|
return;
|
|
}
|
|
smp_found_config = 1;
|
|
pic_mode = 1;
|
|
register_lapic_address(lapic_addr);
|
|
}
|
|
|
|
#endif /* CONFIG_X86_LOCAL_APIC */
|
|
|
|
#ifdef CONFIG_X86_IO_APIC
|
|
static unsigned int ioapic_id;
|
|
|
|
struct of_ioapic_type {
|
|
u32 out_type;
|
|
u32 trigger;
|
|
u32 polarity;
|
|
};
|
|
|
|
static struct of_ioapic_type of_ioapic_type[] =
|
|
{
|
|
{
|
|
.out_type = IRQ_TYPE_EDGE_RISING,
|
|
.trigger = IOAPIC_EDGE,
|
|
.polarity = 1,
|
|
},
|
|
{
|
|
.out_type = IRQ_TYPE_LEVEL_LOW,
|
|
.trigger = IOAPIC_LEVEL,
|
|
.polarity = 0,
|
|
},
|
|
{
|
|
.out_type = IRQ_TYPE_LEVEL_HIGH,
|
|
.trigger = IOAPIC_LEVEL,
|
|
.polarity = 1,
|
|
},
|
|
{
|
|
.out_type = IRQ_TYPE_EDGE_FALLING,
|
|
.trigger = IOAPIC_EDGE,
|
|
.polarity = 0,
|
|
},
|
|
};
|
|
|
|
static int dt_irqdomain_alloc(struct irq_domain *domain, unsigned int virq,
|
|
unsigned int nr_irqs, void *arg)
|
|
{
|
|
struct irq_fwspec *fwspec = (struct irq_fwspec *)arg;
|
|
struct of_ioapic_type *it;
|
|
struct irq_alloc_info tmp;
|
|
int type_index;
|
|
|
|
if (WARN_ON(fwspec->param_count < 2))
|
|
return -EINVAL;
|
|
|
|
type_index = fwspec->param[1];
|
|
if (type_index >= ARRAY_SIZE(of_ioapic_type))
|
|
return -EINVAL;
|
|
|
|
it = &of_ioapic_type[type_index];
|
|
ioapic_set_alloc_attr(&tmp, NUMA_NO_NODE, it->trigger, it->polarity);
|
|
tmp.ioapic_id = mpc_ioapic_id(mp_irqdomain_ioapic_idx(domain));
|
|
tmp.ioapic_pin = fwspec->param[0];
|
|
|
|
return mp_irqdomain_alloc(domain, virq, nr_irqs, &tmp);
|
|
}
|
|
|
|
static const struct irq_domain_ops ioapic_irq_domain_ops = {
|
|
.alloc = dt_irqdomain_alloc,
|
|
.free = mp_irqdomain_free,
|
|
.activate = mp_irqdomain_activate,
|
|
.deactivate = mp_irqdomain_deactivate,
|
|
};
|
|
|
|
static void __init dtb_add_ioapic(struct device_node *dn)
|
|
{
|
|
struct resource r;
|
|
int ret;
|
|
struct ioapic_domain_cfg cfg = {
|
|
.type = IOAPIC_DOMAIN_DYNAMIC,
|
|
.ops = &ioapic_irq_domain_ops,
|
|
.dev = dn,
|
|
};
|
|
|
|
ret = of_address_to_resource(dn, 0, &r);
|
|
if (ret) {
|
|
printk(KERN_ERR "Can't obtain address from device node %pOF.\n", dn);
|
|
return;
|
|
}
|
|
mp_register_ioapic(++ioapic_id, r.start, gsi_top, &cfg);
|
|
}
|
|
|
|
static void __init dtb_ioapic_setup(void)
|
|
{
|
|
struct device_node *dn;
|
|
|
|
for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic")
|
|
dtb_add_ioapic(dn);
|
|
|
|
if (nr_ioapics) {
|
|
of_ioapic = 1;
|
|
return;
|
|
}
|
|
printk(KERN_ERR "Error: No information about IO-APIC in OF.\n");
|
|
}
|
|
#else
|
|
static void __init dtb_ioapic_setup(void) {}
|
|
#endif
|
|
|
|
static void __init dtb_apic_setup(void)
|
|
{
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
dtb_lapic_setup();
|
|
dtb_cpu_setup();
|
|
#endif
|
|
dtb_ioapic_setup();
|
|
}
|
|
|
|
#ifdef CONFIG_OF_EARLY_FLATTREE
|
|
static void __init x86_flattree_get_config(void)
|
|
{
|
|
u32 size, map_len;
|
|
void *dt;
|
|
|
|
if (!initial_dtb)
|
|
return;
|
|
|
|
map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128);
|
|
|
|
dt = early_memremap(initial_dtb, map_len);
|
|
size = fdt_totalsize(dt);
|
|
if (map_len < size) {
|
|
early_memunmap(dt, map_len);
|
|
dt = early_memremap(initial_dtb, size);
|
|
map_len = size;
|
|
}
|
|
|
|
early_init_dt_verify(dt);
|
|
unflatten_and_copy_device_tree();
|
|
early_memunmap(dt, map_len);
|
|
}
|
|
#else
|
|
static inline void x86_flattree_get_config(void) { }
|
|
#endif
|
|
|
|
void __init x86_dtb_init(void)
|
|
{
|
|
x86_flattree_get_config();
|
|
|
|
if (!of_have_populated_dt())
|
|
return;
|
|
|
|
dtb_setup_hpet();
|
|
dtb_apic_setup();
|
|
}
|