arch/powerpc/platforms/powermac/pfunc_core.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powermac/pfunc_core.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powermac/pfunc_core.c- Extension
.c- Size
- 25575 bytes
- Lines
- 1023
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/kernel.hlinux/spinlock.hlinux/slab.hlinux/module.hlinux/mutex.hlinux/of.hasm/pmac_pfunc.h
Detected Declarations
struct pmf_cmdstruct pmf_devicefunction print_blobfunction pmf_next32function pmf_next_blobfunction pmf_parser_write_gpiofunction pmf_parser_read_gpiofunction pmf_parser_write_reg32function pmf_parser_read_reg32function pmf_parser_write_reg16function pmf_parser_read_reg16function pmf_parser_write_reg8function pmf_parser_read_reg8function pmf_parser_delayfunction pmf_parser_wait_reg32function pmf_parser_wait_reg16function pmf_parser_wait_reg8function pmf_parser_read_i2cfunction pmf_parser_write_i2cfunction pmf_parser_rmw_i2cfunction pmf_parser_read_cfgfunction pmf_parser_write_cfgfunction pmf_parser_rmw_cfgfunction pmf_parser_read_i2c_subfunction pmf_parser_write_i2c_subfunction pmf_parser_set_i2c_modefunction pmf_parser_rmw_i2c_subfunction pmf_parser_read_reg32_msrxfunction pmf_parser_read_reg16_msrxfunction pmf_parser_read_reg8_msrxfunction pmf_parser_write_reg32_slmfunction pmf_parser_write_reg16_slmfunction pmf_parser_write_reg8_slmfunction pmf_parser_mask_and_comparefunction pmf_release_devicefunction pmf_put_devicefunction list_for_each_entryfunction pmf_parse_onefunction pmf_add_function_propfunction pmf_add_functionsfunction for_each_property_of_nodefunction pmf_register_driverfunction pmf_release_functionfunction __pmf_put_functionfunction pmf_put_functionfunction pmf_unregister_driverfunction list_for_each_entryfunction pmf_register_irq_client
Annotated Snippet
struct pmf_cmd {
const void *cmdptr;
const void *cmdend;
struct pmf_function *func;
void *instdata;
struct pmf_args *args;
int error;
};
#if 0
/* Debug output */
static void print_blob(const char *title, const void *blob, int bytes)
{
printk("%s", title);
while(bytes--) {
printk("%02x ", *((u8 *)blob));
blob += 1;
}
printk("\n");
}
#endif
/*
* Parser helpers
*/
static u32 pmf_next32(struct pmf_cmd *cmd)
{
u32 value;
if ((cmd->cmdend - cmd->cmdptr) < 4) {
cmd->error = 1;
return 0;
}
value = *((u32 *)cmd->cmdptr);
cmd->cmdptr += 4;
return value;
}
static const void* pmf_next_blob(struct pmf_cmd *cmd, int count)
{
const void *value;
if ((cmd->cmdend - cmd->cmdptr) < count) {
cmd->error = 1;
return NULL;
}
value = cmd->cmdptr;
cmd->cmdptr += count;
return value;
}
/*
* Individual command parsers
*/
#define PMF_PARSE_CALL(name, cmd, handlers, p...) \
do { \
if (cmd->error) \
return -ENXIO; \
if (handlers == NULL) \
return 0; \
if (handlers->name) \
return handlers->name(cmd->func, cmd->instdata, \
cmd->args, p); \
return -1; \
} while(0) \
static int pmf_parser_write_gpio(struct pmf_cmd *cmd, struct pmf_handlers *h)
{
u8 value = (u8)pmf_next32(cmd);
u8 mask = (u8)pmf_next32(cmd);
LOG_PARSE("pmf: write_gpio(value: %02x, mask: %02x)\n", value, mask);
PMF_PARSE_CALL(write_gpio, cmd, h, value, mask);
}
static int pmf_parser_read_gpio(struct pmf_cmd *cmd, struct pmf_handlers *h)
{
u8 mask = (u8)pmf_next32(cmd);
int rshift = (int)pmf_next32(cmd);
u8 xor = (u8)pmf_next32(cmd);
LOG_PARSE("pmf: read_gpio(mask: %02x, rshift: %d, xor: %02x)\n",
mask, rshift, xor);
PMF_PARSE_CALL(read_gpio, cmd, h, mask, rshift, xor);
}
static int pmf_parser_write_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/module.h`, `linux/mutex.h`, `linux/of.h`, `asm/pmac_pfunc.h`.
- Detected declarations: `struct pmf_cmd`, `struct pmf_device`, `function print_blob`, `function pmf_next32`, `function pmf_next_blob`, `function pmf_parser_write_gpio`, `function pmf_parser_read_gpio`, `function pmf_parser_write_reg32`, `function pmf_parser_read_reg32`, `function pmf_parser_write_reg16`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.