1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include "superiotool.h"
5 #define DEVICE_ID_REG 0x20
6 #define DEVICE_REV_REG 0x21
8 static const struct superio_registers reg_table
[] = {
11 {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a,
12 0x2b,0x2c,0x2e, 0x2f, EOT
},
13 {NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,EOT
}},
15 {0x30,0x60,0x61, EOT
},
16 {NANA
,NANA
,NANA
,EOT
}},
18 {0x30,0x60,0x61,0x70, EOT
},
19 {NANA
,NANA
,NANA
,NANA
,EOT
}},
20 {0x7, "Keyboard Controller",
24 {0x30,0x60,0x61, EOT
},
25 {NANA
,NANA
,NANA
,EOT
}},
29 {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a,
30 0x2b,0x2c,0x2e, 0x2f, EOT
},
31 {NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,EOT
}},
33 {0x30,0x60,0x61, EOT
},
34 {NANA
,NANA
,NANA
,EOT
}},
36 {0x30,0x60,0x61,0x70, EOT
},
37 {NANA
,NANA
,NANA
,NANA
,EOT
}},
38 {0x7, "Keyboard Controller",
42 {0x30,0x60,0x61, EOT
},
43 {NANA
,NANA
,NANA
,EOT
}},
48 /* same as serverengines */
49 static void enter_conf_mode_ec(uint16_t port
)
54 static void exit_conf_mode_ec(uint16_t port
)
59 uint16_t detect_ec(void)
64 dev
= pci_dev_find(0x1002, 0x439d);
70 /* is EC disabled ? */
71 if (!(pci_read_byte(dev
, 0x40) & (1 << 7)))
74 ec_port
= pci_read_word(dev
, 0xa4);
84 void probe_idregs_amd(uint16_t port
)
88 probing_for("AMD EC", "", port
);
90 if (!(port
= detect_ec()))
93 enter_conf_mode_ec(port
);
95 devid
= regval(port
, DEVICE_ID_REG
);
96 rev
= regval(port
, DEVICE_REV_REG
);
98 if (superio_unknown(reg_table
, devid
)) {
100 printf(NOTFOUND
"id=0x%02x, rev=0x%02x\n", devid
, rev
);
101 exit_conf_mode_ec(port
);
105 printf("Found AMD EC %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
106 get_superio_name(reg_table
, devid
), devid
, rev
, port
);
109 dump_superio("AMD EC", reg_table
, port
, devid
, LDN_SEL
);
111 exit_conf_mode_ec(port
);
114 void print_amd_chips(void)
116 print_vendor_chips("AMD EC", reg_table
);