arch/mips/sgi-ip30/ip30-xtalk.c
Source file repositories/reference/linux-study-clean/arch/mips/sgi-ip30/ip30-xtalk.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/sgi-ip30/ip30-xtalk.c- Extension
.c- Size
- 5125 bytes
- Lines
- 187
- 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.
- 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/platform_device.hlinux/platform_data/sgi-w1.hlinux/platform_data/xtalk-bridge.hasm/xtalk/xwidget.hasm/pci/bridge.h
Detected Declarations
function Copyrightfunction xbow_widget_activefunction xtalk_init_widgetfunction ip30_xtalk_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* ip30-xtalk.c - Very basic Crosstalk (XIO) detection support.
* Copyright (C) 2004-2007 Stanislaw Skowronek <skylark@unaligned.org>
* Copyright (C) 2009 Johannes Dickgreber <tanzy@gmx.de>
* Copyright (C) 2007, 2014-2016 Joshua Kinard <linux@kumba.dev>
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/platform_data/sgi-w1.h>
#include <linux/platform_data/xtalk-bridge.h>
#include <asm/xtalk/xwidget.h>
#include <asm/pci/bridge.h>
#define IP30_SWIN_BASE(widget) \
(0x0000000010000000 | (((unsigned long)(widget)) << 24))
#define IP30_RAW_SWIN_BASE(widget) (IO_BASE + IP30_SWIN_BASE(widget))
#define IP30_SWIN_SIZE (1 << 24)
#define IP30_WIDGET_XBOW _AC(0x0, UL) /* XBow is always 0 */
#define IP30_WIDGET_HEART _AC(0x8, UL) /* HEART is always 8 */
#define IP30_WIDGET_PCI_BASE _AC(0xf, UL) /* BaseIO PCI is always 15 */
#define XTALK_NODEV 0xffffffff
#define XBOW_REG_LINK_STAT_0 0x114
#define XBOW_REG_LINK_BLK_SIZE 0x40
#define XBOW_REG_LINK_ALIVE 0x80000000
#define HEART_INTR_ADDR 0x00000080
#define xtalk_read __raw_readl
static void bridge_platform_create(int widget, int masterwid)
{
struct xtalk_bridge_platform_data *bd;
struct sgi_w1_platform_data *wd;
struct platform_device *pdev_wd;
struct platform_device *pdev_bd;
struct resource w1_res;
wd = kzalloc_obj(*wd);
if (!wd) {
pr_warn("xtalk:%x bridge create out of memory\n", widget);
return;
}
snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx",
IP30_SWIN_BASE(widget));
memset(&w1_res, 0, sizeof(w1_res));
w1_res.start = IP30_SWIN_BASE(widget) +
offsetof(struct bridge_regs, b_nic);
w1_res.end = w1_res.start + 3;
w1_res.flags = IORESOURCE_MEM;
pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO);
if (!pdev_wd) {
pr_warn("xtalk:%x bridge create out of memory\n", widget);
goto err_kfree_wd;
}
if (platform_device_add_resources(pdev_wd, &w1_res, 1)) {
pr_warn("xtalk:%x bridge failed to add platform resources.\n", widget);
goto err_put_pdev_wd;
}
if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) {
pr_warn("xtalk:%x bridge failed to add platform data.\n", widget);
goto err_put_pdev_wd;
}
if (platform_device_add(pdev_wd)) {
pr_warn("xtalk:%x bridge failed to add platform device.\n", widget);
goto err_put_pdev_wd;
}
/* platform_device_add_data() duplicates the data */
kfree(wd);
bd = kzalloc_obj(*bd);
if (!bd) {
pr_warn("xtalk:%x bridge create out of memory\n", widget);
goto err_unregister_pdev_wd;
}
pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO);
if (!pdev_bd) {
pr_warn("xtalk:%x bridge create out of memory\n", widget);
goto err_kfree_bd;
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/platform_device.h`, `linux/platform_data/sgi-w1.h`, `linux/platform_data/xtalk-bridge.h`, `asm/xtalk/xwidget.h`, `asm/pci/bridge.h`.
- Detected declarations: `function Copyright`, `function xbow_widget_active`, `function xtalk_init_widget`, `function ip30_xtalk_init`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.