linux-stable/arch/powerpc/include/asm/uninorth.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

230 lines
8.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* uninorth.h: definitions for using the "UniNorth" host bridge chip
* from Apple. This chip is used on "Core99" machines
* This also includes U2 used on more recent MacRISC2/3
* machines and U3 (G5)
*
*/
#ifdef __KERNEL__
#ifndef __ASM_UNINORTH_H__
#define __ASM_UNINORTH_H__
/*
* Uni-N and U3 config space reg. definitions
*
* (Little endian)
*/
/* Address ranges selection. This one should work with Bandit too */
/* Not U3 */
#define UNI_N_ADDR_SELECT 0x48
#define UNI_N_ADDR_COARSE_MASK 0xffff0000 /* 256Mb regions at *0000000 */
#define UNI_N_ADDR_FINE_MASK 0x0000ffff /* 16Mb regions at f*000000 */
/* AGP registers */
/* Not U3 */
#define UNI_N_CFG_GART_BASE 0x8c
#define UNI_N_CFG_AGP_BASE 0x90
#define UNI_N_CFG_GART_CTRL 0x94
#define UNI_N_CFG_INTERNAL_STATUS 0x98
#define UNI_N_CFG_GART_DUMMY_PAGE 0xa4
/* UNI_N_CFG_GART_CTRL bits definitions */
#define UNI_N_CFG_GART_INVAL 0x00000001
#define UNI_N_CFG_GART_ENABLE 0x00000100
#define UNI_N_CFG_GART_2xRESET 0x00010000
#define UNI_N_CFG_GART_DISSBADET 0x00020000
/* The following seems to only be used only on U3 <j.glisse@gmail.com> */
#define U3_N_CFG_GART_SYNCMODE 0x00040000
#define U3_N_CFG_GART_PERFRD 0x00080000
#define U3_N_CFG_GART_B2BGNT 0x00200000
#define U3_N_CFG_GART_FASTDDR 0x00400000
/* My understanding of UniNorth AGP as of UniNorth rev 1.0x,
* revision 1.5 (x4 AGP) may need further changes.
*
* AGP_BASE register contains the base address of the AGP aperture on
* the AGP bus. It doesn't seem to be visible to the CPU as of UniNorth 1.x,
* even if decoding of this address range is enabled in the address select
* register. Apparently, the only supported bases are 256Mb multiples
* (high 4 bits of that register).
*
* GART_BASE register appear to contain the physical address of the GART
* in system memory in the high address bits (page aligned), and the
* GART size in the low order bits (number of GART pages)
*
* The GART format itself is one 32bits word per physical memory page.
* This word contains, in little-endian format (!!!), the physical address
* of the page in the high bits, and what appears to be an "enable" bit
* in the LSB bit (0) that must be set to 1 when the entry is valid.
*
* Obviously, the GART is not cache coherent and so any change to it
* must be flushed to memory (or maybe just make the GART space non
* cachable). AGP memory itself doesn't seem to be cache coherent neither.
*
* In order to invalidate the GART (which is probably necessary to inval
* the bridge internal TLBs), the following sequence has to be written,
* in order, to the GART_CTRL register:
*
* UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL
* UNI_N_CFG_GART_ENABLE
* UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_2xRESET
* UNI_N_CFG_GART_ENABLE
*
* As far as AGP "features" are concerned, it looks like fast write may
* not be supported but this has to be confirmed.
*
* Turning on AGP seem to require a double invalidate operation, one before
* setting the AGP command register, on after.
*
* Turning off AGP seems to require the following sequence: first wait
* for the AGP to be idle by reading the internal status register, then
* write in that order to the GART_CTRL register:
*
* UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL
* 0
* UNI_N_CFG_GART_2xRESET
* 0
*/
/*
* Uni-N memory mapped reg. definitions
*
* Those registers are Big-Endian !!
*
* Their meaning come from either Darwin and/or from experiments I made with
* the bootrom, I'm not sure about their exact meaning yet
*
*/
/* Version of the UniNorth chip */
#define UNI_N_VERSION 0x0000 /* Known versions: 3,7 and 8 */
#define UNI_N_VERSION_107 0x0003 /* 1.0.7 */
#define UNI_N_VERSION_10A 0x0007 /* 1.0.10 */
#define UNI_N_VERSION_150 0x0011 /* 1.5 */
#define UNI_N_VERSION_200 0x0024 /* 2.0 */
#define UNI_N_VERSION_PANGEA 0x00C0 /* Integrated U1 + K */
#define UNI_N_VERSION_INTREPID 0x00D2 /* Integrated U2 + K */
#define UNI_N_VERSION_300 0x0030 /* 3.0 (U3 on G5) */
/* This register is used to enable/disable various clocks */
#define UNI_N_CLOCK_CNTL 0x0020
#define UNI_N_CLOCK_CNTL_PCI 0x00000001 /* PCI2 clock control */
#define UNI_N_CLOCK_CNTL_GMAC 0x00000002 /* GMAC clock control */
#define UNI_N_CLOCK_CNTL_FW 0x00000004 /* FireWire clock control */
#define UNI_N_CLOCK_CNTL_ATA100 0x00000010 /* ATA-100 clock control (U2) */
/* Power Management control */
#define UNI_N_POWER_MGT 0x0030
#define UNI_N_POWER_MGT_NORMAL 0x00
#define UNI_N_POWER_MGT_IDLE2 0x01
#define UNI_N_POWER_MGT_SLEEP 0x02
/* This register is configured by Darwin depending on the UniN
* revision
*/
#define UNI_N_ARB_CTRL 0x0040
#define UNI_N_ARB_CTRL_QACK_DELAY_SHIFT 15
#define UNI_N_ARB_CTRL_QACK_DELAY_MASK 0x0e1f8000
#define UNI_N_ARB_CTRL_QACK_DELAY 0x30
#define UNI_N_ARB_CTRL_QACK_DELAY105 0x00
/* This one _might_ return the CPU number of the CPU reading it;
* the bootROM decides whether to boot or to sleep/spinloop depending
* on this register being 0 or not
*/
#define UNI_N_CPU_NUMBER 0x0050
/* This register appear to be read by the bootROM to decide what
* to do on a non-recoverable reset (powerup or wakeup)
*/
#define UNI_N_HWINIT_STATE 0x0070
#define UNI_N_HWINIT_STATE_SLEEPING 0x01
#define UNI_N_HWINIT_STATE_RUNNING 0x02
/* This last bit appear to be used by the bootROM to know the second
* CPU has started and will enter it's sleep loop with IP=0
*/
#define UNI_N_HWINIT_STATE_CPU1_FLAG 0x10000000
/* This register controls AACK delay, which is set when 2004 iBook/PowerBook
* is in low speed mode.
*/
#define UNI_N_AACK_DELAY 0x0100
#define UNI_N_AACK_DELAY_ENABLE 0x00000001
/* Clock status for Intrepid */
#define UNI_N_CLOCK_STOP_STATUS0 0x0150
#define UNI_N_CLOCK_STOPPED_EXTAGP 0x00200000
#define UNI_N_CLOCK_STOPPED_AGPDEL 0x00100000
#define UNI_N_CLOCK_STOPPED_I2S0_45_49 0x00080000
#define UNI_N_CLOCK_STOPPED_I2S0_18 0x00040000
#define UNI_N_CLOCK_STOPPED_I2S1_45_49 0x00020000
#define UNI_N_CLOCK_STOPPED_I2S1_18 0x00010000
#define UNI_N_CLOCK_STOPPED_TIMER 0x00008000
#define UNI_N_CLOCK_STOPPED_SCC_RTCLK18 0x00004000
#define UNI_N_CLOCK_STOPPED_SCC_RTCLK32 0x00002000
#define UNI_N_CLOCK_STOPPED_SCC_VIA32 0x00001000
#define UNI_N_CLOCK_STOPPED_SCC_SLOT0 0x00000800
#define UNI_N_CLOCK_STOPPED_SCC_SLOT1 0x00000400
#define UNI_N_CLOCK_STOPPED_SCC_SLOT2 0x00000200
#define UNI_N_CLOCK_STOPPED_PCI_FBCLKO 0x00000100
#define UNI_N_CLOCK_STOPPED_VEO0 0x00000080
#define UNI_N_CLOCK_STOPPED_VEO1 0x00000040
#define UNI_N_CLOCK_STOPPED_USB0 0x00000020
#define UNI_N_CLOCK_STOPPED_USB1 0x00000010
#define UNI_N_CLOCK_STOPPED_USB2 0x00000008
#define UNI_N_CLOCK_STOPPED_32 0x00000004
#define UNI_N_CLOCK_STOPPED_45 0x00000002
#define UNI_N_CLOCK_STOPPED_49 0x00000001
#define UNI_N_CLOCK_STOP_STATUS1 0x0160
#define UNI_N_CLOCK_STOPPED_PLL4REF 0x00080000
#define UNI_N_CLOCK_STOPPED_CPUDEL 0x00040000
#define UNI_N_CLOCK_STOPPED_CPU 0x00020000
#define UNI_N_CLOCK_STOPPED_BUF_REFCKO 0x00010000
#define UNI_N_CLOCK_STOPPED_PCI2 0x00008000
#define UNI_N_CLOCK_STOPPED_FW 0x00004000
#define UNI_N_CLOCK_STOPPED_GB 0x00002000
#define UNI_N_CLOCK_STOPPED_ATA66 0x00001000
#define UNI_N_CLOCK_STOPPED_ATA100 0x00000800
#define UNI_N_CLOCK_STOPPED_MAX 0x00000400
#define UNI_N_CLOCK_STOPPED_PCI1 0x00000200
#define UNI_N_CLOCK_STOPPED_KLPCI 0x00000100
#define UNI_N_CLOCK_STOPPED_USB0PCI 0x00000080
#define UNI_N_CLOCK_STOPPED_USB1PCI 0x00000040
#define UNI_N_CLOCK_STOPPED_USB2PCI 0x00000020
#define UNI_N_CLOCK_STOPPED_7PCI1 0x00000008
#define UNI_N_CLOCK_STOPPED_AGP 0x00000004
#define UNI_N_CLOCK_STOPPED_PCI0 0x00000002
#define UNI_N_CLOCK_STOPPED_18 0x00000001
/* Intrepid registe to OF do-platform-clockspreading */
#define UNI_N_CLOCK_SPREADING 0x190
/* Uninorth 1.5 rev. has additional perf. monitor registers at 0xf00-0xf50 */
/*
* U3 specific registers
*/
/* U3 Toggle */
#define U3_TOGGLE_REG 0x00e0
#define U3_PMC_START_STOP 0x0001
#define U3_MPIC_RESET 0x0002
#define U3_MPIC_OUTPUT_ENABLE 0x0004
/* U3 API PHY Config 1 */
#define U3_API_PHY_CONFIG_1 0x23030
/* U3 HyperTransport registers */
#define U3_HT_CONFIG_BASE 0x70000
#define U3_HT_LINK_COMMAND 0x100
#define U3_HT_LINK_CONFIG 0x110
#define U3_HT_LINK_FREQ 0x120
#endif /* __ASM_UNINORTH_H__ */
#endif /* __KERNEL__ */