Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing Ampere Altra Processor detection (#237)
**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.
- Loading branch information