arch/powerpc/kernel/rtas-proc.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/rtas-proc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/rtas-proc.c- Extension
.c- Size
- 22315 bytes
- Lines
- 770
- 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/sched.hlinux/proc_fs.hlinux/stat.hlinux/ctype.hlinux/time.hlinux/string.hlinux/init.hlinux/seq_file.hlinux/bitops.hlinux/rtc.hlinux/of.hlinux/uaccess.hasm/processor.hasm/io.hasm/rtas.hasm/machdep.hasm/time.h
Detected Declarations
struct individual_sensorstruct rtas_sensorsfunction poweron_openfunction progress_openfunction clock_openfunction tone_freq_openfunction tone_volume_openfunction proc_rtas_initfunction parse_numberfunction ppc_rtas_poweron_writefunction ppc_rtas_poweron_showfunction ppc_rtas_progress_writefunction ppc_rtas_progress_showfunction ppc_rtas_clock_writefunction ppc_rtas_clock_showfunction ppc_rtas_sensors_showfunction ppc_rtas_find_all_sensorsfunction ppc_rtas_process_sensorfunction check_locationfunction check_location_stringfunction get_location_codefunction ppc_rtas_tone_freq_writefunction ppc_rtas_tone_freq_showfunction ppc_rtas_tone_volume_writefunction ppc_rtas_tone_volume_showfunction ppc_rtas_rmo_buf_show
Annotated Snippet
struct individual_sensor {
unsigned int token;
unsigned int quant;
};
struct rtas_sensors {
struct individual_sensor sensor[MAX_SENSORS];
unsigned int quant;
};
/* Globals */
static struct rtas_sensors sensors;
static struct device_node *rtas_node = NULL;
static unsigned long power_on_time = 0; /* Save the time the user set */
static char progress_led[MAX_LINELENGTH];
static unsigned long rtas_tone_frequency = 1000;
static unsigned long rtas_tone_volume = 0;
/* ****************************************************************** */
/* Declarations */
static int ppc_rtas_sensors_show(struct seq_file *m, void *v);
static int ppc_rtas_clock_show(struct seq_file *m, void *v);
static ssize_t ppc_rtas_clock_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos);
static int ppc_rtas_progress_show(struct seq_file *m, void *v);
static ssize_t ppc_rtas_progress_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos);
static int ppc_rtas_poweron_show(struct seq_file *m, void *v);
static ssize_t ppc_rtas_poweron_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos);
static ssize_t ppc_rtas_tone_freq_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos);
static int ppc_rtas_tone_freq_show(struct seq_file *m, void *v);
static ssize_t ppc_rtas_tone_volume_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos);
static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v);
static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v);
static int poweron_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_poweron_show, NULL);
}
static const struct proc_ops ppc_rtas_poweron_proc_ops = {
.proc_open = poweron_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_poweron_write,
.proc_release = single_release,
};
static int progress_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_progress_show, NULL);
}
static const struct proc_ops ppc_rtas_progress_proc_ops = {
.proc_open = progress_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_progress_write,
.proc_release = single_release,
};
static int clock_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_clock_show, NULL);
}
static const struct proc_ops ppc_rtas_clock_proc_ops = {
.proc_open = clock_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_clock_write,
.proc_release = single_release,
};
static int tone_freq_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_tone_freq_show, NULL);
}
static const struct proc_ops ppc_rtas_tone_freq_proc_ops = {
.proc_open = tone_freq_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_tone_freq_write,
.proc_release = single_release,
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched.h`, `linux/proc_fs.h`, `linux/stat.h`, `linux/ctype.h`, `linux/time.h`, `linux/string.h`, `linux/init.h`.
- Detected declarations: `struct individual_sensor`, `struct rtas_sensors`, `function poweron_open`, `function progress_open`, `function clock_open`, `function tone_freq_open`, `function tone_volume_open`, `function proc_rtas_init`, `function parse_number`, `function ppc_rtas_poweron_write`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.