blob: 648dbf03a504fee470f52e010e1b938f6506a6c2 [file] [log] [blame]
Ruud Schramp18b02362011-04-11 07:46:27 +00001/*
2 * This file is part of the superiotool project.
3 *
4 * Copyright (C) 2011 Ruud Schramp <schramp@holmes.nl>
5 *
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.
10 *
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.
Ruud Schramp18b02362011-04-11 07:46:27 +000015 */
16
17#include "superiotool.h"
18
19#define DEVICE_ID_BYTE1_REG 0x20
20#define DEVICE_ID_BYTE2_REG 0x21
21
22#define DEVICE_REV_REG 0x1f
23
24static const struct superio_registers reg_table[] = {
25 /*
26 * Note: These register defaults are based on educated guessing,
27 * take them with a grain of salt.
28 *
29 * TODO: Don't know the ID registers yet: 0x21 probably is not an ID
30 * register as it is being set in the BIOS. For now still use as there
31 * is no known alternative.
32 */
33 {0x02c0, "SE-SM 4210-P01", {
34 {NOLDN, NULL,
35 {0x1f,0x20,0x21,0x22,0x23,0x2c,0x2d,0x2e,EOT},
36 {NANA,0x02,0xc0,0x00,0x00,RSVD,RSVD,RSVD,EOT}},
37 {0x0, "UNKNOWN",
38 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
39 {NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
40 {0x1, "COM2",
41 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
42 {0x00,0x02,0xf8,0x03,0x00,0x00,0x0c,EOT}},
43 {0x2, "COM1",
44 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
45 {0x00,0x03,0xf8,0x04,0x00,0x00,0x0c,EOT}},
46 {0x3, "UNKNOWN",
47 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
48 {NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
49 {0x4, "UNKNOWN",
50 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
51 {NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
52 {0x5, "UNKNOWN",
53 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
54 {NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
55 {0x6, "UNKNOWN",
56 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
57 {NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
58 {0x7, "UNKNOWN",
59 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
60 {NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
61 {EOT}}},
62 {EOT}
63};
64
65static void enter_conf_mode_serverengines(uint16_t port)
66{
67 OUTB(0x5a, port);
68}
69
70static void exit_conf_mode_serverengines(uint16_t port)
71{
72 OUTB(0xa5, port);
73}
74
75void probe_idregs_serverengines(uint16_t port)
76{
77 uint16_t id;
78 uint8_t rev;
79
80 probing_for("Server Engines", "", port);
81
82 enter_conf_mode_serverengines(port);
83
84 id = regval(port, DEVICE_ID_BYTE1_REG) << 8;
85 id |= regval(port, DEVICE_ID_BYTE2_REG);
86
87 /* TODO: Not documented/available on ServerEngines. */
88 rev = regval(port, DEVICE_REV_REG);
89
90 if (superio_unknown(reg_table, id)) {
91 if (verbose)
92 printf(NOTFOUND "id=0x%04x, rev=0x%02x\n", id, rev);
93 exit_conf_mode_serverengines(port);
94 return;
95 }
96
97 printf("Found Server Engines %s (id=0x%04x, rev=0x%02x) at 0x%x\n",
98 get_superio_name(reg_table, id), id, rev, port);
99 chip_found = 1;
100
101 dump_superio("Server Engines", reg_table, port, id, LDN_SEL);
102
103 exit_conf_mode_serverengines(port);
104}
105
106void print_serverengines_chips(void)
107{
108 print_vendor_chips("Server Engines", reg_table);
109}