mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 07:04:10 +08:00
b24413180f
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>
272 lines
6.5 KiB
C
272 lines
6.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Macintosh interrupts
|
|
*
|
|
* General design:
|
|
* In contrary to the Amiga and Atari platforms, the Mac hardware seems to
|
|
* exclusively use the autovector interrupts (the 'generic level0-level7'
|
|
* interrupts with exception vectors 0x19-0x1f). The following interrupt levels
|
|
* are used:
|
|
* 1 - VIA1
|
|
* - slot 0: one second interrupt (CA2)
|
|
* - slot 1: VBlank (CA1)
|
|
* - slot 2: ADB data ready (SR full)
|
|
* - slot 3: ADB data (CB2)
|
|
* - slot 4: ADB clock (CB1)
|
|
* - slot 5: timer 2
|
|
* - slot 6: timer 1
|
|
* - slot 7: status of IRQ; signals 'any enabled int.'
|
|
*
|
|
* 2 - VIA2 or RBV
|
|
* - slot 0: SCSI DRQ (CA2)
|
|
* - slot 1: NUBUS IRQ (CA1) need to read port A to find which
|
|
* - slot 2: /EXP IRQ (only on IIci)
|
|
* - slot 3: SCSI IRQ (CB2)
|
|
* - slot 4: ASC IRQ (CB1)
|
|
* - slot 5: timer 2 (not on IIci)
|
|
* - slot 6: timer 1 (not on IIci)
|
|
* - slot 7: status of IRQ; signals 'any enabled int.'
|
|
*
|
|
* Levels 3-6 vary by machine type. For VIA or RBV Macintoshes:
|
|
*
|
|
* 3 - unused (?)
|
|
*
|
|
* 4 - SCC
|
|
*
|
|
* 5 - unused (?)
|
|
* [serial errors or special conditions seem to raise level 6
|
|
* interrupts on some models (LC4xx?)]
|
|
*
|
|
* 6 - off switch (?)
|
|
*
|
|
* Machines with Quadra-like VIA hardware, except PSC and PMU machines, support
|
|
* an alternate interrupt mapping, as used by A/UX. It spreads ethernet and
|
|
* sound out to their own autovector IRQs and gives VIA1 a higher priority:
|
|
*
|
|
* 1 - unused (?)
|
|
*
|
|
* 3 - on-board SONIC
|
|
*
|
|
* 5 - Apple Sound Chip (ASC)
|
|
*
|
|
* 6 - VIA1
|
|
*
|
|
* For OSS Macintoshes (IIfx only), we apply an interrupt mapping similar to
|
|
* the Quadra (A/UX) mapping:
|
|
*
|
|
* 1 - ISM IOP (ADB)
|
|
*
|
|
* 2 - SCSI
|
|
*
|
|
* 3 - NuBus
|
|
*
|
|
* 4 - SCC IOP
|
|
*
|
|
* 6 - VIA1
|
|
*
|
|
* For PSC Macintoshes (660AV, 840AV):
|
|
*
|
|
* 3 - PSC level 3
|
|
* - slot 0: MACE
|
|
*
|
|
* 4 - PSC level 4
|
|
* - slot 1: SCC channel A interrupt
|
|
* - slot 2: SCC channel B interrupt
|
|
* - slot 3: MACE DMA
|
|
*
|
|
* 5 - PSC level 5
|
|
*
|
|
* 6 - PSC level 6
|
|
*
|
|
* Finally we have good 'ole level 7, the non-maskable interrupt:
|
|
*
|
|
* 7 - NMI (programmer's switch on the back of some Macs)
|
|
* Also RAM parity error on models which support it (IIc, IIfx?)
|
|
*
|
|
* The current interrupt logic looks something like this:
|
|
*
|
|
* - We install dispatchers for the autovector interrupts (1-7). These
|
|
* dispatchers are responsible for querying the hardware (the
|
|
* VIA/RBV/OSS/PSC chips) to determine the actual interrupt source. Using
|
|
* this information a machspec interrupt number is generated by placing the
|
|
* index of the interrupt hardware into the low three bits and the original
|
|
* autovector interrupt number in the upper 5 bits. The handlers for the
|
|
* resulting machspec interrupt are then called.
|
|
*
|
|
* - Nubus is a special case because its interrupts are hidden behind two
|
|
* layers of hardware. Nubus interrupts come in as index 1 on VIA #2,
|
|
* which translates to IRQ number 17. In this spot we install _another_
|
|
* dispatcher. This dispatcher finds the interrupting slot number (9-F) and
|
|
* then forms a new machspec interrupt number as above with the slot number
|
|
* minus 9 in the low three bits and the pseudo-level 7 in the upper five
|
|
* bits. The handlers for this new machspec interrupt number are then
|
|
* called. This puts Nubus interrupts into the range 56-62.
|
|
*
|
|
* - The Baboon interrupts (used on some PowerBooks) are an even more special
|
|
* case. They're hidden behind the Nubus slot $C interrupt thus adding a
|
|
* third layer of indirection. Why oh why did the Apple engineers do that?
|
|
*
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/sched/debug.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/delay.h>
|
|
|
|
#include <asm/irq.h>
|
|
#include <asm/macintosh.h>
|
|
#include <asm/macints.h>
|
|
#include <asm/mac_via.h>
|
|
#include <asm/mac_psc.h>
|
|
#include <asm/mac_oss.h>
|
|
#include <asm/mac_iop.h>
|
|
#include <asm/mac_baboon.h>
|
|
#include <asm/hwtest.h>
|
|
#include <asm/irq_regs.h>
|
|
|
|
extern void show_registers(struct pt_regs *);
|
|
|
|
irqreturn_t mac_nmi_handler(int, void *);
|
|
|
|
static unsigned int mac_irq_startup(struct irq_data *);
|
|
static void mac_irq_shutdown(struct irq_data *);
|
|
|
|
static struct irq_chip mac_irq_chip = {
|
|
.name = "mac",
|
|
.irq_enable = mac_irq_enable,
|
|
.irq_disable = mac_irq_disable,
|
|
.irq_startup = mac_irq_startup,
|
|
.irq_shutdown = mac_irq_shutdown,
|
|
};
|
|
|
|
void __init mac_init_IRQ(void)
|
|
{
|
|
m68k_setup_irq_controller(&mac_irq_chip, handle_simple_irq, IRQ_USER,
|
|
NUM_MAC_SOURCES - IRQ_USER);
|
|
|
|
/*
|
|
* Now register the handlers for the master IRQ handlers
|
|
* at levels 1-7. Most of the work is done elsewhere.
|
|
*/
|
|
|
|
if (oss_present)
|
|
oss_register_interrupts();
|
|
else
|
|
via_register_interrupts();
|
|
if (psc)
|
|
psc_register_interrupts();
|
|
if (baboon_present)
|
|
baboon_register_interrupts();
|
|
iop_register_interrupts();
|
|
if (request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI",
|
|
mac_nmi_handler))
|
|
pr_err("Couldn't register NMI\n");
|
|
}
|
|
|
|
/*
|
|
* mac_irq_enable - enable an interrupt source
|
|
* mac_irq_disable - disable an interrupt source
|
|
*
|
|
* These routines are just dispatchers to the VIA/OSS/PSC routines.
|
|
*/
|
|
|
|
void mac_irq_enable(struct irq_data *data)
|
|
{
|
|
int irq = data->irq;
|
|
int irq_src = IRQ_SRC(irq);
|
|
|
|
switch(irq_src) {
|
|
case 1:
|
|
case 2:
|
|
case 7:
|
|
if (oss_present)
|
|
oss_irq_enable(irq);
|
|
else
|
|
via_irq_enable(irq);
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
case 5:
|
|
case 6:
|
|
if (psc)
|
|
psc_irq_enable(irq);
|
|
else if (oss_present)
|
|
oss_irq_enable(irq);
|
|
break;
|
|
case 8:
|
|
if (baboon_present)
|
|
baboon_irq_enable(irq);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void mac_irq_disable(struct irq_data *data)
|
|
{
|
|
int irq = data->irq;
|
|
int irq_src = IRQ_SRC(irq);
|
|
|
|
switch(irq_src) {
|
|
case 1:
|
|
case 2:
|
|
case 7:
|
|
if (oss_present)
|
|
oss_irq_disable(irq);
|
|
else
|
|
via_irq_disable(irq);
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
case 5:
|
|
case 6:
|
|
if (psc)
|
|
psc_irq_disable(irq);
|
|
else if (oss_present)
|
|
oss_irq_disable(irq);
|
|
break;
|
|
case 8:
|
|
if (baboon_present)
|
|
baboon_irq_disable(irq);
|
|
break;
|
|
}
|
|
}
|
|
|
|
static unsigned int mac_irq_startup(struct irq_data *data)
|
|
{
|
|
int irq = data->irq;
|
|
|
|
if (IRQ_SRC(irq) == 7 && !oss_present)
|
|
via_nubus_irq_startup(irq);
|
|
else
|
|
mac_irq_enable(data);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void mac_irq_shutdown(struct irq_data *data)
|
|
{
|
|
int irq = data->irq;
|
|
|
|
if (IRQ_SRC(irq) == 7 && !oss_present)
|
|
via_nubus_irq_shutdown(irq);
|
|
else
|
|
mac_irq_disable(data);
|
|
}
|
|
|
|
static volatile int in_nmi;
|
|
|
|
irqreturn_t mac_nmi_handler(int irq, void *dev_id)
|
|
{
|
|
if (in_nmi)
|
|
return IRQ_HANDLED;
|
|
in_nmi = 1;
|
|
|
|
pr_info("Non-Maskable Interrupt\n");
|
|
show_registers(get_irq_regs());
|
|
|
|
in_nmi = 0;
|
|
return IRQ_HANDLED;
|
|
}
|