Uwe Hermann | 0120e1a | 2007-09-16 18:11:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the LinuxBIOS project. |
| 3 | * |
| 4 | * Copyright (C) 2006 coresystems GmbH <info@coresystems.de> |
| 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. |
| 15 | * |
| 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 |
| 19 | */ |
| 20 | |
| 21 | #include "superiotool.h" |
| 22 | |
Uwe Hermann | de24a0e | 2007-09-19 00:03:14 +0000 | [diff] [blame^] | 23 | void dump_fintek(uint16_t port, uint16_t did) |
Uwe Hermann | 0120e1a | 2007-09-16 18:11:03 +0000 | [diff] [blame] | 24 | { |
| 25 | switch (did) { |
| 26 | case 0x0604: |
| 27 | printf("Fintek F71805\n"); |
| 28 | break; |
| 29 | case 0x4103: |
| 30 | printf("Fintek F71872\n"); |
| 31 | break; |
| 32 | default: |
| 33 | printf("Unknown Fintek Super I/O: did=0x%04x\n", did); |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | printf("Flash write is %s.\n", |
| 38 | regval(port, 0x28) & 0x80 ? "enabled" : "disabled"); |
| 39 | printf("Flash control is 0x%04x.\n", regval(port, 0x28)); |
| 40 | printf("27=%02x\n", regval(port, 0x27)); |
| 41 | printf("29=%02x\n", regval(port, 0x29)); |
| 42 | printf("2a=%02x\n", regval(port, 0x2a)); |
| 43 | printf("2b=%02x\n", regval(port, 0x2b)); |
| 44 | |
| 45 | /* Select UART 1. */ |
| 46 | regwrite(port, 0x07, 0x01); |
| 47 | printf("UART1 is %s\n", |
| 48 | regval(port, 0x30) & 1 ? "enabled" : "disabled"); |
| 49 | printf("UART1 base=%02x%02x, irq=%02x, mode=%s\n", regval(port, 0x60), |
| 50 | regval(port, 0x61), regval(port, 0x70) & 0x0f, |
| 51 | regval(port, 0xf0) & 0x10 ? "RS485" : "RS232"); |
| 52 | |
| 53 | /* Select UART 2. */ |
| 54 | regwrite(port, 0x07, 0x02); |
| 55 | printf("UART2 is %s\n", |
| 56 | regval(port, 0x30) & 1 ? "enabled" : "disabled"); |
| 57 | printf("UART2 base=%02x%02x, irq=%02x, mode=%s\n", regval(port, 0x60), |
| 58 | regval(port, 0x61), regval(port, 0x70) & 0x0f, |
| 59 | regval(port, 0xf0) & 0x10 ? "RS485" : "RS232"); |
| 60 | |
| 61 | /* Select parallel port. */ |
| 62 | regwrite(port, 0x07, 0x03); |
| 63 | printf("PARPORT is %s\n", |
| 64 | regval(port, 0x30) & 1 ? "enabled" : "disabled"); |
| 65 | printf("PARPORT base=%02x%02x, irq=%02x\n", regval(port, 0x60), |
| 66 | regval(port, 0x61), regval(port, 0x70) & 0x0f); |
| 67 | |
| 68 | /* Select HW monitor. */ |
| 69 | regwrite(port, 0x07, 0x04); |
| 70 | printf("HW monitor is %s\n", |
| 71 | regval(port, 0x30) & 1 ? "enabled" : "disabled"); |
| 72 | printf("HW monitor base=%02x%02x, irq=%02x\n", regval(port, 0x60), |
| 73 | regval(port, 0x61), regval(port, 0x70) & 0x0f); |
| 74 | |
| 75 | /* Select GPIO. */ |
| 76 | regwrite(port, 0x07, 0x05); |
| 77 | printf("GPIO is %s\n", regval(port, 0x30) & 1 ? "enabled" : "disabled"); |
| 78 | printf |
| 79 | ("GPIO 70=%02x, e0=%02x, e1=%02x, e2=%02x, e3=%02x, e4=%02x, e5=%02x\n", |
| 80 | regval(port, 0x70), regval(port, 0xe0), regval(port, 0xe1), |
| 81 | regval(port, 0xe2), regval(port, 0xe3), regval(port, 0xe4), |
| 82 | regval(port, 0xe5)); |
| 83 | printf |
| 84 | ("GPIO e6=%02x, e7=%02x, e8=%02x, e9=%02x, f0=%02x, f1=%02x, f3=%02x, f4=%02x\n", |
| 85 | regval(port, 0xe6), regval(port, 0xe7), regval(port, 0xe8), |
| 86 | regval(port, 0xe9), regval(port, 0xf0), regval(port, 0xf1), |
| 87 | regval(port, 0xf3), regval(port, 0xf4)); |
| 88 | printf("GPIO f5=%02x, f6=%02x, f7=%02x, f8=%02x\n", regval(port, 0xf5), |
| 89 | regval(port, 0xf6), regval(port, 0xf7), regval(port, 0xf8)); |
| 90 | } |
| 91 | |
Uwe Hermann | de24a0e | 2007-09-19 00:03:14 +0000 | [diff] [blame^] | 92 | void probe_idregs_fintek(uint16_t port) |
Uwe Hermann | 0120e1a | 2007-09-16 18:11:03 +0000 | [diff] [blame] | 93 | { |
Uwe Hermann | de24a0e | 2007-09-19 00:03:14 +0000 | [diff] [blame^] | 94 | uint16_t vid, did, success = 0; |
Uwe Hermann | 0120e1a | 2007-09-16 18:11:03 +0000 | [diff] [blame] | 95 | |
| 96 | /* Enable configuration sequence (Fintek uses this for example) |
| 97 | * Older ITE chips have the same enable sequence. |
| 98 | */ |
| 99 | outb(0x87, port); |
| 100 | outb(0x87, port); |
| 101 | |
| 102 | outb(0x20, port); |
| 103 | if (inb(port) != 0x20) { |
| 104 | if (inb(port) == 0xff) |
| 105 | printf("No Super I/O chip found at 0x%04x\n", port); |
| 106 | else |
| 107 | printf("Probing 0x%04x, failed (0x%02x), data returns 0x%02x\n", port, inb(port), inb(port + 1)); |
| 108 | return; |
| 109 | } |
| 110 | did = inb(port + 1); |
| 111 | did |= (regval(port, 0x21) << 8); |
| 112 | |
| 113 | vid = regval(port, 0x23); |
| 114 | vid |= (regval(port, 0x24) << 8); |
| 115 | |
| 116 | printf("Super I/O found at 0x%02x: vid=0x%04x/did=0x%04x\n", |
| 117 | port, vid, did); |
| 118 | |
| 119 | if (vid == 0xff || vid == 0xffff) |
| 120 | return; |
| 121 | |
| 122 | /* printf("%s\n", familyid[id]); */ |
| 123 | switch (did) { |
| 124 | case 0x0887: /* Pseudoreversed for ITE8708 */ |
| 125 | case 0x1087: /* Pseudoreversed for ITE8710 */ |
| 126 | success = 1; |
| 127 | dump_ite(port, ((did & 0xff) << 8) | ((did & 0xff00) >> 8)); |
| 128 | regwrite(port, 0x02, 0x02); /* Exit MB PnP mode. */ |
| 129 | break; |
| 130 | default: |
| 131 | break; |
| 132 | } |
| 133 | |
| 134 | switch (vid) { |
| 135 | case 0x3419: |
| 136 | success = 1; |
| 137 | dump_fintek(port, did); |
| 138 | break; |
| 139 | default: |
| 140 | break; |
| 141 | } |
| 142 | |
| 143 | if (!success) |
| 144 | printf("No dump for vid 0x%04x, did 0x%04x\n", vid, did); |
| 145 | |
| 146 | /* Exit MB PnP mode (for Fintek, doesn't hurt ITE). */ |
| 147 | outb(0xaa, port); |
| 148 | } |
| 149 | |