arch/mips/cavium-octeon/executive/cvmx-helper.c
Source file repositories/reference/linux-study-clean/arch/mips/cavium-octeon/executive/cvmx-helper.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/cavium-octeon/executive/cvmx-helper.c- Extension
.c- Size
- 35097 bytes
- Lines
- 1173
- 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/bug.hasm/octeon/octeon.hasm/octeon/cvmx-config.hasm/octeon/cvmx-fpa.hasm/octeon/cvmx-pip.hasm/octeon/cvmx-pko.hasm/octeon/cvmx-ipd.hasm/octeon/cvmx-spi.hasm/octeon/cvmx-helper.hasm/octeon/cvmx-helper-board.hasm/octeon/cvmx-pip-defs.hasm/octeon/cvmx-asxx-defs.h
Detected Declarations
function cvmx_helper_get_number_of_interfacesfunction cvmx_helper_ports_on_interfacefunction __cvmx_get_mode_cn68xxfunction __cvmx_get_mode_octeon2function __cvmx_get_mode_cn7xxxfunction cvmx_helper_interface_get_modefunction __cvmx_helper_port_setup_ipdfunction cvmx_helper_interface_enumeratefunction cvmx_helper_interface_probefunction __cvmx_helper_interface_setup_ipdfunction __cvmx_helper_global_setup_ipdfunction __cvmx_helper_interface_setup_pkofunction __cvmx_helper_global_setup_pkofunction __cvmx_helper_global_setup_backpressurefunction __cvmx_helper_packet_hardware_enablefunction __cvmx_helper_errata_fix_ipd_ptr_alignmentfunction cvmx_helper_ipd_and_packet_input_enablefunction cvmx_helper_initialize_packet_io_globalfunction cvmx_helper_link_setfunction cvmx_helper_link_getexport cvmx_helper_get_number_of_interfacesexport cvmx_helper_ports_on_interfaceexport cvmx_helper_interface_get_modeexport cvmx_helper_ipd_and_packet_input_enableexport cvmx_helper_initialize_packet_io_globalexport cvmx_helper_link_getexport cvmx_helper_link_set
Annotated Snippet
if (qlm_cfg.s.qlm_spd == 15) {
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
} else if (qlm_cfg.s.qlm_cfg != 0) {
qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(1));
if (qlm_cfg.s.qlm_cfg != 0)
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
}
return CVMX_HELPER_INTERFACE_MODE_NPI;
case 8:
return CVMX_HELPER_INTERFACE_MODE_LOOP;
default:
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
}
}
/**
* @INTERNAL
* Return interface mode for an Octeon II
*/
static cvmx_helper_interface_mode_t __cvmx_get_mode_octeon2(int interface)
{
union cvmx_gmxx_inf_mode mode;
if (OCTEON_IS_MODEL(OCTEON_CN68XX))
return __cvmx_get_mode_cn68xx(interface);
if (interface == 2)
return CVMX_HELPER_INTERFACE_MODE_NPI;
if (interface == 3)
return CVMX_HELPER_INTERFACE_MODE_LOOP;
/* Only present in CN63XX & CN66XX Octeon model */
if ((OCTEON_IS_MODEL(OCTEON_CN63XX) &&
(interface == 4 || interface == 5)) ||
(OCTEON_IS_MODEL(OCTEON_CN66XX) &&
interface >= 4 && interface <= 7)) {
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
}
if (OCTEON_IS_MODEL(OCTEON_CN66XX)) {
union cvmx_mio_qlmx_cfg mio_qlm_cfg;
/* QLM2 is SGMII0 and QLM1 is SGMII1 */
if (interface == 0)
mio_qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(2));
else if (interface == 1)
mio_qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(1));
else
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
if (mio_qlm_cfg.s.qlm_spd == 15)
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
if (mio_qlm_cfg.s.qlm_cfg == 9)
return CVMX_HELPER_INTERFACE_MODE_SGMII;
else if (mio_qlm_cfg.s.qlm_cfg == 11)
return CVMX_HELPER_INTERFACE_MODE_XAUI;
else
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
} else if (OCTEON_IS_MODEL(OCTEON_CN61XX)) {
union cvmx_mio_qlmx_cfg qlm_cfg;
if (interface == 0) {
qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(2));
if (qlm_cfg.s.qlm_cfg == 2)
return CVMX_HELPER_INTERFACE_MODE_SGMII;
else if (qlm_cfg.s.qlm_cfg == 3)
return CVMX_HELPER_INTERFACE_MODE_XAUI;
else
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
} else if (interface == 1) {
qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(0));
if (qlm_cfg.s.qlm_cfg == 2)
return CVMX_HELPER_INTERFACE_MODE_SGMII;
else if (qlm_cfg.s.qlm_cfg == 3)
return CVMX_HELPER_INTERFACE_MODE_XAUI;
else
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
}
} else if (OCTEON_IS_MODEL(OCTEON_CNF71XX)) {
if (interface == 0) {
union cvmx_mio_qlmx_cfg qlm_cfg;
qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(0));
if (qlm_cfg.s.qlm_cfg == 2)
return CVMX_HELPER_INTERFACE_MODE_SGMII;
}
return CVMX_HELPER_INTERFACE_MODE_DISABLED;
}
Annotation
- Immediate include surface: `linux/bug.h`, `asm/octeon/octeon.h`, `asm/octeon/cvmx-config.h`, `asm/octeon/cvmx-fpa.h`, `asm/octeon/cvmx-pip.h`, `asm/octeon/cvmx-pko.h`, `asm/octeon/cvmx-ipd.h`, `asm/octeon/cvmx-spi.h`.
- Detected declarations: `function cvmx_helper_get_number_of_interfaces`, `function cvmx_helper_ports_on_interface`, `function __cvmx_get_mode_cn68xx`, `function __cvmx_get_mode_octeon2`, `function __cvmx_get_mode_cn7xxx`, `function cvmx_helper_interface_get_mode`, `function __cvmx_helper_port_setup_ipd`, `function cvmx_helper_interface_enumerate`, `function cvmx_helper_interface_probe`, `function __cvmx_helper_interface_setup_ipd`.
- 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.