arch/mips/sibyte/swarm/rtc_xicor1241.c
Source file repositories/reference/linux-study-clean/arch/mips/sibyte/swarm/rtc_xicor1241.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/sibyte/swarm/rtc_xicor1241.c- Extension
.c- Size
- 5061 bytes
- Lines
- 207
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bcd.hlinux/types.hlinux/time.hasm/time.hasm/addrspace.hasm/io.hasm/sibyte/sb1250.hasm/sibyte/sb1250_regs.hasm/sibyte/sb1250_smbus.h
Detected Declarations
function Copyrightfunction xicor_writefunction xicor_set_timefunction xicor_get_timefunction xicor_probe
Annotated Snippet
if (tm.tm_hour >= 12) {
tmp |= 0x20;
tm.tm_hour -= 12;
}
tm.tm_hour = bin2bcd(tm.tm_hour);
tmp |= tm.tm_hour;
}
xicor_write(X1241REG_HR, tmp);
xicor_write(X1241REG_SR, 0);
spin_unlock_irqrestore(&rtc_lock, flags);
return 0;
}
time64_t xicor_get_time(void)
{
unsigned int year, mon, day, hour, min, sec, y2k;
unsigned long flags;
spin_lock_irqsave(&rtc_lock, flags);
sec = xicor_read(X1241REG_SC);
min = xicor_read(X1241REG_MN);
hour = xicor_read(X1241REG_HR);
if (hour & X1241REG_HR_MIL) {
hour &= 0x3f;
} else {
if (hour & 0x20)
hour = (hour & 0xf) + 0x12;
}
day = xicor_read(X1241REG_DT);
mon = xicor_read(X1241REG_MO);
year = xicor_read(X1241REG_YR);
y2k = xicor_read(X1241REG_Y2K);
spin_unlock_irqrestore(&rtc_lock, flags);
sec = bcd2bin(sec);
min = bcd2bin(min);
hour = bcd2bin(hour);
day = bcd2bin(day);
mon = bcd2bin(mon);
year = bcd2bin(year);
y2k = bcd2bin(y2k);
year += (y2k * 100);
return mktime64(year, mon, day, hour, min, sec);
}
int xicor_probe(void)
{
return xicor_read(X1241REG_SC) != -1;
}
Annotation
- Immediate include surface: `linux/bcd.h`, `linux/types.h`, `linux/time.h`, `asm/time.h`, `asm/addrspace.h`, `asm/io.h`, `asm/sibyte/sb1250.h`, `asm/sibyte/sb1250_regs.h`.
- Detected declarations: `function Copyright`, `function xicor_write`, `function xicor_set_time`, `function xicor_get_time`, `function xicor_probe`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source 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.