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
|
2006-12-29 01:22:32 +08:00
|
|
|
#include <linux/types.h>
|
2011-06-02 02:04:57 +08:00
|
|
|
#include <linux/i8253.h>
|
2006-12-29 01:22:32 +08:00
|
|
|
#include <linux/interrupt.h>
|
2010-10-07 21:08:54 +08:00
|
|
|
#include <linux/irq.h>
|
2009-06-19 21:05:26 +08:00
|
|
|
#include <linux/smp.h>
|
2006-12-29 01:22:32 +08:00
|
|
|
#include <linux/time.h>
|
2007-11-01 18:36:42 +08:00
|
|
|
#include <linux/clockchips.h>
|
2006-12-29 01:22:32 +08:00
|
|
|
|
|
|
|
#include <asm/sni.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
#define SNI_CLOCK_TICK_RATE 3686400
|
|
|
|
#define SNI_COUNTER2_DIV 64
|
|
|
|
#define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ)
|
2006-12-29 01:22:32 +08:00
|
|
|
|
2015-07-06 19:12:05 +08:00
|
|
|
static int a20r_set_periodic(struct clock_event_device *evt)
|
2006-12-29 01:22:32 +08:00
|
|
|
{
|
2015-07-06 19:12:05 +08:00
|
|
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34;
|
|
|
|
wmb();
|
|
|
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
|
|
|
|
wmb();
|
|
|
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV >> 8;
|
|
|
|
wmb();
|
2007-10-26 21:36:10 +08:00
|
|
|
|
2015-07-06 19:12:05 +08:00
|
|
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0xb4;
|
|
|
|
wmb();
|
|
|
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV;
|
|
|
|
wmb();
|
|
|
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV >> 8;
|
|
|
|
wmb();
|
|
|
|
return 0;
|
2006-12-29 01:22:32 +08:00
|
|
|
}
|
|
|
|
|
2007-10-26 21:36:10 +08:00
|
|
|
static struct clock_event_device a20r_clockevent_device = {
|
2015-07-06 19:12:05 +08:00
|
|
|
.name = "a20r-timer",
|
|
|
|
.features = CLOCK_EVT_FEAT_PERIODIC,
|
2007-10-26 21:36:10 +08:00
|
|
|
|
|
|
|
/* .mult, .shift, .max_delta_ns and .min_delta_ns left uninitialized */
|
|
|
|
|
2015-07-06 19:12:05 +08:00
|
|
|
.rating = 300,
|
|
|
|
.irq = SNI_A20R_IRQ_TIMER,
|
|
|
|
.set_state_periodic = a20r_set_periodic,
|
2007-10-26 21:36:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static irqreturn_t a20r_interrupt(int irq, void *dev_id)
|
|
|
|
{
|
|
|
|
struct clock_event_device *cd = dev_id;
|
|
|
|
|
|
|
|
*(volatile u8 *)A20R_PT_TIM0_ACK = 0;
|
|
|
|
wmb();
|
|
|
|
|
|
|
|
cd->event_handler(cd);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2006-12-29 01:22:32 +08:00
|
|
|
/*
|
|
|
|
* a20r platform uses 2 counters to divide the input frequency.
|
|
|
|
* Counter 2 output is connected to Counter 0 & 1 input.
|
|
|
|
*/
|
2007-10-26 21:36:10 +08:00
|
|
|
static void __init sni_a20r_timer_setup(void)
|
2006-12-29 01:22:32 +08:00
|
|
|
{
|
2007-10-26 21:36:10 +08:00
|
|
|
struct clock_event_device *cd = &a20r_clockevent_device;
|
|
|
|
unsigned int cpu = smp_processor_id();
|
2006-12-29 01:22:32 +08:00
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
cd->cpumask = cpumask_of(cpu);
|
2007-11-01 18:36:42 +08:00
|
|
|
clockevents_register_device(cd);
|
2020-03-05 19:57:53 +08:00
|
|
|
if (request_irq(SNI_A20R_IRQ_TIMER, a20r_interrupt,
|
|
|
|
IRQF_PERCPU | IRQF_TIMER, "a20r-timer", cd))
|
|
|
|
pr_err("Failed to register a20r-timer interrupt\n");
|
2006-12-29 01:22:32 +08:00
|
|
|
}
|
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
#define SNI_8254_TICK_RATE 1193182UL
|
2006-12-29 01:22:32 +08:00
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
#define SNI_8254_TCSAMP_COUNTER ((SNI_8254_TICK_RATE / HZ) + 255)
|
2006-12-29 01:22:32 +08:00
|
|
|
|
|
|
|
static __init unsigned long dosample(void)
|
|
|
|
{
|
|
|
|
u32 ct0, ct1;
|
2011-03-29 17:57:11 +08:00
|
|
|
volatile u8 msb;
|
2006-12-29 01:22:32 +08:00
|
|
|
|
|
|
|
/* Start the counter. */
|
2007-10-12 06:46:15 +08:00
|
|
|
outb_p(0x34, 0x43);
|
2006-12-29 01:22:32 +08:00
|
|
|
outb_p(SNI_8254_TCSAMP_COUNTER & 0xff, 0x40);
|
2007-10-12 06:46:15 +08:00
|
|
|
outb(SNI_8254_TCSAMP_COUNTER >> 8, 0x40);
|
2006-12-29 01:22:32 +08:00
|
|
|
|
|
|
|
/* Get initial counter invariant */
|
|
|
|
ct0 = read_c0_count();
|
|
|
|
|
|
|
|
/* Latch and spin until top byte of counter0 is zero */
|
|
|
|
do {
|
2007-10-12 06:46:15 +08:00
|
|
|
outb(0x00, 0x43);
|
2011-03-29 17:57:11 +08:00
|
|
|
(void) inb(0x40);
|
2007-10-12 06:46:15 +08:00
|
|
|
msb = inb(0x40);
|
2006-12-29 01:22:32 +08:00
|
|
|
ct1 = read_c0_count();
|
|
|
|
} while (msb);
|
|
|
|
|
|
|
|
/* Stop the counter. */
|
2007-10-12 06:46:15 +08:00
|
|
|
outb(0x38, 0x43);
|
2006-12-29 01:22:32 +08:00
|
|
|
/*
|
|
|
|
* Return the difference, this is how far the r4k counter increments
|
|
|
|
* for every 1/HZ seconds. We round off the nearest 1 MHz of master
|
|
|
|
* clock (= 1000000 / HZ / 2).
|
|
|
|
*/
|
|
|
|
/*return (ct1 - ct0 + (500000/HZ/2)) / (500000/HZ) * (500000/HZ);*/
|
|
|
|
return (ct1 - ct0) / (500000/HZ) * (500000/HZ);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Here we need to calibrate the cycle counter to at least be close.
|
|
|
|
*/
|
2007-10-12 06:46:08 +08:00
|
|
|
void __init plat_time_init(void)
|
2006-12-29 01:22:32 +08:00
|
|
|
{
|
|
|
|
unsigned long r4k_ticks[3];
|
|
|
|
unsigned long r4k_tick;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Figure out the r4k offset, the algorithm is very simple and works in
|
|
|
|
* _all_ cases as long as the 8254 counter register itself works ok (as
|
|
|
|
* an interrupt driving timer it does not because of bug, this is why
|
|
|
|
* we are using the onchip r4k counter/compare register to serve this
|
|
|
|
* purpose, but for r4k_offset calculation it will work ok for us).
|
|
|
|
* There are other very complicated ways of performing this calculation
|
|
|
|
* but this one works just fine so I am not going to futz around. ;-)
|
|
|
|
*/
|
|
|
|
printk(KERN_INFO "Calibrating system timer... ");
|
|
|
|
dosample(); /* Prime cache. */
|
|
|
|
dosample(); /* Prime cache. */
|
|
|
|
/* Zero is NOT an option. */
|
|
|
|
do {
|
|
|
|
r4k_ticks[0] = dosample();
|
|
|
|
} while (!r4k_ticks[0]);
|
|
|
|
do {
|
|
|
|
r4k_ticks[1] = dosample();
|
|
|
|
} while (!r4k_ticks[1]);
|
|
|
|
|
|
|
|
if (r4k_ticks[0] != r4k_ticks[1]) {
|
|
|
|
printk("warning: timer counts differ, retrying... ");
|
|
|
|
r4k_ticks[2] = dosample();
|
|
|
|
if (r4k_ticks[2] == r4k_ticks[0]
|
|
|
|
|| r4k_ticks[2] == r4k_ticks[1])
|
|
|
|
r4k_tick = r4k_ticks[2];
|
|
|
|
else {
|
|
|
|
printk("disagreement, using average... ");
|
|
|
|
r4k_tick = (r4k_ticks[0] + r4k_ticks[1]
|
|
|
|
+ r4k_ticks[2]) / 3;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
r4k_tick = r4k_ticks[0];
|
|
|
|
|
|
|
|
printk("%d [%d.%04d MHz CPU]\n", (int) r4k_tick,
|
|
|
|
(int) (r4k_tick / (500000 / HZ)),
|
|
|
|
(int) (r4k_tick % (500000 / HZ)));
|
|
|
|
|
|
|
|
mips_hpt_frequency = r4k_tick * HZ;
|
2007-10-12 06:46:10 +08:00
|
|
|
|
2006-12-29 01:22:32 +08:00
|
|
|
switch (sni_brd_type) {
|
|
|
|
case SNI_BRD_10:
|
|
|
|
case SNI_BRD_10NEW:
|
|
|
|
case SNI_BRD_TOWER_OASIC:
|
|
|
|
case SNI_BRD_MINITOWER:
|
2007-10-26 21:36:10 +08:00
|
|
|
sni_a20r_timer_setup();
|
|
|
|
break;
|
2006-12-29 01:22:32 +08:00
|
|
|
}
|
2008-01-05 06:31:07 +08:00
|
|
|
setup_pit_timer();
|
2006-12-29 01:22:32 +08:00
|
|
|
}
|