mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 02:54:32 +08:00
ead751507d
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> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWfswbQ8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ykvEwCfXU1MuYFQGgMdDmAZXEc+xFXZvqgAoKEcHDNA 6dVh26uchcEQLN/XqUDt =x306 -----END PGP SIGNATURE----- Merge tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull initial SPDX identifiers from Greg KH: "License cleanup: add SPDX license identifiers to some files 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>" * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: License cleanup: add SPDX license identifier to uapi header files with a license License cleanup: add SPDX license identifier to uapi header files with no license License cleanup: add SPDX GPL-2.0 license identifier to files with no license
227 lines
5.4 KiB
C
227 lines
5.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* linux/arch/alpha/kernel/sys_eiger.c
|
|
*
|
|
* Copyright (C) 1995 David A Rusling
|
|
* Copyright (C) 1996, 1999 Jay A Estabrook
|
|
* Copyright (C) 1998, 1999 Richard Henderson
|
|
* Copyright (C) 1999 Iain Grant
|
|
*
|
|
* Code supporting the EIGER (EV6+TSUNAMI).
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/init.h>
|
|
#include <linux/bitops.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
#include <asm/dma.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/mmu_context.h>
|
|
#include <asm/io.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/core_tsunami.h>
|
|
#include <asm/hwrpb.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
#include "proto.h"
|
|
#include "irq_impl.h"
|
|
#include "pci_impl.h"
|
|
#include "machvec_impl.h"
|
|
|
|
|
|
/* Note that this interrupt code is identical to TAKARA. */
|
|
|
|
/* Note mask bit is true for DISABLED irqs. */
|
|
static unsigned long cached_irq_mask[2] = { -1, -1 };
|
|
|
|
static inline void
|
|
eiger_update_irq_hw(unsigned long irq, unsigned long mask)
|
|
{
|
|
int regaddr;
|
|
|
|
mask = (irq >= 64 ? mask << 16 : mask >> ((irq - 16) & 0x30));
|
|
regaddr = 0x510 + (((irq - 16) >> 2) & 0x0c);
|
|
outl(mask & 0xffff0000UL, regaddr);
|
|
}
|
|
|
|
static inline void
|
|
eiger_enable_irq(struct irq_data *d)
|
|
{
|
|
unsigned int irq = d->irq;
|
|
unsigned long mask;
|
|
mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63)));
|
|
eiger_update_irq_hw(irq, mask);
|
|
}
|
|
|
|
static void
|
|
eiger_disable_irq(struct irq_data *d)
|
|
{
|
|
unsigned int irq = d->irq;
|
|
unsigned long mask;
|
|
mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63));
|
|
eiger_update_irq_hw(irq, mask);
|
|
}
|
|
|
|
static struct irq_chip eiger_irq_type = {
|
|
.name = "EIGER",
|
|
.irq_unmask = eiger_enable_irq,
|
|
.irq_mask = eiger_disable_irq,
|
|
.irq_mask_ack = eiger_disable_irq,
|
|
};
|
|
|
|
static void
|
|
eiger_device_interrupt(unsigned long vector)
|
|
{
|
|
unsigned intstatus;
|
|
|
|
/*
|
|
* The PALcode will have passed us vectors 0x800 or 0x810,
|
|
* which are fairly arbitrary values and serve only to tell
|
|
* us whether an interrupt has come in on IRQ0 or IRQ1. If
|
|
* it's IRQ1 it's a PCI interrupt; if it's IRQ0, it's
|
|
* probably ISA, but PCI interrupts can come through IRQ0
|
|
* as well if the interrupt controller isn't in accelerated
|
|
* mode.
|
|
*
|
|
* OTOH, the accelerator thing doesn't seem to be working
|
|
* overly well, so what we'll do instead is try directly
|
|
* examining the Master Interrupt Register to see if it's a
|
|
* PCI interrupt, and if _not_ then we'll pass it on to the
|
|
* ISA handler.
|
|
*/
|
|
|
|
intstatus = inw(0x500) & 15;
|
|
if (intstatus) {
|
|
/*
|
|
* This is a PCI interrupt. Check each bit and
|
|
* despatch an interrupt if it's set.
|
|
*/
|
|
|
|
if (intstatus & 8) handle_irq(16+3);
|
|
if (intstatus & 4) handle_irq(16+2);
|
|
if (intstatus & 2) handle_irq(16+1);
|
|
if (intstatus & 1) handle_irq(16+0);
|
|
} else {
|
|
isa_device_interrupt(vector);
|
|
}
|
|
}
|
|
|
|
static void
|
|
eiger_srm_device_interrupt(unsigned long vector)
|
|
{
|
|
int irq = (vector - 0x800) >> 4;
|
|
handle_irq(irq);
|
|
}
|
|
|
|
static void __init
|
|
eiger_init_irq(void)
|
|
{
|
|
long i;
|
|
|
|
outb(0, DMA1_RESET_REG);
|
|
outb(0, DMA2_RESET_REG);
|
|
outb(DMA_MODE_CASCADE, DMA2_MODE_REG);
|
|
outb(0, DMA2_MASK_REG);
|
|
|
|
if (alpha_using_srm)
|
|
alpha_mv.device_interrupt = eiger_srm_device_interrupt;
|
|
|
|
for (i = 16; i < 128; i += 16)
|
|
eiger_update_irq_hw(i, -1);
|
|
|
|
init_i8259a_irqs();
|
|
|
|
for (i = 16; i < 128; ++i) {
|
|
irq_set_chip_and_handler(i, &eiger_irq_type, handle_level_irq);
|
|
irq_set_status_flags(i, IRQ_LEVEL);
|
|
}
|
|
}
|
|
|
|
static int
|
|
eiger_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
|
{
|
|
u8 irq_orig;
|
|
|
|
/* The SRM console has already calculated out the IRQ value's for
|
|
option cards. As this works lets just read in the value already
|
|
set and change it to a useable value by Linux.
|
|
|
|
All the IRQ values generated by the console are greater than 90,
|
|
so we subtract 80 because it is (90 - allocated ISA IRQ's). */
|
|
|
|
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq_orig);
|
|
|
|
return irq_orig - 0x80;
|
|
}
|
|
|
|
static u8
|
|
eiger_swizzle(struct pci_dev *dev, u8 *pinp)
|
|
{
|
|
struct pci_controller *hose = dev->sysdata;
|
|
int slot, pin = *pinp;
|
|
int bridge_count = 0;
|
|
|
|
/* Find the number of backplane bridges. */
|
|
int backplane = inw(0x502) & 0x0f;
|
|
|
|
switch (backplane)
|
|
{
|
|
case 0x00: bridge_count = 0; break; /* No bridges */
|
|
case 0x01: bridge_count = 1; break; /* 1 */
|
|
case 0x03: bridge_count = 2; break; /* 2 */
|
|
case 0x07: bridge_count = 3; break; /* 3 */
|
|
case 0x0f: bridge_count = 4; break; /* 4 */
|
|
};
|
|
|
|
slot = PCI_SLOT(dev->devfn);
|
|
while (dev->bus->self) {
|
|
/* Check for built-in bridges on hose 0. */
|
|
if (hose->index == 0
|
|
&& (PCI_SLOT(dev->bus->self->devfn)
|
|
> 20 - bridge_count)) {
|
|
slot = PCI_SLOT(dev->devfn);
|
|
break;
|
|
}
|
|
/* Must be a card-based bridge. */
|
|
pin = pci_swizzle_interrupt_pin(dev, pin);
|
|
|
|
/* Move up the chain of bridges. */
|
|
dev = dev->bus->self;
|
|
}
|
|
*pinp = pin;
|
|
return slot;
|
|
}
|
|
|
|
/*
|
|
* The System Vectors
|
|
*/
|
|
|
|
struct alpha_machine_vector eiger_mv __initmv = {
|
|
.vector_name = "Eiger",
|
|
DO_EV6_MMU,
|
|
DO_DEFAULT_RTC,
|
|
DO_TSUNAMI_IO,
|
|
.machine_check = tsunami_machine_check,
|
|
.max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
|
|
.min_io_address = DEFAULT_IO_BASE,
|
|
.min_mem_address = DEFAULT_MEM_BASE,
|
|
.pci_dac_offset = TSUNAMI_DAC_OFFSET,
|
|
|
|
.nr_irqs = 128,
|
|
.device_interrupt = eiger_device_interrupt,
|
|
|
|
.init_arch = tsunami_init_arch,
|
|
.init_irq = eiger_init_irq,
|
|
.init_rtc = common_init_rtc,
|
|
.init_pci = common_init_pci,
|
|
.kill_arch = tsunami_kill_arch,
|
|
.pci_map_irq = eiger_map_irq,
|
|
.pci_swizzle = eiger_swizzle,
|
|
};
|
|
ALIAS_MV(eiger)
|