2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Written by: Garry Forsgren, Unisys Corporation
|
|
|
|
* Natalie Protasevich, Unisys Corporation
|
2009-02-17 22:29:30 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* This file contains the code to configure and interface
|
|
|
|
* with Unisys ES7000 series hardware system manager.
|
|
|
|
*
|
2009-02-17 22:29:30 +08:00
|
|
|
* Copyright (c) 2003 Unisys Corporation.
|
|
|
|
* Copyright (C) 2009, Red Hat, Inc., Ingo Molnar
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it would be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write the Free Software Foundation, Inc., 59
|
|
|
|
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Contact information: Unisys Corporation, Township Line & Union Meeting
|
|
|
|
* Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
|
|
|
|
*
|
|
|
|
* http://www.unisys.com
|
|
|
|
*/
|
2009-12-10 02:45:33 +08:00
|
|
|
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <linux/notifier.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/cpumask.h>
|
|
|
|
#include <linux/threads.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/kernel.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/reboot.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/string.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <linux/types.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/acpi.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <linux/init.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
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>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/gfp.h>
|
2009-02-17 22:29:30 +08:00
|
|
|
#include <linux/nmi.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <linux/smp.h>
|
2009-02-17 22:29:30 +08:00
|
|
|
#include <linux/io.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/apicdef.h>
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <asm/fixmap.h>
|
|
|
|
#include <asm/mpspec.h>
|
x86: fix wakeup_cpu with numaq/es7000, v2
Impact: fix secondary-CPU wakeup/init path with numaq and es7000
While looking at wakeup_secondary_cpu for WAKE_SECONDARY_VIA_NMI:
|#ifdef WAKE_SECONDARY_VIA_NMI
|/*
| * Poke the other CPU in the eye via NMI to wake it up. Remember that the normal
| * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
| * won't ... remember to clear down the APIC, etc later.
| */
|static int __devinit
|wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip)
|{
| unsigned long send_status, accept_status = 0;
| int maxlvt;
|...
| if (APIC_INTEGRATED(apic_version[phys_apicid])) {
| maxlvt = lapic_get_maxlvt();
I noticed that there is no warning about undefined phys_apicid...
because WAKE_SECONDARY_VIA_NMI and WAKE_SECONDARY_VIA_INIT can not be
defined at the same time. So NUMAQ is using wrong wakeup_secondary_cpu.
WAKE_SECONDARY_VIA_NMI, WAKE_SECONDARY_VIA_INIT and
WAKE_SECONDARY_VIA_MIP are variants of a weird and fragile
preprocessor-driven "HAL" mechanisms to specify the kind of secondary-CPU
wakeup strategy a given x86 kernel will use.
The vast majority of systems want to use INIT for secondary wakeup - NUMAQ
uses an NMI, (old-style-) ES7000 uses 'MIP' (a firmware driven in-memory
flag to let secondaries continue).
So convert these mechanisms to x86_quirks and add a
->wakeup_secondary_cpu() method to specify the rare exception
to the sane default.
Extend genapic accordingly as well, for 32-bit.
While looking further, I noticed that functions in wakecup.h for numaq
and es7000 are different to the default in mach_wakecpu.h - but smpboot.c
will only use default mach_wakecpu.h with smphook.h.
So we need to add mach_wakecpu.h for mach_generic, to properly support
numaq and es7000, and vectorize the following SMP init methods:
int trampoline_phys_low;
int trampoline_phys_high;
void (*wait_for_init_deassert)(atomic_t *deassert);
void (*smp_callin_clear_local_apic)(void);
void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
void (*inquire_remote_apic)(int apicid);
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-16 19:12:49 +08:00
|
|
|
#include <asm/setup.h>
|
2009-02-17 21:57:16 +08:00
|
|
|
#include <asm/apic.h>
|
|
|
|
#include <asm/ipi.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-08-28 14:01:16 +08:00
|
|
|
/*
|
|
|
|
* ES7000 chipsets
|
|
|
|
*/
|
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
#define NON_UNISYS 0
|
|
|
|
#define ES7000_CLASSIC 1
|
|
|
|
#define ES7000_ZORRO 2
|
2008-08-28 14:01:16 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
#define MIP_REG 1
|
|
|
|
#define MIP_PSAI_REG 4
|
2008-08-28 14:01:16 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
#define MIP_BUSY 1
|
|
|
|
#define MIP_SPIN 0xf0000
|
|
|
|
#define MIP_VALID 0x0100000000000000ULL
|
2009-02-17 22:17:55 +08:00
|
|
|
#define MIP_SW_APIC 0x1020b
|
2008-08-28 14:01:16 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
#define MIP_PORT(val) ((val >> 32) & 0xffff)
|
2008-08-28 14:01:16 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
#define MIP_RD_LO(val) (val & 0xffffffff)
|
2008-08-28 14:01:16 +08:00
|
|
|
|
2009-02-17 22:17:55 +08:00
|
|
|
struct mip_reg {
|
|
|
|
unsigned long long off_0x00;
|
|
|
|
unsigned long long off_0x08;
|
|
|
|
unsigned long long off_0x10;
|
|
|
|
unsigned long long off_0x18;
|
|
|
|
unsigned long long off_0x20;
|
|
|
|
unsigned long long off_0x28;
|
|
|
|
unsigned long long off_0x30;
|
|
|
|
unsigned long long off_0x38;
|
|
|
|
};
|
|
|
|
|
2008-08-28 14:01:16 +08:00
|
|
|
struct mip_reg_info {
|
2009-02-17 21:57:16 +08:00
|
|
|
unsigned long long mip_info;
|
|
|
|
unsigned long long delivery_info;
|
|
|
|
unsigned long long host_reg;
|
|
|
|
unsigned long long mip_reg;
|
2008-08-28 14:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct psai {
|
2009-02-17 21:57:16 +08:00
|
|
|
unsigned long long entry_type;
|
|
|
|
unsigned long long addr;
|
|
|
|
unsigned long long bep_addr;
|
2008-08-28 14:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI
|
2009-02-17 22:29:30 +08:00
|
|
|
|
2009-02-17 22:17:55 +08:00
|
|
|
struct es7000_oem_table {
|
2009-02-17 21:57:16 +08:00
|
|
|
struct acpi_table_header Header;
|
|
|
|
u32 OEMTableAddr;
|
|
|
|
u32 OEMTableSize;
|
2008-08-28 14:01:16 +08:00
|
|
|
};
|
2009-02-17 22:29:30 +08:00
|
|
|
|
|
|
|
static unsigned long oem_addrX;
|
|
|
|
static unsigned long oem_size;
|
|
|
|
|
2008-08-28 14:01:16 +08:00
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* ES7000 Globals
|
|
|
|
*/
|
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
static volatile unsigned long *psai;
|
2009-02-17 21:57:16 +08:00
|
|
|
static struct mip_reg *mip_reg;
|
|
|
|
static struct mip_reg *host_reg;
|
|
|
|
static int mip_port;
|
2009-02-17 22:29:30 +08:00
|
|
|
static unsigned long mip_addr;
|
|
|
|
static unsigned long host_addr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
int es7000_plat;
|
2008-05-14 23:02:51 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* GSI override for ES7000 platforms.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 06:23:59 +08:00
|
|
|
static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
|
x86: fix wakeup_cpu with numaq/es7000, v2
Impact: fix secondary-CPU wakeup/init path with numaq and es7000
While looking at wakeup_secondary_cpu for WAKE_SECONDARY_VIA_NMI:
|#ifdef WAKE_SECONDARY_VIA_NMI
|/*
| * Poke the other CPU in the eye via NMI to wake it up. Remember that the normal
| * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
| * won't ... remember to clear down the APIC, etc later.
| */
|static int __devinit
|wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip)
|{
| unsigned long send_status, accept_status = 0;
| int maxlvt;
|...
| if (APIC_INTEGRATED(apic_version[phys_apicid])) {
| maxlvt = lapic_get_maxlvt();
I noticed that there is no warning about undefined phys_apicid...
because WAKE_SECONDARY_VIA_NMI and WAKE_SECONDARY_VIA_INIT can not be
defined at the same time. So NUMAQ is using wrong wakeup_secondary_cpu.
WAKE_SECONDARY_VIA_NMI, WAKE_SECONDARY_VIA_INIT and
WAKE_SECONDARY_VIA_MIP are variants of a weird and fragile
preprocessor-driven "HAL" mechanisms to specify the kind of secondary-CPU
wakeup strategy a given x86 kernel will use.
The vast majority of systems want to use INIT for secondary wakeup - NUMAQ
uses an NMI, (old-style-) ES7000 uses 'MIP' (a firmware driven in-memory
flag to let secondaries continue).
So convert these mechanisms to x86_quirks and add a
->wakeup_secondary_cpu() method to specify the rare exception
to the sane default.
Extend genapic accordingly as well, for 32-bit.
While looking further, I noticed that functions in wakecup.h for numaq
and es7000 are different to the default in mach_wakecpu.h - but smpboot.c
will only use default mach_wakecpu.h with smphook.h.
So we need to add mach_wakecpu.h for mach_generic, to properly support
numaq and es7000, and vectorize the following SMP init methods:
int trampoline_phys_low;
int trampoline_phys_high;
void (*wait_for_init_deassert)(atomic_t *deassert);
void (*smp_callin_clear_local_apic)(void);
void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
void (*inquire_remote_apic)(int apicid);
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-16 19:12:49 +08:00
|
|
|
{
|
|
|
|
unsigned long vect = 0, psaival = 0;
|
|
|
|
|
|
|
|
if (psai == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
vect = ((unsigned long)__pa(eip)/0x1000) << 16;
|
|
|
|
psaival = (0x1000000 | vect | cpu);
|
|
|
|
|
|
|
|
while (*psai & 0x1000000)
|
|
|
|
;
|
|
|
|
|
|
|
|
*psai = psaival;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2008-11-18 07:19:53 +08:00
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_apic_is_cluster(void)
|
2008-11-18 07:19:53 +08:00
|
|
|
{
|
2008-11-19 00:14:14 +08:00
|
|
|
/* MPENTIUMIII */
|
|
|
|
if (boot_cpu_data.x86 == 6 &&
|
2009-08-25 21:35:12 +08:00
|
|
|
(boot_cpu_data.x86_model >= 7 && boot_cpu_data.x86_model <= 11))
|
2009-02-26 12:50:49 +08:00
|
|
|
return 1;
|
2008-11-19 00:14:14 +08:00
|
|
|
|
2008-11-18 07:19:53 +08:00
|
|
|
return 0;
|
|
|
|
}
|
x86: fix wakeup_cpu with numaq/es7000, v2
Impact: fix secondary-CPU wakeup/init path with numaq and es7000
While looking at wakeup_secondary_cpu for WAKE_SECONDARY_VIA_NMI:
|#ifdef WAKE_SECONDARY_VIA_NMI
|/*
| * Poke the other CPU in the eye via NMI to wake it up. Remember that the normal
| * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
| * won't ... remember to clear down the APIC, etc later.
| */
|static int __devinit
|wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip)
|{
| unsigned long send_status, accept_status = 0;
| int maxlvt;
|...
| if (APIC_INTEGRATED(apic_version[phys_apicid])) {
| maxlvt = lapic_get_maxlvt();
I noticed that there is no warning about undefined phys_apicid...
because WAKE_SECONDARY_VIA_NMI and WAKE_SECONDARY_VIA_INIT can not be
defined at the same time. So NUMAQ is using wrong wakeup_secondary_cpu.
WAKE_SECONDARY_VIA_NMI, WAKE_SECONDARY_VIA_INIT and
WAKE_SECONDARY_VIA_MIP are variants of a weird and fragile
preprocessor-driven "HAL" mechanisms to specify the kind of secondary-CPU
wakeup strategy a given x86 kernel will use.
The vast majority of systems want to use INIT for secondary wakeup - NUMAQ
uses an NMI, (old-style-) ES7000 uses 'MIP' (a firmware driven in-memory
flag to let secondaries continue).
So convert these mechanisms to x86_quirks and add a
->wakeup_secondary_cpu() method to specify the rare exception
to the sane default.
Extend genapic accordingly as well, for 32-bit.
While looking further, I noticed that functions in wakecup.h for numaq
and es7000 are different to the default in mach_wakecpu.h - but smpboot.c
will only use default mach_wakecpu.h with smphook.h.
So we need to add mach_wakecpu.h for mach_generic, to properly support
numaq and es7000, and vectorize the following SMP init methods:
int trampoline_phys_low;
int trampoline_phys_high;
void (*wait_for_init_deassert)(atomic_t *deassert);
void (*smp_callin_clear_local_apic)(void);
void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
void (*inquire_remote_apic)(int apicid);
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-16 19:12:49 +08:00
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static void setup_unisys(void)
|
2005-09-04 06:56:34 +08:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Determine the generation of the ES7000 currently running.
|
|
|
|
*
|
|
|
|
* es7000_plat = 1 if the machine is a 5xx ES7000 box
|
|
|
|
* es7000_plat = 2 if the machine is a x86_64 ES7000 box
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
|
2005-10-31 06:59:38 +08:00
|
|
|
es7000_plat = ES7000_ZORRO;
|
2005-09-04 06:56:34 +08:00
|
|
|
else
|
2005-10-31 06:59:38 +08:00
|
|
|
es7000_plat = ES7000_CLASSIC;
|
2005-09-04 06:56:34 +08:00
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2009-02-17 22:13:05 +08:00
|
|
|
* Parse the OEM Table:
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2009-03-02 18:34:27 +08:00
|
|
|
static int parse_unisys_oem(char *oemptr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-02-17 22:17:55 +08:00
|
|
|
int i;
|
2005-04-17 06:20:36 +08:00
|
|
|
int success = 0;
|
2009-02-17 22:17:55 +08:00
|
|
|
unsigned char type, size;
|
|
|
|
unsigned long val;
|
|
|
|
char *tp = NULL;
|
|
|
|
struct psai *psaip = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct mip_reg_info *mi;
|
|
|
|
struct mip_reg *host, *mip;
|
|
|
|
|
|
|
|
tp = oemptr;
|
|
|
|
|
|
|
|
tp += 8;
|
|
|
|
|
2009-02-17 22:17:55 +08:00
|
|
|
for (i = 0; i <= 6; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
type = *tp++;
|
|
|
|
size = *tp++;
|
|
|
|
tp -= 2;
|
|
|
|
switch (type) {
|
|
|
|
case MIP_REG:
|
|
|
|
mi = (struct mip_reg_info *)tp;
|
|
|
|
val = MIP_RD_LO(mi->host_reg);
|
|
|
|
host_addr = val;
|
|
|
|
host = (struct mip_reg *)val;
|
|
|
|
host_reg = __va(host);
|
|
|
|
val = MIP_RD_LO(mi->mip_reg);
|
|
|
|
mip_port = MIP_PORT(mi->mip_info);
|
|
|
|
mip_addr = val;
|
|
|
|
mip = (struct mip_reg *)val;
|
|
|
|
mip_reg = __va(mip);
|
2009-12-10 02:45:33 +08:00
|
|
|
pr_debug("host_reg = 0x%lx\n",
|
2008-07-22 03:58:34 +08:00
|
|
|
(unsigned long)host_reg);
|
2009-12-10 02:45:33 +08:00
|
|
|
pr_debug("mip_reg = 0x%lx\n",
|
2008-07-22 03:58:34 +08:00
|
|
|
(unsigned long)mip_reg);
|
2005-04-17 06:20:36 +08:00
|
|
|
success++;
|
|
|
|
break;
|
|
|
|
case MIP_PSAI_REG:
|
|
|
|
psaip = (struct psai *)tp;
|
|
|
|
if (tp != NULL) {
|
|
|
|
if (psaip->addr)
|
|
|
|
psai = __va(psaip->addr);
|
|
|
|
else
|
|
|
|
psai = NULL;
|
|
|
|
success++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
tp += size;
|
|
|
|
}
|
|
|
|
|
2009-02-17 22:13:05 +08:00
|
|
|
if (success < 2)
|
2005-10-31 06:59:38 +08:00
|
|
|
es7000_plat = NON_UNISYS;
|
2009-02-17 22:13:05 +08:00
|
|
|
else
|
2005-09-04 06:56:34 +08:00
|
|
|
setup_unisys();
|
2009-02-17 21:57:16 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return es7000_plat;
|
|
|
|
}
|
|
|
|
|
2006-03-23 18:59:36 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
2009-05-09 17:35:10 +08:00
|
|
|
static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-02-03 00:48:22 +08:00
|
|
|
struct acpi_table_header *header = NULL;
|
2009-02-17 22:29:30 +08:00
|
|
|
struct es7000_oem_table *table;
|
2009-02-08 07:39:41 +08:00
|
|
|
acpi_size tbl_size;
|
2009-02-17 22:29:30 +08:00
|
|
|
acpi_status ret;
|
|
|
|
int i = 0;
|
2008-09-14 17:33:14 +08:00
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
for (;;) {
|
|
|
|
ret = acpi_get_table_with_size("OEM1", i++, &header, &tbl_size);
|
|
|
|
if (!ACPI_SUCCESS(ret))
|
|
|
|
return -1;
|
2008-09-14 17:33:14 +08:00
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
if (!memcmp((char *) &header->oem_id, "UNISYS", 6))
|
|
|
|
break;
|
2008-09-14 17:33:14 +08:00
|
|
|
|
2009-02-08 07:39:41 +08:00
|
|
|
early_acpi_os_unmap_memory(header, tbl_size);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2009-02-17 22:29:30 +08:00
|
|
|
|
|
|
|
table = (void *)header;
|
|
|
|
|
|
|
|
oem_addrX = table->OEMTableAddr;
|
|
|
|
oem_size = table->OEMTableSize;
|
|
|
|
|
|
|
|
early_acpi_os_unmap_memory(header, tbl_size);
|
|
|
|
|
|
|
|
*oem_addr = (unsigned long)__acpi_map_table(oem_addrX, oem_size);
|
|
|
|
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-09-14 17:33:14 +08:00
|
|
|
|
2009-05-09 17:35:10 +08:00
|
|
|
static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
|
2008-09-14 17:33:14 +08:00
|
|
|
{
|
2009-02-08 07:39:41 +08:00
|
|
|
if (!oem_addr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
__acpi_unmap_table((char *)oem_addr, oem_size);
|
2008-09-14 17:33:14 +08:00
|
|
|
}
|
2009-02-17 22:29:30 +08:00
|
|
|
|
|
|
|
static int es7000_check_dsdt(void)
|
|
|
|
{
|
|
|
|
struct acpi_table_header header;
|
|
|
|
|
|
|
|
if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
|
|
|
|
!strncmp(header.oem_id, "UNISYS", 6))
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_acpi_ret;
|
2009-02-26 12:50:49 +08:00
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
/* Hook from generic ACPI tables.c */
|
2009-05-09 17:35:10 +08:00
|
|
|
static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
|
2009-02-17 22:29:30 +08:00
|
|
|
{
|
|
|
|
unsigned long oem_addr = 0;
|
|
|
|
int check_dsdt;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
/* check dsdt at first to avoid clear fix_map for oem_addr */
|
|
|
|
check_dsdt = es7000_check_dsdt();
|
|
|
|
|
|
|
|
if (!find_unisys_acpi_oem_table(&oem_addr)) {
|
|
|
|
if (check_dsdt) {
|
|
|
|
ret = parse_unisys_oem((char *)oem_addr);
|
|
|
|
} else {
|
|
|
|
setup_unisys();
|
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* we need to unmap it
|
|
|
|
*/
|
|
|
|
unmap_unisys_acpi_oem_table(oem_addr);
|
|
|
|
}
|
2009-02-26 12:50:49 +08:00
|
|
|
|
|
|
|
es7000_acpi_ret = ret;
|
|
|
|
|
|
|
|
return ret && !es7000_apic_is_cluster();
|
2009-02-17 22:29:30 +08:00
|
|
|
}
|
2009-02-26 21:34:08 +08:00
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_acpi_madt_oem_check_cluster(char *oem_id, char *oem_table_id)
|
2009-02-26 12:50:49 +08:00
|
|
|
{
|
|
|
|
int ret = es7000_acpi_ret;
|
|
|
|
|
|
|
|
return ret && es7000_apic_is_cluster();
|
|
|
|
}
|
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
#else /* !CONFIG_ACPI: */
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
|
2009-02-17 22:29:30 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-02-26 21:34:08 +08:00
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_acpi_madt_oem_check_cluster(char *oem_id, char *oem_table_id)
|
2009-02-26 21:34:08 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-02-17 22:29:30 +08:00
|
|
|
#endif /* !CONFIG_ACPI */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
static void es7000_spin(int n)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
while (i++ < n)
|
|
|
|
rep_nop();
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_mip_write(struct mip_reg *mip_reg)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-02-17 21:57:16 +08:00
|
|
|
int status = 0;
|
|
|
|
int spin;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
spin = MIP_SPIN;
|
2009-02-17 21:57:16 +08:00
|
|
|
while ((host_reg->off_0x38 & MIP_VALID) != 0) {
|
|
|
|
if (--spin <= 0) {
|
2009-02-17 22:29:30 +08:00
|
|
|
WARN(1, "Timeout waiting for Host Valid Flag\n");
|
2009-02-17 21:57:16 +08:00
|
|
|
return -1;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
es7000_spin(MIP_SPIN);
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
|
|
|
|
outb(1, mip_port);
|
|
|
|
|
|
|
|
spin = MIP_SPIN;
|
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
while ((mip_reg->off_0x38 & MIP_VALID) == 0) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (--spin <= 0) {
|
2009-02-17 22:29:30 +08:00
|
|
|
WARN(1, "Timeout waiting for MIP Valid Flag\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
es7000_spin(MIP_SPIN);
|
|
|
|
}
|
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48;
|
|
|
|
mip_reg->off_0x38 &= ~MIP_VALID;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static void es7000_enable_apic_mode(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-01-28 20:15:06 +08:00
|
|
|
struct mip_reg es7000_mip_reg;
|
|
|
|
int mip_status;
|
|
|
|
|
|
|
|
if (!es7000_plat)
|
2005-04-17 06:20:36 +08:00
|
|
|
return;
|
2009-01-28 20:15:06 +08:00
|
|
|
|
2009-12-10 02:45:33 +08:00
|
|
|
pr_info("Enabling APIC mode.\n");
|
2009-02-17 22:17:55 +08:00
|
|
|
memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
|
|
|
|
es7000_mip_reg.off_0x00 = MIP_SW_APIC;
|
|
|
|
es7000_mip_reg.off_0x38 = MIP_VALID;
|
2009-01-28 20:15:06 +08:00
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
|
|
|
|
WARN(1, "Command failed, status = %x\n", mip_status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
static void es7000_wait_for_init_deassert(atomic_t *deassert)
|
|
|
|
{
|
|
|
|
while (!atomic_read(deassert))
|
|
|
|
cpu_relax();
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned int es7000_get_apic_id(unsigned long x)
|
|
|
|
{
|
|
|
|
return (x >> 24) & 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
|
|
|
|
{
|
2009-01-30 11:31:49 +08:00
|
|
|
default_send_IPI_mask_sequence_phys(mask, vector);
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void es7000_send_IPI_allbutself(int vector)
|
|
|
|
{
|
2009-01-30 11:31:49 +08:00
|
|
|
default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void es7000_send_IPI_all(int vector)
|
|
|
|
{
|
|
|
|
es7000_send_IPI_mask(cpu_online_mask, vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int es7000_apic_id_registered(void)
|
|
|
|
{
|
2009-02-17 22:17:55 +08:00
|
|
|
return 1;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2009-03-13 12:19:57 +08:00
|
|
|
static const struct cpumask *target_cpus_cluster(void)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
2009-03-13 12:19:47 +08:00
|
|
|
return cpu_all_mask;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2009-03-13 12:19:54 +08:00
|
|
|
static const struct cpumask *es7000_target_cpus(void)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
2009-03-13 12:19:54 +08:00
|
|
|
return cpumask_of(smp_processor_id());
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2009-11-10 06:06:59 +08:00
|
|
|
static unsigned long es7000_check_apicid_used(physid_mask_t *map, int apicid)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-11-10 06:06:59 +08:00
|
|
|
|
2009-01-29 02:01:05 +08:00
|
|
|
static unsigned long es7000_check_apicid_present(int bit)
|
|
|
|
{
|
|
|
|
return physid_isset(bit, phys_cpu_present_map);
|
|
|
|
}
|
|
|
|
|
2011-01-23 21:37:37 +08:00
|
|
|
static int es7000_early_logical_apicid(int cpu)
|
|
|
|
{
|
|
|
|
/* on es7000, logical apicid is the same as physical */
|
|
|
|
return early_per_cpu(x86_bios_cpu_apicid, cpu);
|
|
|
|
}
|
|
|
|
|
2009-01-29 02:01:05 +08:00
|
|
|
static unsigned long calculate_ldr(int cpu)
|
|
|
|
{
|
2009-02-17 21:57:16 +08:00
|
|
|
unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu);
|
2009-01-29 02:01:05 +08:00
|
|
|
|
2009-02-17 21:57:16 +08:00
|
|
|
return SET_APIC_LOGICAL_ID(id);
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the logical destination ID.
|
|
|
|
*
|
|
|
|
* Intel recommends to set DFR, LdR and TPR before enabling
|
|
|
|
* an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
|
|
|
|
* document number 292116). So here it goes...
|
|
|
|
*/
|
|
|
|
static void es7000_init_apic_ldr_cluster(void)
|
|
|
|
{
|
|
|
|
unsigned long val;
|
|
|
|
int cpu = smp_processor_id();
|
|
|
|
|
2009-02-17 22:17:55 +08:00
|
|
|
apic_write(APIC_DFR, APIC_DFR_CLUSTER);
|
2009-01-29 02:01:05 +08:00
|
|
|
val = calculate_ldr(cpu);
|
|
|
|
apic_write(APIC_LDR, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void es7000_init_apic_ldr(void)
|
|
|
|
{
|
|
|
|
unsigned long val;
|
|
|
|
int cpu = smp_processor_id();
|
|
|
|
|
2009-02-17 22:17:55 +08:00
|
|
|
apic_write(APIC_DFR, APIC_DFR_FLAT);
|
2009-01-29 02:01:05 +08:00
|
|
|
val = calculate_ldr(cpu);
|
|
|
|
apic_write(APIC_LDR, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void es7000_setup_apic_routing(void)
|
|
|
|
{
|
|
|
|
int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
|
2009-02-17 22:29:30 +08:00
|
|
|
|
2009-12-10 02:45:33 +08:00
|
|
|
pr_info("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
|
2009-01-29 02:01:05 +08:00
|
|
|
(apic_version[apic] == 0x14) ?
|
|
|
|
"Physical Cluster" : "Logical Cluster",
|
2009-03-13 12:19:54 +08:00
|
|
|
nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int es7000_cpu_present_to_apicid(int mps_cpu)
|
|
|
|
{
|
|
|
|
if (!mps_cpu)
|
|
|
|
return boot_cpu_physical_apicid;
|
|
|
|
else if (mps_cpu < nr_cpu_ids)
|
2009-02-17 21:57:16 +08:00
|
|
|
return per_cpu(x86_bios_cpu_apicid, mps_cpu);
|
2009-01-29 02:01:05 +08:00
|
|
|
else
|
|
|
|
return BAD_APICID;
|
|
|
|
}
|
|
|
|
|
2009-02-17 22:29:30 +08:00
|
|
|
static int cpu_id;
|
|
|
|
|
2009-11-10 06:06:59 +08:00
|
|
|
static void es7000_apicid_to_cpu_present(int phys_apicid, physid_mask_t *retmap)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
2009-11-10 06:06:59 +08:00
|
|
|
physid_set_mask_of_physid(cpu_id, retmap);
|
2009-02-17 22:29:30 +08:00
|
|
|
++cpu_id;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2009-11-10 06:06:59 +08:00
|
|
|
static void es7000_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
|
|
|
/* For clustered we don't have a good way to do this yet - hack */
|
2009-11-10 06:06:59 +08:00
|
|
|
physids_promote(0xFFL, retmap);
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
|
|
|
|
{
|
|
|
|
boot_cpu_physical_apicid = read_apic_id();
|
2009-02-17 21:57:16 +08:00
|
|
|
return 1;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2012-06-14 15:49:35 +08:00
|
|
|
static inline int
|
2012-06-07 21:15:59 +08:00
|
|
|
es7000_cpu_mask_to_apicid(const struct cpumask *cpumask, unsigned int *dest_id)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
2009-03-02 17:53:57 +08:00
|
|
|
unsigned int round = 0;
|
2012-06-14 15:49:55 +08:00
|
|
|
unsigned int cpu, uninitialized_var(apicid);
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
/*
|
2009-03-02 17:53:57 +08:00
|
|
|
* The cpus in the mask must all be on the apic cluster.
|
2009-01-29 02:01:05 +08:00
|
|
|
*/
|
2012-06-07 21:16:25 +08:00
|
|
|
for_each_cpu_and(cpu, cpumask, cpu_online_mask) {
|
2011-01-23 21:37:32 +08:00
|
|
|
int new_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
|
2009-01-29 02:01:05 +08:00
|
|
|
|
2009-03-02 17:53:57 +08:00
|
|
|
if (round && APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
|
|
|
|
WARN(1, "Not a valid mask!");
|
2009-01-29 02:01:05 +08:00
|
|
|
|
2012-06-07 21:15:59 +08:00
|
|
|
return -EINVAL;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
2012-06-14 15:50:44 +08:00
|
|
|
apicid |= new_apicid;
|
2009-03-02 17:53:57 +08:00
|
|
|
round++;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
2012-06-14 15:50:27 +08:00
|
|
|
if (!round)
|
|
|
|
return -EINVAL;
|
2012-06-07 21:15:59 +08:00
|
|
|
*dest_id = apicid;
|
|
|
|
return 0;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2012-06-07 21:15:59 +08:00
|
|
|
static int
|
2009-01-29 02:01:05 +08:00
|
|
|
es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
|
2012-06-07 21:15:59 +08:00
|
|
|
const struct cpumask *andmask,
|
|
|
|
unsigned int *apicid)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
|
|
|
cpumask_var_t cpumask;
|
2012-06-14 15:50:11 +08:00
|
|
|
*apicid = early_per_cpu(x86_cpu_to_logical_apicid, 0);
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
|
2012-06-07 21:15:59 +08:00
|
|
|
return 0;
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
cpumask_and(cpumask, inmask, andmask);
|
2012-06-07 21:15:59 +08:00
|
|
|
es7000_cpu_mask_to_apicid(cpumask, apicid);
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
free_cpumask_var(cpumask);
|
|
|
|
|
2012-06-07 21:15:59 +08:00
|
|
|
return 0;
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
|
|
|
|
{
|
|
|
|
return cpuid_apic >> index_msb;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int probe_es7000(void)
|
|
|
|
{
|
|
|
|
/* probed later in mptable/ACPI hooks */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_mps_ret;
|
|
|
|
static int es7000_mps_oem_check(struct mpc_table *mpc, char *oem,
|
|
|
|
char *productid)
|
2009-01-29 02:01:05 +08:00
|
|
|
{
|
2009-02-26 12:50:49 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
2009-01-29 02:01:05 +08:00
|
|
|
if (mpc->oemptr) {
|
|
|
|
struct mpc_oemtable *oem_table =
|
|
|
|
(struct mpc_oemtable *)mpc->oemptr;
|
|
|
|
|
|
|
|
if (!strncmp(oem, "UNISYS", 6))
|
2009-02-26 12:50:49 +08:00
|
|
|
ret = parse_unisys_oem((char *)oem_table);
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
2009-02-26 12:50:49 +08:00
|
|
|
|
|
|
|
es7000_mps_ret = ret;
|
|
|
|
|
|
|
|
return ret && !es7000_apic_is_cluster();
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:34:27 +08:00
|
|
|
static int es7000_mps_oem_check_cluster(struct mpc_table *mpc, char *oem,
|
|
|
|
char *productid)
|
2009-02-26 12:50:49 +08:00
|
|
|
{
|
|
|
|
int ret = es7000_mps_ret;
|
|
|
|
|
|
|
|
return ret && es7000_apic_is_cluster();
|
2009-01-29 02:01:05 +08:00
|
|
|
}
|
|
|
|
|
2009-07-12 19:04:12 +08:00
|
|
|
/* We've been warned by a false positive warning.Use __refdata to keep calm. */
|
2011-05-21 08:51:20 +08:00
|
|
|
static struct apic __refdata apic_es7000_cluster = {
|
2009-02-26 12:50:49 +08:00
|
|
|
|
|
|
|
.name = "es7000",
|
|
|
|
.probe = probe_es7000,
|
|
|
|
.acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster,
|
2012-03-14 15:17:34 +08:00
|
|
|
.apic_id_valid = default_apic_id_valid,
|
2009-02-26 12:50:49 +08:00
|
|
|
.apic_id_registered = es7000_apic_id_registered,
|
|
|
|
|
|
|
|
.irq_delivery_mode = dest_LowestPrio,
|
|
|
|
/* logical delivery broadcast to all procs: */
|
|
|
|
.irq_dest_mode = 1,
|
|
|
|
|
|
|
|
.target_cpus = target_cpus_cluster,
|
|
|
|
.disable_esr = 1,
|
|
|
|
.dest_logical = 0,
|
|
|
|
.check_apicid_used = es7000_check_apicid_used,
|
|
|
|
.check_apicid_present = es7000_check_apicid_present,
|
|
|
|
|
2012-06-07 21:14:49 +08:00
|
|
|
.vector_allocation_domain = flat_vector_allocation_domain,
|
2009-02-26 12:50:49 +08:00
|
|
|
.init_apic_ldr = es7000_init_apic_ldr_cluster,
|
|
|
|
|
|
|
|
.ioapic_phys_id_map = es7000_ioapic_phys_id_map,
|
|
|
|
.setup_apic_routing = es7000_setup_apic_routing,
|
|
|
|
.multi_timer_check = NULL,
|
|
|
|
.cpu_present_to_apicid = es7000_cpu_present_to_apicid,
|
|
|
|
.apicid_to_cpu_present = es7000_apicid_to_cpu_present,
|
|
|
|
.setup_portio_remap = NULL,
|
|
|
|
.check_phys_apicid_present = es7000_check_phys_apicid_present,
|
|
|
|
.enable_apic_mode = es7000_enable_apic_mode,
|
|
|
|
.phys_pkg_id = es7000_phys_pkg_id,
|
|
|
|
.mps_oem_check = es7000_mps_oem_check_cluster,
|
|
|
|
|
|
|
|
.get_apic_id = es7000_get_apic_id,
|
|
|
|
.set_apic_id = NULL,
|
|
|
|
.apic_id_mask = 0xFF << 24,
|
|
|
|
|
|
|
|
.cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
|
|
|
|
|
|
|
|
.send_IPI_mask = es7000_send_IPI_mask,
|
|
|
|
.send_IPI_mask_allbutself = NULL,
|
|
|
|
.send_IPI_allbutself = es7000_send_IPI_allbutself,
|
|
|
|
.send_IPI_all = es7000_send_IPI_all,
|
|
|
|
.send_IPI_self = default_send_IPI_self,
|
|
|
|
|
2009-02-26 20:51:40 +08:00
|
|
|
.wakeup_secondary_cpu = wakeup_secondary_cpu_via_mip,
|
2009-02-26 12:50:49 +08:00
|
|
|
|
|
|
|
.trampoline_phys_low = 0x467,
|
|
|
|
.trampoline_phys_high = 0x469,
|
|
|
|
|
|
|
|
.wait_for_init_deassert = NULL,
|
|
|
|
|
|
|
|
/* Nothing to do for most platforms, since cleared by the INIT cycle: */
|
|
|
|
.smp_callin_clear_local_apic = NULL,
|
|
|
|
.inquire_remote_apic = default_inquire_remote_apic,
|
|
|
|
|
|
|
|
.read = native_apic_mem_read,
|
|
|
|
.write = native_apic_mem_write,
|
2012-05-17 00:03:52 +08:00
|
|
|
.eoi_write = native_apic_mem_write,
|
2009-02-26 12:50:49 +08:00
|
|
|
.icr_read = native_apic_icr_read,
|
|
|
|
.icr_write = native_apic_icr_write,
|
|
|
|
.wait_icr_idle = native_apic_wait_icr_idle,
|
|
|
|
.safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
|
2011-01-23 21:37:33 +08:00
|
|
|
|
2011-01-23 21:37:37 +08:00
|
|
|
.x86_32_early_logical_apicid = es7000_early_logical_apicid,
|
2009-02-26 12:50:49 +08:00
|
|
|
};
|
2009-01-29 02:01:05 +08:00
|
|
|
|
2011-05-21 08:51:20 +08:00
|
|
|
static struct apic __refdata apic_es7000 = {
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
.name = "es7000",
|
|
|
|
.probe = probe_es7000,
|
|
|
|
.acpi_madt_oem_check = es7000_acpi_madt_oem_check,
|
2012-03-14 15:17:34 +08:00
|
|
|
.apic_id_valid = default_apic_id_valid,
|
2009-01-29 02:01:05 +08:00
|
|
|
.apic_id_registered = es7000_apic_id_registered,
|
|
|
|
|
|
|
|
.irq_delivery_mode = dest_Fixed,
|
|
|
|
/* phys delivery to target CPUs: */
|
|
|
|
.irq_dest_mode = 0,
|
|
|
|
|
|
|
|
.target_cpus = es7000_target_cpus,
|
|
|
|
.disable_esr = 1,
|
|
|
|
.dest_logical = 0,
|
|
|
|
.check_apicid_used = es7000_check_apicid_used,
|
|
|
|
.check_apicid_present = es7000_check_apicid_present,
|
|
|
|
|
2012-06-07 21:14:49 +08:00
|
|
|
.vector_allocation_domain = flat_vector_allocation_domain,
|
2009-01-29 02:01:05 +08:00
|
|
|
.init_apic_ldr = es7000_init_apic_ldr,
|
|
|
|
|
|
|
|
.ioapic_phys_id_map = es7000_ioapic_phys_id_map,
|
|
|
|
.setup_apic_routing = es7000_setup_apic_routing,
|
|
|
|
.multi_timer_check = NULL,
|
|
|
|
.cpu_present_to_apicid = es7000_cpu_present_to_apicid,
|
|
|
|
.apicid_to_cpu_present = es7000_apicid_to_cpu_present,
|
|
|
|
.setup_portio_remap = NULL,
|
|
|
|
.check_phys_apicid_present = es7000_check_phys_apicid_present,
|
|
|
|
.enable_apic_mode = es7000_enable_apic_mode,
|
|
|
|
.phys_pkg_id = es7000_phys_pkg_id,
|
|
|
|
.mps_oem_check = es7000_mps_oem_check,
|
|
|
|
|
|
|
|
.get_apic_id = es7000_get_apic_id,
|
|
|
|
.set_apic_id = NULL,
|
|
|
|
.apic_id_mask = 0xFF << 24,
|
|
|
|
|
|
|
|
.cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
|
|
|
|
|
|
|
|
.send_IPI_mask = es7000_send_IPI_mask,
|
|
|
|
.send_IPI_mask_allbutself = NULL,
|
|
|
|
.send_IPI_allbutself = es7000_send_IPI_allbutself,
|
|
|
|
.send_IPI_all = es7000_send_IPI_all,
|
2009-01-31 06:42:18 +08:00
|
|
|
.send_IPI_self = default_send_IPI_self,
|
2009-01-29 02:01:05 +08:00
|
|
|
|
|
|
|
.trampoline_phys_low = 0x467,
|
|
|
|
.trampoline_phys_high = 0x469,
|
|
|
|
|
|
|
|
.wait_for_init_deassert = es7000_wait_for_init_deassert,
|
|
|
|
|
|
|
|
/* Nothing to do for most platforms, since cleared by the INIT cycle: */
|
|
|
|
.smp_callin_clear_local_apic = NULL,
|
|
|
|
.inquire_remote_apic = default_inquire_remote_apic,
|
2009-02-17 15:02:14 +08:00
|
|
|
|
|
|
|
.read = native_apic_mem_read,
|
|
|
|
.write = native_apic_mem_write,
|
2012-05-17 00:03:52 +08:00
|
|
|
.eoi_write = native_apic_mem_write,
|
2009-02-17 15:02:14 +08:00
|
|
|
.icr_read = native_apic_icr_read,
|
|
|
|
.icr_write = native_apic_icr_write,
|
|
|
|
.wait_icr_idle = native_apic_wait_icr_idle,
|
|
|
|
.safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
|
2011-01-23 21:37:33 +08:00
|
|
|
|
2011-01-23 21:37:37 +08:00
|
|
|
.x86_32_early_logical_apicid = es7000_early_logical_apicid,
|
2009-01-29 02:01:05 +08:00
|
|
|
};
|
2011-05-21 08:51:17 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Need to check for es7000 followed by es7000_cluster, so this order
|
|
|
|
* in apic_drivers is important.
|
|
|
|
*/
|
|
|
|
apic_drivers(apic_es7000, apic_es7000_cluster);
|