linux-sg2042/arch/m68k/include/asm/io_no.h

138 lines
4.2 KiB
C
Raw Normal View History

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 */
#ifndef _M68KNOMMU_IO_H
#define _M68KNOMMU_IO_H
m68k: introduce iomem() macro for __iomem conversions A lot of the ColdFire internal peripherals (clocks, timers, interrupt controllers, etc) are addressed using constants. The only problem with that is they are not type clean when used with __raw_read/__raw_write and read/write - they should be of type "void __iomem". This isn't a problem currently because the IO access functions are local macros. To switch to using the asm-generic implementations of these we need to clean up the types. Otherwise you get warnings like this: In file included from ./arch/m68k/include/asm/mcfsim.h:24:0, from arch/m68k/coldfire/intc-simr.c:20: arch/m68k/coldfire/intc-simr.c: In function ‘init_IRQ’: ./arch/m68k/include/asm/m520xsim.h:40:29: warning: passing argument 2 of ‘__raw_writeb’ makes pointer from integer without a cast [-Wint-conversion] #define MCFINTC0_SIMR (MCFICM_INTC0 + MCFINTC_SIMR) ^ arch/m68k/coldfire/intc-simr.c:182:21: note: in expansion of macro ‘MCFINTC0_SIMR’ __raw_writeb(0xff, MCFINTC0_SIMR); ^ In file included from ./arch/m68k/include/asm/io_no.h:120:0, from ./arch/m68k/include/asm/io.h:3, from ./include/linux/io.h:25, from ./include/linux/irq.h:25, from ./include/asm-generic/hardirq.h:13, from ./arch/m68k/include/asm/hardirq.h:25, from ./include/linux/hardirq.h:9, from ./include/linux/interrupt.h:13, from arch/m68k/coldfire/intc-simr.c:16: ./include/asm-generic/io.h:71:22: note: expected ‘volatile void *’ but argument is of type ‘unsigned int’ #define __raw_writeb __raw_writeb ^ ./include/asm-generic/io.h:72:20: note: in expansion of macro ‘__raw_writeb’ static inline void __raw_writeb(u8 value, volatile void __iomem *addr) ^ To start this clean up process introduce a macro, iomem(), that converts a constant address to the correct "void __iomem *" type. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org> Tested-by: Angelo Dureghello <angelo@sysam.it>
2018-04-08 21:12:55 +08:00
/*
* Convert a physical memory address into a IO memory address.
* For us this is trivially a type cast.
*/
#define iomem(a) ((void __iomem *) (a))
/*
* The non-MMU m68k and ColdFire IO and memory mapped hardware access
* functions have always worked in CPU native endian. We need to define
* that behavior here first before we include asm-generic/io.h.
*/
#define __raw_readb(addr) \
({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
#define __raw_readw(addr) \
({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
#define __raw_readl(addr) \
({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
#define __raw_writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b))
#define __raw_writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b))
#define __raw_writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))
#if defined(CONFIG_COLDFIRE)
/*
* For ColdFire platforms we may need to do some extra checks for what
* type of address range we are accessing. Include the ColdFire platform
* definitions so we can figure out if need to do something special.
*/
#include <asm/byteorder.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#endif /* CONFIG_COLDFIRE */
#if defined(IOMEMBASE)
/*
* The ColdFire SoC internal peripherals are mapped into virtual address
* space using the ACR registers of the cache control unit. This means we
* are using a 1:1 physical:virtual mapping for them. We can quickly
* determine if we are accessing an internal peripheral device given the
* physical or vitrual address using the same range check. This check logic
* applies just the same of there is no MMU but something like a PCI bus
* is present.
*/
static int __cf_internalio(unsigned long addr)
{
return (addr >= IOMEMBASE) && (addr <= IOMEMBASE + IOMEMSIZE - 1);
}
static int cf_internalio(const volatile void __iomem *addr)
{
return __cf_internalio((unsigned long) addr);
}
/*
* We need to treat built-in peripherals and bus based address ranges
* differently. Local built-in peripherals (and the ColdFire SoC parts
* have quite a lot of them) are always native endian - which is big
* endian on m68k/ColdFire. Bus based address ranges, like the PCI bus,
* are accessed little endian - so we need to byte swap those.
*/
#define readw readw
static inline u16 readw(const volatile void __iomem *addr)
{
if (cf_internalio(addr))
return __raw_readw(addr);
return __le16_to_cpu(__raw_readw(addr));
}
#define readl readl
static inline u32 readl(const volatile void __iomem *addr)
{
if (cf_internalio(addr))
return __raw_readl(addr);
return __le32_to_cpu(__raw_readl(addr));
}
#define writew writew
static inline void writew(u16 value, volatile void __iomem *addr)
{
if (cf_internalio(addr))
__raw_writew(value, addr);
else
__raw_writew(__cpu_to_le16(value), addr);
}
#define writel writel
static inline void writel(u32 value, volatile void __iomem *addr)
{
if (cf_internalio(addr))
__raw_writel(value, addr);
else
__raw_writel(__cpu_to_le32(value), addr);
}
#else
#define readb __raw_readb
#define readw __raw_readw
#define readl __raw_readl
#define writeb __raw_writeb
#define writew __raw_writew
#define writel __raw_writel
#endif /* IOMEMBASE */
#if defined(CONFIG_PCI)
/*
* Support for PCI bus access uses the asm-generic access functions.
* We need to supply the base address and masks for the normal memory
* and IO address space mappings.
*/
#define PCI_MEM_PA 0xf0000000 /* Host physical address */
#define PCI_MEM_BA 0xf0000000 /* Bus physical address */
#define PCI_MEM_SIZE 0x08000000 /* 128 MB */
#define PCI_MEM_MASK (PCI_MEM_SIZE - 1)
#define PCI_IO_PA 0xf8000000 /* Host physical address */
#define PCI_IO_BA 0x00000000 /* Bus physical address */
#define PCI_IO_SIZE 0x00010000 /* 64k */
#define PCI_IO_MASK (PCI_IO_SIZE - 1)
#define HAVE_ARCH_PIO_SIZE
#define PIO_OFFSET 0
#define PIO_MASK 0xffff
#define PIO_RESERVED 0x10000
#define PCI_IOBASE ((void __iomem *) PCI_IO_PA)
#define PCI_SPACE_LIMIT PCI_IO_MASK
#endif /* CONFIG_PCI */
#include <asm/kmap.h>
#include <asm/virtconvert.h>
#endif /* _M68KNOMMU_IO_H */