soc/intel/common/block/itss: Route PCI INT pin to PIRQ using PIR
[coreboot2.git] / util / superiotool / exar.c
blobaf87273206c0f42e1f9a684025ab3fc7cb228509
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include "superiotool.h"
5 #define DEVICE_ID_BYTE1_REG 0x20
6 #define DEVICE_ID_BYTE2_REG 0x21
8 #define VENDOR_ID_BYTE1_REG 0x23
9 #define VENDOR_ID_BYTE2_REG 0x24
11 #define EXAR_VENDOR_ID 0xa813
13 static const struct superio_registers reg_table[] = {
14 {0x8403, "XR28V384", {
15 /* We assume reserved bits are read as 0. */
16 {NOLDN, NULL,
17 {0x02,0x07,0x20,0x21,0x23,0x24,0x25,0x26,0x27,EOT},
18 {0x00,0x00,0x03,0x84,0x13,0xa8,0x00,0x00,0x00,EOT}},
19 {0x0, "COM1",
20 {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf4,0xf5,0xf6,EOT},
21 {0x01,0x03,0xf8,0x03,0x00,0x44,0x00,0x00,0x00,EOT}},
22 {0x1, "COM2",
23 {0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,0xf6,EOT},
24 {0x01,0x02,0xf8,0x04,0x00,0x00,0x00,0x00,EOT}},
25 {0x2, "COM3",
26 {0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,0xf6,EOT},
27 {0x01,0x03,0xe8,0x05,0x00,0x00,0x00,0x00,EOT}},
28 {0x3, "COM4",
29 {0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,0xf6,EOT},
30 {0x01,0x02,0xe8,0x09,0x00,0x00,0x00,0x00,EOT}},
31 {0x8, "WDT",
32 {0x30,0x60,0x61,0x70,0xf0,0xf1,EOT},
33 {0x01,0x04,0x42,0x00,0x02,0x0a,EOT}},
34 {EOT}}},
35 {EOT}
38 void enter_conf_mode_exar(uint16_t port)
40 OUTB(0x67, port);
41 OUTB(0x67, port);
44 void exit_conf_mode_exar(uint16_t port)
46 OUTB(0xaa, port);
49 void probe_idregs_exar(uint16_t port)
51 uint16_t vid, did;
53 probing_for("Exar", "", port);
55 enter_conf_mode_exar(port);
57 did = regval(port, DEVICE_ID_BYTE1_REG);
58 did |= (regval(port, DEVICE_ID_BYTE2_REG) << 8);
60 vid = regval(port, VENDOR_ID_BYTE1_REG);
61 vid |= (regval(port, VENDOR_ID_BYTE2_REG) << 8);
63 if (vid != EXAR_VENDOR_ID || superio_unknown(reg_table, did)) {
64 if (verbose)
65 printf(NOTFOUND "vid=0x%04x, id=0x%04x\n", vid, did);
66 exit_conf_mode_exar(port);
67 return;
70 printf("Found Exar %s (vid=0x%04x, id=0x%04x) at 0x%x\n",
71 get_superio_name(reg_table, did), vid, did, port);
72 chip_found = 1;
74 dump_superio("Exar", reg_table, port, did, LDN_SEL);
76 exit_conf_mode_exar(port);
79 void print_exar_chips(void)
81 print_vendor_chips("Exar", reg_table);