blob: e20e561b865c3cdbfb4a9c49d61ea94fe772f38d [file] [log] [blame]
ollie6a600992005-11-26 21:55:36 +00001/*
2 * flash rom utility: enable flash writes
3 *
stepan927d4e22007-04-04 22:45:58 +00004 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2005-2007 coresystems GmbH <stepan@coresystems.de>
stepanca42a0b2006-09-06 15:48:48 +00006 * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
ollie6a600992005-11-26 21:55:36 +00007 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2
11 *
12 */
13
ollie5672ac62004-03-17 22:22:08 +000014#include <stdio.h>
15#include <pci/pci.h>
16#include <stdlib.h>
17
stepan927d4e22007-04-04 22:45:58 +000018#include "flash.h"
19#include "debug.h"
stepancb140092006-03-31 11:26:55 +000020
uwe691ddb62007-05-20 16:16:13 +000021static int enable_flash_ali_m1533(struct pci_dev *dev, char *name)
22{
23 uint8_t tmp;
24
25 /* ROM Write enable, 0xFFFC0000-0xFFFDFFFF and
26 0xFFFE0000-0xFFFFFFFF ROM select enable. */
27 tmp = pci_read_byte(dev, 0x47);
28 tmp |= 0x46;
29 pci_write_byte(dev, 0x47, tmp);
30
31 return 0;
32}
33
ollie5b621572004-03-20 16:46:10 +000034static int enable_flash_sis630(struct pci_dev *dev, char *name)
ollie5672ac62004-03-17 22:22:08 +000035{
36 char b;
37
ollie5672ac62004-03-17 22:22:08 +000038 /* Enable 0xFFF8000~0xFFFF0000 decoding on SiS 540/630 */
39 outl(0x80000840, 0x0cf8);
40 b = inb(0x0cfc) | 0x0b;
41 outb(b, 0xcfc);
42 /* Flash write enable on SiS 540/630 */
43 outl(0x80000845, 0x0cf8);
44 b = inb(0x0cfd) | 0x40;
45 outb(b, 0xcfd);
46
47 /* The same thing on SiS 950 SuperIO side */
48 outb(0x87, 0x2e);
49 outb(0x01, 0x2e);
50 outb(0x55, 0x2e);
51 outb(0x55, 0x2e);
52
53 if (inb(0x2f) != 0x87) {
54 outb(0x87, 0x4e);
55 outb(0x01, 0x4e);
56 outb(0x55, 0x4e);
57 outb(0xaa, 0x4e);
58 if (inb(0x4f) != 0x87) {
59 printf("Can not access SiS 950\n");
60 return -1;
61 }
62 outb(0x24, 0x4e);
63 b = inb(0x4f) | 0xfc;
64 outb(0x24, 0x4e);
65 outb(b, 0x4f);
66 outb(0x02, 0x4e);
ollie5b621572004-03-20 16:46:10 +000067 outb(0x02, 0x4f);
ollie5672ac62004-03-17 22:22:08 +000068 }
69
70 outb(0x24, 0x2e);
71 printf("2f is %#x\n", inb(0x2f));
72 b = inb(0x2f) | 0xfc;
73 outb(0x24, 0x2e);
74 outb(b, 0x2f);
75
76 outb(0x02, 0x2e);
77 outb(0x02, 0x2f);
78
79 return 0;
80}
81
uwe877ca432006-11-07 11:16:21 +000082/* Datasheet:
83 * - Name: 82371AB PCI-TO-ISA / IDE XCELERATOR (PIIX4)
84 * - URL: http://www.intel.com/design/intarch/datashts/290562.htm
85 * - PDF: http://www.intel.com/design/intarch/datashts/29056201.pdf
86 * - Order Number: 290562-001
87 */
uwe12b38692006-11-05 18:26:08 +000088static int enable_flash_piix4(struct pci_dev *dev, char *name)
89{
90 uint16_t old, new;
uwef6641642007-05-09 10:17:44 +000091 uint16_t xbcs = 0x4e; /* X-Bus Chip Select register. */
uwe12b38692006-11-05 18:26:08 +000092
93 old = pci_read_word(dev, xbcs);
94
95 /* Set bit 9: 1-Meg Extended BIOS Enable (PCI master accesses to
uwef6641642007-05-09 10:17:44 +000096 * FFF00000-FFF7FFFF are forwarded to ISA).
97 * Set bit 7: Extended BIOS Enable (PCI master accesses to
98 * FFF80000-FFFDFFFF are forwarded to ISA).
99 * Set bit 6: Lower BIOS Enable (PCI master, or ISA master accesses to
100 * the lower 64-Kbyte BIOS block (E0000-EFFFF) at the top
101 * of 1 Mbyte, or the aliases at the top of 4 Gbyte
102 * (FFFE0000-FFFEFFFF) result in the generation of BIOSCS#.
103 * Note: Accesses to FFFF0000-FFFFFFFF are always forwarded to ISA.
104 * Set bit 2: BIOSCS# Write Enable (1=enable, 0=disable).
105 */
uwe12b38692006-11-05 18:26:08 +0000106 new = old | 0x2c4;
107
108 if (new == old)
109 return 0;
110
111 pci_write_word(dev, xbcs, new);
112
113 if (pci_read_word(dev, xbcs) != new) {
114 printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", xbcs, new, name);
115 return -1;
116 }
117 return 0;
118}
119
stepancb140092006-03-31 11:26:55 +0000120static int enable_flash_ich(struct pci_dev *dev, char *name, int bios_cntl)
rminnich1bcc2b22004-09-28 20:09:06 +0000121{
122 /* register 4e.b gets or'ed with one */
ollie6a600992005-11-26 21:55:36 +0000123 uint8_t old, new;
stepanca42a0b2006-09-06 15:48:48 +0000124
rminnich1bcc2b22004-09-28 20:09:06 +0000125 /* if it fails, it fails. There are so many variations of broken mobos
stepan927d4e22007-04-04 22:45:58 +0000126 * that it is hard to argue that we should quit at this point.
rminnich1bcc2b22004-09-28 20:09:06 +0000127 */
128
stepanca42a0b2006-09-06 15:48:48 +0000129 /* Note: the ICH0-ICH5 BIOS_CNTL register is actually 16 bit wide, but
uwef6641642007-05-09 10:17:44 +0000130 * just treating it as 8 bit wide seems to work fine in practice.
stepanca42a0b2006-09-06 15:48:48 +0000131 */
132
133 /* see ie. page 375 of "Intel ICH7 External Design Specification"
stepan927d4e22007-04-04 22:45:58 +0000134 * http://download.intel.com/design/chipsets/datashts/30701302.pdf
stepanca42a0b2006-09-06 15:48:48 +0000135 */
136
stepancb140092006-03-31 11:26:55 +0000137 old = pci_read_byte(dev, bios_cntl);
rminnich1bcc2b22004-09-28 20:09:06 +0000138
139 new = old | 1;
140
141 if (new == old)
142 return 0;
143
stepancb140092006-03-31 11:26:55 +0000144 pci_write_byte(dev, bios_cntl, new);
rminnich1bcc2b22004-09-28 20:09:06 +0000145
stepancb140092006-03-31 11:26:55 +0000146 if (pci_read_byte(dev, bios_cntl) != new) {
uwef6641642007-05-09 10:17:44 +0000147 printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", bios_cntl, new, name);
rminnich1bcc2b22004-09-28 20:09:06 +0000148 return -1;
149 }
150 return 0;
151}
152
stepanca42a0b2006-09-06 15:48:48 +0000153static int enable_flash_ich_4e(struct pci_dev *dev, char *name)
stepancb140092006-03-31 11:26:55 +0000154{
stepanca42a0b2006-09-06 15:48:48 +0000155 return enable_flash_ich(dev, name, 0x4e);
stepancb140092006-03-31 11:26:55 +0000156}
157
stepanca42a0b2006-09-06 15:48:48 +0000158static int enable_flash_ich_dc(struct pci_dev *dev, char *name)
stepancb140092006-03-31 11:26:55 +0000159{
stepanca42a0b2006-09-06 15:48:48 +0000160 return enable_flash_ich(dev, name, 0xdc);
stepancb140092006-03-31 11:26:55 +0000161}
162
stepan927d4e22007-04-04 22:45:58 +0000163/*
164 *
165 */
uwef6641642007-05-09 10:17:44 +0000166static int enable_flash_vt823x(struct pci_dev *dev, char *name)
ollie5672ac62004-03-17 22:22:08 +0000167{
ollie6a600992005-11-26 21:55:36 +0000168 uint8_t val;
ollie5b621572004-03-20 16:46:10 +0000169
uwef6641642007-05-09 10:17:44 +0000170 /* ROM Write enable */
ollie5672ac62004-03-17 22:22:08 +0000171 val = pci_read_byte(dev, 0x40);
172 val |= 0x10;
173 pci_write_byte(dev, 0x40, val);
174
175 if (pci_read_byte(dev, 0x40) != val) {
stepan927d4e22007-04-04 22:45:58 +0000176 printf("\nWARNING: Failed to enable ROM Write on \"%s\"\n",
uwef6641642007-05-09 10:17:44 +0000177 name);
stepan927d4e22007-04-04 22:45:58 +0000178 return -1;
ollie5672ac62004-03-17 22:22:08 +0000179 }
uwe1f088472007-03-02 22:16:38 +0000180
uwef6641642007-05-09 10:17:44 +0000181 return 0;
ollie5672ac62004-03-17 22:22:08 +0000182}
183
184static int enable_flash_cs5530(struct pci_dev *dev, char *name)
185{
uwe7a75a6a2007-06-06 21:35:45 +0000186 uint8_t reg8;
ollie5b621572004-03-20 16:46:10 +0000187
uwe7a75a6a2007-06-06 21:35:45 +0000188 #define DECODE_CONTROL_REG2 0x5b /* F0 index 0x5b */
189 #define ROM_AT_LOGIC_CONTROL_REG 0x52 /* F0 index 0x52 */
ollie5672ac62004-03-17 22:22:08 +0000190
uwe7a75a6a2007-06-06 21:35:45 +0000191 #define LOWER_ROM_ADDRESS_RANGE (1 << 0)
192 #define ROM_WRITE_ENABLE (1 << 1)
193 #define UPPER_ROM_ADDRESS_RANGE (1 << 2)
194 #define BIOS_ROM_POSITIVE_DECODE (1 << 5)
ollie5672ac62004-03-17 22:22:08 +0000195
uwe7a75a6a2007-06-06 21:35:45 +0000196 /* Decode 0x000E0000-0x000FFFFF (128 KB), not just 64 KB, and
197 * decode 0xFF000000-0xFFFFFFFF (16 MB), not just 256 KB.
198 * Make the configured ROM areas writable.
199 */
200 reg8 = pci_read_byte(dev, ROM_AT_LOGIC_CONTROL_REG);
201 reg8 |= LOWER_ROM_ADDRESS_RANGE;
202 reg8 |= UPPER_ROM_ADDRESS_RANGE;
203 reg8 |= ROM_WRITE_ENABLE;
204 pci_write_byte(dev, ROM_AT_LOGIC_CONTROL_REG, reg8);
stepan927d4e22007-04-04 22:45:58 +0000205
uwe7a75a6a2007-06-06 21:35:45 +0000206 /* Set positive decode on ROM. */
207 reg8 = pci_read_byte(dev, DECODE_CONTROL_REG2);
208 reg8 |= BIOS_ROM_POSITIVE_DECODE;
209 pci_write_byte(dev, DECODE_CONTROL_REG2, reg8);
stepan927d4e22007-04-04 22:45:58 +0000210
ollie5672ac62004-03-17 22:22:08 +0000211 return 0;
212}
213
214static int enable_flash_sc1100(struct pci_dev *dev, char *name)
215{
ollie6a600992005-11-26 21:55:36 +0000216 uint8_t new;
ollie5b621572004-03-20 16:46:10 +0000217
ollie5672ac62004-03-17 22:22:08 +0000218 pci_write_byte(dev, 0x52, 0xee);
219
220 new = pci_read_byte(dev, 0x52);
221
222 if (new != 0xee) {
uwef6641642007-05-09 10:17:44 +0000223 printf("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x52, new, name);
ollie5672ac62004-03-17 22:22:08 +0000224 return -1;
225 }
226 return 0;
227}
228
229static int enable_flash_sis5595(struct pci_dev *dev, char *name)
230{
ollie6a600992005-11-26 21:55:36 +0000231 uint8_t new, newer;
ollie5b621572004-03-20 16:46:10 +0000232
ollie5672ac62004-03-17 22:22:08 +0000233 new = pci_read_byte(dev, 0x45);
234
235 /* clear bit 5 */
ollie5b621572004-03-20 16:46:10 +0000236 new &= (~0x20);
ollie5672ac62004-03-17 22:22:08 +0000237 /* set bit 2 */
238 new |= 0x4;
239
240 pci_write_byte(dev, 0x45, new);
241
242 newer = pci_read_byte(dev, 0x45);
243 if (newer != new) {
uwef6641642007-05-09 10:17:44 +0000244 printf("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x45, new, name);
ollie5672ac62004-03-17 22:22:08 +0000245 printf("Stuck at 0x%x\n", newer);
246 return -1;
247 }
248 return 0;
249}
250
ollie5b621572004-03-20 16:46:10 +0000251static int enable_flash_amd8111(struct pci_dev *dev, char *name)
252{
ollie5672ac62004-03-17 22:22:08 +0000253 /* register 4e.b gets or'ed with one */
ollie6a600992005-11-26 21:55:36 +0000254 uint8_t old, new;
uwef6641642007-05-09 10:17:44 +0000255
ollie5672ac62004-03-17 22:22:08 +0000256 /* if it fails, it fails. There are so many variations of broken mobos
stepan927d4e22007-04-04 22:45:58 +0000257 * that it is hard to argue that we should quit at this point.
ollie5672ac62004-03-17 22:22:08 +0000258 */
259
olliefc9a03b2004-12-07 17:19:04 +0000260 /* enable decoding at 0xffb00000 to 0xffffffff */
ollie5672ac62004-03-17 22:22:08 +0000261 old = pci_read_byte(dev, 0x43);
olliefc9a03b2004-12-07 17:19:04 +0000262 new = old | 0xC0;
ollie5672ac62004-03-17 22:22:08 +0000263 if (new != old) {
264 pci_write_byte(dev, 0x43, new);
265 if (pci_read_byte(dev, 0x43) != new) {
uwef6641642007-05-09 10:17:44 +0000266 printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x43, new, name);
ollie5672ac62004-03-17 22:22:08 +0000267 }
268 }
269
ollie5b621572004-03-20 16:46:10 +0000270 old = pci_read_byte(dev, 0x40);
ollie5672ac62004-03-17 22:22:08 +0000271 new = old | 0x01;
272 if (new == old)
273 return 0;
274 pci_write_byte(dev, 0x40, new);
275
276 if (pci_read_byte(dev, 0x40) != new) {
uwef6641642007-05-09 10:17:44 +0000277 printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x40, new, name);
ollie5672ac62004-03-17 22:22:08 +0000278 return -1;
279 }
280 return 0;
281}
282
arch6a1225a2005-07-06 17:13:46 +0000283static int enable_flash_ck804(struct pci_dev *dev, char *name)
284{
uwef6641642007-05-09 10:17:44 +0000285 /* register 4e.b gets or'ed with one */
286 uint8_t old, new;
arch6a1225a2005-07-06 17:13:46 +0000287
uwef6641642007-05-09 10:17:44 +0000288 /* if it fails, it fails. There are so many variations of broken mobos
289 * that it is hard to argue that we should quit at this point.
290 */
stepan927d4e22007-04-04 22:45:58 +0000291
uwef6641642007-05-09 10:17:44 +0000292 /* dump_pci_device(dev); */
arch6a1225a2005-07-06 17:13:46 +0000293
uwef6641642007-05-09 10:17:44 +0000294 old = pci_read_byte(dev, 0x88);
295 new = old | 0xc0;
296 if (new != old) {
297 pci_write_byte(dev, 0x88, new);
298 if (pci_read_byte(dev, 0x88) != new) {
299 printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x88, new, name);
300 }
301 }
arch6a1225a2005-07-06 17:13:46 +0000302
uwef6641642007-05-09 10:17:44 +0000303 old = pci_read_byte(dev, 0x6d);
304 new = old | 0x01;
305 if (new == old)
306 return 0;
307 pci_write_byte(dev, 0x6d, new);
308
309 if (pci_read_byte(dev, 0x6d) != new) {
310 printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x6d, new, name);
311 return -1;
312 }
313 return 0;
arch6a1225a2005-07-06 17:13:46 +0000314}
315
stepancb140092006-03-31 11:26:55 +0000316static int enable_flash_sb400(struct pci_dev *dev, char *name)
317{
uwef6641642007-05-09 10:17:44 +0000318 uint8_t tmp;
stepancb140092006-03-31 11:26:55 +0000319
320 struct pci_filter f;
321 struct pci_dev *smbusdev;
322
stepancb140092006-03-31 11:26:55 +0000323 /* then look for the smbus device */
uwef6641642007-05-09 10:17:44 +0000324 pci_filter_init((struct pci_access *)0, &f);
stepancb140092006-03-31 11:26:55 +0000325 f.vendor = 0x1002;
326 f.device = 0x4372;
stepan927d4e22007-04-04 22:45:58 +0000327
stepancb140092006-03-31 11:26:55 +0000328 for (smbusdev = pacc->devices; smbusdev; smbusdev = smbusdev->next) {
329 if (pci_filter_match(&f, smbusdev)) {
330 break;
331 }
332 }
stepan927d4e22007-04-04 22:45:58 +0000333
uwef6641642007-05-09 10:17:44 +0000334 if (!smbusdev) {
stepan927d4e22007-04-04 22:45:58 +0000335 fprintf(stderr, "ERROR: SMBus device not found. aborting\n");
stepancb140092006-03-31 11:26:55 +0000336 exit(1);
337 }
stepan927d4e22007-04-04 22:45:58 +0000338
339 /* enable some smbus stuff */
uwef6641642007-05-09 10:17:44 +0000340 tmp = pci_read_byte(smbusdev, 0x79);
341 tmp |= 0x01;
stepancb140092006-03-31 11:26:55 +0000342 pci_write_byte(smbusdev, 0x79, tmp);
343
stepan927d4e22007-04-04 22:45:58 +0000344 /* change southbridge */
uwef6641642007-05-09 10:17:44 +0000345 tmp = pci_read_byte(dev, 0x48);
346 tmp |= 0x21;
stepancb140092006-03-31 11:26:55 +0000347 pci_write_byte(dev, 0x48, tmp);
348
stepan927d4e22007-04-04 22:45:58 +0000349 /* now become a bit silly. */
uwef6641642007-05-09 10:17:44 +0000350 tmp = inb(0xc6f);
stepancb140092006-03-31 11:26:55 +0000351 outb(tmp, 0xeb);
uwef6641642007-05-09 10:17:44 +0000352 outb(tmp, 0xeb);
353 tmp |= 0x40;
stepancb140092006-03-31 11:26:55 +0000354 outb(tmp, 0xc6f);
355 outb(tmp, 0xeb);
356 outb(tmp, 0xeb);
357
358 return 0;
359}
360
uwe9af0ce82007-01-22 20:21:17 +0000361static int enable_flash_mcp55(struct pci_dev *dev, char *name)
362{
uwef6641642007-05-09 10:17:44 +0000363 /* register 4e.b gets or'ed with one */
364 unsigned char old, new, byte;
365 unsigned short word;
stepan927d4e22007-04-04 22:45:58 +0000366
uwef6641642007-05-09 10:17:44 +0000367 /* if it fails, it fails. There are so many variations of broken mobos
368 * that it is hard to argue that we should quit at this point.
369 */
uwe9af0ce82007-01-22 20:21:17 +0000370
uwef6641642007-05-09 10:17:44 +0000371 /* dump_pci_device(dev); */
uwe9af0ce82007-01-22 20:21:17 +0000372
uwef6641642007-05-09 10:17:44 +0000373 /* Set the 4MB enable bit bit */
374 byte = pci_read_byte(dev, 0x88);
375 byte |= 0xff; /* 256K */
376 pci_write_byte(dev, 0x88, byte);
377 byte = pci_read_byte(dev, 0x8c);
378 byte |= 0xff; /* 1M */
379 pci_write_byte(dev, 0x8c, byte);
380 word = pci_read_word(dev, 0x90);
381 word |= 0x7fff; /* 15M */
382 pci_write_word(dev, 0x90, word);
stepan927d4e22007-04-04 22:45:58 +0000383
uwef6641642007-05-09 10:17:44 +0000384 old = pci_read_byte(dev, 0x6d);
385 new = old | 0x01;
386 if (new == old)
387 return 0;
388 pci_write_byte(dev, 0x6d, new);
uwe9af0ce82007-01-22 20:21:17 +0000389
uwef6641642007-05-09 10:17:44 +0000390 if (pci_read_byte(dev, 0x6d) != new) {
391 printf
392 ("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n",
393 0x6d, new, name);
394 return -1;
395 }
uwe9af0ce82007-01-22 20:21:17 +0000396
397 return 0;
398
399}
400
stepanfaa9c542007-06-05 10:28:39 +0000401static int enable_flash_ht1000(struct pci_dev *dev, char *name)
402{
uwefcce12f2007-06-05 15:02:18 +0000403 uint8_t byte;
stepanfaa9c542007-06-05 10:28:39 +0000404
uwefcce12f2007-06-05 15:02:18 +0000405 /* Set the 4MB enable bit. */
stepanfaa9c542007-06-05 10:28:39 +0000406 byte = pci_read_byte(dev, 0x41);
407 byte |= 0x0e;
408 pci_write_byte(dev, 0x41, byte);
409
410 byte = pci_read_byte(dev, 0x43);
411 byte |= (1<<4);
412 pci_write_byte(dev, 0x43, byte);
413
stepanfaa9c542007-06-05 10:28:39 +0000414 return 0;
415}
416
ollie5672ac62004-03-17 22:22:08 +0000417typedef struct penable {
ollie5b621572004-03-20 16:46:10 +0000418 unsigned short vendor, device;
ollie5672ac62004-03-17 22:22:08 +0000419 char *name;
ollie5b621572004-03-20 16:46:10 +0000420 int (*doit) (struct pci_dev * dev, char *name);
ollie5672ac62004-03-17 22:22:08 +0000421} FLASH_ENABLE;
422
423static FLASH_ENABLE enables[] = {
stepanca42a0b2006-09-06 15:48:48 +0000424 {0x1039, 0x0630, "SIS630", enable_flash_sis630},
uwe12b38692006-11-05 18:26:08 +0000425 {0x8086, 0x7110, "PIIX4/PIIX4E/PIIX4M", enable_flash_piix4},
stepanca42a0b2006-09-06 15:48:48 +0000426 {0x8086, 0x2410, "ICH", enable_flash_ich_4e},
427 {0x8086, 0x2420, "ICH0", enable_flash_ich_4e},
428 {0x8086, 0x2440, "ICH2", enable_flash_ich_4e},
429 {0x8086, 0x244c, "ICH2-M", enable_flash_ich_4e},
430 {0x8086, 0x2480, "ICH3-S", enable_flash_ich_4e},
431 {0x8086, 0x248c, "ICH3-M", enable_flash_ich_4e},
432 {0x8086, 0x24c0, "ICH4/ICH4-L", enable_flash_ich_4e},
433 {0x8086, 0x24cc, "ICH4-M", enable_flash_ich_4e},
434 {0x8086, 0x24d0, "ICH5/ICH5R", enable_flash_ich_4e},
435 {0x8086, 0x2640, "ICH6/ICH6R", enable_flash_ich_dc},
436 {0x8086, 0x2641, "ICH6-M", enable_flash_ich_dc},
uwefb21b022007-03-31 19:48:38 +0000437 {0x8086, 0x27b0, "ICH7DH", enable_flash_ich_dc},
stepanca42a0b2006-09-06 15:48:48 +0000438 {0x8086, 0x27b8, "ICH7/ICH7R", enable_flash_ich_dc},
439 {0x8086, 0x27b9, "ICH7M", enable_flash_ich_dc},
440 {0x8086, 0x27bd, "ICH7MDH", enable_flash_ich_dc},
441 {0x8086, 0x2810, "ICH8/ICH8R", enable_flash_ich_dc},
442 {0x8086, 0x2812, "ICH8DH", enable_flash_ich_dc},
443 {0x8086, 0x2814, "ICH8DO", enable_flash_ich_dc},
uwe1f088472007-03-02 22:16:38 +0000444 {0x1106, 0x8231, "VT8231", enable_flash_vt823x},
445 {0x1106, 0x3177, "VT8235", enable_flash_vt823x},
446 {0x1106, 0x3227, "VT8237", enable_flash_vt823x},
uwef6641642007-05-09 10:17:44 +0000447 {0x1106, 0x8324, "CX700", enable_flash_vt823x},
stepan3715fdf2006-11-07 10:22:20 +0000448 {0x1106, 0x0686, "VT82C686", enable_flash_amd8111},
uwe7a75a6a2007-06-06 21:35:45 +0000449 {0x1078, 0x0100, "CS5530/CS5530A", enable_flash_cs5530},
ollie5b621572004-03-20 16:46:10 +0000450 {0x100b, 0x0510, "SC1100", enable_flash_sc1100},
ollie5672ac62004-03-17 22:22:08 +0000451 {0x1039, 0x0008, "SIS5595", enable_flash_sis5595},
452 {0x1022, 0x7468, "AMD8111", enable_flash_amd8111},
uwe691ddb62007-05-20 16:16:13 +0000453 {0x10B9, 0x1533, "ALi M1533", enable_flash_ali_m1533},
stepan927d4e22007-04-04 22:45:58 +0000454 /* this fallthrough looks broken. */
uwef6641642007-05-09 10:17:44 +0000455 {0x10de, 0x0050, "NVIDIA CK804", enable_flash_ck804}, /* LPC */
456 {0x10de, 0x0051, "NVIDIA CK804", enable_flash_ck804}, /* Pro */
457 {0x10de, 0x00d3, "NVIDIA CK804", enable_flash_ck804}, /* Slave, should not be here, to fix known bug for A01. */
stepan82181662006-10-14 21:04:49 +0000458
uwef6641642007-05-09 10:17:44 +0000459 {0x10de, 0x0260, "NVidia MCP51", enable_flash_ck804},
460 {0x10de, 0x0261, "NVidia MCP51", enable_flash_ck804},
461 {0x10de, 0x0262, "NVidia MCP51", enable_flash_ck804},
462 {0x10de, 0x0263, "NVidia MCP51", enable_flash_ck804},
stepan82181662006-10-14 21:04:49 +0000463
uwef6641642007-05-09 10:17:44 +0000464 {0x10de, 0x0360, "NVIDIA MCP55", enable_flash_mcp55}, /* Gigabyte m57sli-s4 */
465 {0x10de, 0x0361, "NVIDIA MCP55", enable_flash_mcp55}, /* LPC */
466 {0x10de, 0x0362, "NVIDIA MCP55", enable_flash_mcp55}, /* LPC */
467 {0x10de, 0x0363, "NVIDIA MCP55", enable_flash_mcp55}, /* LPC */
468 {0x10de, 0x0364, "NVIDIA MCP55", enable_flash_mcp55}, /* LPC */
469 {0x10de, 0x0365, "NVIDIA MCP55", enable_flash_mcp55}, /* LPC */
470 {0x10de, 0x0366, "NVIDIA MCP55", enable_flash_mcp55}, /* LPC */
471 {0x10de, 0x0367, "NVIDIA MCP55", enable_flash_mcp55}, /* Pro */
uwe9af0ce82007-01-22 20:21:17 +0000472
uwef6641642007-05-09 10:17:44 +0000473 {0x1002, 0x4377, "ATI SB400", enable_flash_sb400}, /* ATI Technologies Inc IXP SB400 PCI-ISA Bridge (rev 80) */
stepanfaa9c542007-06-05 10:28:39 +0000474
uwefcce12f2007-06-05 15:02:18 +0000475 {0x1166, 0x0205, "Broadcom HT-1000", enable_flash_ht1000},
ollie5672ac62004-03-17 22:22:08 +0000476};
ollie5b621572004-03-20 16:46:10 +0000477
stepan927d4e22007-04-04 22:45:58 +0000478/*
479 *
stepancb140092006-03-31 11:26:55 +0000480 */
uwef6641642007-05-09 10:17:44 +0000481int chipset_flash_enable(void)
ollie5672ac62004-03-17 22:22:08 +0000482{
uwef6641642007-05-09 10:17:44 +0000483 struct pci_dev *dev = 0;
484 int ret = -2; /* nothing! */
485 int i;
ollie5672ac62004-03-17 22:22:08 +0000486
ollie5672ac62004-03-17 22:22:08 +0000487 /* now let's try to find the chipset we have ... */
stepan927d4e22007-04-04 22:45:58 +0000488 for (i = 0; i < sizeof(enables) / sizeof(enables[0]); i++) {
uwef6641642007-05-09 10:17:44 +0000489 dev = pci_dev_find(enables[i].vendor, enables[i].device);
490 if (dev)
491 break;
ollie5672ac62004-03-17 22:22:08 +0000492 }
493
uwef6641642007-05-09 10:17:44 +0000494 if (dev) {
495 printf("Found chipset \"%s\": Enabling flash write... ",
496 enables[i].name);
497
498 ret = enables[i].doit(dev, enables[i].name);
499 if (ret)
500 printf("Failed!\n");
501 else
502 printf("OK.\n");
503 }
504
505 return ret;
ollie5672ac62004-03-17 22:22:08 +0000506}