mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +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>
252 lines
9.4 KiB
C
252 lines
9.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* 7990.h -- LANCE ethernet IC generic routines.
|
|
* This is an attempt to separate out the bits of various ethernet
|
|
* drivers that are common because they all use the AMD 7990 LANCE
|
|
* (Local Area Network Controller for Ethernet) chip.
|
|
*
|
|
* Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk>
|
|
*
|
|
* Most of this stuff was obtained by looking at other LANCE drivers,
|
|
* in particular a2065.[ch]. The AMD C-LANCE datasheet was also helpful.
|
|
*/
|
|
|
|
#ifndef _7990_H
|
|
#define _7990_H
|
|
|
|
/* The lance only has two register locations. We communicate mostly via memory. */
|
|
#define LANCE_RDP 0 /* Register Data Port */
|
|
#define LANCE_RAP 2 /* Register Address Port */
|
|
|
|
/* Transmit/receive ring definitions.
|
|
* We allow the specific drivers to override these defaults if they want to.
|
|
* NB: according to lance.c, increasing the number of buffers is a waste
|
|
* of space and reduces the chance that an upper layer will be able to
|
|
* reorder queued Tx packets based on priority. [Clearly there is a minimum
|
|
* limit too: too small and we drop rx packets and can't tx at full speed.]
|
|
* 4+4 seems to be the usual setting; the atarilance driver uses 3 and 5.
|
|
*/
|
|
|
|
/* Blast! This won't work. The problem is that we can't specify a default
|
|
* setting because that would cause the lance_init_block struct to be
|
|
* too long (and overflow the RAM on shared-memory cards like the HP LANCE.
|
|
*/
|
|
#ifndef LANCE_LOG_TX_BUFFERS
|
|
#define LANCE_LOG_TX_BUFFERS 1
|
|
#define LANCE_LOG_RX_BUFFERS 3
|
|
#endif
|
|
|
|
#define TX_RING_SIZE (1 << LANCE_LOG_TX_BUFFERS)
|
|
#define RX_RING_SIZE (1 << LANCE_LOG_RX_BUFFERS)
|
|
#define TX_RING_MOD_MASK (TX_RING_SIZE - 1)
|
|
#define RX_RING_MOD_MASK (RX_RING_SIZE - 1)
|
|
#define TX_RING_LEN_BITS ((LANCE_LOG_TX_BUFFERS) << 29)
|
|
#define RX_RING_LEN_BITS ((LANCE_LOG_RX_BUFFERS) << 29)
|
|
#define PKT_BUFF_SIZE (1544)
|
|
#define RX_BUFF_SIZE PKT_BUFF_SIZE
|
|
#define TX_BUFF_SIZE PKT_BUFF_SIZE
|
|
|
|
/* Each receive buffer is described by a receive message descriptor (RMD) */
|
|
struct lance_rx_desc {
|
|
volatile unsigned short rmd0; /* low address of packet */
|
|
volatile unsigned char rmd1_bits; /* descriptor bits */
|
|
volatile unsigned char rmd1_hadr; /* high address of packet */
|
|
volatile short length; /* This length is 2s complement (negative)!
|
|
* Buffer length */
|
|
volatile unsigned short mblength; /* Actual number of bytes received */
|
|
};
|
|
|
|
/* Ditto for TMD: */
|
|
struct lance_tx_desc {
|
|
volatile unsigned short tmd0; /* low address of packet */
|
|
volatile unsigned char tmd1_bits; /* descriptor bits */
|
|
volatile unsigned char tmd1_hadr; /* high address of packet */
|
|
volatile short length; /* Length is 2s complement (negative)! */
|
|
volatile unsigned short misc;
|
|
};
|
|
|
|
/* There are three memory structures accessed by the LANCE:
|
|
* the initialization block, the receive and transmit descriptor rings,
|
|
* and the data buffers themselves. In fact we might as well put the
|
|
* init block,the Tx and Rx rings and the buffers together in memory:
|
|
*/
|
|
struct lance_init_block {
|
|
volatile unsigned short mode; /* Pre-set mode (reg. 15) */
|
|
volatile unsigned char phys_addr[6]; /* Physical ethernet address */
|
|
volatile unsigned filter[2]; /* Multicast filter (64 bits) */
|
|
|
|
/* Receive and transmit ring base, along with extra bits. */
|
|
volatile unsigned short rx_ptr; /* receive descriptor addr */
|
|
volatile unsigned short rx_len; /* receive len and high addr */
|
|
volatile unsigned short tx_ptr; /* transmit descriptor addr */
|
|
volatile unsigned short tx_len; /* transmit len and high addr */
|
|
|
|
/* The Tx and Rx ring entries must be aligned on 8-byte boundaries.
|
|
* This will be true if this whole struct is 8-byte aligned.
|
|
*/
|
|
volatile struct lance_tx_desc btx_ring[TX_RING_SIZE];
|
|
volatile struct lance_rx_desc brx_ring[RX_RING_SIZE];
|
|
|
|
volatile char tx_buf[TX_RING_SIZE][TX_BUFF_SIZE];
|
|
volatile char rx_buf[RX_RING_SIZE][RX_BUFF_SIZE];
|
|
/* we use this just to make the struct big enough that we can move its startaddr
|
|
* in order to force alignment to an eight byte boundary.
|
|
*/
|
|
};
|
|
|
|
/* This is where we keep all the stuff the driver needs to know about.
|
|
* I'm definitely unhappy about the mechanism for allowing specific
|
|
* drivers to add things...
|
|
*/
|
|
struct lance_private {
|
|
const char *name;
|
|
unsigned long base;
|
|
volatile struct lance_init_block *init_block; /* CPU address of RAM */
|
|
volatile struct lance_init_block *lance_init_block; /* LANCE address of RAM */
|
|
|
|
int rx_new, tx_new;
|
|
int rx_old, tx_old;
|
|
|
|
int lance_log_rx_bufs, lance_log_tx_bufs;
|
|
int rx_ring_mod_mask, tx_ring_mod_mask;
|
|
|
|
int tpe; /* TPE is selected */
|
|
int auto_select; /* cable-selection is by carrier */
|
|
unsigned short busmaster_regval;
|
|
|
|
unsigned int irq; /* IRQ to register */
|
|
|
|
/* This is because the HP LANCE is disgusting and you have to check
|
|
* a DIO-specific register every time you read/write the LANCE regs :-<
|
|
* [could we get away with making these some sort of macro?]
|
|
*/
|
|
void (*writerap)(void *, unsigned short);
|
|
void (*writerdp)(void *, unsigned short);
|
|
unsigned short (*readrdp)(void *);
|
|
spinlock_t devlock;
|
|
char tx_full;
|
|
};
|
|
|
|
/*
|
|
* Am7990 Control and Status Registers
|
|
*/
|
|
#define LE_CSR0 0x0000 /* LANCE Controller Status */
|
|
#define LE_CSR1 0x0001 /* IADR[15:0] (bit0==0 ie word aligned) */
|
|
#define LE_CSR2 0x0002 /* IADR[23:16] (high bits reserved) */
|
|
#define LE_CSR3 0x0003 /* Misc */
|
|
|
|
/*
|
|
* Bit definitions for CSR0 (LANCE Controller Status)
|
|
*/
|
|
#define LE_C0_ERR 0x8000 /* Error = BABL | CERR | MISS | MERR */
|
|
#define LE_C0_BABL 0x4000 /* Babble: Transmitted too many bits */
|
|
#define LE_C0_CERR 0x2000 /* No Heartbeat (10BASE-T) */
|
|
#define LE_C0_MISS 0x1000 /* Missed Frame (no rx buffer to put it in) */
|
|
#define LE_C0_MERR 0x0800 /* Memory Error */
|
|
#define LE_C0_RINT 0x0400 /* Receive Interrupt */
|
|
#define LE_C0_TINT 0x0200 /* Transmit Interrupt */
|
|
#define LE_C0_IDON 0x0100 /* Initialization Done */
|
|
#define LE_C0_INTR 0x0080 /* Interrupt Flag
|
|
= BABL | MISS | MERR | RINT | TINT | IDON */
|
|
#define LE_C0_INEA 0x0040 /* Interrupt Enable */
|
|
#define LE_C0_RXON 0x0020 /* Receive On */
|
|
#define LE_C0_TXON 0x0010 /* Transmit On */
|
|
#define LE_C0_TDMD 0x0008 /* Transmit Demand */
|
|
#define LE_C0_STOP 0x0004 /* Stop */
|
|
#define LE_C0_STRT 0x0002 /* Start */
|
|
#define LE_C0_INIT 0x0001 /* Initialize */
|
|
|
|
|
|
/*
|
|
* Bit definitions for CSR3
|
|
*/
|
|
#define LE_C3_BSWP 0x0004 /* Byte Swap (on for big endian byte order) */
|
|
#define LE_C3_ACON 0x0002 /* ALE Control (on for active low ALE) */
|
|
#define LE_C3_BCON 0x0001 /* Byte Control */
|
|
|
|
|
|
/*
|
|
* Mode Flags
|
|
*/
|
|
#define LE_MO_PROM 0x8000 /* Promiscuous Mode */
|
|
/* these next ones 0x4000 -- 0x0080 are not available on the LANCE 7990,
|
|
* but they are in NetBSD's am7990.h, presumably for backwards-compatible chips
|
|
*/
|
|
#define LE_MO_DRCVBC 0x4000 /* disable receive broadcast */
|
|
#define LE_MO_DRCVPA 0x2000 /* disable physical address detection */
|
|
#define LE_MO_DLNKTST 0x1000 /* disable link status */
|
|
#define LE_MO_DAPC 0x0800 /* disable automatic polarity correction */
|
|
#define LE_MO_MENDECL 0x0400 /* MENDEC loopback mode */
|
|
#define LE_MO_LRTTSEL 0x0200 /* lower RX threshold / TX mode selection */
|
|
#define LE_MO_PSEL1 0x0100 /* port selection bit1 */
|
|
#define LE_MO_PSEL0 0x0080 /* port selection bit0 */
|
|
/* and this one is from the C-LANCE data sheet... */
|
|
#define LE_MO_EMBA 0x0080 /* Enable Modified Backoff Algorithm
|
|
(C-LANCE, not original LANCE) */
|
|
#define LE_MO_INTL 0x0040 /* Internal Loopback */
|
|
#define LE_MO_DRTY 0x0020 /* Disable Retry */
|
|
#define LE_MO_FCOLL 0x0010 /* Force Collision */
|
|
#define LE_MO_DXMTFCS 0x0008 /* Disable Transmit CRC */
|
|
#define LE_MO_LOOP 0x0004 /* Loopback Enable */
|
|
#define LE_MO_DTX 0x0002 /* Disable Transmitter */
|
|
#define LE_MO_DRX 0x0001 /* Disable Receiver */
|
|
|
|
|
|
/*
|
|
* Receive Flags
|
|
*/
|
|
#define LE_R1_OWN 0x80 /* LANCE owns the descriptor */
|
|
#define LE_R1_ERR 0x40 /* Error */
|
|
#define LE_R1_FRA 0x20 /* Framing Error */
|
|
#define LE_R1_OFL 0x10 /* Overflow Error */
|
|
#define LE_R1_CRC 0x08 /* CRC Error */
|
|
#define LE_R1_BUF 0x04 /* Buffer Error */
|
|
#define LE_R1_SOP 0x02 /* Start of Packet */
|
|
#define LE_R1_EOP 0x01 /* End of Packet */
|
|
#define LE_R1_POK 0x03 /* Packet is complete: SOP + EOP */
|
|
|
|
|
|
/*
|
|
* Transmit Flags
|
|
*/
|
|
#define LE_T1_OWN 0x80 /* LANCE owns the descriptor */
|
|
#define LE_T1_ERR 0x40 /* Error */
|
|
#define LE_T1_RES 0x20 /* Reserved, LANCE writes this with a zero */
|
|
#define LE_T1_EMORE 0x10 /* More than one retry needed */
|
|
#define LE_T1_EONE 0x08 /* One retry needed */
|
|
#define LE_T1_EDEF 0x04 /* Deferred */
|
|
#define LE_T1_SOP 0x02 /* Start of Packet */
|
|
#define LE_T1_EOP 0x01 /* End of Packet */
|
|
#define LE_T1_POK 0x03 /* Packet is complete: SOP + EOP */
|
|
|
|
/*
|
|
* Error Flags
|
|
*/
|
|
#define LE_T3_BUF 0x8000 /* Buffer Error */
|
|
#define LE_T3_UFL 0x4000 /* Underflow Error */
|
|
#define LE_T3_LCOL 0x1000 /* Late Collision */
|
|
#define LE_T3_CLOS 0x0800 /* Loss of Carrier */
|
|
#define LE_T3_RTY 0x0400 /* Retry Error */
|
|
#define LE_T3_TDR 0x03ff /* Time Domain Reflectometry */
|
|
|
|
/* Miscellaneous useful macros */
|
|
|
|
#define TX_BUFFS_AVAIL ((lp->tx_old <= lp->tx_new) ? \
|
|
lp->tx_old + lp->tx_ring_mod_mask - lp->tx_new : \
|
|
lp->tx_old - lp->tx_new - 1)
|
|
|
|
/* The LANCE only uses 24 bit addresses. This does the obvious thing. */
|
|
#define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
|
|
|
|
/* Now the prototypes we export */
|
|
int lance_open(struct net_device *dev);
|
|
int lance_close(struct net_device *dev);
|
|
int lance_start_xmit(struct sk_buff *skb, struct net_device *dev);
|
|
void lance_set_multicast(struct net_device *dev);
|
|
void lance_tx_timeout(struct net_device *dev);
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
void lance_poll(struct net_device *dev);
|
|
#endif
|
|
|
|
#endif /* ndef _7990_H */
|