2 * This file is part of the superiotool project.
4 * Copyright (C) 2011 Rudolf Marek <r.marek@assembler.cz>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include "superiotool.h"
19 #define DEVICE_ID_REG 0x20
20 #define DEVICE_REV_REG 0x21
22 static const struct superio_registers reg_table
[] = {
25 {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a,
26 0x2b,0x2c,0x2e, 0x2f, EOT
},
27 {NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,EOT
}},
29 {0x30,0x60,0x61, EOT
},
30 {NANA
,NANA
,NANA
,EOT
}},
32 {0x30,0x60,0x61,0x70, EOT
},
33 {NANA
,NANA
,NANA
,NANA
,EOT
}},
34 {0x7, "Keyboard Controller",
38 {0x30,0x60,0x61, EOT
},
39 {NANA
,NANA
,NANA
,EOT
}},
43 {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a,
44 0x2b,0x2c,0x2e, 0x2f, EOT
},
45 {NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,EOT
}},
47 {0x30,0x60,0x61, EOT
},
48 {NANA
,NANA
,NANA
,EOT
}},
50 {0x30,0x60,0x61,0x70, EOT
},
51 {NANA
,NANA
,NANA
,NANA
,EOT
}},
52 {0x7, "Keyboard Controller",
56 {0x30,0x60,0x61, EOT
},
57 {NANA
,NANA
,NANA
,EOT
}},
62 /* same as serverengines */
63 static void enter_conf_mode_ec(uint16_t port
)
68 static void exit_conf_mode_ec(uint16_t port
)
73 uint16_t detect_ec(void)
78 dev
= pci_dev_find(0x1002, 0x439d);
84 /* is EC disabled ? */
85 if (!(pci_read_byte(dev
, 0x40) & (1 << 7)))
88 ec_port
= pci_read_word(dev
, 0xa4);
98 void probe_idregs_amd(uint16_t port
)
102 probing_for("AMD EC", "", port
);
104 if (!(port
= detect_ec()))
107 enter_conf_mode_ec(port
);
109 devid
= regval(port
, DEVICE_ID_REG
);
110 rev
= regval(port
, DEVICE_REV_REG
);
112 if (superio_unknown(reg_table
, devid
)) {
114 printf(NOTFOUND
"id=0x%02x, rev=0x%02x\n", devid
, rev
);
115 exit_conf_mode_ec(port
);
119 printf("Found AMD EC %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
120 get_superio_name(reg_table
, devid
), devid
, rev
, port
);
123 dump_superio("AMD EC", reg_table
, port
, devid
, LDN_SEL
);
125 exit_conf_mode_ec(port
);
128 void print_amd_chips(void)
130 print_vendor_chips("AMD EC", reg_table
);