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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "superiotool.h"
23 #define DEVICE_ID_REG 0x20
24 #define DEVICE_REV_REG 0x21
26 static const struct superio_registers reg_table
[] = {
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
}},
47 {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a,
48 0x2b,0x2c,0x2e, 0x2f, EOT
},
49 {NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,NANA
,EOT
}},
51 {0x30,0x60,0x61, EOT
},
52 {NANA
,NANA
,NANA
,EOT
}},
54 {0x30,0x60,0x61,0x70, EOT
},
55 {NANA
,NANA
,NANA
,NANA
,EOT
}},
56 {0x7, "Keyboard Controller",
60 {0x30,0x60,0x61, EOT
},
61 {NANA
,NANA
,NANA
,EOT
}},
66 /* same as serverengines */
67 static void enter_conf_mode_ec(uint16_t port
)
72 static void exit_conf_mode_ec(uint16_t port
)
77 uint16_t detect_ec(void)
82 dev
= pci_dev_find(0x1002, 0x439d);
88 /* is EC disabled ? */
89 if (!(pci_read_byte(dev
, 0x40) & (1 << 7)))
92 ec_port
= pci_read_word(dev
, 0xa4);
102 void probe_idregs_amd(uint16_t port
)
106 probing_for("AMD EC", "", port
);
108 if (!(port
= detect_ec()))
111 enter_conf_mode_ec(port
);
113 devid
= regval(port
, DEVICE_ID_REG
);
114 rev
= regval(port
, DEVICE_REV_REG
);
116 if (superio_unknown(reg_table
, devid
)) {
118 printf(NOTFOUND
"id=0x%02x, rev=0x%02x\n", devid
, rev
);
119 exit_conf_mode_ec(port
);
123 printf("Found AMD EC %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
124 get_superio_name(reg_table
, devid
), devid
, rev
, port
);
127 dump_superio("AMD EC", reg_table
, port
, devid
, LDN_SEL
);
129 exit_conf_mode_ec(port
);
132 void print_amd_chips(void)
134 print_vendor_chips("AMD EC", reg_table
);