cpu/x86/topology: Simplify CPU topology initialization
This commit rewrites the CPU topology initialization code to simplify it and make it more maintainable. The previous code used a complex set of if-else statements to initialize the CPU topology based on the CPUID leaves that were supported. This has been replaced with a simpler and more readable function that follows the Intel Software Developer Manual recommendation by prioritizing CPUID EAX=0x1f over CPUID EAX=0xb if available. The new code removes the need for separate functions to handle the topology initialization for different CPUID leaves. It uses a static array of bitfield descriptors to store the APIC ID descriptor information for each level of the CPU topology. This simplifies the code and makes it easier to add new levels of topology in the future. The code populates the node ID based on the package ID, eliminating the need for an extra function call. Change-Id: Ie9424559f895af69e79c36b919e80af803861148 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/85576 Reviewed-by: Jincheng Li <jincheng.li@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Shuo Liu <shuo.liu@intel.com>
This commit is contained in:
parent
3a2ffba231
commit
70bdd2e1fa
4 changed files with 110 additions and 125 deletions
|
|
@ -5,15 +5,13 @@
|
|||
|
||||
#include <device/device.h>
|
||||
|
||||
/* Fill in the topology in struct path APIC based CPUID EAX=0xb.
|
||||
* If leaf 0xb is not supported or is not implemented then no topology
|
||||
* will be filled in.
|
||||
/*
|
||||
* Sets the topology information for the given CPU device using the bitfield descriptors
|
||||
* obtained from the CPUID leaves. Per Intel Software Developer Manual recommendation, it
|
||||
* prioritizes CPUID EAX=0x1f over CPUID EAX=0xb if available.
|
||||
*
|
||||
* If the topology information cannot be obtained from CPUID, it sets default values.
|
||||
*/
|
||||
void set_cpu_topology_from_leaf_b(struct device *cpu);
|
||||
void set_cpu_topology(struct device *cpu);
|
||||
|
||||
/* Fill in the topology node ID in struct path APIC based CPUID EAX=0x1f
|
||||
* or CPUID EAX=0xb. If those leaves aren't supported then the node ID
|
||||
* won't be updated.
|
||||
*/
|
||||
void set_cpu_node_id_leaf_1f_b(struct device *cpu);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue