arch/powerpc/include/asm/pmac_pfunc.h

Source file repositories/reference/linux-study-clean/arch/powerpc/include/asm/pmac_pfunc.h

File Facts

System
Linux kernel
Corpus path
arch/powerpc/include/asm/pmac_pfunc.h
Extension
.h
Size
8237 bytes
Lines
255
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

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;
};

Annotation

Implementation Notes