2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-24 05:04:00 +08:00
linux-next/drivers/scsi/ppa.h
Greg Kroah-Hartman b24413180f 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-02 11:10:55 +01:00

152 lines
5.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* Driver for the PPA3 parallel port SCSI HBA embedded in
* the Iomega ZIP drive
*
* (c) 1996 Grant R. Guenther grant@torque.net
* David Campbell
*
* All comments to David.
*/
#ifndef _PPA_H
#define _PPA_H
#define PPA_VERSION "2.07 (for Linux 2.4.x)"
/*
* this driver has been hacked by Matteo Frigo (athena@theory.lcs.mit.edu)
* to support EPP and scatter-gather. [0.26-athena]
*
* additional hacks by David Campbell
* in response to this driver "mis-behaving" on his machine.
* Fixed EPP to handle "software" changing of EPP port data direction.
* Chased down EPP timeouts
* Made this driver "kernel version friendly" [0.28-athena]
*
* [ Stuff removed ]
*
* Corrected ppa.h for 2.1.x kernels (>=2.1.85)
* Modified "Nat Semi Kludge" for extended chipsets
* [1.41]
*
* Fixed id_probe for EPP 1.9 chipsets (misdetected as EPP 1.7)
* [1.42]
*
* Development solely for 2.1.x kernels from now on!
* [2.00]
*
* Hack and slash at the init code (EPP device check routine)
* Added INSANE option.
* [2.01]
*
* Patch applied to sync against the 2.1.x kernel code
* Included qboot_zip.sh
* [2.02]
*
* Cleaned up the mess left by someone else trying to fix the
* asm section to keep egcc happy. The asm section no longer
* exists, the nibble code is *almost* as fast as the asm code
* providing it is compiled with egcc.
*
* Other clean ups include the follow changes:
* CONFIG_SCSI_PPA_HAVE_PEDANTIC => CONFIG_SCSI_IZIP_EPP16
* added CONFIG_SCSI_IZIP_SLOW_CTR option
* [2.03]
*
* Use ppa_wait() to check for ready AND connected status bits
* Add ppa_wait() calls to ppa_completion()
* by Peter Cherriman <pjc@ecs.soton.ac.uk> and
* Tim Waugh <twaugh@redhat.com>
* [2.04]
*
* Fix kernel panic on scsi timeout, 2000-08-18 [2.05]
*
* Avoid io_request_lock problems.
* John Cavan <johncavan@home.com> [2.06]
*
* Busy wait for connected status bit in ppa_completion()
* in order to cope with some hardware that has this bit low
* for short periods of time.
* Add udelay() to ppa_select()
* by Peter Cherriman <pjc@ecs.soton.ac.uk> and
* Oleg Makarenko <omakarenko@cyberplat.ru>
* [2.07]
*/
/* ------ END OF USER CONFIGURABLE PARAMETERS ----- */
#include <linux/stddef.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/blkdev.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <scsi/scsi_host.h>
/* batteries not included :-) */
/*
* modes in which the driver can operate
*/
#define PPA_AUTODETECT 0 /* Autodetect mode */
#define PPA_NIBBLE 1 /* work in standard 4 bit mode */
#define PPA_PS2 2 /* PS/2 byte mode */
#define PPA_EPP_8 3 /* EPP mode, 8 bit */
#define PPA_EPP_16 4 /* EPP mode, 16 bit */
#define PPA_EPP_32 5 /* EPP mode, 32 bit */
#define PPA_UNKNOWN 6 /* Just in case... */
static char *PPA_MODE_STRING[] =
{
"Autodetect",
"SPP",
"PS/2",
"EPP 8 bit",
"EPP 16 bit",
#ifdef CONFIG_SCSI_IZIP_EPP16
"EPP 16 bit",
#else
"EPP 32 bit",
#endif
"Unknown"};
/* other options */
#define PPA_BURST_SIZE 512 /* data burst size */
#define PPA_SELECT_TMO 5000 /* how long to wait for target ? */
#define PPA_SPIN_TMO 50000 /* ppa_wait loop limiter */
#define PPA_RECON_TMO 500 /* scsi reconnection loop limiter */
#define PPA_DEBUG 0 /* debugging option */
#define IN_EPP_MODE(x) (x == PPA_EPP_8 || x == PPA_EPP_16 || x == PPA_EPP_32)
/* args to ppa_connect */
#define CONNECT_EPP_MAYBE 1
#define CONNECT_NORMAL 0
#define r_dtr(x) (unsigned char)inb((x))
#define r_str(x) (unsigned char)inb((x)+1)
#define r_ctr(x) (unsigned char)inb((x)+2)
#define r_epp(x) (unsigned char)inb((x)+4)
#define r_fifo(x) (unsigned char)inb((x)) /* x must be base_hi */
/* On PCI is base+0x400 != base_hi */
#define r_ecr(x) (unsigned char)inb((x)+0x2) /* x must be base_hi */
#define w_dtr(x,y) outb(y, (x))
#define w_str(x,y) outb(y, (x)+1)
#define w_epp(x,y) outb(y, (x)+4)
#define w_fifo(x,y) outb(y, (x)) /* x must be base_hi */
#define w_ecr(x,y) outb(y, (x)+0x2)/* x must be base_hi */
#ifdef CONFIG_SCSI_IZIP_SLOW_CTR
#define w_ctr(x,y) outb_p(y, (x)+2)
#else
#define w_ctr(x,y) outb(y, (x)+2)
#endif
static int ppa_engine(ppa_struct *, struct scsi_cmnd *);
#endif /* _PPA_H */