arch/mips/sgi-ip27/ip27-memory.c
Source file repositories/reference/linux-study-clean/arch/mips/sgi-ip27/ip27-memory.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/sgi-ip27/ip27-memory.c- Extension
.c- Size
- 9618 bytes
- Lines
- 413
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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/init.hlinux/kernel.hlinux/memblock.hlinux/mm.hlinux/mmzone.hlinux/export.hlinux/nodemask.hlinux/swap.hlinux/pfn.hlinux/highmem.hasm/page.hasm/pgalloc.hasm/sections.hasm/sgialib.hasm/sn/arch.hasm/sn/agent.hasm/sn/klconfig.hip27-common.h
Detected Declarations
function gen_region_maskfunction router_recursefunction compute_node_distancefunction init_topology_matrixfunction for_each_online_nodefunction dump_topologyfunction for_each_online_nodefunction slot_getbasepfnfunction slot_psize_computefunction mlresetfunction szmemfunction for_each_online_nodefunction node_mem_initfunction prom_meminitfunction arch_zone_limits_initexport __node_dataexport __node_distances
Annotated Snippet
if (brd->brd_type == KLTYPE_ROUTER) {
router = (klrou_t *)NODE_OFFSET_TO_K0(NASID_GET(brd), brd->brd_compts[0]);
if (router == router_b) {
if (depth < router_distance)
router_distance = depth;
}
else
router_recurse(router, router_b, depth + 1);
}
}
router_a->rou_rflag = 0;
}
unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
EXPORT_SYMBOL(__node_distances);
static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
{
klrou_t *router, *router_a = NULL, *router_b = NULL;
lboard_t *brd, *dest_brd;
nasid_t nasid;
int port;
/* Figure out which routers nodes in question are connected to */
for_each_online_node(nasid) {
brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid),
KLTYPE_ROUTER);
if (!brd)
continue;
do {
if (brd->brd_flags & DUPLICATE_BOARD)
continue;
router = (klrou_t *)NODE_OFFSET_TO_K0(NASID_GET(brd), brd->brd_compts[0]);
router->rou_rflag = 0;
for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
if (router->rou_port[port].port_nasid == INVALID_NASID)
continue;
dest_brd = (lboard_t *)NODE_OFFSET_TO_K0(
router->rou_port[port].port_nasid,
router->rou_port[port].port_offset);
if (dest_brd->brd_type == KLTYPE_IP27) {
if (dest_brd->brd_nasid == nasid_a)
router_a = router;
if (dest_brd->brd_nasid == nasid_b)
router_b = router;
}
}
} while ((brd = find_lboard_class(KLCF_NEXT(brd), KLTYPE_ROUTER)));
}
if (nasid_a == nasid_b)
return LOCAL_DISTANCE;
if (router_a == router_b)
return LOCAL_DISTANCE + 1;
if (router_a == NULL) {
pr_info("node_distance: router_a NULL\n");
return 255;
}
if (router_b == NULL) {
pr_info("node_distance: router_b NULL\n");
return 255;
}
router_distance = 100;
router_recurse(router_a, router_b, 2);
return LOCAL_DISTANCE + router_distance;
}
static void __init init_topology_matrix(void)
{
nasid_t row, col;
for (row = 0; row < MAX_NUMNODES; row++)
for (col = 0; col < MAX_NUMNODES; col++)
__node_distances[row][col] = -1;
for_each_online_node(row) {
for_each_online_node(col) {
__node_distances[row][col] =
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/memblock.h`, `linux/mm.h`, `linux/mmzone.h`, `linux/export.h`, `linux/nodemask.h`, `linux/swap.h`.
- Detected declarations: `function gen_region_mask`, `function router_recurse`, `function compute_node_distance`, `function init_topology_matrix`, `function for_each_online_node`, `function dump_topology`, `function for_each_online_node`, `function slot_getbasepfn`, `function slot_psize_compute`, `function mlreset`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.