Repository navigation
fh: read the FH865x and FH8632 packages where the vendor kernel does - #255
Conversation
Both families share one chip ID per family and are told apart by a second register, which mach-fh's fh_chipid reads: CHIP_INFO (PMU 0x33C) bits 3:2 for FH8652/FH8656/FH8658, SPC_IO_STATUS (PMU 0x054) bits 5:0 for FH8632/FH8632v2. IP_VER was read for both, so the package was never set and the chip came out empty.
PR Summary by QodoRead FH865x package IDs from PMU CHIP_INFO
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. FH8632 packages remain unknown
|
| /* mach-fh/fh_chipid.c reads the FH865x package from CHIP_INFO */ | ||
| mem_reg(REG_PMU_CHIP_INFO, &chipinfo, OP_READ); |
There was a problem hiding this comment.
1. Fh8632 packages remain unknown 📘 Rule violation ≡ Correctness
fh_detect_cpu() still derives FH8632 and FH8632v2 from ipver, while the required package value is in the PMU SPC_IO_STATUS register. When the chip ID is 0x46488302, the unchanged IP_VER mask can leave chip_name unset, so both package names remain unidentified even though the new register handling is present for FH865x only.
Agent Prompt
## Issue description
FH8632 and FH8632v2 package detection still reads `IP_VER`, but the vendor implementation reads PMU `SPC_IO_STATUS` at offset `0x054` and masks bits 5:0. As a result, the `0x46488302` path can leave the package name unset.
## Fix Focus Areas
- src/hal/fh.c[88-95]
- src/hal/fh.h[8-12]
## Recommended Fix
Define the PMU `SPC_IO_STATUS` register address and read it in the `0x46488302` branch before applying the vendor’s `0x3f` mask, while retaining the existing FH865x `CHIP_INFO` handling separately.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Qodo's finding is right. The FH8632 half was in my working tree but not in the pushed commit, because the amend did not stage it. It is now in 8c3ea29: |
Thanks for the clarification. The fix in |
FH8652/FH8656/FH8658 share one chip ID, and so do FH8632/FH8632v2.
mach-fh'sfh_chipidtells the packages apart with a second register:CHIP_INFO(PMU0x33C), bits 3:2, underCONFIG_ARCH_FH865x;SPC_IO_STATUS(PMU0x054), bits 5:0, read byfh_get_chipid()for plat0x46488302.fh_detect_cpu()readIP_VERfor both, with the vendor masks, so the package was never set andipcinfo -cprintedunknown.Tested only in qemu-hisilicon's fh8652, fh8658 and fh8632 machines, whose PMU models take these registers from the vendor sources.
ipcinfo -cnow printsfh8652,fh8658andfh8632; it printedunknownbefore.fh8626v100was already right and is unchanged. Not run on an FH865x or FH8632 camera.