You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR 220 has introduced an index problem that is preventing the retrieval of correct CPU information for Windows ARM64 systems using Ampere(R) Altra(R) Processor.
The main reason is the incompatibility between woa_chip_name (windows-arm-init.h) and woa_chips[] (init.c).
Since woa_chip_name_microsoft_sq_3 is duplicated, this for loop is not reaching the Ampere(R) Altra(R) Processor element in the array due to wrong size.
Error:
"Unknown chip model name 'Ampere(R) Altra(R) Processor'.
Please add new Windows on Arm SoC/chip support to arm/windows/init.c!"
**Summary:**
Resolves#236
Also related to [PR 220](#220) change.
```
"Unknown chip model name 'Ampere(R) Altra(R) Processor'.
Please add new Windows on Arm SoC/chip support to arm/windows/init.c!"
```
---
**Previous error details:**
The error's reason was:
`woa_chip_name` (`windows-arm-init.h`) enum had only 4 elements (stored in `woa_chip_name_last`)
```c
enum woa_chip_name {
woa_chip_name_microsoft_sq_1 = 0,
woa_chip_name_microsoft_sq_2 = 1,
woa_chip_name_microsoft_sq_3 = 2,
woa_chip_name_ampere_altra = 3,
woa_chip_name_unknown = 4,
woa_chip_name_last = woa_chip_name_unknown
};
```
However, `woa_chips[]` (`init.c`) has a duplicated value for `woa_chip_name_microsoft_sq_3` due to different strings for same target after the [PR 220](#220)
> Strings are `Snapdragon (TM) 8cx Gen 3` and `Snapdragon Compute Platform`
And this was causing following `for loop` (`init.c`) is not checking for all elements in `woa_chips[]`.
```c
for (uint32_t i = 0; i < (uint32_t)woa_chip_name_last; i++) {
size_t compare_length = wcsnlen(woa_chips[i].chip_name_string, CPUINFO_PACKAGE_NAME_MAX);
int compare_result = wcsncmp(text_buffer, woa_chips[i].chip_name_string, compare_length);
if (compare_result == 0) {
chip_info = woa_chips + i;
break;
}
}
```
---
**Fix Details:**
We added `woa_chip_name_microsoft_sq_3_devkit` to maintain **one to one** relationship between `woa_chip_name` (`windows-arm-init.h`) and `woa_chips[]` (`init.c`).
Also, we especially specified indexes with `enums` to prevent future duplications and increase readability of the code and relationship.
Summary:
PR 220 has introduced an index problem that is preventing the retrieval of correct CPU information for Windows ARM64 systems using
Ampere(R) Altra(R) Processor
.Found by: @iremyux
Details:
The main reason is the incompatibility between
woa_chip_name
(windows-arm-init.h) andwoa_chips[]
(init.c).Since
woa_chip_name_microsoft_sq_3
is duplicated, this for loop is not reaching theAmpere(R) Altra(R) Processor
element in the array due to wrong size.Error:
cc: @iremyux, @malfet
The text was updated successfully, but these errors were encountered: