drivers/soc/apple/rtkit-crashlog.c
Source file repositories/reference/linux-study-clean/drivers/soc/apple/rtkit-crashlog.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/apple/rtkit-crashlog.c- Extension
.c- Size
- 6103 bytes
- Lines
- 248
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rtkit-internal.h
Detected Declarations
struct apple_rtkit_crashlog_headerstruct apple_rtkit_crashlog_mbox_entrystruct apple_rtkit_crashlog_regsfunction apple_rtkit_crashlog_dump_strfunction apple_rtkit_crashlog_dump_versionfunction apple_rtkit_crashlog_dump_timefunction apple_rtkit_crashlog_dump_mailboxfunction apple_rtkit_crashlog_dump_regsfunction apple_rtkit_crashlog_dump
Annotated Snippet
struct apple_rtkit_crashlog_header {
u32 fourcc;
u32 version;
u32 size;
u32 flags;
u8 _unk[16];
};
static_assert(sizeof(struct apple_rtkit_crashlog_header) == 0x20);
struct apple_rtkit_crashlog_mbox_entry {
u64 msg0;
u64 msg1;
u32 timestamp;
u8 _unk[4];
};
static_assert(sizeof(struct apple_rtkit_crashlog_mbox_entry) == 0x18);
struct apple_rtkit_crashlog_regs {
u32 unk_0;
u32 unk_4;
u64 regs[31];
u64 sp;
u64 pc;
u64 psr;
u64 cpacr;
u64 fpsr;
u64 fpcr;
u64 unk[64];
u64 far;
u64 unk_X;
u64 esr;
u64 unk_Z;
} __packed;
static_assert(sizeof(struct apple_rtkit_crashlog_regs) == 0x350);
static void apple_rtkit_crashlog_dump_str(struct apple_rtkit *rtk, u8 *bfr,
size_t size)
{
u32 idx;
u8 *ptr, *end;
memcpy(&idx, bfr, 4);
ptr = bfr + 4;
end = bfr + size;
while (ptr < end) {
u8 *newline = memchr(ptr, '\n', end - ptr);
if (newline) {
u8 tmp = *newline;
*newline = '\0';
dev_warn(rtk->dev, "RTKit: Message (id=%x): %s\n", idx,
ptr);
*newline = tmp;
ptr = newline + 1;
} else {
dev_warn(rtk->dev, "RTKit: Message (id=%x): %s", idx,
ptr);
break;
}
}
}
static void apple_rtkit_crashlog_dump_version(struct apple_rtkit *rtk, u8 *bfr,
size_t size)
{
dev_warn(rtk->dev, "RTKit: Version: %s", bfr + 16);
}
static void apple_rtkit_crashlog_dump_time(struct apple_rtkit *rtk, u8 *bfr,
size_t size)
{
u64 crash_time;
memcpy(&crash_time, bfr, 8);
dev_warn(rtk->dev, "RTKit: Crash time: %lld", crash_time);
}
static void apple_rtkit_crashlog_dump_mailbox(struct apple_rtkit *rtk, u8 *bfr,
size_t size)
{
u32 type, index, i;
size_t n_messages;
struct apple_rtkit_crashlog_mbox_entry entry;
memcpy(&type, bfr + 16, 4);
memcpy(&index, bfr + 24, 4);
n_messages = (size - 28) / sizeof(entry);
dev_warn(rtk->dev, "RTKit: Mailbox history (type = %d, index = %d)",
Annotation
- Immediate include surface: `rtkit-internal.h`.
- Detected declarations: `struct apple_rtkit_crashlog_header`, `struct apple_rtkit_crashlog_mbox_entry`, `struct apple_rtkit_crashlog_regs`, `function apple_rtkit_crashlog_dump_str`, `function apple_rtkit_crashlog_dump_version`, `function apple_rtkit_crashlog_dump_time`, `function apple_rtkit_crashlog_dump_mailbox`, `function apple_rtkit_crashlog_dump_regs`, `function apple_rtkit_crashlog_dump`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: source implementation candidate.
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.