arch/mips/txx9/generic/setup.c
Source file repositories/reference/linux-study-clean/arch/mips/txx9/generic/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/txx9/generic/setup.c- Extension
.c- Size
- 20248 bytes
- Lines
- 856
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/types.hlinux/interrupt.hlinux/string.hlinux/export.hlinux/clk-provider.hlinux/clkdev.hlinux/err.hlinux/gpio/driver.hlinux/platform_device.hlinux/platform_data/txx9/ndfmc.hlinux/serial_core.hlinux/mtd/physmap.hlinux/leds.hlinux/device.hlinux/slab.hlinux/io.hlinux/irq.hasm/bootinfo.hasm/idle.hasm/time.hasm/reboot.hasm/r4kcache.hasm/setup.hasm/txx9/generic.hasm/txx9/pci.hasm/txx9tmr.hasm/txx9/dmac.hasm/txx9/tx4938.hasm/txx9/boards.h
Detected Declarations
struct txx9_iocled_datastruct txx9_sramc_devfunction txx9_reg_res_initfunction find_board_bynamefunction prom_init_cmdlinefunction early_flush_dcachefunction txx9_cache_fixupfunction txx9_cache_fixupfunction select_boardfunction prom_initfunction prom_getenvfunction txx9_machine_haltfunction txx9_wdt_initfunction txx9_wdt_nowfunction txx9_spi_initfunction txx9_ethaddr_initfunction txx9_sio_initfunction null_prom_putcharfunction prom_putcharfunction early_txx9_sio_putcharfunction txx9_sio_putchar_initfunction plat_mem_setupfunction arch_init_irqfunction plat_time_initfunction txx9_clk_initfunction _txx9_arch_initfunction _txx9_device_initfunction plat_irq_dispatchfunction __swizzle_addr_nonefunction txx9_physmap_flash_initfunction txx9_ndfmc_initfunction txx9_iocled_getfunction txx9_iocled_setfunction txx9_iocled_dir_infunction txx9_iocled_dir_outfunction txx9_iocled_initfunction txx9_iocled_initfunction txx9_aclc_initfunction txx9_sram_readfunction txx9_sram_writefunction txx9_device_releasefunction txx9_sramc_initmodule init _txx9_device_initexport __swizzle_addr_b
Annotated Snippet
static const struct bus_type txx9_sramc_subsys = {
.name = "txx9_sram",
.dev_name = "txx9_sram",
};
struct txx9_sramc_dev {
struct device dev;
struct bin_attribute bindata_attr;
void __iomem *base;
};
static ssize_t txx9_sram_read(struct file *filp, struct kobject *kobj,
const struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{
struct txx9_sramc_dev *dev = bin_attr->private;
size_t ramsize = bin_attr->size;
if (pos >= ramsize)
return 0;
if (pos + size > ramsize)
size = ramsize - pos;
memcpy_fromio(buf, dev->base + pos, size);
return size;
}
static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj,
const struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{
struct txx9_sramc_dev *dev = bin_attr->private;
size_t ramsize = bin_attr->size;
if (pos >= ramsize)
return 0;
if (pos + size > ramsize)
size = ramsize - pos;
memcpy_toio(dev->base + pos, buf, size);
return size;
}
static void txx9_device_release(struct device *dev)
{
struct txx9_sramc_dev *tdev;
tdev = container_of(dev, struct txx9_sramc_dev, dev);
kfree(tdev);
}
void __init txx9_sramc_init(struct resource *r)
{
struct txx9_sramc_dev *dev;
size_t size;
int err;
err = subsys_system_register(&txx9_sramc_subsys, NULL);
if (err)
return;
dev = kzalloc_obj(*dev);
if (!dev)
return;
size = resource_size(r);
dev->base = ioremap(r->start, size);
if (!dev->base) {
kfree(dev);
return;
}
dev->dev.release = &txx9_device_release;
dev->dev.bus = &txx9_sramc_subsys;
sysfs_bin_attr_init(&dev->bindata_attr);
dev->bindata_attr.attr.name = "bindata";
dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR;
dev->bindata_attr.read = txx9_sram_read;
dev->bindata_attr.write = txx9_sram_write;
dev->bindata_attr.size = size;
dev->bindata_attr.private = dev;
err = device_register(&dev->dev);
if (err)
goto exit_put;
err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
if (err) {
iounmap(dev->base);
device_unregister(&dev->dev);
}
return;
exit_put:
iounmap(dev->base);
put_device(&dev->dev);
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/types.h`, `linux/interrupt.h`, `linux/string.h`, `linux/export.h`, `linux/clk-provider.h`, `linux/clkdev.h`.
- Detected declarations: `struct txx9_iocled_data`, `struct txx9_sramc_dev`, `function txx9_reg_res_init`, `function find_board_byname`, `function prom_init_cmdline`, `function early_flush_dcache`, `function txx9_cache_fixup`, `function txx9_cache_fixup`, `function select_board`, `function prom_init`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: pattern 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.