aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/amd/model_fxx/fidvid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/amd/model_fxx/fidvid.c')
-rw-r--r--src/cpu/amd/model_fxx/fidvid.c302
1 files changed, 153 insertions, 149 deletions
diff --git a/src/cpu/amd/model_fxx/fidvid.c b/src/cpu/amd/model_fxx/fidvid.c
index 2b23e11c1d..edc7ac909c 100644
--- a/src/cpu/amd/model_fxx/fidvid.c
+++ b/src/cpu/amd/model_fxx/fidvid.c
@@ -1,10 +1,10 @@
-#if K8_SET_FIDVID == 1
+#if SET_FIDVID == 1
-#define K8_SET_FIDVID_DEBUG 0
+#define SET_FIDVID_DEBUG 0
-#define K8_SET_FIDVID_ONE_BY_ONE 1
+#define SET_FIDVID_ONE_BY_ONE 1
-#define K8_SET_FIDVID_STORE_AP_APICID_AT_FIRST 1
+#define SET_FIDVID_STORE_AP_APICID_AT_FIRST 1
#ifndef SB_VFSMAF
#define SB_VFSMAF 1
@@ -12,78 +12,77 @@
#define FX_SUPPORT 1
-static inline void print_debug_fv(const char *str, unsigned val)
+static inline void print_debug_fv(const char *str, u32 val)
{
-#if K8_SET_FIDVID_DEBUG == 1
- printk(BIOS_DEBUG, "%s%x\n", str, val);
+#if SET_FIDVID_DEBUG == 1
+ printk(BIOS_DEBUG, "%s%x\n", str, val);
#endif
}
-static inline void print_debug_fv_8(const char *str, unsigned val)
+static inline void print_debug_fv_8(const char *str, u8 val)
{
-#if K8_SET_FIDVID_DEBUG == 1
- printk(BIOS_DEBUG, "%s%02x\n", str, val);
+#if SET_FIDVID_DEBUG == 1
+ printk(BIOS_DEBUG, "%s%02x\n", str, val);
#endif
}
-static inline void print_debug_fv_64(const char *str, unsigned val, unsigned val2)
+static inline void print_debug_fv_64(const char *str, u32 val, u32 val2)
{
-#if K8_SET_FIDVID_DEBUG == 1
- printk(BIOS_DEBUG, "%s%x%x\n", str, val, val2);
+#if SET_FIDVID_DEBUG == 1
+ printk(BIOS_DEBUG, "%s%x%x\n", str, val, val2);
#endif
}
-
static void enable_fid_change(void)
{
- uint32_t dword;
- unsigned nodes;
+ u32 dword;
+ u32 nodes;
int i;
nodes = ((pci_read_config32(PCI_DEV(0, 0x18, 0), 0x60) >> 4) & 7) + 1;
for (i = 0; i < nodes; i++) {
- dword = pci_read_config32(PCI_DEV(0, 0x18+i, 3), 0xd8);
+ dword = pci_read_config32(PCI_DEV(0, 0x18 + i, 3), 0xd8);
dword &= 0x8ff00000;
dword |= (2 << 28) | (0x02710);
- pci_write_config32(PCI_DEV(0, 0x18+i, 3), 0xd8, dword);
+ pci_write_config32(PCI_DEV(0, 0x18 + i, 3), 0xd8, dword);
dword = 0x04e2a707;
- pci_write_config32(PCI_DEV(0, 0x18+i, 3), 0xd4, dword);
+ pci_write_config32(PCI_DEV(0, 0x18 + i, 3), 0xd4, dword);
/* disable the DRAM interface at first, it will be enabled
* by raminit again */
- dword = pci_read_config32(PCI_DEV(0, 0x18+i, 2), 0x94);
+ dword = pci_read_config32(PCI_DEV(0, 0x18 + i, 2), 0x94);
dword |= (1 << 14);
- pci_write_config32(PCI_DEV(0, 0x18+i, 2), 0x94, dword);
+ pci_write_config32(PCI_DEV(0, 0x18 + i, 2), 0x94, dword);
- dword = 0x23070700; /* enable FID/VID change */
-// dword = 0x00070000; /* enable FID/VID change */
- pci_write_config32(PCI_DEV(0, 0x18+i, 3), 0x80, dword);
+ dword = 0x23070700; /* enable FID/VID change */
+// dword = 0x00070000; /* enable FID/VID change */
+ pci_write_config32(PCI_DEV(0, 0x18 + i, 3), 0x80, dword);
#if CONFIG_HAVE_ACPI_RESUME
dword = 0x21132113;
#else
dword = 0x00132113;
#endif
- pci_write_config32(PCI_DEV(0, 0x18+i, 3), 0x84, dword);
+ pci_write_config32(PCI_DEV(0, 0x18 + i, 3), 0x84, dword);
}
}
-#if K8_SET_FIDVID_ONE_BY_ONE == 0
+#if SET_FIDVID_ONE_BY_ONE == 0
static unsigned set_fidvid_without_init(unsigned fidvid)
{
msr_t msr;
- uint32_t vid;
- uint32_t fid;
+ u32 vid;
+ u32 fid;
fid = (fidvid >> 8) & 0x3f;
vid = (fidvid >> 16) & 0x3f;
/* set new FID/VID */
msr.hi = 1;
- msr.lo = (vid<<8) | fid;
+ msr.lo = (vid << 8) | fid;
wrmsr(0xc0010041, msr);
return fidvid;
}
@@ -117,12 +116,12 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
};
msr_t msr;
- uint32_t vid_new;
- uint32_t fid_new;
- uint32_t vid_max;
- uint32_t fid_max;
- uint32_t vid_cur;
- uint32_t fid_cur;
+ u32 vid_new;
+ u32 fid_new;
+ u32 vid_max;
+ u32 fid_max;
+ u32 vid_cur;
+ u32 fid_cur;
unsigned apicidx;
int step_limit;
@@ -131,7 +130,9 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
apicidx = lapicid();
if (apicid != apicidx) {
- printk(BIOS_ERR, "wrong apicid, we want change %x, but it is %x\n", apicid, apicidx);
+ printk(BIOS_ERR,
+ "wrong apicid, we want change %x, but it is %x\n",
+ apicid, apicidx);
return fidvid;
}
@@ -146,14 +147,14 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
if ((vid_cur == vid_new) && (fid_cur == fid_new))
return fidvid;
- vid_max = (msr.hi >> (48-32)) & 0x3f;
- fid_max = ((msr.lo >> 16) & 0x3f); /* max fid */
+ vid_max = (msr.hi >> (48 - 32)) & 0x3f;
+ fid_max = ((msr.lo >> 16) & 0x3f); /* max fid */
#if FX_SUPPORT
- if (fid_max >= ((25 - 4) * 2)) { /* FX max fid is 5G */
- fid_max = ((msr.lo >> 8) & 0x3f) + 5 * 2; /* max FID is min fid + 1G */
- if (fid_max >= ((25-4) * 2)) {
- fid_max = (10-4) * 2; /* hard set to 2G */
+ if (fid_max >= ((25 - 4) * 2)) { /* FX max fid is 5G */
+ fid_max = ((msr.lo >> 8) & 0x3f) + 5 * 2; /* max FID is min fid + 1G */
+ if (fid_max >= ((25 - 4) * 2)) {
+ fid_max = (10 - 4) * 2; /* hard set to 2G */
}
}
#endif
@@ -162,25 +163,24 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
/* TODO - make this more correct. Not a big deal for setting max...
* BKDG figure 11
* if TargetFID > InitialFID
- * TargetVID = FinalVID - RVO
+ * TargetVID = FinalVID - RVO
* else
- * if CurrentVID > FinalVID
- * TargetVID = FinalVID - RVO
- * else
- * TargetVID = CurrentVIDD - RVO
+ * if CurrentVID > FinalVID
+ * TargetVID = FinalVID - RVO
+ * else
+ * TargetVID = CurrentVIDD - RVO
*/
msr.hi = 1;
msr.lo = (vid_max << 8) | (fid_cur);
#if SB_VFSMAF == 1
- msr.lo |= (1 << 16); /* init changes */
+ msr.lo |= (1 << 16); /* init changes */
#endif
wrmsr(0xc0010041, msr);
#if SB_VFSMAF == 0
ldtstop_sb();
#endif
-
- for (loop=0; loop < 100000; loop++){
+ for (loop = 0; loop < 100000; loop++) {
msr = rdmsr(0xc0010042);
if (!(msr.lo & (1 << 31)))
break;
@@ -201,19 +201,20 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
* transition to target fid
*/
- printk(BIOS_DEBUG, "Current fid_cur: 0x%x, fid_max: 0x%x\n", fid_cur, fid_max);
+ printk(BIOS_DEBUG, "Current fid_cur: 0x%x, fid_max: 0x%x\n", fid_cur,
+ fid_max);
printk(BIOS_DEBUG, "Requested fid_new: 0x%x\n", fid_new);
- step_limit = 8; /* max 8 steps just in case... */
+ step_limit = 8; /* max 8 steps just in case... */
while ((fid_cur != fid_new) && (step_limit--)) {
u32 fid_temp;
int step;
if (fid_cur < fid_new)
/* Force Fid steps even. step == 0 means 100MHz step */
- step = ((fid_new/2) - (fid_cur/2)) * 2;
+ step = ((fid_new / 2) - (fid_cur / 2)) * 2;
else
- step = ((fid_cur/2) - (fid_new/2)) * 2;
+ step = ((fid_cur / 2) - (fid_new / 2)) * 2;
/* If 200Mhz step OR past 3200 max table value */
if ((step == 2) || (fid_new >= 0x18 || fid_cur >= 0x18)) {
@@ -226,23 +227,23 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
else
fid_temp = fid_cur - 2;
-
- } else if ( step > 2) { /* If more than a 200Mhz step */
+ } else if (step > 2) { /* If more than a 200Mhz step */
int temp;
/* look it up in the table */
printk(BIOS_DEBUG, "FidVid table step ");
- temp = next_fid_200[((fid_new/2) * 13) + (fid_cur/2)];
+ temp =
+ next_fid_200[((fid_new / 2) * 13) + (fid_cur / 2)];
if (temp > 0)
- fid_temp = (temp-4) * 2; /* Table 108 */
+ fid_temp = (temp - 4) * 2; /* Table 108 */
else if (temp == 0)
fid_temp = fid_new;
else
- break; /* table error */
+ break; /* table error */
- } else { /* step < 2 (100MHZ) */
+ } else { /* step < 2 (100MHZ) */
printk(BIOS_DEBUG, "100MHZ step ");
/* The table adjust in 200MHz increments. If requested,
@@ -256,41 +257,41 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
}
}
- if(fid_temp > fid_max) {
- printk(BIOS_DEBUG, "fid_temp 0x%x > fid_max 0x%x\n", fid_temp, fid_max);
+ if (fid_temp > fid_max) {
+ printk(BIOS_DEBUG, "fid_temp 0x%x > fid_max 0x%x\n",
+ fid_temp, fid_max);
break;
}
printk(BIOS_DEBUG, "fidvid: 0x%x\n", fid_temp);
/* set target fid */
- msr.hi = 0x190; /* 2 us for AMD NPT Family 0Fh Processors */
+ msr.hi = 0x190; /* 2 us for AMD NPT Family 0Fh Processors */
msr.lo = (vid_cur << 8) | fid_temp;
#if SB_VFSMAF == 1
- msr.lo |= (1 << 16); /* init changes */
+ msr.lo |= (1 << 16); /* init changes */
#endif
wrmsr(0xc0010041, msr);
#if SB_VFSMAF == 0
ldtstop_sb();
#endif
-
-#if K8_SET_FIDVID_DEBUG == 1
+#if SET_FIDVID_DEBUG == 1
if (showmessage) {
print_debug_fv_8("set_fidvid APICID = ", apicid);
print_debug_fv_64("fidvid ctrl msr ", msr.hi, msr.lo);
}
#endif
- for (loop = 0; loop < 100000; loop++){
+ for (loop = 0; loop < 100000; loop++) {
msr = rdmsr(0xc0010042);
if (!(msr.lo & (1 << 31)))
break;
}
fid_cur = msr.lo & 0x3f;
-#if K8_SET_FIDVID_DEBUG == 1
- if (showmessage) {
+#if SET_FIDVID_DEBUG == 1
+ if (showmessage) {
print_debug_fv_64("fidvid status msr ", msr.hi, msr.lo);
}
#endif
@@ -310,14 +311,14 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
msr.hi = 1;
msr.lo = (vid_new << 8) | (fid_cur);
#if SB_VFSMAF == 1
- msr.lo |= (1 << 16); // init changes
+ msr.lo |= (1 << 16); // init changes
#endif
wrmsr(0xc0010041, msr);
#if SB_VFSMAF == 0
ldtstop_sb();
#endif
- for (loop = 0; loop < 100000; loop++){
+ for (loop = 0; loop < 100000; loop++) {
msr = rdmsr(0xc0010042);
if (!(msr.lo & (1 << 31)))
break;
@@ -328,10 +329,12 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
if (showmessage) {
if (vid_new != vid_cur) {
- print_err("set vid failed for apicid ="); print_err_hex8(apicidx); print_err("\n");
+ printk(BIOS_ERR, "set vid failed for apicid =%02x\n",
+ apicidx);
}
if (fid_new != fid_cur) {
- print_err("set fid failed for apicid ="); print_err_hex8(apicidx); print_err("\n");
+ printk(BIOS_ERR, "set fid failed for apicid =%02x\n",
+ apicidx);
}
}
@@ -341,35 +344,35 @@ static u32 set_fidvid(unsigned apicid, unsigned fidvid, int showmessage)
static void init_fidvid_ap(unsigned bsp_apicid, unsigned apicid)
{
- uint32_t send;
- uint32_t readback = 0;
+ u32 send;
+ u32 readback = 0;
unsigned timeout = 1;
msr_t msr;
- uint32_t vid_cur;
- uint32_t fid_cur;
- uint32_t fid_max;
+ u32 vid_cur;
+ u32 fid_cur;
+ u32 fid_max;
int loop;
- msr = rdmsr(0xc0010042);
- fid_max = ((msr.lo >> 16) & 0x3f); /* max fid */
+ msr = rdmsr(0xc0010042);
+ fid_max = ((msr.lo >> 16) & 0x3f); /* max fid */
#if FX_SUPPORT
- if (fid_max >= ((25-4) * 2)) { /* FX max fid is 5G */
- fid_max = ((msr.lo>>8) & 0x3f) + 5*2; /* maxFID = minFID + 1G */
- if (fid_max >= ((25-4) * 2)) {
- fid_max = (10-4) * 2; // hard set to 2G
+ if (fid_max >= ((25 - 4) * 2)) { /* FX max fid is 5G */
+ fid_max = ((msr.lo >> 8) & 0x3f) + 5 * 2; /* maxFID = minFID + 1G */
+ if (fid_max >= ((25 - 4) * 2)) {
+ fid_max = (10 - 4) * 2; // hard set to 2G
}
}
#endif
- send = fid_max<<8;
+ send = fid_max << 8;
- send |= ((msr.hi >> (48-32)) & 0x3f) << 16; /* max vid */
- send |= (apicid << 24); /* ap apicid */
+ send |= ((msr.hi >> (48 - 32)) & 0x3f) << 16; /* max vid */
+ send |= (apicid << 24); /* ap apicid */
-#if K8_SET_FIDVID_ONE_BY_ONE == 1
+#if SET_FIDVID_ONE_BY_ONE == 1
vid_cur = msr.hi & 0x3f;
fid_cur = msr.lo & 0x3f;
- /* set to current */
+ /* set to current */
msr.hi = 1;
msr.lo = (vid_cur << 8) | (fid_cur);
wrmsr(0xc0010041, msr);
@@ -377,52 +380,55 @@ static void init_fidvid_ap(unsigned bsp_apicid, unsigned apicid)
timeout = wait_cpu_state(bsp_apicid, 1);
if (timeout) {
- print_initcpu8("fidvid_ap_stage1: time out while reading from BSP on ", apicid);
+ printk(BIOS_DEBUG, "fidvid_ap_stage1: time out while reading"
+ " from BSP on %02x\n", apicid);
}
/* send signal to BSP about this AP max fid and vid */
/* AP at state 1 that sent our fid and vid */
lapic_write(LAPIC_MSG_REG, send | 1);
-// wait_cpu_state(bsp_apicid, 2); /* don't need we can use apicid directly */
+// wait_cpu_state(bsp_apicid, 2); /* don't need we can use apicid directly */
loop = 1000000;
while (--loop > 0) {
/* remote read BSP signal that include vid/fid that need to set */
- if (lapic_remote_read(bsp_apicid, LAPIC_MSG_REG, &readback)!=0)
+ if (lapic_remote_read(bsp_apicid, LAPIC_MSG_REG, &readback) !=
+ 0)
continue;
if (((readback >> 24) & 0xff) == apicid)
- break; /* it is this cpu turn */
+ break; /* it is this cpu turn */
}
if (loop > 0) {
- #if K8_SET_FIDVID_ONE_BY_ONE == 1
- readback = set_fidvid(apicid, readback & 0xffff00, 1); // this AP
- #else
- readback = set_fidvid_without_init(readback & 0xffff00); // this AP
- #endif
+#if SET_FIDVID_ONE_BY_ONE == 1
+ readback = set_fidvid(apicid, readback & 0xffff00, 1); // this AP
+#else
+ readback = set_fidvid_without_init(readback & 0xffff00); // this AP
+#endif
/* send signal to BSP that this AP fid/vid is set */
/* allow to change state2 is together with apicid */
/* AP at state that We set the requested fid/vid */
- send = (apicid<<24) | (readback & 0x00ffff00);
+ send = (apicid << 24) | (readback & 0x00ffff00);
} else {
- print_initcpu8("fidvid_ap_stage2: time out while reading from BSP on ", apicid);
+ printk(BIOS_DEBUG, "%s: time out while reading from BSP on %02x",
+ __func__, apicid);
}
- lapic_write(LAPIC_MSG_REG, send | 2);
+ lapic_write(LAPIC_MSG_REG, send | 2);
timeout = wait_cpu_state(bsp_apicid, 3);
if (timeout) {
- print_initcpu8("fidvid_ap_stage3: time out while reading from BSP on ", apicid);
+ printk(BIOS_DEBUG, "%s: time out while reading from BSP on %02x",
+ __func__, apicid);
}
}
-static unsigned calc_common_fidvid(unsigned fidvid, unsigned fidvidx)
+static u32 calc_common_fidvid(unsigned fidvid, unsigned fidvidx)
{
/* FIXME: need to check the change path to verify if it is reachable
* when common fid is small than 1.6G */
if ((fidvid & 0xff00) <= (fidvidx & 0xff00)) {
return fidvid;
- }
- else {
+ } else {
return fidvidx;
}
}
@@ -431,10 +437,10 @@ struct fidvid_st {
unsigned common_fidvid;
};
-static void init_fidvid_bsp_stage1(unsigned ap_apicid, void *gp )
+static void init_fidvid_bsp_stage1(u32 ap_apicid, void *gp)
{
- unsigned readback = 0;
- unsigned timeout = 1;
+ u32 readback = 0;
+ u32 timeout = 1;
struct fidvid_st *fvp = gp;
int loop;
@@ -443,19 +449,21 @@ static void init_fidvid_bsp_stage1(unsigned ap_apicid, void *gp )
loop = 1000000;
while (--loop > 0) {
- if (lapic_remote_read(ap_apicid, LAPIC_MSG_REG, &readback)!=0)
+ if (lapic_remote_read(ap_apicid, LAPIC_MSG_REG, &readback) != 0)
continue;
if ((readback & 0xff) == 1) {
timeout = 0;
- break; /* target ap is in stage 1 */
+ break; /* target ap is in stage 1 */
}
}
+
if (timeout) {
- print_initcpu8("fidvid_bsp_stage1: time out while reading from ap ", ap_apicid);
+ printk(BIOS_DEBUG, "%s: timed out reading from ap %02x\n",
+ __func__, ap_apicid);
return;
}
- print_debug_fv("\treadback=", readback);
+ print_debug_fv("\treadback = ", readback);
fvp->common_fidvid = calc_common_fidvid(fvp->common_fidvid, readback & 0xffff00);
@@ -473,31 +481,31 @@ static void init_fidvid_bsp_stage2(unsigned ap_apicid, void *gp)
print_debug_fv("state 2: ap_apicid=", ap_apicid);
/* all set to state2 */
- lapic_write(LAPIC_MSG_REG, fvp->common_fidvid | (ap_apicid<<24) | 2);
+ lapic_write(LAPIC_MSG_REG, fvp->common_fidvid | (ap_apicid << 24) | 2);
loop = 1000000;
while (--loop > 0) {
- if (lapic_remote_read(ap_apicid, LAPIC_MSG_REG, &readback)!=0)
+ if (lapic_remote_read(ap_apicid, LAPIC_MSG_REG, &readback) != 0)
continue;
if ((readback & 0xff) == 2) {
timeout = 0;
- break; /* target ap is stage 2, it's FID has beed set */
+ break; /* target ap is stage 2, it's FID has beed set */
}
}
if (timeout) {
- print_initcpu8("fidvid_bsp_stage2: time out while reading from ap ", ap_apicid);
+ printk(BIOS_DEBUG, "%s: time out while reading from ap %02x",
+ __func__, ap_apicid);
return;
}
print_debug_fv("\treadback=", readback);
}
-#if K8_SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
+#if SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
struct ap_apicid_st {
- unsigned num;
- unsigned apicid[16]; /* 8 way dual core need 16 */
- /* FIXME: 32 node quad core, may need 128 */
+ u32 num;
+ unsigned apicid[16]; /* 8 way dual core need 16 */
};
static void store_ap_apicid(unsigned ap_apicid, void *gp)
@@ -511,77 +519,75 @@ static void store_ap_apicid(unsigned ap_apicid, void *gp)
static void init_fidvid_bsp(unsigned bsp_apicid)
{
- uint32_t vid_max;
- uint32_t fid_max;
+ u32 vid_max;
+ u32 fid_max;
struct fidvid_st fv;
-#if K8_SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
+#if SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
struct ap_apicid_st ap_apicidx;
unsigned i;
#endif
msr_t msr;
- msr = rdmsr(0xc0010042);
- fid_max = ((msr.lo >> 16) & 0x3f); /* max fid */
+ msr = rdmsr(0xc0010042);
+ fid_max = ((msr.lo >> 16) & 0x3f); /* max fid */
#if FX_SUPPORT == 1
- if (fid_max >= ((25-4) * 2)) { /* FX max fid is 5G */
- fid_max = ((msr.lo >> 8) & 0x3f) + 5*2; /* maxFID = minFID + 1G */
- if (fid_max >= ((25-4) * 2)) {
- fid_max = (10-4) * 2; /* hard set to 2G */
+ if (fid_max >= ((25 - 4) * 2)) { /* FX max fid is 5G */
+ fid_max = ((msr.lo >> 8) & 0x3f) + 5 * 2; /* maxFID = minFID + 1G */
+ if (fid_max >= ((25 - 4) * 2)) {
+ fid_max = (10 - 4) * 2; /* hard set to 2G */
}
}
#endif
- vid_max = ((msr.hi>>(48-32)) & 0x3f); //max vid
- fv.common_fidvid = (fid_max << 8)|(vid_max << 16);
-
+ vid_max = ((msr.hi >> (48 - 32)) & 0x3f); //max vid
+ fv.common_fidvid = (fid_max << 8) | (vid_max << 16);
/* for all APs (We know the APIC ID of all APs even the APIC ID is lifted)
* remote read from AP about max fid/vid */
/* let all ap trains to state 1 */
- lapic_write(LAPIC_MSG_REG, (bsp_apicid << 24) | 1);
+ lapic_write(LAPIC_MSG_REG, (bsp_apicid << 24) | 1);
/* calculate the common max fid/vid that could be used for
* all APs and BSP */
-#if K8_SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
+#if SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
ap_apicidx.num = 0;
- for_each_ap(bsp_apicid, K8_SET_FIDVID_CORE0_ONLY, store_ap_apicid, &ap_apicidx);
+ for_each_ap(bsp_apicid, SET_FIDVID_CORE0_ONLY, store_ap_apicid, &ap_apicidx);
for (i = 0; i < ap_apicidx.num; i++) {
init_fidvid_bsp_stage1(ap_apicidx.apicid[i], &fv);
}
#else
- for_each_ap(bsp_apicid, K8_SET_FIDVID_CORE0_ONLY, init_fidvid_bsp_stage1, &fv);
+ for_each_ap(bsp_apicid, SET_FIDVID_CORE0_ONLY, init_fidvid_bsp_stage1, &fv);
#endif
-
#if 0
unsigned fid, vid;
/* Can we use max only? So we can only set fid in one around,
* otherwise we need to set that to max after raminit */
/* set fid vid to DQS training required */
- fid = (fv.common_fidvid >> 8) & 0x3f;
+ fid = (fv.common_fidvid >> 8) & 0x3f;
vid = (fv.common_fidvid >> 16) & 0x3f;
- if (fid > (10-4) * 2) {
- fid = (10-4) * 2; // x10
+ if (fid > (10 - 4) * 2) {
+ fid = (10 - 4) * 2; // x10
}
if (vid >= 0x1f) {
- vid += 4; /* unit is 12.5mV */
+ vid += 4; /* unit is 12.5mV */
} else {
- vid += 2; /* unit is 25mV */
+ vid += 2; /* unit is 25mV */
}
- fv.common_fidvid = (fid<<8) | (vid<<16);
+ fv.common_fidvid = (fid << 8) | (vid << 16);
print_debug_fv("common_fidvid=", fv.common_fidvid);
#endif
-#if K8_SET_FIDVID_ONE_BY_ONE == 1
+#if SET_FIDVID_ONE_BY_ONE == 1
/* set BSP fid and vid */
print_debug_fv("bsp apicid=", bsp_apicid);
fv.common_fidvid = set_fidvid(bsp_apicid, fv.common_fidvid, 1);
@@ -595,15 +601,15 @@ static void init_fidvid_bsp(unsigned bsp_apicid)
fv.common_fidvid &= 0xffff00;
/* set state 2 allow is in init_fidvid_bsp_stage2 */
-#if K8_SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
+#if SET_FIDVID_STORE_AP_APICID_AT_FIRST == 1
for (i = 0; i < ap_apicidx.num; i++) {
init_fidvid_bsp_stage2(ap_apicidx.apicid[i], &fv);
}
#else
- for_each_ap(bsp_apicid, K8_SET_FIDVID_CORE0_ONLY, init_fidvid_bsp_stage2, &fv);
+ for_each_ap(bsp_apicid, SET_FIDVID_CORE0_ONLY, init_fidvid_bsp_stage2, &fv);
#endif
-#if K8_SET_FIDVID_ONE_BY_ONE == 0
+#if SET_FIDVID_ONE_BY_ONE == 0
/* set BSP fid and vid */
print_debug_fv("bsp apicid=", bsp_apicid);
fv.common_fidvid = set_fidvid(bsp_apicid, fv.common_fidvid, 1);
@@ -616,7 +622,5 @@ static void init_fidvid_bsp(unsigned bsp_apicid)
/* here wait a while, so last ap could read pack, and stop it, don't
* call init_timer too early or just don't use init_timer */
-
}
-
#endif