License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* This file contains work-arounds for x86 and x86_64 platform bugs.
|
|
|
|
*/
|
2017-08-01 20:10:41 +08:00
|
|
|
#include <linux/dmi.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
|
2007-10-13 05:04:23 +08:00
|
|
|
#include <asm/hpet.h>
|
2018-11-22 10:04:09 +08:00
|
|
|
#include <asm/setup.h>
|
2007-10-13 05:04:23 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
|
|
|
|
|
2012-12-22 06:02:53 +08:00
|
|
|
static void quirk_intel_irqbalance(struct pci_dev *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-07-11 23:01:38 +08:00
|
|
|
u8 config;
|
2008-02-11 12:18:15 +08:00
|
|
|
u16 word;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* BIOS may enable hardware IRQ balancing for
|
|
|
|
* E7520/E7320/E7525(revision ID 0x9 and below)
|
|
|
|
* based platforms.
|
|
|
|
* Disable SW irqbalance/affinity on those platforms.
|
|
|
|
*/
|
2011-07-11 23:01:38 +08:00
|
|
|
if (dev->revision > 0x9)
|
2005-04-17 06:20:36 +08:00
|
|
|
return;
|
|
|
|
|
2007-05-03 01:27:04 +08:00
|
|
|
/* enable access to config space*/
|
|
|
|
pci_read_config_byte(dev, 0xf4, &config);
|
|
|
|
pci_write_config_byte(dev, 0xf4, config|0x2);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-02-11 12:18:15 +08:00
|
|
|
/*
|
|
|
|
* read xTPR register. We may not have a pci_dev for device 8
|
|
|
|
* because it might be hidden until the above write.
|
|
|
|
*/
|
|
|
|
pci_bus_read_config_word(dev->bus, PCI_DEVFN(8, 0), 0x4c, &word);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!(word & (1 << 13))) {
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_info(&dev->dev, "Intel E7520/7320/7525 detected; "
|
|
|
|
"disabling irq balancing and affinity\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
noirqdebug_setup("");
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
no_irq_affinity = 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-05-03 01:27:04 +08:00
|
|
|
/* put back the original value for config space*/
|
2006-01-19 09:44:13 +08:00
|
|
|
if (!(config & 0x2))
|
2007-05-03 01:27:04 +08:00
|
|
|
pci_write_config_byte(dev, 0xf4, config);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2007-10-20 02:35:02 +08:00
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH,
|
|
|
|
quirk_intel_irqbalance);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH,
|
|
|
|
quirk_intel_irqbalance);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH,
|
|
|
|
quirk_intel_irqbalance);
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
2007-10-13 05:04:23 +08:00
|
|
|
|
|
|
|
#if defined(CONFIG_HPET_TIMER)
|
|
|
|
unsigned long force_hpet_address;
|
|
|
|
|
2007-10-13 05:04:24 +08:00
|
|
|
static enum {
|
|
|
|
NONE_FORCE_HPET_RESUME,
|
|
|
|
OLD_ICH_FORCE_HPET_RESUME,
|
2007-10-20 02:35:02 +08:00
|
|
|
ICH_FORCE_HPET_RESUME,
|
2007-10-20 01:51:27 +08:00
|
|
|
VT8237_FORCE_HPET_RESUME,
|
|
|
|
NVIDIA_FORCE_HPET_RESUME,
|
2008-05-09 17:49:11 +08:00
|
|
|
ATI_FORCE_HPET_RESUME,
|
2007-10-13 05:04:24 +08:00
|
|
|
} force_hpet_resume_type;
|
|
|
|
|
2007-10-13 05:04:23 +08:00
|
|
|
static void __iomem *rcba_base;
|
|
|
|
|
2007-10-13 05:04:24 +08:00
|
|
|
static void ich_force_hpet_resume(void)
|
2007-10-13 05:04:23 +08:00
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
if (!force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
2009-03-10 13:10:32 +08:00
|
|
|
BUG_ON(rcba_base == NULL);
|
2007-10-13 05:04:23 +08:00
|
|
|
|
|
|
|
/* read the Function Disable register, dword mode only */
|
|
|
|
val = readl(rcba_base + 0x3404);
|
|
|
|
if (!(val & 0x80)) {
|
|
|
|
/* HPET disabled in HPTC. Trying to enable */
|
|
|
|
writel(val | 0x80, rcba_base + 0x3404);
|
|
|
|
}
|
|
|
|
|
|
|
|
val = readl(rcba_base + 0x3404);
|
|
|
|
if (!(val & 0x80))
|
|
|
|
BUG();
|
|
|
|
else
|
|
|
|
printk(KERN_DEBUG "Force enabled HPET at resume\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ich_force_enable_hpet(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
u32 uninitialized_var(rcba);
|
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
if (hpet_address || force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pci_read_config_dword(dev, 0xF0, &rcba);
|
|
|
|
rcba &= 0xFFFFC000;
|
|
|
|
if (rcba == 0) {
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "RCBA disabled; "
|
|
|
|
"cannot force enable HPET\n");
|
2007-10-13 05:04:23 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* use bits 31:14, 16 kB aligned */
|
2020-01-06 16:43:50 +08:00
|
|
|
rcba_base = ioremap(rcba, 0x4000);
|
2007-10-13 05:04:23 +08:00
|
|
|
if (rcba_base == NULL) {
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "ioremap failed; "
|
|
|
|
"cannot force enable HPET\n");
|
2007-10-13 05:04:23 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read the Function Disable register, dword mode only */
|
|
|
|
val = readl(rcba_base + 0x3404);
|
|
|
|
|
|
|
|
if (val & 0x80) {
|
|
|
|
/* HPET is enabled in HPTC. Just not reported by BIOS */
|
|
|
|
val = val & 0x3;
|
|
|
|
force_hpet_address = 0xFED00000 | (val << 12);
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
|
|
|
|
"0x%lx\n", force_hpet_address);
|
2007-10-13 05:04:23 +08:00
|
|
|
iounmap(rcba_base);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* HPET disabled in HPTC. Trying to enable */
|
|
|
|
writel(val | 0x80, rcba_base + 0x3404);
|
|
|
|
|
|
|
|
val = readl(rcba_base + 0x3404);
|
|
|
|
if (!(val & 0x80)) {
|
|
|
|
err = 1;
|
|
|
|
} else {
|
|
|
|
val = val & 0x3;
|
|
|
|
force_hpet_address = 0xFED00000 | (val << 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
force_hpet_address = 0;
|
|
|
|
iounmap(rcba_base);
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev,
|
|
|
|
"Failed to force enable HPET\n");
|
2007-10-13 05:04:23 +08:00
|
|
|
} else {
|
2007-10-13 05:04:24 +08:00
|
|
|
force_hpet_resume_type = ICH_FORCE_HPET_RESUME;
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
|
|
|
|
"0x%lx\n", force_hpet_address);
|
2007-10-13 05:04:23 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,
|
2007-10-20 02:35:02 +08:00
|
|
|
ich_force_enable_hpet);
|
2008-06-04 09:40:17 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0,
|
|
|
|
ich_force_enable_hpet);
|
2007-10-13 05:04:23 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1,
|
2007-10-20 02:35:02 +08:00
|
|
|
ich_force_enable_hpet);
|
2007-10-13 05:04:24 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0,
|
2007-10-20 02:35:02 +08:00
|
|
|
ich_force_enable_hpet);
|
2007-10-13 05:04:23 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1,
|
2007-10-20 02:35:02 +08:00
|
|
|
ich_force_enable_hpet);
|
2007-10-13 05:04:23 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31,
|
2007-10-20 02:35:02 +08:00
|
|
|
ich_force_enable_hpet);
|
2007-10-13 05:04:23 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1,
|
2007-10-20 02:35:02 +08:00
|
|
|
ich_force_enable_hpet);
|
2008-12-16 19:39:57 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4,
|
|
|
|
ich_force_enable_hpet);
|
2008-01-30 20:33:39 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7,
|
|
|
|
ich_force_enable_hpet);
|
2009-01-10 04:17:40 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x3a16, /* ICH10 */
|
|
|
|
ich_force_enable_hpet);
|
2007-10-13 05:04:24 +08:00
|
|
|
|
|
|
|
static struct pci_dev *cached_dev;
|
|
|
|
|
2008-05-11 03:42:14 +08:00
|
|
|
static void hpet_print_force_info(void)
|
|
|
|
{
|
|
|
|
printk(KERN_INFO "HPET not enabled in BIOS. "
|
|
|
|
"You might try hpet=force boot option\n");
|
|
|
|
}
|
|
|
|
|
2007-10-13 05:04:24 +08:00
|
|
|
static void old_ich_force_hpet_resume(void)
|
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
u32 uninitialized_var(gen_cntl);
|
|
|
|
|
|
|
|
if (!force_hpet_address || !cached_dev)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pci_read_config_dword(cached_dev, 0xD0, &gen_cntl);
|
|
|
|
gen_cntl &= (~(0x7 << 15));
|
|
|
|
gen_cntl |= (0x4 << 15);
|
|
|
|
|
|
|
|
pci_write_config_dword(cached_dev, 0xD0, gen_cntl);
|
|
|
|
pci_read_config_dword(cached_dev, 0xD0, &gen_cntl);
|
|
|
|
val = gen_cntl >> 15;
|
|
|
|
val &= 0x7;
|
|
|
|
if (val == 0x4)
|
|
|
|
printk(KERN_DEBUG "Force enabled HPET at resume\n");
|
|
|
|
else
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void old_ich_force_enable_hpet(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
u32 uninitialized_var(gen_cntl);
|
|
|
|
|
|
|
|
if (hpet_address || force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pci_read_config_dword(dev, 0xD0, &gen_cntl);
|
|
|
|
/*
|
|
|
|
* Bit 17 is HPET enable bit.
|
|
|
|
* Bit 16:15 control the HPET base address.
|
|
|
|
*/
|
|
|
|
val = gen_cntl >> 15;
|
|
|
|
val &= 0x7;
|
|
|
|
if (val & 0x4) {
|
|
|
|
val &= 0x3;
|
|
|
|
force_hpet_address = 0xFED00000 | (val << 12);
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "HPET at 0x%lx\n",
|
|
|
|
force_hpet_address);
|
2007-10-13 05:04:24 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* HPET is disabled. Trying enabling at FED00000 and check
|
|
|
|
* whether it sticks
|
|
|
|
*/
|
|
|
|
gen_cntl &= (~(0x7 << 15));
|
|
|
|
gen_cntl |= (0x4 << 15);
|
|
|
|
pci_write_config_dword(dev, 0xD0, gen_cntl);
|
|
|
|
|
|
|
|
pci_read_config_dword(dev, 0xD0, &gen_cntl);
|
|
|
|
|
|
|
|
val = gen_cntl >> 15;
|
|
|
|
val &= 0x7;
|
|
|
|
if (val & 0x4) {
|
|
|
|
/* HPET is enabled in HPTC. Just not reported by BIOS */
|
|
|
|
val &= 0x3;
|
|
|
|
force_hpet_address = 0xFED00000 | (val << 12);
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
|
|
|
|
"0x%lx\n", force_hpet_address);
|
2007-10-13 05:04:24 +08:00
|
|
|
cached_dev = dev;
|
2007-10-13 05:04:24 +08:00
|
|
|
force_hpet_resume_type = OLD_ICH_FORCE_HPET_RESUME;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Failed to force enable HPET\n");
|
2007-10-13 05:04:24 +08:00
|
|
|
}
|
|
|
|
|
2007-10-20 02:35:02 +08:00
|
|
|
/*
|
|
|
|
* Undocumented chipset features. Make sure that the user enforced
|
|
|
|
* this.
|
|
|
|
*/
|
|
|
|
static void old_ich_force_enable_hpet_user(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
if (hpet_force_user)
|
|
|
|
old_ich_force_enable_hpet(dev);
|
|
|
|
}
|
|
|
|
|
2008-06-09 20:55:20 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1,
|
|
|
|
old_ich_force_enable_hpet_user);
|
2007-10-20 02:35:02 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
|
|
|
|
old_ich_force_enable_hpet_user);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12,
|
|
|
|
old_ich_force_enable_hpet_user);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
|
|
|
|
old_ich_force_enable_hpet_user);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12,
|
|
|
|
old_ich_force_enable_hpet_user);
|
2007-10-13 05:04:24 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
|
2007-10-20 02:35:02 +08:00
|
|
|
old_ich_force_enable_hpet);
|
2007-10-13 05:04:24 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12,
|
2007-10-20 02:35:02 +08:00
|
|
|
old_ich_force_enable_hpet);
|
2007-10-13 05:04:24 +08:00
|
|
|
|
2007-10-20 02:35:02 +08:00
|
|
|
|
|
|
|
static void vt8237_force_hpet_resume(void)
|
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
if (!force_hpet_address || !cached_dev)
|
|
|
|
return;
|
|
|
|
|
|
|
|
val = 0xfed00000 | 0x80;
|
|
|
|
pci_write_config_dword(cached_dev, 0x68, val);
|
|
|
|
|
|
|
|
pci_read_config_dword(cached_dev, 0x68, &val);
|
|
|
|
if (val & 0x80)
|
|
|
|
printk(KERN_DEBUG "Force enabled HPET at resume\n");
|
|
|
|
else
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void vt8237_force_enable_hpet(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
u32 uninitialized_var(val);
|
|
|
|
|
2008-05-11 03:42:14 +08:00
|
|
|
if (hpet_address || force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!hpet_force_user) {
|
|
|
|
hpet_print_force_info();
|
2007-10-20 02:35:02 +08:00
|
|
|
return;
|
2008-05-11 03:42:14 +08:00
|
|
|
}
|
2007-10-20 02:35:02 +08:00
|
|
|
|
|
|
|
pci_read_config_dword(dev, 0x68, &val);
|
|
|
|
/*
|
|
|
|
* Bit 7 is HPET enable bit.
|
|
|
|
* Bit 31:10 is HPET base address (contrary to what datasheet claims)
|
|
|
|
*/
|
|
|
|
if (val & 0x80) {
|
|
|
|
force_hpet_address = (val & ~0x3ff);
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "HPET at 0x%lx\n",
|
|
|
|
force_hpet_address);
|
2007-10-20 02:35:02 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* HPET is disabled. Trying enabling at FED00000 and check
|
|
|
|
* whether it sticks
|
|
|
|
*/
|
|
|
|
val = 0xfed00000 | 0x80;
|
|
|
|
pci_write_config_dword(dev, 0x68, val);
|
|
|
|
|
|
|
|
pci_read_config_dword(dev, 0x68, &val);
|
|
|
|
if (val & 0x80) {
|
|
|
|
force_hpet_address = (val & ~0x3ff);
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
|
|
|
|
"0x%lx\n", force_hpet_address);
|
2007-10-20 02:35:02 +08:00
|
|
|
cached_dev = dev;
|
|
|
|
force_hpet_resume_type = VT8237_FORCE_HPET_RESUME;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Failed to force enable HPET\n");
|
2007-10-20 02:35:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
|
|
|
|
vt8237_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
|
|
|
|
vt8237_force_enable_hpet);
|
2010-09-14 13:15:08 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_CX700,
|
|
|
|
vt8237_force_enable_hpet);
|
2007-10-20 02:35:02 +08:00
|
|
|
|
2008-05-09 17:49:11 +08:00
|
|
|
static void ati_force_hpet_resume(void)
|
|
|
|
{
|
|
|
|
pci_write_config_dword(cached_dev, 0x14, 0xfed00000);
|
|
|
|
printk(KERN_DEBUG "Force enabled HPET at resume\n");
|
|
|
|
}
|
|
|
|
|
2008-09-06 00:33:26 +08:00
|
|
|
static u32 ati_ixp4x0_rev(struct pci_dev *dev)
|
|
|
|
{
|
2013-03-05 04:16:20 +08:00
|
|
|
int err = 0;
|
|
|
|
u32 d = 0;
|
|
|
|
u8 b = 0;
|
2008-09-06 00:33:26 +08:00
|
|
|
|
2013-03-05 04:16:20 +08:00
|
|
|
err = pci_read_config_byte(dev, 0xac, &b);
|
2008-09-06 00:33:26 +08:00
|
|
|
b &= ~(1<<5);
|
2013-03-05 04:16:20 +08:00
|
|
|
err |= pci_write_config_byte(dev, 0xac, b);
|
|
|
|
err |= pci_read_config_dword(dev, 0x70, &d);
|
2008-09-06 00:33:26 +08:00
|
|
|
d |= 1<<8;
|
2013-03-05 04:16:20 +08:00
|
|
|
err |= pci_write_config_dword(dev, 0x70, d);
|
|
|
|
err |= pci_read_config_dword(dev, 0x8, &d);
|
2008-09-06 00:33:26 +08:00
|
|
|
d &= 0xff;
|
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "SB4X0 revision 0x%x\n", d);
|
2013-03-05 04:16:20 +08:00
|
|
|
|
|
|
|
WARN_ON_ONCE(err);
|
|
|
|
|
2008-09-06 00:33:26 +08:00
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:49:11 +08:00
|
|
|
static void ati_force_enable_hpet(struct pci_dev *dev)
|
|
|
|
{
|
2008-09-06 00:33:26 +08:00
|
|
|
u32 d, val;
|
|
|
|
u8 b;
|
2008-05-09 17:49:11 +08:00
|
|
|
|
2008-05-11 03:42:14 +08:00
|
|
|
if (hpet_address || force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!hpet_force_user) {
|
|
|
|
hpet_print_force_info();
|
2008-05-09 17:49:11 +08:00
|
|
|
return;
|
2008-05-11 03:42:14 +08:00
|
|
|
}
|
2008-05-09 17:49:11 +08:00
|
|
|
|
2008-09-06 00:33:26 +08:00
|
|
|
d = ati_ixp4x0_rev(dev);
|
|
|
|
if (d < 0x82)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* base address */
|
2008-05-09 17:49:11 +08:00
|
|
|
pci_write_config_dword(dev, 0x14, 0xfed00000);
|
|
|
|
pci_read_config_dword(dev, 0x14, &val);
|
2008-09-06 00:33:26 +08:00
|
|
|
|
|
|
|
/* enable interrupt */
|
|
|
|
outb(0x72, 0xcd6); b = inb(0xcd7);
|
|
|
|
b |= 0x1;
|
|
|
|
outb(0x72, 0xcd6); outb(b, 0xcd7);
|
|
|
|
outb(0x72, 0xcd6); b = inb(0xcd7);
|
|
|
|
if (!(b & 0x1))
|
|
|
|
return;
|
|
|
|
pci_read_config_dword(dev, 0x64, &d);
|
|
|
|
d |= (1<<10);
|
|
|
|
pci_write_config_dword(dev, 0x64, d);
|
|
|
|
pci_read_config_dword(dev, 0x64, &d);
|
|
|
|
if (!(d & (1<<10)))
|
|
|
|
return;
|
|
|
|
|
2008-05-09 17:49:11 +08:00
|
|
|
force_hpet_address = val;
|
|
|
|
force_hpet_resume_type = ATI_FORCE_HPET_RESUME;
|
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
|
|
|
|
force_hpet_address);
|
|
|
|
cached_dev = dev;
|
|
|
|
}
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
|
|
|
|
ati_force_enable_hpet);
|
|
|
|
|
2007-10-20 01:51:27 +08:00
|
|
|
/*
|
|
|
|
* Undocumented chipset feature taken from LinuxBIOS.
|
|
|
|
*/
|
|
|
|
static void nvidia_force_hpet_resume(void)
|
|
|
|
{
|
|
|
|
pci_write_config_dword(cached_dev, 0x44, 0xfed00001);
|
|
|
|
printk(KERN_DEBUG "Force enabled HPET at resume\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void nvidia_force_enable_hpet(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
u32 uninitialized_var(val);
|
|
|
|
|
2008-05-11 03:42:14 +08:00
|
|
|
if (hpet_address || force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!hpet_force_user) {
|
|
|
|
hpet_print_force_info();
|
2007-10-20 01:51:27 +08:00
|
|
|
return;
|
2008-05-11 03:42:14 +08:00
|
|
|
}
|
2007-10-20 01:51:27 +08:00
|
|
|
|
|
|
|
pci_write_config_dword(dev, 0x44, 0xfed00001);
|
|
|
|
pci_read_config_dword(dev, 0x44, &val);
|
|
|
|
force_hpet_address = val & 0xfffffffe;
|
|
|
|
force_hpet_resume_type = NVIDIA_FORCE_HPET_RESUME;
|
2007-12-18 05:09:40 +08:00
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
|
2007-10-20 01:51:27 +08:00
|
|
|
force_hpet_address);
|
|
|
|
cached_dev = dev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ISA Bridges */
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0050,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0051,
|
|
|
|
nvidia_force_enable_hpet);
|
2007-10-20 02:35:02 +08:00
|
|
|
|
2007-10-20 02:34:15 +08:00
|
|
|
/* LPC bridges */
|
2008-03-19 22:51:50 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0260,
|
|
|
|
nvidia_force_enable_hpet);
|
2007-10-20 02:34:15 +08:00
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0360,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0361,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0362,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0363,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0364,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0365,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0366,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0367,
|
|
|
|
nvidia_force_enable_hpet);
|
|
|
|
|
2007-10-13 05:04:24 +08:00
|
|
|
void force_hpet_resume(void)
|
|
|
|
{
|
|
|
|
switch (force_hpet_resume_type) {
|
2008-02-07 05:39:44 +08:00
|
|
|
case ICH_FORCE_HPET_RESUME:
|
|
|
|
ich_force_hpet_resume();
|
|
|
|
return;
|
|
|
|
case OLD_ICH_FORCE_HPET_RESUME:
|
|
|
|
old_ich_force_hpet_resume();
|
|
|
|
return;
|
|
|
|
case VT8237_FORCE_HPET_RESUME:
|
|
|
|
vt8237_force_hpet_resume();
|
|
|
|
return;
|
|
|
|
case NVIDIA_FORCE_HPET_RESUME:
|
|
|
|
nvidia_force_hpet_resume();
|
|
|
|
return;
|
2008-05-09 17:49:11 +08:00
|
|
|
case ATI_FORCE_HPET_RESUME:
|
|
|
|
ati_force_hpet_resume();
|
|
|
|
return;
|
2008-02-07 05:39:44 +08:00
|
|
|
default:
|
2007-10-13 05:04:24 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-01-22 03:09:52 +08:00
|
|
|
|
2014-09-12 19:06:13 +08:00
|
|
|
/*
|
|
|
|
* According to the datasheet e6xx systems have the HPET hardwired to
|
|
|
|
* 0xfed00000
|
|
|
|
*/
|
|
|
|
static void e6xx_force_enable_hpet(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
if (hpet_address || force_hpet_address)
|
|
|
|
return;
|
|
|
|
|
|
|
|
force_hpet_address = 0xFED00000;
|
|
|
|
force_hpet_resume_type = NONE_FORCE_HPET_RESUME;
|
|
|
|
dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
|
|
|
|
"0x%lx\n", force_hpet_address);
|
|
|
|
}
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E6XX_CU,
|
|
|
|
e6xx_force_enable_hpet);
|
|
|
|
|
2010-01-22 03:09:52 +08:00
|
|
|
/*
|
|
|
|
* HPET MSI on some boards (ATI SB700/SB800) has side effect on
|
|
|
|
* floppy DMA. Disable HPET MSI on such platforms.
|
2010-05-18 00:43:24 +08:00
|
|
|
* See erratum #27 (Misinterpreted MSI Requests May Result in
|
|
|
|
* Corrupted LPC DMA Data) in AMD Publication #46837,
|
|
|
|
* "SB700 Family Product Errata", Rev. 1.0, March 2010.
|
2010-01-22 03:09:52 +08:00
|
|
|
*/
|
|
|
|
static void force_disable_hpet_msi(struct pci_dev *unused)
|
|
|
|
{
|
2015-10-19 18:35:44 +08:00
|
|
|
hpet_msi_disable = true;
|
2010-01-22 03:09:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
|
|
|
|
force_disable_hpet_msi);
|
|
|
|
|
2009-04-17 18:07:46 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
|
|
|
|
/* Set correct numa_node information for AMD NB functions */
|
2012-12-22 06:02:53 +08:00
|
|
|
static void quirk_amd_nb_node(struct pci_dev *dev)
|
2009-04-17 18:07:46 +08:00
|
|
|
{
|
|
|
|
struct pci_dev *nb_ht;
|
|
|
|
unsigned int devfn;
|
2009-11-13 02:09:31 +08:00
|
|
|
u32 node;
|
2009-04-17 18:07:46 +08:00
|
|
|
u32 val;
|
|
|
|
|
|
|
|
devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 0);
|
|
|
|
nb_ht = pci_get_slot(dev->bus, devfn);
|
|
|
|
if (!nb_ht)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pci_read_config_dword(nb_ht, 0x60, &val);
|
2014-03-13 19:43:01 +08:00
|
|
|
node = pcibus_to_node(dev->bus) | (val & 7);
|
2009-11-13 02:09:31 +08:00
|
|
|
/*
|
|
|
|
* Some hardware may return an invalid node ID,
|
|
|
|
* so check it first:
|
|
|
|
*/
|
|
|
|
if (node_online(node))
|
|
|
|
set_dev_node(&dev->dev, node);
|
2009-09-08 18:16:18 +08:00
|
|
|
pci_dev_put(nb_ht);
|
2009-04-17 18:07:46 +08:00
|
|
|
}
|
2007-10-13 05:04:24 +08:00
|
|
|
|
2009-04-17 18:07:46 +08:00
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MEMCTL,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_HT,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MAP,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_DRAM,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_LINK,
|
|
|
|
quirk_amd_nb_node);
|
2011-12-02 15:21:43 +08:00
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F0,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F1,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F2,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5,
|
|
|
|
quirk_amd_nb_node);
|
|
|
|
|
2007-10-13 05:04:23 +08:00
|
|
|
#endif
|
2014-01-24 06:13:32 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
/*
|
|
|
|
* Processor does not ensure DRAM scrub read/write sequence
|
|
|
|
* is atomic wrt accesses to CC6 save state area. Therefore
|
|
|
|
* if a concurrent scrub read/write access is to same address
|
|
|
|
* the entry may appear as if it is not written. This quirk
|
|
|
|
* applies to Fam16h models 00h-0Fh
|
|
|
|
*
|
|
|
|
* See "Revision Guide" for AMD F16h models 00h-0fh,
|
|
|
|
* document 51810 rev. 3.04, Nov 2013
|
|
|
|
*/
|
|
|
|
static void amd_disable_seq_and_redirect_scrub(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Suggested workaround:
|
|
|
|
* set D18F3x58[4:0] = 00h and set D18F3x5C[0] = 0b
|
|
|
|
*/
|
|
|
|
pci_read_config_dword(dev, 0x58, &val);
|
|
|
|
if (val & 0x1F) {
|
|
|
|
val &= ~(0x1F);
|
|
|
|
pci_write_config_dword(dev, 0x58, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
pci_read_config_dword(dev, 0x5C, &val);
|
|
|
|
if (val & BIT(0)) {
|
|
|
|
val &= ~BIT(0);
|
|
|
|
pci_write_config_dword(dev, 0x5c, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3,
|
|
|
|
amd_disable_seq_and_redirect_scrub);
|
|
|
|
|
2016-09-02 02:39:33 +08:00
|
|
|
#if defined(CONFIG_X86_64) && defined(CONFIG_X86_MCE)
|
|
|
|
#include <linux/jump_label.h>
|
|
|
|
#include <asm/string_64.h>
|
|
|
|
|
|
|
|
/* Ivy Bridge, Haswell, Broadwell */
|
|
|
|
static void quirk_intel_brickland_xeon_ras_cap(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
u32 capid0;
|
|
|
|
|
|
|
|
pci_read_config_dword(pdev, 0x84, &capid0);
|
|
|
|
|
|
|
|
if (capid0 & 0x10)
|
|
|
|
static_branch_inc(&mcsafe_key);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skylake */
|
|
|
|
static void quirk_intel_purley_xeon_ras_cap(struct pci_dev *pdev)
|
|
|
|
{
|
2018-05-26 05:42:09 +08:00
|
|
|
u32 capid0, capid5;
|
2016-09-02 02:39:33 +08:00
|
|
|
|
|
|
|
pci_read_config_dword(pdev, 0x84, &capid0);
|
2018-05-26 05:42:09 +08:00
|
|
|
pci_read_config_dword(pdev, 0x98, &capid5);
|
2016-09-02 02:39:33 +08:00
|
|
|
|
2018-05-26 05:42:09 +08:00
|
|
|
/*
|
|
|
|
* CAPID0{7:6} indicate whether this is an advanced RAS SKU
|
|
|
|
* CAPID5{8:5} indicate that various NVDIMM usage modes are
|
|
|
|
* enabled, so memory machine check recovery is also enabled.
|
|
|
|
*/
|
|
|
|
if ((capid0 & 0xc0) == 0xc0 || (capid5 & 0x1e0))
|
2016-09-02 02:39:33 +08:00
|
|
|
static_branch_inc(&mcsafe_key);
|
2018-05-26 05:42:09 +08:00
|
|
|
|
2016-09-02 02:39:33 +08:00
|
|
|
}
|
|
|
|
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x0ec3, quirk_intel_brickland_xeon_ras_cap);
|
|
|
|
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, quirk_intel_brickland_xeon_ras_cap);
|
|
|
|
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, quirk_intel_brickland_xeon_ras_cap);
|
|
|
|
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2083, quirk_intel_purley_xeon_ras_cap);
|
|
|
|
#endif
|
2016-10-24 23:33:18 +08:00
|
|
|
#endif
|
2017-08-01 20:10:41 +08:00
|
|
|
|
|
|
|
bool x86_apple_machine;
|
|
|
|
EXPORT_SYMBOL(x86_apple_machine);
|
|
|
|
|
|
|
|
void __init early_platform_quirks(void)
|
|
|
|
{
|
|
|
|
x86_apple_machine = dmi_match(DMI_SYS_VENDOR, "Apple Inc.") ||
|
|
|
|
dmi_match(DMI_SYS_VENDOR, "Apple Computer, Inc.");
|
|
|
|
}
|