mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 19:26:51 +07: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>
282 lines
8.7 KiB
C
282 lines
8.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* This header file contains public constants and structures used by
|
|
* the SCSI initiator code.
|
|
*/
|
|
#ifndef _SCSI_SCSI_H
|
|
#define _SCSI_SCSI_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/scatterlist.h>
|
|
#include <linux/kernel.h>
|
|
#include <scsi/scsi_common.h>
|
|
#include <scsi/scsi_proto.h>
|
|
|
|
struct scsi_cmnd;
|
|
|
|
enum scsi_timeouts {
|
|
SCSI_DEFAULT_EH_TIMEOUT = 10 * HZ,
|
|
};
|
|
|
|
/*
|
|
* DIX-capable adapters effectively support infinite chaining for the
|
|
* protection information scatterlist
|
|
*/
|
|
#define SCSI_MAX_PROT_SG_SEGMENTS 0xFFFF
|
|
|
|
/*
|
|
* Special value for scanning to specify scanning or rescanning of all
|
|
* possible channels, (target) ids, or luns on a given shost.
|
|
*/
|
|
#define SCAN_WILD_CARD ~0
|
|
|
|
/** scsi_status_is_good - check the status return.
|
|
*
|
|
* @status: the status passed up from the driver (including host and
|
|
* driver components)
|
|
*
|
|
* This returns true for known good conditions that may be treated as
|
|
* command completed normally
|
|
*/
|
|
static inline int scsi_status_is_good(int status)
|
|
{
|
|
/*
|
|
* FIXME: bit0 is listed as reserved in SCSI-2, but is
|
|
* significant in SCSI-3. For now, we follow the SCSI-2
|
|
* behaviour and ignore reserved bits.
|
|
*/
|
|
status &= 0xfe;
|
|
return ((status == SAM_STAT_GOOD) ||
|
|
(status == SAM_STAT_INTERMEDIATE) ||
|
|
(status == SAM_STAT_INTERMEDIATE_CONDITION_MET) ||
|
|
/* FIXME: this is obsolete in SAM-3 */
|
|
(status == SAM_STAT_COMMAND_TERMINATED));
|
|
}
|
|
|
|
|
|
/*
|
|
* standard mode-select header prepended to all mode-select commands
|
|
*/
|
|
|
|
struct ccs_modesel_head {
|
|
__u8 _r1; /* reserved */
|
|
__u8 medium; /* device-specific medium type */
|
|
__u8 _r2; /* reserved */
|
|
__u8 block_desc_length; /* block descriptor length */
|
|
__u8 density; /* device-specific density code */
|
|
__u8 number_blocks_hi; /* number of blocks in this block desc */
|
|
__u8 number_blocks_med;
|
|
__u8 number_blocks_lo;
|
|
__u8 _r3;
|
|
__u8 block_length_hi; /* block length for blocks in this desc */
|
|
__u8 block_length_med;
|
|
__u8 block_length_lo;
|
|
};
|
|
|
|
/*
|
|
* The Well Known LUNS (SAM-3) in our int representation of a LUN
|
|
*/
|
|
#define SCSI_W_LUN_BASE 0xc100
|
|
#define SCSI_W_LUN_REPORT_LUNS (SCSI_W_LUN_BASE + 1)
|
|
#define SCSI_W_LUN_ACCESS_CONTROL (SCSI_W_LUN_BASE + 2)
|
|
#define SCSI_W_LUN_TARGET_LOG_PAGE (SCSI_W_LUN_BASE + 3)
|
|
|
|
static inline int scsi_is_wlun(u64 lun)
|
|
{
|
|
return (lun & 0xff00) == SCSI_W_LUN_BASE;
|
|
}
|
|
|
|
|
|
/*
|
|
* MESSAGE CODES
|
|
*/
|
|
|
|
#define COMMAND_COMPLETE 0x00
|
|
#define EXTENDED_MESSAGE 0x01
|
|
#define EXTENDED_MODIFY_DATA_POINTER 0x00
|
|
#define EXTENDED_SDTR 0x01
|
|
#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
|
|
#define EXTENDED_WDTR 0x03
|
|
#define EXTENDED_PPR 0x04
|
|
#define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05
|
|
#define SAVE_POINTERS 0x02
|
|
#define RESTORE_POINTERS 0x03
|
|
#define DISCONNECT 0x04
|
|
#define INITIATOR_ERROR 0x05
|
|
#define ABORT_TASK_SET 0x06
|
|
#define MESSAGE_REJECT 0x07
|
|
#define NOP 0x08
|
|
#define MSG_PARITY_ERROR 0x09
|
|
#define LINKED_CMD_COMPLETE 0x0a
|
|
#define LINKED_FLG_CMD_COMPLETE 0x0b
|
|
#define TARGET_RESET 0x0c
|
|
#define ABORT_TASK 0x0d
|
|
#define CLEAR_TASK_SET 0x0e
|
|
#define INITIATE_RECOVERY 0x0f /* SCSI-II only */
|
|
#define RELEASE_RECOVERY 0x10 /* SCSI-II only */
|
|
#define CLEAR_ACA 0x16
|
|
#define LOGICAL_UNIT_RESET 0x17
|
|
#define SIMPLE_QUEUE_TAG 0x20
|
|
#define HEAD_OF_QUEUE_TAG 0x21
|
|
#define ORDERED_QUEUE_TAG 0x22
|
|
#define IGNORE_WIDE_RESIDUE 0x23
|
|
#define ACA 0x24
|
|
#define QAS_REQUEST 0x55
|
|
|
|
/* Old SCSI2 names, don't use in new code */
|
|
#define BUS_DEVICE_RESET TARGET_RESET
|
|
#define ABORT ABORT_TASK_SET
|
|
|
|
/*
|
|
* Host byte codes
|
|
*/
|
|
|
|
#define DID_OK 0x00 /* NO error */
|
|
#define DID_NO_CONNECT 0x01 /* Couldn't connect before timeout period */
|
|
#define DID_BUS_BUSY 0x02 /* BUS stayed busy through time out period */
|
|
#define DID_TIME_OUT 0x03 /* TIMED OUT for other reason */
|
|
#define DID_BAD_TARGET 0x04 /* BAD target. */
|
|
#define DID_ABORT 0x05 /* Told to abort for some other reason */
|
|
#define DID_PARITY 0x06 /* Parity error */
|
|
#define DID_ERROR 0x07 /* Internal error */
|
|
#define DID_RESET 0x08 /* Reset by somebody. */
|
|
#define DID_BAD_INTR 0x09 /* Got an interrupt we weren't expecting. */
|
|
#define DID_PASSTHROUGH 0x0a /* Force command past mid-layer */
|
|
#define DID_SOFT_ERROR 0x0b /* The low level driver just wish a retry */
|
|
#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */
|
|
#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also
|
|
* without decrementing the retry count */
|
|
#define DID_TRANSPORT_DISRUPTED 0x0e /* Transport error disrupted execution
|
|
* and the driver blocked the port to
|
|
* recover the link. Transport class will
|
|
* retry or fail IO */
|
|
#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */
|
|
#define DID_TARGET_FAILURE 0x10 /* Permanent target failure, do not retry on
|
|
* other paths */
|
|
#define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other
|
|
* paths might yield different results */
|
|
#define DID_ALLOC_FAILURE 0x12 /* Space allocation on the device failed */
|
|
#define DID_MEDIUM_ERROR 0x13 /* Medium error */
|
|
#define DRIVER_OK 0x00 /* Driver status */
|
|
|
|
/*
|
|
* These indicate the error that occurred, and what is available.
|
|
*/
|
|
|
|
#define DRIVER_BUSY 0x01
|
|
#define DRIVER_SOFT 0x02
|
|
#define DRIVER_MEDIA 0x03
|
|
#define DRIVER_ERROR 0x04
|
|
|
|
#define DRIVER_INVALID 0x05
|
|
#define DRIVER_TIMEOUT 0x06
|
|
#define DRIVER_HARD 0x07
|
|
#define DRIVER_SENSE 0x08
|
|
|
|
/*
|
|
* Internal return values.
|
|
*/
|
|
|
|
#define NEEDS_RETRY 0x2001
|
|
#define SUCCESS 0x2002
|
|
#define FAILED 0x2003
|
|
#define QUEUED 0x2004
|
|
#define SOFT_ERROR 0x2005
|
|
#define ADD_TO_MLQUEUE 0x2006
|
|
#define TIMEOUT_ERROR 0x2007
|
|
#define SCSI_RETURN_NOT_HANDLED 0x2008
|
|
#define FAST_IO_FAIL 0x2009
|
|
|
|
/*
|
|
* Midlevel queue return values.
|
|
*/
|
|
#define SCSI_MLQUEUE_HOST_BUSY 0x1055
|
|
#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056
|
|
#define SCSI_MLQUEUE_EH_RETRY 0x1057
|
|
#define SCSI_MLQUEUE_TARGET_BUSY 0x1058
|
|
|
|
/*
|
|
* Use these to separate status msg and our bytes
|
|
*
|
|
* These are set by:
|
|
*
|
|
* status byte = set from target device
|
|
* msg_byte = return status from host adapter itself.
|
|
* host_byte = set by low-level driver to indicate status.
|
|
* driver_byte = set by mid-level.
|
|
*/
|
|
#define status_byte(result) (((result) >> 1) & 0x7f)
|
|
#define msg_byte(result) (((result) >> 8) & 0xff)
|
|
#define host_byte(result) (((result) >> 16) & 0xff)
|
|
#define driver_byte(result) (((result) >> 24) & 0xff)
|
|
|
|
#define sense_class(sense) (((sense) >> 4) & 0x7)
|
|
#define sense_error(sense) ((sense) & 0xf)
|
|
#define sense_valid(sense) ((sense) & 0x80)
|
|
|
|
/*
|
|
* default timeouts
|
|
*/
|
|
#define FORMAT_UNIT_TIMEOUT (2 * 60 * 60 * HZ)
|
|
#define START_STOP_TIMEOUT (60 * HZ)
|
|
#define MOVE_MEDIUM_TIMEOUT (5 * 60 * HZ)
|
|
#define READ_ELEMENT_STATUS_TIMEOUT (5 * 60 * HZ)
|
|
#define READ_DEFECT_DATA_TIMEOUT (60 * HZ )
|
|
|
|
|
|
#define IDENTIFY_BASE 0x80
|
|
#define IDENTIFY(can_disconnect, lun) (IDENTIFY_BASE |\
|
|
((can_disconnect) ? 0x40 : 0) |\
|
|
((lun) & 0x07))
|
|
|
|
/*
|
|
* struct scsi_device::scsi_level values. For SCSI devices other than those
|
|
* prior to SCSI-2 (i.e. over 12 years old) this value is (resp[2] + 1)
|
|
* where "resp" is a byte array of the response to an INQUIRY. The scsi_level
|
|
* variable is visible to the user via sysfs.
|
|
*/
|
|
|
|
#define SCSI_UNKNOWN 0
|
|
#define SCSI_1 1
|
|
#define SCSI_1_CCS 2
|
|
#define SCSI_2 3
|
|
#define SCSI_3 4 /* SPC */
|
|
#define SCSI_SPC_2 5
|
|
#define SCSI_SPC_3 6
|
|
|
|
/*
|
|
* INQ PERIPHERAL QUALIFIERS
|
|
*/
|
|
#define SCSI_INQ_PQ_CON 0x00
|
|
#define SCSI_INQ_PQ_NOT_CON 0x01
|
|
#define SCSI_INQ_PQ_NOT_CAP 0x03
|
|
|
|
|
|
/*
|
|
* Here are some scsi specific ioctl commands which are sometimes useful.
|
|
*
|
|
* Note that include/linux/cdrom.h also defines IOCTL 0x5300 - 0x5395
|
|
*/
|
|
|
|
/* Used to obtain PUN and LUN info. Conflicts with CDROMAUDIOBUFSIZ */
|
|
#define SCSI_IOCTL_GET_IDLUN 0x5382
|
|
|
|
/* 0x5383 and 0x5384 were used for SCSI_IOCTL_TAGGED_{ENABLE,DISABLE} */
|
|
|
|
/* Used to obtain the host number of a device. */
|
|
#define SCSI_IOCTL_PROBE_HOST 0x5385
|
|
|
|
/* Used to obtain the bus number for a device */
|
|
#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
|
|
|
|
/* Used to obtain the PCI location of a device */
|
|
#define SCSI_IOCTL_GET_PCI 0x5387
|
|
|
|
/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
|
|
static inline __u32 scsi_to_u32(__u8 *ptr)
|
|
{
|
|
return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
|
|
}
|
|
|
|
#endif /* _SCSI_SCSI_H */
|