drivers/misc/ibmasm/ibmasm.h
Source file repositories/reference/linux-study-clean/drivers/misc/ibmasm/ibmasm.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/ibmasm/ibmasm.h- Extension
.h- Size
- 6038 bytes
- Lines
- 210
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/types.hlinux/errno.hlinux/list.hlinux/wait.hlinux/spinlock.hlinux/slab.hlinux/module.hlinux/interrupt.hlinux/kref.hlinux/device.hlinux/input.hlinux/time64.h
Detected Declarations
struct commandstruct ibmasm_eventstruct event_bufferstruct event_readerstruct reverse_heartbeatstruct ibmasm_remotestruct service_processorfunction command_putfunction command_get
Annotated Snippet
struct command {
struct list_head queue_node;
wait_queue_head_t wait;
unsigned char *buffer;
size_t buffer_size;
int status;
struct kref kref;
spinlock_t *lock;
};
#define to_command(c) container_of(c, struct command, kref)
void ibmasm_free_command(struct kref *kref);
static inline void command_put(struct command *cmd)
{
unsigned long flags;
spinlock_t *lock = cmd->lock;
spin_lock_irqsave(lock, flags);
kref_put(&cmd->kref, ibmasm_free_command);
spin_unlock_irqrestore(lock, flags);
}
static inline void command_get(struct command *cmd)
{
kref_get(&cmd->kref);
}
struct ibmasm_event {
unsigned int serial_number;
unsigned int data_size;
unsigned char data[IBMASM_EVENT_MAX_SIZE];
};
struct event_buffer {
struct ibmasm_event events[IBMASM_NUM_EVENTS];
unsigned int next_serial_number;
unsigned int next_index;
struct list_head readers;
};
struct event_reader {
int cancelled;
unsigned int next_serial_number;
wait_queue_head_t wait;
struct list_head node;
unsigned int data_size;
unsigned char data[IBMASM_EVENT_MAX_SIZE];
};
struct reverse_heartbeat {
wait_queue_head_t wait;
unsigned int stopped;
};
struct ibmasm_remote {
struct input_dev *keybd_dev;
struct input_dev *mouse_dev;
};
struct service_processor {
struct list_head node;
spinlock_t lock;
void __iomem *base_address;
unsigned int irq;
struct command *current_command;
struct command *heartbeat;
struct list_head command_queue;
struct event_buffer *event_buffer;
char dirname[IBMASM_NAME_SIZE];
char devname[IBMASM_NAME_SIZE];
unsigned int number;
struct ibmasm_remote remote;
int serial_line;
struct device *dev;
};
/* command processing */
struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size);
void ibmasm_exec_command(struct service_processor *sp, struct command *cmd);
void ibmasm_wait_for_response(struct command *cmd, int timeout);
void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size);
/* event processing */
int ibmasm_event_buffer_init(struct service_processor *sp);
void ibmasm_event_buffer_exit(struct service_processor *sp);
void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size);
void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader);
void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader);
int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/errno.h`, `linux/list.h`, `linux/wait.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/module.h`.
- Detected declarations: `struct command`, `struct ibmasm_event`, `struct event_buffer`, `struct event_reader`, `struct reverse_heartbeat`, `struct ibmasm_remote`, `struct service_processor`, `function command_put`, `function command_get`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.