mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
5a0e3ad6af
percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
266 lines
6.9 KiB
C
266 lines
6.9 KiB
C
/*
|
|
* arch/arm/mach-ixp2000/enp2611.c
|
|
*
|
|
* Radisys ENP-2611 support.
|
|
*
|
|
* Created 2004 by Lennert Buytenhek from the ixdp2x01 code. The
|
|
* original version carries the following notices:
|
|
*
|
|
* Original Author: Andrzej Mialkowski <andrzej.mialkowski@intel.com>
|
|
* Maintainer: Deepak Saxena <dsaxena@plexity.net>
|
|
*
|
|
* Copyright (C) 2002-2003 Intel Corp.
|
|
* Copyright (C) 2003-2004 MontaVista Software, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/serial.h>
|
|
#include <linux/tty.h>
|
|
#include <linux/serial_core.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/irq.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/page.h>
|
|
#include <asm/system.h>
|
|
#include <mach/hardware.h>
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/pci.h>
|
|
#include <asm/mach/map.h>
|
|
#include <asm/mach/irq.h>
|
|
#include <asm/mach/time.h>
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/flash.h>
|
|
|
|
/*************************************************************************
|
|
* ENP-2611 timer tick configuration
|
|
*************************************************************************/
|
|
static void __init enp2611_timer_init(void)
|
|
{
|
|
ixp2000_init_time(50 * 1000 * 1000);
|
|
}
|
|
|
|
static struct sys_timer enp2611_timer = {
|
|
.init = enp2611_timer_init,
|
|
.offset = ixp2000_gettimeoffset,
|
|
};
|
|
|
|
|
|
/*************************************************************************
|
|
* ENP-2611 I/O
|
|
*************************************************************************/
|
|
static struct map_desc enp2611_io_desc[] __initdata = {
|
|
{
|
|
.virtual = ENP2611_CALEB_VIRT_BASE,
|
|
.pfn = __phys_to_pfn(ENP2611_CALEB_PHYS_BASE),
|
|
.length = ENP2611_CALEB_SIZE,
|
|
.type = MT_DEVICE,
|
|
}, {
|
|
.virtual = ENP2611_PM3386_0_VIRT_BASE,
|
|
.pfn = __phys_to_pfn(ENP2611_PM3386_0_PHYS_BASE),
|
|
.length = ENP2611_PM3386_0_SIZE,
|
|
.type = MT_DEVICE,
|
|
}, {
|
|
.virtual = ENP2611_PM3386_1_VIRT_BASE,
|
|
.pfn = __phys_to_pfn(ENP2611_PM3386_1_PHYS_BASE),
|
|
.length = ENP2611_PM3386_1_SIZE,
|
|
.type = MT_DEVICE,
|
|
}
|
|
};
|
|
|
|
void __init enp2611_map_io(void)
|
|
{
|
|
ixp2000_map_io();
|
|
iotable_init(enp2611_io_desc, ARRAY_SIZE(enp2611_io_desc));
|
|
}
|
|
|
|
|
|
/*************************************************************************
|
|
* ENP-2611 PCI
|
|
*************************************************************************/
|
|
static int enp2611_pci_setup(int nr, struct pci_sys_data *sys)
|
|
{
|
|
sys->mem_offset = 0xe0000000;
|
|
ixp2000_pci_setup(nr, sys);
|
|
return 1;
|
|
}
|
|
|
|
static void __init enp2611_pci_preinit(void)
|
|
{
|
|
ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
|
|
ixp2000_pci_preinit();
|
|
pcibios_setup("firmware");
|
|
}
|
|
|
|
static inline int enp2611_pci_valid_device(struct pci_bus *bus,
|
|
unsigned int devfn)
|
|
{
|
|
/* The 82559 ethernet controller appears at both PCI:1:0:0 and
|
|
* PCI:1:2:0, so let's pretend the second one isn't there.
|
|
*/
|
|
if (bus->number == 0x01 && devfn == 0x10)
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
static int enp2611_pci_read_config(struct pci_bus *bus, unsigned int devfn,
|
|
int where, int size, u32 *value)
|
|
{
|
|
if (enp2611_pci_valid_device(bus, devfn))
|
|
return ixp2000_pci_read_config(bus, devfn, where, size, value);
|
|
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
}
|
|
|
|
static int enp2611_pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
|
int where, int size, u32 value)
|
|
{
|
|
if (enp2611_pci_valid_device(bus, devfn))
|
|
return ixp2000_pci_write_config(bus, devfn, where, size, value);
|
|
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
}
|
|
|
|
static struct pci_ops enp2611_pci_ops = {
|
|
.read = enp2611_pci_read_config,
|
|
.write = enp2611_pci_write_config
|
|
};
|
|
|
|
static struct pci_bus * __init enp2611_pci_scan_bus(int nr,
|
|
struct pci_sys_data *sys)
|
|
{
|
|
return pci_scan_bus(sys->busnr, &enp2611_pci_ops, sys);
|
|
}
|
|
|
|
static int __init enp2611_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
|
|
{
|
|
int irq;
|
|
|
|
if (dev->bus->number == 0 && PCI_SLOT(dev->devfn) == 0) {
|
|
/* IXP2400. */
|
|
irq = IRQ_IXP2000_PCIA;
|
|
} else if (dev->bus->number == 0 && PCI_SLOT(dev->devfn) == 1) {
|
|
/* 21555 non-transparent bridge. */
|
|
irq = IRQ_IXP2000_PCIB;
|
|
} else if (dev->bus->number == 0 && PCI_SLOT(dev->devfn) == 4) {
|
|
/* PCI2050B transparent bridge. */
|
|
irq = -1;
|
|
} else if (dev->bus->number == 1 && PCI_SLOT(dev->devfn) == 0) {
|
|
/* 82559 ethernet. */
|
|
irq = IRQ_IXP2000_PCIA;
|
|
} else if (dev->bus->number == 1 && PCI_SLOT(dev->devfn) == 1) {
|
|
/* SPI-3 option board. */
|
|
irq = IRQ_IXP2000_PCIB;
|
|
} else {
|
|
printk(KERN_ERR "enp2611_pci_map_irq() called for unknown "
|
|
"device PCI:%d:%d:%d\n", dev->bus->number,
|
|
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
|
|
irq = -1;
|
|
}
|
|
|
|
return irq;
|
|
}
|
|
|
|
struct hw_pci enp2611_pci __initdata = {
|
|
.nr_controllers = 1,
|
|
.setup = enp2611_pci_setup,
|
|
.preinit = enp2611_pci_preinit,
|
|
.scan = enp2611_pci_scan_bus,
|
|
.map_irq = enp2611_pci_map_irq,
|
|
};
|
|
|
|
int __init enp2611_pci_init(void)
|
|
{
|
|
if (machine_is_enp2611())
|
|
pci_common_init(&enp2611_pci);
|
|
|
|
return 0;
|
|
}
|
|
|
|
subsys_initcall(enp2611_pci_init);
|
|
|
|
|
|
/*************************************************************************
|
|
* ENP-2611 Machine Initialization
|
|
*************************************************************************/
|
|
static struct flash_platform_data enp2611_flash_platform_data = {
|
|
.map_name = "cfi_probe",
|
|
.width = 1,
|
|
};
|
|
|
|
static struct ixp2000_flash_data enp2611_flash_data = {
|
|
.platform_data = &enp2611_flash_platform_data,
|
|
.nr_banks = 1
|
|
};
|
|
|
|
static struct resource enp2611_flash_resource = {
|
|
.start = 0xc4000000,
|
|
.end = 0xc4000000 + 0x00ffffff,
|
|
.flags = IORESOURCE_MEM,
|
|
};
|
|
|
|
static struct platform_device enp2611_flash = {
|
|
.name = "IXP2000-Flash",
|
|
.id = 0,
|
|
.dev = {
|
|
.platform_data = &enp2611_flash_data,
|
|
},
|
|
.num_resources = 1,
|
|
.resource = &enp2611_flash_resource,
|
|
};
|
|
|
|
static struct ixp2000_i2c_pins enp2611_i2c_gpio_pins = {
|
|
.sda_pin = ENP2611_GPIO_SDA,
|
|
.scl_pin = ENP2611_GPIO_SCL,
|
|
};
|
|
|
|
static struct platform_device enp2611_i2c_controller = {
|
|
.name = "IXP2000-I2C",
|
|
.id = 0,
|
|
.dev = {
|
|
.platform_data = &enp2611_i2c_gpio_pins
|
|
},
|
|
.num_resources = 0
|
|
};
|
|
|
|
static struct platform_device *enp2611_devices[] __initdata = {
|
|
&enp2611_flash,
|
|
&enp2611_i2c_controller
|
|
};
|
|
|
|
static void __init enp2611_init_machine(void)
|
|
{
|
|
platform_add_devices(enp2611_devices, ARRAY_SIZE(enp2611_devices));
|
|
ixp2000_uart_init();
|
|
}
|
|
|
|
|
|
MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board")
|
|
/* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
|
|
.phys_io = IXP2000_UART_PHYS_BASE,
|
|
.io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc,
|
|
.boot_params = 0x00000100,
|
|
.map_io = enp2611_map_io,
|
|
.init_irq = ixp2000_init_irq,
|
|
.timer = &enp2611_timer,
|
|
.init_machine = enp2611_init_machine,
|
|
MACHINE_END
|
|
|
|
|