Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 1 | /* |
| 2 | * flash rom utility: enable flash writes (board specific) |
| 3 | * |
| 4 | * Copyright (C) 2005-2007 coresystems GmbH <stepan@coresystems.de> |
| 5 | * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de> |
| 6 | * Copyright (C) 2007 Luc Verhaegen <libv@skynet.be> |
| 7 | * |
| 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 | |
| 14 | /* |
| 15 | * Contains the board specific flash enables. |
| 16 | */ |
| 17 | |
| 18 | #include <stdio.h> |
| 19 | #include <pci/pci.h> |
| 20 | #include <stdint.h> |
| 21 | #include <string.h> |
| 22 | |
| 23 | #include "flash.h" |
| 24 | #include "debug.h" |
| 25 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 26 | /* |
| 27 | * Helper functions for many Winbond superIOs of the w836xx range. |
| 28 | */ |
| 29 | #define W836_INDEX 0x2E |
| 30 | #define W836_DATA 0x2F |
| 31 | |
| 32 | /* Enter extended functions */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 33 | static void w836xx_ext_enter(void) |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 34 | { |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 35 | outb(0x87, W836_INDEX); |
| 36 | outb(0x87, W836_INDEX); |
| 37 | } |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 38 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 39 | /* Leave extended functions */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 40 | static void w836xx_ext_leave(void) |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 41 | { |
| 42 | outb(0xAA, W836_INDEX); |
| 43 | } |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 44 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 45 | /* General functions for read/writing WB SuperIOs */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 46 | static unsigned char wbsio_read(unsigned char index) |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 47 | { |
| 48 | outb(index, W836_INDEX); |
| 49 | return inb(W836_DATA); |
| 50 | } |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 51 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 52 | static void wbsio_write(unsigned char index, unsigned char data) |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 53 | { |
| 54 | outb(index, W836_INDEX); |
| 55 | outb(data, W836_DATA); |
| 56 | } |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 57 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 58 | static void |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 59 | wbsio_mask(unsigned char index, unsigned char data, unsigned char mask) |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 60 | { |
| 61 | unsigned char tmp; |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 62 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 63 | outb(index, W836_INDEX); |
| 64 | tmp = inb(W836_DATA) & ~mask; |
| 65 | outb(tmp | (data & mask), W836_DATA); |
Mondrian Nuessle | aef1c7c | 2007-05-03 10:09:23 +0000 | [diff] [blame] | 66 | } |
| 67 | |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 68 | /* |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 69 | * WinBond w83627hf: raise GPIO24. |
| 70 | * |
| 71 | * Suited for: |
| 72 | * * Agami Aruma |
| 73 | * * IWILL DK8-HTX |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 74 | */ |
| 75 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 76 | static int w83627hf_gpio24_raise(const char *name) |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 77 | { |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 78 | w836xx_ext_enter(); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 79 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 80 | /* Is this the w83627hf? */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 81 | if (wbsio_read(0x20) != 0x52) { /* SIO device ID register */ |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 82 | fprintf(stderr, "\nERROR: %s: W83627HF: Wrong ID: 0x%02X.\n", |
| 83 | name, wbsio_read(0x20)); |
| 84 | w836xx_ext_leave(); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 85 | return -1; |
| 86 | } |
| 87 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 88 | /* PIN89S: WDTO/GP24 multiplex -> GPIO24 */ |
| 89 | wbsio_mask(0x2B, 0x10, 0x10); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 90 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 91 | wbsio_write(0x07, 0x08); /* Select logical device 8: GPIO port 2 */ |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 92 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 93 | wbsio_mask(0x30, 0x01, 0x01); /* Activate logical device. */ |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 94 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 95 | wbsio_mask(0xF0, 0x00, 0x10); /* GPIO24 -> output */ |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 96 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 97 | wbsio_mask(0xF2, 0x00, 0x10); /* Clear GPIO24 inversion */ |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 98 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 99 | wbsio_mask(0xF1, 0x10, 0x10); /* Raise GPIO24 */ |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 100 | |
| 101 | w836xx_ext_leave(); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 102 | |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | * Suited for VIAs EPIA M and MII, and maybe other CLE266 based EPIAs. |
| 108 | * |
| 109 | * We don't need to do this when using linuxbios, GPIO15 is never lowered there. |
| 110 | */ |
| 111 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 112 | static int board_via_epia_m(const char *name) |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 113 | { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 114 | struct pci_dev *dev; |
| 115 | unsigned int base; |
| 116 | uint8_t val; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 117 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 118 | dev = pci_dev_find(0x1106, 0x3177); /* VT8235 ISA bridge */ |
| 119 | if (!dev) { |
| 120 | fprintf(stderr, "\nERROR: VT8235 ISA Bridge not found.\n"); |
| 121 | return -1; |
| 122 | } |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 123 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 124 | /* GPIO12-15 -> output */ |
| 125 | val = pci_read_byte(dev, 0xE4); |
| 126 | val |= 0x10; |
| 127 | pci_write_byte(dev, 0xE4, val); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 128 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 129 | /* Get Power Management IO address. */ |
| 130 | base = pci_read_word(dev, 0x88) & 0xFF80; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 131 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 132 | /* enable GPIO15 which is connected to write protect. */ |
| 133 | val = inb(base + 0x4D); |
| 134 | val |= 0x80; |
| 135 | outb(val, base + 0x4D); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 136 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 137 | return 0; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | /* |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 141 | * Suited for Asus A7V8X-MX SE and A7V400-MX. |
| 142 | * |
| 143 | */ |
| 144 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 145 | static int board_asus_a7v8x_mx(const char *name) |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 146 | { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 147 | struct pci_dev *dev; |
| 148 | uint8_t val; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 149 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 150 | dev = pci_dev_find(0x1106, 0x3177); /* VT8235 ISA bridge */ |
| 151 | if (!dev) { |
| 152 | fprintf(stderr, "\nERROR: VT8235 ISA Bridge not found.\n"); |
| 153 | return -1; |
| 154 | } |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 155 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 156 | /* This bit is marked reserved actually */ |
| 157 | val = pci_read_byte(dev, 0x59); |
| 158 | val &= 0x7F; |
| 159 | pci_write_byte(dev, 0x59, val); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 160 | |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 161 | /* Raise ROM MEMW# line on Winbond w83697 SuperIO */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 162 | w836xx_ext_enter(); |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 163 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 164 | if (!(wbsio_read(0x24) & 0x02)) /* flash rom enabled? */ |
| 165 | wbsio_mask(0x24, 0x08, 0x08); /* enable MEMW# */ |
Luc Verhaegen | 7977f4e | 2007-05-04 04:47:04 +0000 | [diff] [blame] | 166 | |
| 167 | w836xx_ext_leave(); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 168 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 169 | return 0; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | /* |
| 173 | * We use 2 sets of ids here, you're free to choose which is which. This |
| 174 | * to provide a very high degree of certainty when matching a board on |
| 175 | * the basis of Subsystem/card ids. As not every vendor handles |
| 176 | * subsystem/card ids in a sane manner. |
| 177 | * |
| 178 | * Keep the second set nulled if it should be ignored. |
| 179 | * |
| 180 | */ |
| 181 | |
| 182 | struct board_pciid_enable { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 183 | /* Any device, but make it sensible, like the isa bridge. */ |
| 184 | uint16_t first_vendor; |
| 185 | uint16_t first_device; |
| 186 | uint16_t first_card_vendor; |
| 187 | uint16_t first_card_device; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 188 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 189 | /* Any device, but make it sensible, like |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 190 | * the host bridge. May be NULL |
| 191 | */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 192 | uint16_t second_vendor; |
| 193 | uint16_t second_device; |
| 194 | uint16_t second_card_vendor; |
| 195 | uint16_t second_card_device; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 196 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 197 | /* From linuxbios table */ |
| 198 | char *lb_vendor; |
| 199 | char *lb_part; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 200 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 201 | char *name; |
| 202 | int (*enable) (const char *name); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 203 | }; |
| 204 | |
| 205 | struct board_pciid_enable board_pciid_enables[] = { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 206 | {0x1022, 0x7468, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 207 | "iwill", "dk8_htx", "IWILL DK8-HTX", w83627hf_gpio24_raise}, |
| 208 | {0x1022, 0x746B, 0x1022, 0x36C0, 0x0000, 0x0000, 0x0000, 0x0000, |
| 209 | "AGAMI", "ARUMA", "agami Aruma", w83627hf_gpio24_raise}, |
| 210 | {0x1106, 0x3177, 0x1106, 0xAA01, 0x1106, 0x3123, 0x1106, 0xAA01, |
| 211 | NULL, NULL, "VIA EPIA M/MII/...", board_via_epia_m}, |
| 212 | {0x1106, 0x3177, 0x1043, 0x80A1, 0x1106, 0x3205, 0x1043, 0x8118, |
| 213 | NULL, NULL, "ASUS A7V8-MX SE", board_asus_a7v8x_mx}, |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 214 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 215 | {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL} /* Keep this */ |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 216 | }; |
| 217 | |
| 218 | /* |
| 219 | * Match boards on linuxbios table gathered vendor and part name. |
| 220 | * Require main pci-ids to match too as extra safety. |
| 221 | * |
| 222 | */ |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 223 | static struct board_pciid_enable *board_match_linuxbios_name(char *vendor, |
| 224 | char *part) |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 225 | { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 226 | struct board_pciid_enable *board = board_pciid_enables; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 227 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 228 | for (; board->name; board++) { |
| 229 | if (!board->lb_vendor || strcmp(board->lb_vendor, vendor)) |
| 230 | continue; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 231 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 232 | if (!board->lb_part || strcmp(board->lb_part, part)) |
| 233 | continue; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 234 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 235 | if (!pci_dev_find(board->first_vendor, board->first_device)) |
| 236 | continue; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 237 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 238 | if (board->second_vendor && |
| 239 | !pci_dev_find(board->second_vendor, board->second_device)) |
| 240 | continue; |
| 241 | return board; |
| 242 | } |
| 243 | return NULL; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | /* |
| 247 | * Match boards on pci ids and subsystem ids. |
| 248 | * Second set of ids can be main only or missing completely. |
| 249 | */ |
| 250 | static struct board_pciid_enable *board_match_pci_card_ids(void) |
| 251 | { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 252 | struct board_pciid_enable *board = board_pciid_enables; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 253 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 254 | for (; board->name; board++) { |
| 255 | if (!board->first_card_vendor || !board->first_card_device) |
| 256 | continue; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 257 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 258 | if (!pci_card_find(board->first_vendor, board->first_device, |
| 259 | board->first_card_vendor, |
| 260 | board->first_card_device)) |
| 261 | continue; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 262 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 263 | if (board->second_vendor) { |
| 264 | if (board->second_card_vendor) { |
| 265 | if (!pci_card_find(board->second_vendor, |
| 266 | board->second_device, |
| 267 | board->second_card_vendor, |
| 268 | board->second_card_device)) |
| 269 | continue; |
| 270 | } else { |
| 271 | if (!pci_dev_find(board->second_vendor, |
| 272 | board->second_device)) |
| 273 | continue; |
| 274 | } |
| 275 | } |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 276 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 277 | return board; |
| 278 | } |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 279 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 280 | return NULL; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | /* |
| 284 | * |
| 285 | */ |
| 286 | int board_flash_enable(char *vendor, char *part) |
| 287 | { |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 288 | struct board_pciid_enable *board = NULL; |
| 289 | int ret = 0; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 290 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 291 | if (vendor && part) |
| 292 | board = board_match_linuxbios_name(vendor, part); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 293 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 294 | if (!board) |
| 295 | board = board_match_pci_card_ids(); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 296 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 297 | if (board) { |
| 298 | printf("Found board \"%s\": Enabling flash write... ", |
| 299 | board->name); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 300 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 301 | ret = board->enable(board->name); |
| 302 | if (ret) |
| 303 | printf("Failed!\n"); |
| 304 | else |
| 305 | printf("OK.\n"); |
| 306 | } |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 307 | |
Uwe Hermann | a7e0548 | 2007-05-09 10:17:44 +0000 | [diff] [blame^] | 308 | return ret; |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 309 | } |