diff options
Diffstat (limited to 'src/cpu/amd/dualcore/dualcore_id.c')
-rw-r--r-- | src/cpu/amd/dualcore/dualcore_id.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cpu/amd/dualcore/dualcore_id.c b/src/cpu/amd/dualcore/dualcore_id.c index 389969795b..c8c8d8d443 100644 --- a/src/cpu/amd/dualcore/dualcore_id.c +++ b/src/cpu/amd/dualcore/dualcore_id.c @@ -20,6 +20,8 @@ static inline unsigned get_initial_apicid(void) } //called by amd_siblings too +#define CORE_ID_BIT 1 +#define NODE_ID_BIT 3 struct node_core_id get_node_core_id(unsigned nb_cfg_54) { struct node_core_id id; @@ -27,15 +29,15 @@ struct node_core_id get_node_core_id(unsigned nb_cfg_54) if( nb_cfg_54) { // when NB_CFG[54] is set, nodeid = ebx[27:25], coreid = ebx[24] id.coreid = (cpuid_ebx(1) >> 24) & 0xf; - id.nodeid = (id.coreid>>1); - id.coreid &= 1; + id.nodeid = (id.coreid>>CORE_ID_BIT); + id.coreid &= ((1<<CORE_ID_BIT)-1); } else { // when NB_CFG[54] is clear, nodeid = ebx[26:24], coreid = ebx[27] id.nodeid = (cpuid_ebx(1) >> 24) & 0xf; - id.coreid = (id.nodeid>>3); - id.nodeid &= 7; + id.coreid = (id.nodeid>>NODE_ID_BIT); + id.nodeid &= ((1<<NODE_ID_BIT)-1); } return id; } |