OpenCloudOS-Kernel/arch/powerpc/include/asm/pmac_pfunc.h

254 lines
8.0 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 __PMAC_PFUNC_H__
#define __PMAC_PFUNC_H__
#include <linux/types.h>
#include <linux/list.h>
/* Flags in command lists */
#define PMF_FLAGS_ON_INIT 0x80000000u
#define PMF_FLGAS_ON_TERM 0x40000000u
#define PMF_FLAGS_ON_SLEEP 0x20000000u
#define PMF_FLAGS_ON_WAKE 0x10000000u
#define PMF_FLAGS_ON_DEMAND 0x08000000u
#define PMF_FLAGS_INT_GEN 0x04000000u
#define PMF_FLAGS_HIGH_SPEED 0x02000000u
#define PMF_FLAGS_LOW_SPEED 0x01000000u
#define PMF_FLAGS_SIDE_EFFECTS 0x00800000u
/*
* Arguments to a platform function call.
*
* NOTE: By convention, pointer arguments point to an u32
*/
struct pmf_args {
union {
u32 v;
u32 *p;
} u[4];
unsigned int count;
};
/*
* A driver capable of interpreting commands provides a handlers
* structure filled with whatever handlers are implemented by this
* driver. Non implemented handlers are left NULL.
*
* PMF_STD_ARGS are the same arguments that are passed to the parser
* and that gets passed back to the various handlers.
*
* Interpreting a given function always start with a begin() call which
* returns an instance data to be passed around subsequent calls, and
* ends with an end() call. This allows the low level driver to implement
* locking policy or per-function instance data.
*
* For interrupt capable functions, irq_enable() is called when a client
* registers, and irq_disable() is called when the last client unregisters
* Note that irq_enable & irq_disable are called within a semaphore held
* by the core, thus you should not try to register yourself to some other
* pmf interrupt during those calls.
*/
#define PMF_STD_ARGS struct pmf_function *func, void *instdata, \
struct pmf_args *args
struct pmf_function;
struct pmf_handlers {
void * (*begin)(struct pmf_function *func, struct pmf_args *args);
void (*end)(struct pmf_function *func, void *instdata);
int (*irq_enable)(struct pmf_function *func);
int (*irq_disable)(struct pmf_function *func);
int (*write_gpio)(PMF_STD_ARGS, u8 value, u8 mask);
int (*read_gpio)(PMF_STD_ARGS, u8 mask, int rshift, u8 xor);
int (*write_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask);
int (*read_reg32)(PMF_STD_ARGS, u32 offset);
int (*write_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask);
int (*read_reg16)(PMF_STD_ARGS, u32 offset);
int (*write_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask);
int (*read_reg8)(PMF_STD_ARGS, u32 offset);
int (*delay)(PMF_STD_ARGS, u32 duration);
int (*wait_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask);
int (*wait_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask);
int (*wait_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask);
int (*read_i2c)(PMF_STD_ARGS, u32 len);
int (*write_i2c)(PMF_STD_ARGS, u32 len, const u8 *data);
int (*rmw_i2c)(PMF_STD_ARGS, u32 masklen, u32 valuelen, u32 totallen,
const u8 *maskdata, const u8 *valuedata);
int (*read_cfg)(PMF_STD_ARGS, u32 offset, u32 len);
int (*write_cfg)(PMF_STD_ARGS, u32 offset, u32 len, const u8 *data);
int (*rmw_cfg)(PMF_STD_ARGS, u32 offset, u32 masklen, u32 valuelen,
u32 totallen, const u8 *maskdata, const u8 *valuedata);
int (*read_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len);
int (*write_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len, const u8 *data);
int (*set_i2c_mode)(PMF_STD_ARGS, int mode);
int (*rmw_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 masklen, u32 valuelen,
u32 totallen, const u8 *maskdata,
const u8 *valuedata);
int (*read_reg32_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
u32 xor);
int (*read_reg16_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
u32 xor);
int (*read_reg8_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
u32 xor);
int (*write_reg32_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
int (*write_reg16_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
int (*write_reg8_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
int (*mask_and_compare)(PMF_STD_ARGS, u32 len, const u8 *maskdata,
const u8 *valuedata);
struct module *owner;
};
/*
* Drivers who expose platform functions register at init time, this
* causes the platform functions for that device node to be parsed in
* advance and associated with the device. The data structures are
* partially public so a driver can walk the list of platform functions
* and eventually inspect the flags
*/
struct pmf_device;
struct pmf_function {
/* All functions for a given driver are linked */
struct list_head link;
/* Function node & driver data */
struct device_node *node;
void *driver_data;
/* For internal use by core */
struct pmf_device *dev;
/* The name is the "xxx" in "platform-do-xxx", this is how
* platform functions are identified by this code. Some functions
* only operate for a given target, in which case the phandle is
* here (or 0 if the filter doesn't apply)
*/
const char *name;
u32 phandle;
/* The flags for that function. You can have several functions
* with the same name and different flag
*/
u32 flags;
/* The actual tokenized function blob */
const void *data;
unsigned int length;
/* Interrupt clients */
struct list_head irq_clients;
/* Refcounting */
struct kref ref;
};
/*
* For platform functions that are interrupts, one can register
* irq_client structures. You canNOT use the same structure twice
* as it contains a link member. Also, the callback is called with
* a spinlock held, you must not call back into any of the pmf_* functions
* from within that callback
*/
struct pmf_irq_client {
void (*handler)(void *data);
void *data;
struct module *owner;
struct list_head link;
struct pmf_function *func;
};
/*
* Register/Unregister a function-capable driver and its handlers
*/
extern int pmf_register_driver(struct device_node *np,
struct pmf_handlers *handlers,
void *driverdata);
extern void pmf_unregister_driver(struct device_node *np);
/*
* Register/Unregister interrupt clients
*/
extern int pmf_register_irq_client(struct device_node *np,
const char *name,
struct pmf_irq_client *client);
extern void pmf_unregister_irq_client(struct pmf_irq_client *client);
/*
* Called by the handlers when an irq happens
*/
extern void pmf_do_irq(struct pmf_function *func);
/*
* Low level call to platform functions.
*
* The phandle can filter on the target object for functions that have
* multiple targets, the flags allow you to restrict the call to a given
* combination of flags.
*
* The args array contains as many arguments as is required by the function,
* this is dependent on the function you are calling, unfortunately Apple
* mechanism provides no way to encode that so you have to get it right at
* the call site. Some functions require no args, in which case, you can
* pass NULL.
*
* You can also pass NULL to the name. This will match any function that has
* the appropriate combination of flags & phandle or you can pass 0 to the
* phandle to match any
*/
extern int pmf_do_functions(struct device_node *np, const char *name,
u32 phandle, u32 flags, struct pmf_args *args);
/*
* High level call to a platform function.
*
* This one looks for the platform-xxx first so you should call it to the
* actual target if any. It will fallback to platform-do-xxx if it can't
* find one. It will also exclusively target functions that have
* the "OnDemand" flag.
*/
extern int pmf_call_function(struct device_node *target, const char *name,
struct pmf_args *args);
/*
* For low latency interrupt usage, you can lookup for on-demand functions
* using the functions below
*/
extern struct pmf_function *pmf_find_function(struct device_node *target,
const char *name);
extern struct pmf_function * pmf_get_function(struct pmf_function *func);
extern void pmf_put_function(struct pmf_function *func);
extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args);
/* Suspend/resume code called by via-pmu directly for now */
extern void pmac_pfunc_base_suspend(void);
extern void pmac_pfunc_base_resume(void);
#endif /* __PMAC_PFUNC_H__ */