@@ -42,6 +42,10 @@ struct device {
unsigned int config_cached, config_bufsize;
byte *config; /* Cached configuration space data */
byte *present; /* Maps which configuration bytes are present */
+ int cap_speed;
+ int cap_width;
+ int sta_speed;
+ int sta_width;
};
extern struct device *first_dev;
Then within cap_express_link, the value would be stored to the device structure rather than a local variable.
@@ -781,16 +781,16 @@ static const char *aspm_enabled(int code)
static void cap_express_link(struct device *d, int where, int type)
{
- u32 t, aspm, cap_speed, cap_width, sta_speed, sta_width;
+ u32 t, aspm;
u16 w;
t = get_conf_long(d, where + PCI_EXP_LNKCAP);
aspm = (t & PCI_EXP_LNKCAP_ASPM) >> 10;
- cap_speed = t & PCI_EXP_LNKCAP_SPEED;
- cap_width = (t & PCI_EXP_LNKCAP_WIDTH) >> 4;
+ d->cap_speed = t & PCI_EXP_LNKCAP_SPEED;
+ d->cap_width = (t & PCI_EXP_LNKCAP_WIDTH) >> 4;
printf("\t\tLnkCap:\tPort #%d, Speed %s, Width x%d, ASPM %s",
t >> 24,
- link_speed(cap_speed), cap_width,
+ link_speed(d->cap_speed), d->cap_width,
aspm_support(aspm));
if (aspm)
{
@@ -824,13 +824,13 @@ static void cap_express_link(struct device *d, int where, int type)
FLAG(w, PCI_EXP_LNKCTL_AUTBWIE));
w = get_conf_word(d, where + PCI_EXP_LNKSTA);
- sta_speed = w & PCI_EXP_LNKSTA_SPEED;
- sta_width = (w & PCI_EXP_LNKSTA_WIDTH) >> 4;
+ d->sta_speed = w & PCI_EXP_LNKSTA_SPEED;
+ d->sta_width = (w & PCI_EXP_LNKSTA_WIDTH) >> 4;
printf("\t\tLnkSta:\tSpeed %s (%s), Width x%d (%s)\n",
- link_speed(sta_speed),
- link_compare(sta_speed, cap_speed),
- sta_width,
- link_compare(sta_width, cap_width));
+ link_speed(d->sta_speed),
+ link_compare(d->sta_speed, d->cap_speed),
+ d->sta_width,
+ link_compare(d->sta_width, d->cap_width));
printf("\t\t\tTrErr%c Train%c SlotClk%c DLActive%c BWMgmt%c ABWMgmt%c\n",
FLAG(w, PCI_EXP_LNKSTA_TR_ERR),
FLAG(w, PCI_EXP_LNKSTA_TRAIN),