| @@ -2,6 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | All notable changes to this project will be documented in this file. | 3 | All notable changes to this project will be documented in this file. |
| 4 | 4 | ||
| 5 | +## [1.0.14] - 2026-11-28 | ||
| 6 | +- 新增支持 rmii 驱动接口 | ||
| 7 | + | ||
| 8 | + | ||
| 5 | ## [1.0.13] - 2026-11-26 | 9 | ## [1.0.13] - 2026-11-26 |
| 6 | 10 | ||
| 7 | - 支持 uart_connect 驱动接口 | 11 | - 支持 uart_connect 驱动接口 |
| @@ -10,3 +10,4 @@ subdir('i2c') | |||
| 10 | subdir('lpc_snoop') | 10 | subdir('lpc_snoop') |
| 11 | subdir('uart') | 11 | subdir('uart') |
| 12 | subdir('uart_connect') | 12 | subdir('uart_connect') |
| 13 | +subdir('rmii') | ||
| @@ -0,0 +1,13 @@ | |||||||||||||||||||
| 1 | +driver_name = 'rmii' | ||||||||||||||||||
| 2 | + | ||||||||||||||||||
| 3 | +sources = files('rmii.cpp') | ||||||||||||||||||
| 4 | +bcal_dep = dependency('bcal', required: true) | ||||||||||||||||||
| 5 | + | ||||||||||||||||||
| 6 | +rmii_lib = shared_library(driver_name, | ||||||||||||||||||
| 7 | + sources, | ||||||||||||||||||
| 8 | + dependencies: [bcal_dep], | ||||||||||||||||||
| 9 | + # 默认隐藏,create_driver/destroy_driver 靠 visibility("default") 显式导出 | ||||||||||||||||||
| 10 | + cpp_args: ['-fvisibility=hidden', '-fvisibility-inlines-hidden'], | ||||||||||||||||||
| 11 | + install: true, | ||||||||||||||||||
| 12 | + install_dir: driver_install_dir | ||||||||||||||||||
| 13 | +) | ||||||||||||||||||
🔵 Low Priority drivers/rmii/meson.build:6-11 的 证据链:仓库内 11 个驱动插件中,i2c/jtag/uart_connect/lpc_snoop/pwm/wdt/adc/uart 等均显式传入该 cpp_args,并在注释中写明“默认隐藏,create_driver/destroy_driver 靠 visibility("default") 显式导出”(见 drivers/i2c/meson.build:8-9、drivers/wdt/meson.build:8-9);rmii.cpp:340/346 也确实对 失败模式:rmii 插件会默认导出全部外部链接符号( 修复方向:按既有插件约定补上 cpp_args(该项为可选改进,不影响当前功能验证)。 建议:在 shared_library 参数中补上 cpp_args: ['-fvisibility=hidden', '-fvisibility-inlines-hidden'],与 i2c/uart/wdt 等既有驱动的构建约定保持一致,使只有显式标注 visibility("default") 的 create_driver/destroy_driver 被导出。 Suggestions
![]() ![]() Incorrect? | |||||||||||||||||||
| @@ -0,0 +1,556 @@ | |||||||||||||||||||||||
| 1 | +/* | ||||||||||||||||||||||
| 2 | + * Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved. | ||||||||||||||||||||||
| 3 | + * | ||||||||||||||||||||||
| 4 | + * Licensed under Mulan PSL v2. | ||||||||||||||||||||||
| 5 | + * You may obtain a copy of Mulan PSL v2 at: | ||||||||||||||||||||||
| 6 | + * http://license.coscl.org.cn/MulanPSL2 | ||||||||||||||||||||||
| 7 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||||||||||||||||||||||
| 8 | + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||||||||||||||||||||||
| 9 | + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||||||||||||||||||||||
| 10 | + * See the Mulan PSL v2 for more details. | ||||||||||||||||||||||
| 11 | + */ | ||||||||||||||||||||||
| 12 | + | ||||||||||||||||||||||
| 13 | +#include <bcal/rmii.h> | ||||||||||||||||||||||
| 14 | + | ||||||||||||||||||||||
| 15 | +#include <algorithm> | ||||||||||||||||||||||
| 16 | +#include <cerrno> | ||||||||||||||||||||||
| 17 | +#include <cstddef> | ||||||||||||||||||||||
| 18 | +#include <cstdint> | ||||||||||||||||||||||
| 19 | +#include <cstdio> | ||||||||||||||||||||||
| 20 | +#include <cstring> | ||||||||||||||||||||||
| 21 | +#include <mutex> | ||||||||||||||||||||||
| 22 | +#include <stdexcept> | ||||||||||||||||||||||
| 23 | +#include <string> | ||||||||||||||||||||||
| 24 | +#include <system_error> | ||||||||||||||||||||||
| 25 | +#include <unistd.h> | ||||||||||||||||||||||
🔵 Low Priority 变更行 39-45、78、107-109 使用了 uint32_t / uint16_t / int32_t / size_t 等定宽与尺寸类型,但 13-29 行的 include 列表(algorithm/cerrno/cstdio/cstring/mutex/stdexcept/string/system_error/unistd.h + 系统头)没有 建议:在标准库 include 段显式加入 Suggestions
![]() ![]() Incorrect? | |||||||||||||||||||||||
| 26 | + | ||||||||||||||||||||||
| 27 | +#include <linux/if_packet.h> | ||||||||||||||||||||||
| 28 | +#include <net/if.h> | ||||||||||||||||||||||
| 29 | +#include <netinet/in.h> | ||||||||||||||||||||||
| 30 | +#include <sys/ioctl.h> | ||||||||||||||||||||||
| 31 | +#include <sys/socket.h> | ||||||||||||||||||||||
| 32 | + | ||||||||||||||||||||||
| 33 | +namespace BCAL_RMII_ASPEED { | ||||||||||||||||||||||
| 34 | +using namespace bcal; | ||||||||||||||||||||||
| 35 | +using namespace BCAL_DRIVER_RMII; | ||||||||||||||||||||||
| 36 | + | ||||||||||||||||||||||
| 37 | +namespace { | ||||||||||||||||||||||
| 38 | +constexpr const char* DRIVER_VERSION = "bcal_rmii_aspeed v1.0.0 (raw socket NC-SI)"; | ||||||||||||||||||||||
| 39 | + | ||||||||||||||||||||||
| 40 | +// ---- Packet layout constants (ported from v1 rmii.h) ---- | ||||||||||||||||||||||
| 41 | +constexpr uint32_t NCSI_MAC_LEN = 6; | ||||||||||||||||||||||
| 42 | +constexpr uint32_t NCSI_ETHER_MIN_LEN = 290; // 46-1500 bytes data region | ||||||||||||||||||||||
| 43 | +constexpr uint32_t NCSI_ETHER_MIN_LEN_MULTIPLE = 4; | ||||||||||||||||||||||
| 44 | +constexpr uint32_t NCSI_ETH_NAME_LEN = 16; | ||||||||||||||||||||||
| 45 | +constexpr uint32_t ETH_NCSI_TYPE = 0x88F8; | ||||||||||||||||||||||
| 46 | +constexpr uint32_t RECV_BUFFER_LEN = 2048; | ||||||||||||||||||||||
| 47 | +constexpr uint32_t ETHER_HEADER_LEN = 14; | ||||||||||||||||||||||
| 48 | +constexpr uint32_t PACKET_HEADER_LEN = 16; | ||||||||||||||||||||||
| 49 | + | ||||||||||||||||||||||
| 50 | +// Total wire packet = 14 + 16 + (290*4 - 14 - 16) = 1160 bytes | ||||||||||||||||||||||
| 51 | +constexpr size_t NCSI_PACKET_TOTAL_LEN = | ||||||||||||||||||||||
| 52 | + ETHER_HEADER_LEN + PACKET_HEADER_LEN + | ||||||||||||||||||||||
| 53 | + NCSI_ETHER_MIN_LEN * NCSI_ETHER_MIN_LEN_MULTIPLE - ETHER_HEADER_LEN - PACKET_HEADER_LEN; | ||||||||||||||||||||||
| 54 | + | ||||||||||||||||||||||
| 55 | +/* The Management Controller shall format the 14-byte Ethernet frame header so that when it is received, | ||||||||||||||||||||||
| 56 | +it shall be formatted in the big-endian byte order. | ||||||||||||||||||||||
| 57 | + Bits | ||||||||||||||||||||||
| 58 | +___________________________________________________________ | ||||||||||||||||||||||
| 59 | +| Bytes | 31..24 | 23..16 | 15..08 | 07..00 | | ||||||||||||||||||||||
| 60 | +|_______|___________|____________|____________|____________| | ||||||||||||||||||||||
| 61 | +|00..03 | DA5= 0xFF | DA4= 0xFF | DA3= 0xFF | DA2= 0xFF | | ||||||||||||||||||||||
| 62 | +|_______|___________|_________________________|____________| | ||||||||||||||||||||||
| 63 | +|04..07 | DA1= 0xFF | DA0= 0xFF | SA5 | SA4 | | ||||||||||||||||||||||
| 64 | +|_______|___________|_________________________|____________| | ||||||||||||||||||||||
| 65 | +|08..11 | SA3 | SA2 | SA1 | SA0 | | ||||||||||||||||||||||
| 66 | +|_______|___________|_________________________|____________| | ||||||||||||||||||||||
| 67 | +|12..13 | EtherType = 0x88F8 (DMTF NC-SI) | | ||||||||||||||||||||||
| 68 | +|_______|__________________________________________________| */ | ||||||||||||||||||||||
| 69 | +/* | ||||||||||||||||||||||
| 70 | + * Note: ethernet_header / ctl_packet_header / common_packet_except_name are | ||||||||||||||||||||||
| 71 | + * packed so the struct layout matches the on-the-wire NC-SI byte layout | ||||||||||||||||||||||
| 72 | + * (14B ethernet at offset 0, 16B control header at offset 14, payload at | ||||||||||||||||||||||
| 73 | + * offset 30, total NCSI_PACKET_TOTAL_LEN). The static_assert below pins the | ||||||||||||||||||||||
| 74 | + * struct size to the documented packet length; any future alignment change | ||||||||||||||||||||||
| 75 | + * that breaks the layout fails at compile time instead of producing | ||||||||||||||||||||||
| 76 | + * silently malformed frames on the wire. | ||||||||||||||||||||||
| 77 | + */ | ||||||||||||||||||||||
| 78 | +struct __attribute__((packed)) ethernet_header { | ||||||||||||||||||||||
| 79 | + unsigned char des_address[NCSI_MAC_LEN]; | ||||||||||||||||||||||
| 80 | + unsigned char src_address[NCSI_MAC_LEN]; | ||||||||||||||||||||||
| 81 | + uint16_t ether_type; | ||||||||||||||||||||||
| 82 | +}; | ||||||||||||||||||||||
| 83 | + | ||||||||||||||||||||||
| 84 | +/* The 16-byte control packet header is used in command, response, and AEN packets, and contains data | ||||||||||||||||||||||
| 85 | +values intended to allow the packet to be identified, validated, and processed. The packet header is in | ||||||||||||||||||||||
| 86 | +big-endian byte order. | ||||||||||||||||||||||
| 87 | + | ||||||||||||||||||||||
| 88 | +Bytes 31..24 23..16 15..08 07..00 | ||||||||||||||||||||||
| 89 | +00..03 MC ID Header Revision Reserved IID | ||||||||||||||||||||||
| 90 | +04..07 Control Packet Type Ch. ID Reserved Payload Length | ||||||||||||||||||||||
| 91 | +08..11 Reserved | ||||||||||||||||||||||
| 92 | +12..15 Reserved */ | ||||||||||||||||||||||
| 93 | +struct __attribute__((packed)) ctl_packet_header { | ||||||||||||||||||||||
| 94 | + unsigned char mc_id; | ||||||||||||||||||||||
| 95 | + unsigned char header_revision; | ||||||||||||||||||||||
| 96 | + unsigned char reserved; | ||||||||||||||||||||||
| 97 | + unsigned char iid; // Instance ID | ||||||||||||||||||||||
| 98 | + unsigned char packet_type; // Control Packet Type | ||||||||||||||||||||||
| 99 | +#ifdef BD_BIG_ENDIAN | ||||||||||||||||||||||
| 100 | + unsigned char package_id : 3; | ||||||||||||||||||||||
| @@ -2,14 +2,14 @@ | |||
| 2 | "name": "libsoc_adapter_aspeed", | 2 | "name": "libsoc_adapter_aspeed", |
| 3 | "type": "application", | 3 | "type": "application", |
| 4 | "deployConfig": "", | 4 | "deployConfig": "", |
| 5 | - "version": "1.0.13", | 5 | + "version": "1.0.14", |
| 6 | "license": "Mulan PSL v2", | 6 | "license": "Mulan PSL v2", |
| 7 | "description": "BMC chip adapter for Aspeed.", | 7 | "description": "BMC chip adapter for Aspeed.", |
| 8 | "dependencies": { | 8 | "dependencies": { |
| 9 | "test": [], | 9 | "test": [], |
| 10 | "build": [ | 10 | "build": [ |
| 11 | { | 11 | { |
| 12 | - "conan": "bcal/[>=0.0.13]" | 12 | + "conan": "bcal/[>=0.0.14]" |
| 13 | } | 13 | } |
| 14 | ] | 14 | ] |
| 15 | }, | 15 | }, |


[Major] 新增的 librmii.so 未在 permissions.ini 登记
仓库根的
permissions.ini逐条列出opt/bmc/bcal/lib*.so的落地权限(f 550 0 0),现有 12 个驱动全部在列,本次新增的 rmii 没有对应条目;conanfile.py仍会把该文件打进包,安装后 librmii.so 的属主与权限不受该清单约束。建议在 permissions.ini 末尾补一行
opt/bmc/bcal/librmii.so f 550 0 0,与其余驱动保持一致。规则
permissions-ini-missing-so· AI 检视