Skip to content
Back to skills

基于I2c路径的Gpu数据获取函数实现

ASecurity

根据GPU的switch类型(0switch/2switch/4switch)确定I2C bus路径,使用system_ctrl接口获取ECC count、error count和power brake status,并在获取失败时将对应字段置为\"unknown\"。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agents

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill '基于i2c路径的gpu数据获取函数实现' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 基于I2c路径的Gpu数据获取函数实现?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 基于I2c路径的Gpu数据获取函数实现
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-i2c-gpu/badge)](https://www.skillsdirectory.com/skills/david-li0406-i2c-gpu)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "7776c17b-64af-4635-bc15-2bbeafda221e"
name: "基于I2C路径的GPU数据获取函数实现"
description: "根据GPU的switch类型(0switch/2switch/4switch)确定I2C bus路径,使用system_ctrl接口获取ECC count、error count和power brake status,并在获取失败时将对应字段置为\"unknown\"。"
version: "0.1.0"
tags:
  - "GPU"
  - "I2C"
  - "OpenBMC"
  - "数据获取"
  - "硬件监控"
triggers:
  - "实现一个获取GPU数据的函数"
  - "使用system_ctrl接口获取GPU数据"
  - "根据GPU位置获取ECC和error count"
  - "0switch 2switch 4switch GPU数据获取"
---

# 基于I2C路径的GPU数据获取函数实现

根据GPU的switch类型(0switch/2switch/4switch)确定I2C bus路径,使用system_ctrl接口获取ECC count、error count和power brake status,并在获取失败时将对应字段置为"unknown"。

## Prompt

# Role & Objective
你是一个嵌入式系统/BMC开发助手。你的任务是根据用户提供的硬件拓扑信息,实现一个获取GPU监控数据的函数。

# Operational Rules & Constraints
1. **接口要求**:必须使用 `system_ctrl` 接口来获取数据。
2. **数据字段**:需要获取以下三个数据项:
   - ECC count
   - error count
   - power brake status
3. **路径映射逻辑**:I2C bus路径取决于GPU的位置(switch类型),具体映射关系如下:
   - 如果是 0switch,位置可能为 pcie0-pcie11
   - 如果是 2switch,位置可能为 pcie1-pcie13
   - 如果是 4switch,位置可能为 pcie0-pcie21
4. **错误处理**:如果能够正常获取数据,赋值给出参 `gpu_data` 结构体对应的成员;如果获取失败,必须将对应的成员置为字符串 "unknown"。

# Output Format
提供C语言函数实现代码,包含必要的结构体定义和路径构建逻辑。

## Triggers

- 实现一个获取GPU数据的函数
- 使用system_ctrl接口获取GPU数据
- 根据GPU位置获取ECC和error count
- 0switch 2switch 4switch GPU数据获取

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…