arch/x86/platform/olpc/olpc.c
Source file repositories/reference/linux-study-clean/arch/x86/platform/olpc/olpc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/platform/olpc/olpc.c- Extension
.c- Size
- 7946 bytes
- Lines
- 322
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/export.hlinux/delay.hlinux/io.hlinux/string.hlinux/platform_device.hlinux/of.hlinux/syscore_ops.hlinux/mutex.hlinux/olpc-ec.hasm/geode.hasm/setup.hasm/olpc.hasm/olpc_ofw.h
Detected Declarations
function olpc_ec_timeout_setfunction ibf_statusfunction obf_statusfunction __wait_on_ibffunction __wait_on_obffunction olpc_xo1_ec_cmdfunction check_ofw_architecturefunction get_board_revisionfunction platform_detectfunction add_xo1_platform_devicesfunction olpc_xo1_ec_suspendfunction olpc_xo1_ec_resumefunction olpc_initexport olpc_platform_info
Annotated Snippet
if (wait_on_ibf(0x6c, 0)) {
printk(KERN_ERR "olpc-ec: timeout waiting for"
" EC accept data!\n");
goto err;
}
}
}
if (outbuf && outlen) {
/* read data from EC */
for (i = 0; i < outlen; i++) {
if (wait_on_obf(0x6c, 1)) {
printk(KERN_ERR "olpc-ec: timeout waiting for"
" EC to provide data!\n");
if (restarts++ < 10)
goto restart;
goto err;
}
outbuf[i] = inb(0x68);
pr_devel("olpc-ec: received 0x%x\n", outbuf[i]);
}
}
ret = 0;
err:
return ret;
}
static bool __init check_ofw_architecture(struct device_node *root)
{
const char *olpc_arch;
int propsize;
olpc_arch = of_get_property(root, "architecture", &propsize);
return propsize == 5 && strncmp("OLPC", olpc_arch, 5) == 0;
}
static u32 __init get_board_revision(struct device_node *root)
{
int propsize;
const __be32 *rev;
rev = of_get_property(root, "board-revision-int", &propsize);
if (propsize != 4)
return 0;
return be32_to_cpu(*rev);
}
static bool __init platform_detect(void)
{
struct device_node *root = of_find_node_by_path("/");
bool success;
if (!root)
return false;
success = check_ofw_architecture(root);
if (success) {
olpc_platform_info.boardrev = get_board_revision(root);
olpc_platform_info.flags |= OLPC_F_PRESENT;
pr_info("OLPC board revision %s%X\n",
((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
olpc_platform_info.boardrev >> 4);
}
of_node_put(root);
return success;
}
static int __init add_xo1_platform_devices(void)
{
struct platform_device *pdev;
pdev = platform_device_register_simple("xo1-rfkill", -1, NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
pdev = platform_device_register_simple("olpc-xo1", -1, NULL, 0);
return PTR_ERR_OR_ZERO(pdev);
}
static int olpc_xo1_ec_suspend(struct platform_device *pdev)
{
/*
* Squelch SCIs while suspended. This is a fix for
* <http://dev.laptop.org/ticket/1835>.
*/
return olpc_ec_cmd(EC_SET_SCI_INHIBIT, NULL, 0, NULL, 0);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/export.h`, `linux/delay.h`, `linux/io.h`, `linux/string.h`, `linux/platform_device.h`, `linux/of.h`.
- Detected declarations: `function olpc_ec_timeout_set`, `function ibf_status`, `function obf_status`, `function __wait_on_ibf`, `function __wait_on_obf`, `function olpc_xo1_ec_cmd`, `function check_ofw_architecture`, `function get_board_revision`, `function platform_detect`, `function add_xo1_platform_devices`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration 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.