Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 1 | /* |
Uwe Hermann | d110764 | 2007-08-29 17:52:32 +0000 | [diff] [blame] | 2 | * This file is part of the flashrom project. |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 3 | * |
Uwe Hermann | d22a1d4 | 2007-09-09 20:21:05 +0000 | [diff] [blame] | 4 | * Copyright (C) 2000 Silicon Integrated System Corporation |
| 5 | * Copyright (C) 2000 Ronald G. Minnich <rminnich@gmail.com> |
| 6 | * Copyright (C) 2005-2007 coresystems GmbH <stepan@coresystems.de> |
Carl-Daniel Hailfinger | a0a6ae9 | 2009-06-15 12:10:57 +0000 | [diff] [blame] | 7 | * Copyright (C) 2006-2009 Carl-Daniel Hailfinger |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 8 | * |
Uwe Hermann | d110764 | 2007-08-29 17:52:32 +0000 | [diff] [blame] | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 13 | * |
Uwe Hermann | d110764 | 2007-08-29 17:52:32 +0000 | [diff] [blame] | 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 18 | * |
Uwe Hermann | d110764 | 2007-08-29 17:52:32 +0000 | [diff] [blame] | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 22 | */ |
| 23 | |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 24 | #ifndef __FLASH_H__ |
| 25 | #define __FLASH_H__ 1 |
| 26 | |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 27 | #if defined(__GLIBC__) |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 28 | #include <sys/io.h> |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 29 | #endif |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 30 | #include <unistd.h> |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 31 | #include <stdint.h> |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 32 | #include <stdio.h> |
Christian Ruppert | 0cdb031 | 2009-05-14 18:57:26 +0000 | [diff] [blame] | 33 | #include <pci/pci.h> |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 34 | |
Carl-Daniel Hailfinger | 9abf529 | 2009-05-01 16:34:32 +0000 | [diff] [blame] | 35 | /* for iopl and outb under Solaris */ |
| 36 | #if defined (__sun) && (defined(__i386) || defined(__amd64)) |
| 37 | #include <strings.h> |
| 38 | #include <sys/sysi86.h> |
| 39 | #include <sys/psw.h> |
| 40 | #include <asm/sunddi.h> |
| 41 | #endif |
| 42 | |
Stefan Reinauer | f79edb9 | 2009-01-26 01:23:31 +0000 | [diff] [blame] | 43 | #if (defined(__MACH__) && defined(__APPLE__)) |
| 44 | #define __DARWIN__ |
| 45 | #endif |
| 46 | |
Patrick Georgi | 60622e2 | 2009-04-28 12:56:04 +0000 | [diff] [blame] | 47 | #if defined(__FreeBSD__) || defined(__DragonFly__) |
Andriy Gapon | 65c1b86 | 2008-05-22 13:22:45 +0000 | [diff] [blame] | 48 | #include <machine/cpufunc.h> |
| 49 | #define off64_t off_t |
| 50 | #define lseek64 lseek |
| 51 | #define OUTB(x, y) do { u_int tmp = (y); outb(tmp, (x)); } while (0) |
| 52 | #define OUTW(x, y) do { u_int tmp = (y); outw(tmp, (x)); } while (0) |
| 53 | #define OUTL(x, y) do { u_int tmp = (y); outl(tmp, (x)); } while (0) |
| 54 | #define INB(x) __extension__ ({ u_int tmp = (x); inb(tmp); }) |
| 55 | #define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); }) |
| 56 | #define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); }) |
| 57 | #else |
Stefan Reinauer | f79edb9 | 2009-01-26 01:23:31 +0000 | [diff] [blame] | 58 | #if defined(__DARWIN__) |
| 59 | #include <DirectIO/darwinio.h> |
| 60 | #define off64_t off_t |
| 61 | #define lseek64 lseek |
| 62 | #endif |
Carl-Daniel Hailfinger | 9abf529 | 2009-05-01 16:34:32 +0000 | [diff] [blame] | 63 | #if defined (__sun) && (defined(__i386) || defined(__amd64)) |
| 64 | /* Note different order for outb */ |
| 65 | #define OUTB(x,y) outb(y, x) |
| 66 | #define OUTW(x,y) outw(y, x) |
| 67 | #define OUTL(x,y) outl(y, x) |
| 68 | #define INB inb |
| 69 | #define INW inw |
| 70 | #define INL inl |
| 71 | #else |
Andriy Gapon | 65c1b86 | 2008-05-22 13:22:45 +0000 | [diff] [blame] | 72 | #define OUTB outb |
| 73 | #define OUTW outw |
| 74 | #define OUTL outl |
| 75 | #define INB inb |
| 76 | #define INW inw |
| 77 | #define INL inl |
| 78 | #endif |
Carl-Daniel Hailfinger | 9abf529 | 2009-05-01 16:34:32 +0000 | [diff] [blame] | 79 | #endif |
Andriy Gapon | 65c1b86 | 2008-05-22 13:22:45 +0000 | [diff] [blame] | 80 | |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 81 | typedef unsigned long chipaddr; |
| 82 | |
Carl-Daniel Hailfinger | 702218d | 2009-05-08 17:43:22 +0000 | [diff] [blame] | 83 | extern int programmer; |
Carl-Daniel Hailfinger | c312920 | 2009-05-09 00:54:55 +0000 | [diff] [blame] | 84 | #define PROGRAMMER_INTERNAL 0x00 |
| 85 | #define PROGRAMMER_DUMMY 0x01 |
Uwe Hermann | b4dcb71 | 2009-05-13 11:36:06 +0000 | [diff] [blame] | 86 | #define PROGRAMMER_NIC3COM 0x02 |
Rudolf Marek | 68720c7 | 2009-05-17 19:39:27 +0000 | [diff] [blame] | 87 | #define PROGRAMMER_SATASII 0x03 |
Carl-Daniel Hailfinger | b8afecd | 2009-05-31 18:00:57 +0000 | [diff] [blame] | 88 | #define PROGRAMMER_IT87SPI 0x04 |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 89 | #define PROGRAMMER_FT2232SPI 0x05 |
Carl-Daniel Hailfinger | 702218d | 2009-05-08 17:43:22 +0000 | [diff] [blame] | 90 | |
| 91 | struct programmer_entry { |
| 92 | const char *vendor; |
| 93 | const char *name; |
| 94 | |
| 95 | int (*init) (void); |
| 96 | int (*shutdown) (void); |
| 97 | |
Uwe Hermann | d1129ac | 2009-05-28 15:07:42 +0000 | [diff] [blame] | 98 | void * (*map_flash_region) (const char *descr, unsigned long phys_addr, |
| 99 | size_t len); |
Carl-Daniel Hailfinger | 1455b2b | 2009-05-11 14:13:25 +0000 | [diff] [blame] | 100 | void (*unmap_flash_region) (void *virt_addr, size_t len); |
| 101 | |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 102 | void (*chip_writeb) (uint8_t val, chipaddr addr); |
| 103 | void (*chip_writew) (uint16_t val, chipaddr addr); |
| 104 | void (*chip_writel) (uint32_t val, chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 105 | void (*chip_writen) (uint8_t *buf, chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 106 | uint8_t (*chip_readb) (const chipaddr addr); |
| 107 | uint16_t (*chip_readw) (const chipaddr addr); |
| 108 | uint32_t (*chip_readl) (const chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 109 | void (*chip_readn) (uint8_t *buf, const chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 110 | void (*delay) (int usecs); |
Carl-Daniel Hailfinger | 702218d | 2009-05-08 17:43:22 +0000 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | extern const struct programmer_entry programmer_table[]; |
| 114 | |
Uwe Hermann | 09e04f7 | 2009-05-16 22:36:00 +0000 | [diff] [blame] | 115 | int programmer_init(void); |
| 116 | int programmer_shutdown(void); |
| 117 | void *programmer_map_flash_region(const char *descr, unsigned long phys_addr, |
| 118 | size_t len); |
| 119 | void programmer_unmap_flash_region(void *virt_addr, size_t len); |
| 120 | void chip_writeb(uint8_t val, chipaddr addr); |
| 121 | void chip_writew(uint16_t val, chipaddr addr); |
| 122 | void chip_writel(uint32_t val, chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 123 | void chip_writen(uint8_t *buf, chipaddr addr, size_t len); |
Uwe Hermann | 09e04f7 | 2009-05-16 22:36:00 +0000 | [diff] [blame] | 124 | uint8_t chip_readb(const chipaddr addr); |
| 125 | uint16_t chip_readw(const chipaddr addr); |
| 126 | uint32_t chip_readl(const chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 127 | void chip_readn(uint8_t *buf, const chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 128 | void programmer_delay(int usecs); |
Carl-Daniel Hailfinger | 61a8bd2 | 2009-03-05 19:24:22 +0000 | [diff] [blame] | 129 | |
Uwe Hermann | e5ac164 | 2008-03-12 11:54:51 +0000 | [diff] [blame] | 130 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| 131 | |
Carl-Daniel Hailfinger | 1dfe0ff | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 132 | enum chipbustype { |
Carl-Daniel Hailfinger | 3504b53 | 2009-06-01 00:02:11 +0000 | [diff] [blame] | 133 | CHIP_BUSTYPE_NONE = 0, |
Carl-Daniel Hailfinger | 1dfe0ff | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 134 | CHIP_BUSTYPE_PARALLEL = 1 << 0, |
| 135 | CHIP_BUSTYPE_LPC = 1 << 1, |
| 136 | CHIP_BUSTYPE_FWH = 1 << 2, |
| 137 | CHIP_BUSTYPE_SPI = 1 << 3, |
| 138 | CHIP_BUSTYPE_NONSPI = CHIP_BUSTYPE_PARALLEL | CHIP_BUSTYPE_LPC | CHIP_BUSTYPE_FWH, |
| 139 | CHIP_BUSTYPE_UNKNOWN = CHIP_BUSTYPE_PARALLEL | CHIP_BUSTYPE_LPC | CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_SPI, |
| 140 | }; |
| 141 | |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 142 | struct flashchip { |
Uwe Hermann | 7615868 | 2008-03-14 23:55:58 +0000 | [diff] [blame] | 143 | const char *vendor; |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 144 | const char *name; |
Carl-Daniel Hailfinger | 1dfe0ff | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 145 | |
| 146 | enum chipbustype bustype; |
| 147 | |
Uwe Hermann | 394131e | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 148 | /* |
| 149 | * With 32bit manufacture_id and model_id we can cover IDs up to |
Carl-Daniel Hailfinger | ae8afa9 | 2007-12-31 01:49:00 +0000 | [diff] [blame] | 150 | * (including) the 4th bank of JEDEC JEP106W Standard Manufacturer's |
| 151 | * Identification code. |
| 152 | */ |
| 153 | uint32_t manufacture_id; |
| 154 | uint32_t model_id; |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 155 | |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 156 | int total_size; |
| 157 | int page_size; |
| 158 | |
Uwe Hermann | 394131e | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 159 | /* |
| 160 | * Indicate if flashrom has been tested with this flash chip and if |
Peter Stuge | 1159d58 | 2008-05-03 04:34:37 +0000 | [diff] [blame] | 161 | * everything worked correctly. |
| 162 | */ |
| 163 | uint32_t tested; |
| 164 | |
Uwe Hermann | 0b7afe6 | 2007-04-01 19:44:21 +0000 | [diff] [blame] | 165 | int (*probe) (struct flashchip *flash); |
Maciej Pijanka | c6e1111 | 2009-06-03 14:46:22 +0000 | [diff] [blame] | 166 | |
| 167 | /* Delay after "enter/exit ID mode" commands in microseconds. */ |
| 168 | int probe_timing; |
Uwe Hermann | 0b7afe6 | 2007-04-01 19:44:21 +0000 | [diff] [blame] | 169 | int (*erase) (struct flashchip *flash); |
| 170 | int (*write) (struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 171 | int (*read) (struct flashchip *flash, uint8_t *buf, int start, int len); |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 172 | |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 173 | /* Some flash devices have an additional register space. */ |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 174 | chipaddr virtual_memory; |
| 175 | chipaddr virtual_registers; |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 176 | }; |
| 177 | |
Peter Stuge | 1159d58 | 2008-05-03 04:34:37 +0000 | [diff] [blame] | 178 | #define TEST_UNTESTED 0 |
| 179 | |
Uwe Hermann | d1129ac | 2009-05-28 15:07:42 +0000 | [diff] [blame] | 180 | #define TEST_OK_PROBE (1 << 0) |
| 181 | #define TEST_OK_READ (1 << 1) |
| 182 | #define TEST_OK_ERASE (1 << 2) |
| 183 | #define TEST_OK_WRITE (1 << 3) |
| 184 | #define TEST_OK_PR (TEST_OK_PROBE | TEST_OK_READ) |
| 185 | #define TEST_OK_PRE (TEST_OK_PROBE | TEST_OK_READ | TEST_OK_ERASE) |
| 186 | #define TEST_OK_PREW (TEST_OK_PROBE | TEST_OK_READ | TEST_OK_ERASE | TEST_OK_WRITE) |
Peter Stuge | 1159d58 | 2008-05-03 04:34:37 +0000 | [diff] [blame] | 187 | #define TEST_OK_MASK 0x0f |
| 188 | |
Uwe Hermann | d1129ac | 2009-05-28 15:07:42 +0000 | [diff] [blame] | 189 | #define TEST_BAD_PROBE (1 << 4) |
| 190 | #define TEST_BAD_READ (1 << 5) |
| 191 | #define TEST_BAD_ERASE (1 << 6) |
| 192 | #define TEST_BAD_WRITE (1 << 7) |
| 193 | #define TEST_BAD_PREW (TEST_BAD_PROBE | TEST_BAD_READ | TEST_BAD_ERASE | TEST_BAD_WRITE) |
Peter Stuge | 1159d58 | 2008-05-03 04:34:37 +0000 | [diff] [blame] | 194 | #define TEST_BAD_MASK 0xf0 |
| 195 | |
Maciej Pijanka | c6e1111 | 2009-06-03 14:46:22 +0000 | [diff] [blame] | 196 | /* Timing used in probe routines. ZERO is -2 to differentiate between an unset |
| 197 | * field and zero delay. |
| 198 | * |
| 199 | * SPI devices will always have zero delay and ignore this field. |
| 200 | */ |
| 201 | #define TIMING_FIXME -1 |
| 202 | /* this is intentionally same value as fixme */ |
| 203 | #define TIMING_IGNORED -1 |
| 204 | #define TIMING_ZERO -2 |
| 205 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 206 | extern struct flashchip flashchips[]; |
| 207 | |
Uwe Hermann | 05fab75 | 2009-05-16 23:42:17 +0000 | [diff] [blame] | 208 | struct penable { |
| 209 | uint16_t vendor_id; |
| 210 | uint16_t device_id; |
| 211 | int status; |
| 212 | const char *vendor_name; |
| 213 | const char *device_name; |
| 214 | int (*doit) (struct pci_dev *dev, const char *name); |
| 215 | }; |
| 216 | |
| 217 | extern const struct penable chipset_enables[]; |
| 218 | |
| 219 | struct board_pciid_enable { |
| 220 | /* Any device, but make it sensible, like the ISA bridge. */ |
| 221 | uint16_t first_vendor; |
| 222 | uint16_t first_device; |
| 223 | uint16_t first_card_vendor; |
| 224 | uint16_t first_card_device; |
| 225 | |
| 226 | /* Any device, but make it sensible, like |
| 227 | * the host bridge. May be NULL. |
| 228 | */ |
| 229 | uint16_t second_vendor; |
| 230 | uint16_t second_device; |
| 231 | uint16_t second_card_vendor; |
| 232 | uint16_t second_card_device; |
| 233 | |
| 234 | /* The vendor / part name from the coreboot table. */ |
| 235 | const char *lb_vendor; |
| 236 | const char *lb_part; |
| 237 | |
| 238 | const char *vendor_name; |
| 239 | const char *board_name; |
| 240 | |
| 241 | int (*enable) (const char *name); |
| 242 | }; |
| 243 | |
| 244 | extern struct board_pciid_enable board_pciid_enables[]; |
| 245 | |
| 246 | struct board_info { |
| 247 | const char *vendor; |
| 248 | const char *name; |
| 249 | }; |
| 250 | |
Uwe Hermann | 20a293f | 2009-06-19 10:42:43 +0000 | [diff] [blame] | 251 | struct board_info_url { |
| 252 | const char *vendor; |
| 253 | const char *name; |
| 254 | const char *url; |
| 255 | }; |
| 256 | |
Uwe Hermann | 05fab75 | 2009-05-16 23:42:17 +0000 | [diff] [blame] | 257 | extern const struct board_info boards_ok[]; |
| 258 | extern const struct board_info boards_bad[]; |
Uwe Hermann | e1aa75e | 2009-06-18 14:04:44 +0000 | [diff] [blame] | 259 | extern const struct board_info laptops_ok[]; |
| 260 | extern const struct board_info laptops_bad[]; |
Uwe Hermann | 05fab75 | 2009-05-16 23:42:17 +0000 | [diff] [blame] | 261 | |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 262 | /* udelay.c */ |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 263 | void myusec_delay(int usecs); |
Carl-Daniel Hailfinger | 4363439 | 2009-05-01 12:22:17 +0000 | [diff] [blame] | 264 | void myusec_calibrate_delay(void); |
Luc Verhaegen | 8e3a600 | 2007-04-04 22:45:58 +0000 | [diff] [blame] | 265 | |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 266 | /* pcidev.c */ |
| 267 | #define PCI_OK 0 |
| 268 | #define PCI_NT 1 /* Not tested */ |
Rudolf Marek | 68720c7 | 2009-05-17 19:39:27 +0000 | [diff] [blame] | 269 | |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 270 | extern uint32_t io_base_addr; |
| 271 | extern struct pci_access *pacc; |
| 272 | extern struct pci_filter filter; |
Uwe Hermann | 8403ccb | 2009-05-16 21:39:19 +0000 | [diff] [blame] | 273 | extern struct pci_dev *pcidev_dev; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 274 | struct pcidev_status { |
| 275 | uint16_t vendor_id; |
| 276 | uint16_t device_id; |
| 277 | int status; |
| 278 | const char *vendor_name; |
| 279 | const char *device_name; |
| 280 | }; |
| 281 | uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs); |
| 282 | uint32_t pcidev_init(uint16_t vendor_id, struct pcidev_status *devs); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 283 | |
| 284 | /* print.c */ |
| 285 | char *flashbuses_to_text(enum chipbustype bustype); |
| 286 | void print_supported_chips(void); |
| 287 | void print_supported_chipsets(void); |
| 288 | void print_supported_boards(void); |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 289 | void print_supported_pcidevs(struct pcidev_status *devs); |
Uwe Hermann | 20a293f | 2009-06-19 10:42:43 +0000 | [diff] [blame] | 290 | void print_supported_chips_wiki(void); |
| 291 | void print_supported_boards_wiki(void); |
| 292 | void print_supported_chipsets_wiki(void); |
| 293 | void print_supported_pcidevs_wiki_header(void); |
| 294 | void print_supported_pcidevs_wiki_footer(void); |
| 295 | void print_supported_pcidevs_wiki(struct pcidev_status *devs); |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 296 | |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 297 | /* board_enable.c */ |
Peter Stuge | 9d9399c | 2009-01-26 02:34:51 +0000 | [diff] [blame] | 298 | void w836xx_ext_enter(uint16_t port); |
| 299 | void w836xx_ext_leave(uint16_t port); |
Carl-Daniel Hailfinger | 24c1a16 | 2009-05-25 23:26:50 +0000 | [diff] [blame] | 300 | uint8_t sio_read(uint16_t port, uint8_t reg); |
| 301 | void sio_write(uint16_t port, uint8_t reg, uint8_t data); |
| 302 | void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask); |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 303 | int board_flash_enable(const char *vendor, const char *part); |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 304 | |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 305 | /* chipset_enable.c */ |
Carl-Daniel Hailfinger | 1dfe0ff | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 306 | extern enum chipbustype buses_supported; |
Uwe Hermann | 372eeb5 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 307 | int chipset_flash_enable(void); |
Stefan Reinauer | 2cb94e1 | 2008-06-30 23:45:22 +0000 | [diff] [blame] | 308 | |
Stefan Reinauer | 9a6d176 | 2008-12-03 21:24:40 +0000 | [diff] [blame] | 309 | extern unsigned long flashbase; |
| 310 | |
Stefan Reinauer | 0593f21 | 2009-01-26 01:10:48 +0000 | [diff] [blame] | 311 | /* physmap.c */ |
| 312 | void *physmap(const char *descr, unsigned long phys_addr, size_t len); |
| 313 | void physunmap(void *virt_addr, size_t len); |
| 314 | |
Carl-Daniel Hailfinger | 702218d | 2009-05-08 17:43:22 +0000 | [diff] [blame] | 315 | /* internal.c */ |
Uwe Hermann | 2cac686 | 2009-05-16 22:05:42 +0000 | [diff] [blame] | 316 | struct pci_dev *pci_dev_find_filter(struct pci_filter filter); |
| 317 | struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device); |
| 318 | struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device, |
| 319 | uint16_t card_vendor, uint16_t card_device); |
Carl-Daniel Hailfinger | 3b7e75a | 2009-05-14 21:41:10 +0000 | [diff] [blame] | 320 | void get_io_perms(void); |
Carl-Daniel Hailfinger | 702218d | 2009-05-08 17:43:22 +0000 | [diff] [blame] | 321 | int internal_init(void); |
| 322 | int internal_shutdown(void); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 323 | void internal_chip_writeb(uint8_t val, chipaddr addr); |
| 324 | void internal_chip_writew(uint16_t val, chipaddr addr); |
| 325 | void internal_chip_writel(uint32_t val, chipaddr addr); |
| 326 | uint8_t internal_chip_readb(const chipaddr addr); |
| 327 | uint16_t internal_chip_readw(const chipaddr addr); |
| 328 | uint32_t internal_chip_readl(const chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 329 | void internal_chip_readn(uint8_t *buf, const chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | 78185dc | 2009-05-17 15:49:24 +0000 | [diff] [blame] | 330 | void mmio_writeb(uint8_t val, void *addr); |
| 331 | void mmio_writew(uint16_t val, void *addr); |
| 332 | void mmio_writel(uint32_t val, void *addr); |
| 333 | uint8_t mmio_readb(void *addr); |
| 334 | uint16_t mmio_readw(void *addr); |
| 335 | uint32_t mmio_readl(void *addr); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 336 | void internal_delay(int usecs); |
Uwe Hermann | c691593 | 2009-05-17 23:12:17 +0000 | [diff] [blame] | 337 | void *fallback_map(const char *descr, unsigned long phys_addr, size_t len); |
| 338 | void fallback_unmap(void *virt_addr, size_t len); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 339 | void fallback_chip_writew(uint16_t val, chipaddr addr); |
| 340 | void fallback_chip_writel(uint32_t val, chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 341 | void fallback_chip_writen(uint8_t *buf, chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 342 | uint16_t fallback_chip_readw(const chipaddr addr); |
| 343 | uint32_t fallback_chip_readl(const chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 344 | void fallback_chip_readn(uint8_t *buf, const chipaddr addr, size_t len); |
Uwe Hermann | a086932 | 2009-05-14 20:41:57 +0000 | [diff] [blame] | 345 | #if defined(__FreeBSD__) || defined(__DragonFly__) |
| 346 | extern int io_fd; |
| 347 | #endif |
Carl-Daniel Hailfinger | 702218d | 2009-05-08 17:43:22 +0000 | [diff] [blame] | 348 | |
Carl-Daniel Hailfinger | c312920 | 2009-05-09 00:54:55 +0000 | [diff] [blame] | 349 | /* dummyflasher.c */ |
Carl-Daniel Hailfinger | 3504b53 | 2009-06-01 00:02:11 +0000 | [diff] [blame] | 350 | extern char *dummytype; |
Carl-Daniel Hailfinger | c312920 | 2009-05-09 00:54:55 +0000 | [diff] [blame] | 351 | int dummy_init(void); |
| 352 | int dummy_shutdown(void); |
Carl-Daniel Hailfinger | 1455b2b | 2009-05-11 14:13:25 +0000 | [diff] [blame] | 353 | void *dummy_map(const char *descr, unsigned long phys_addr, size_t len); |
| 354 | void dummy_unmap(void *virt_addr, size_t len); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 355 | void dummy_chip_writeb(uint8_t val, chipaddr addr); |
| 356 | void dummy_chip_writew(uint16_t val, chipaddr addr); |
| 357 | void dummy_chip_writel(uint32_t val, chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 358 | void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 359 | uint8_t dummy_chip_readb(const chipaddr addr); |
| 360 | uint16_t dummy_chip_readw(const chipaddr addr); |
| 361 | uint32_t dummy_chip_readl(const chipaddr addr); |
Carl-Daniel Hailfinger | 0bd2a2b | 2009-06-05 18:32:07 +0000 | [diff] [blame] | 362 | void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len); |
Carl-Daniel Hailfinger | bfe2e0c | 2009-05-14 12:59:36 +0000 | [diff] [blame] | 363 | int dummy_spi_command(unsigned int writecnt, unsigned int readcnt, |
| 364 | const unsigned char *writearr, unsigned char *readarr); |
Carl-Daniel Hailfinger | c312920 | 2009-05-09 00:54:55 +0000 | [diff] [blame] | 365 | |
Uwe Hermann | b4dcb71 | 2009-05-13 11:36:06 +0000 | [diff] [blame] | 366 | /* nic3com.c */ |
| 367 | int nic3com_init(void); |
| 368 | int nic3com_shutdown(void); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 369 | void nic3com_chip_writeb(uint8_t val, chipaddr addr); |
| 370 | uint8_t nic3com_chip_readb(const chipaddr addr); |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 371 | extern struct pcidev_status nics_3com[]; |
Uwe Hermann | b4dcb71 | 2009-05-13 11:36:06 +0000 | [diff] [blame] | 372 | |
Rudolf Marek | 68720c7 | 2009-05-17 19:39:27 +0000 | [diff] [blame] | 373 | /* satasii.c */ |
| 374 | int satasii_init(void); |
| 375 | int satasii_shutdown(void); |
Rudolf Marek | 68720c7 | 2009-05-17 19:39:27 +0000 | [diff] [blame] | 376 | void satasii_chip_writeb(uint8_t val, chipaddr addr); |
| 377 | uint8_t satasii_chip_readb(const chipaddr addr); |
| 378 | extern struct pcidev_status satas_sii[]; |
| 379 | |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 380 | /* ft2232_spi.c */ |
| 381 | int ft2232_spi_init(void); |
| 382 | int ft2232_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); |
| 383 | int ft2232_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
| 384 | int ft2232_spi_write1(struct flashchip *flash, uint8_t *buf); |
| 385 | int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf); |
| 386 | |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 387 | /* flashrom.c */ |
Uwe Hermann | ad216bf | 2009-04-24 16:17:41 +0000 | [diff] [blame] | 388 | extern int verbose; |
| 389 | #define printf_debug(x...) { if (verbose) printf(x); } |
Peter Stuge | 776d202 | 2009-01-26 00:39:57 +0000 | [diff] [blame] | 390 | void map_flash_registers(struct flashchip *flash); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 391 | int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 38a059d | 2009-06-13 12:04:03 +0000 | [diff] [blame] | 392 | int min(int a, int b); |
Carl-Daniel Hailfinger | 30f7cb2 | 2009-06-15 17:23:36 +0000 | [diff] [blame] | 393 | int max(int a, int b); |
| 394 | int check_erased_range(struct flashchip *flash, int start, int len); |
| 395 | int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, char *message); |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 396 | extern char *pcidev_bdf; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 397 | char *strcat_realloc(char *dest, const char *src); |
| 398 | |
| 399 | #define OK 0 |
| 400 | #define NT 1 /* Not tested */ |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 401 | |
| 402 | /* layout.c */ |
Peter Stuge | 7ffbc6f | 2008-06-18 02:08:40 +0000 | [diff] [blame] | 403 | int show_id(uint8_t *bios, int size, int force); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 404 | int read_romlayout(char *name); |
| 405 | int find_romentry(char *name); |
| 406 | int handle_romentries(uint8_t *buffer, uint8_t *content); |
| 407 | |
Uwe Hermann | ad216bf | 2009-04-24 16:17:41 +0000 | [diff] [blame] | 408 | /* cbtable.c */ |
Stefan Reinauer | e3f3e2e | 2008-01-18 15:33:10 +0000 | [diff] [blame] | 409 | int coreboot_init(void); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 410 | extern char *lb_part, *lb_vendor; |
| 411 | |
Carl-Daniel Hailfinger | 00f911e | 2007-10-15 21:44:47 +0000 | [diff] [blame] | 412 | /* spi.c */ |
Carl-Daniel Hailfinger | 1dfe0ff | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 413 | enum spi_controller { |
| 414 | SPI_CONTROLLER_NONE, |
| 415 | SPI_CONTROLLER_ICH7, |
| 416 | SPI_CONTROLLER_ICH9, |
| 417 | SPI_CONTROLLER_IT87XX, |
| 418 | SPI_CONTROLLER_SB600, |
| 419 | SPI_CONTROLLER_VIA, |
| 420 | SPI_CONTROLLER_WBSIO, |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 421 | SPI_CONTROLLER_FT2232, |
Carl-Daniel Hailfinger | 1dfe0ff | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 422 | SPI_CONTROLLER_DUMMY, |
| 423 | }; |
| 424 | extern enum spi_controller spi_controller; |
| 425 | extern void *spibar; |
Carl-Daniel Hailfinger | 42c5497 | 2008-05-15 03:19:49 +0000 | [diff] [blame] | 426 | int probe_spi_rdid(struct flashchip *flash); |
Rudolf Marek | 48a85e4 | 2008-06-30 21:45:17 +0000 | [diff] [blame] | 427 | int probe_spi_rdid4(struct flashchip *flash); |
Carl-Daniel Hailfinger | 14e50ac | 2008-11-28 01:25:00 +0000 | [diff] [blame] | 428 | int probe_spi_rems(struct flashchip *flash); |
Carl-Daniel Hailfinger | 42c5497 | 2008-05-15 03:19:49 +0000 | [diff] [blame] | 429 | int probe_spi_res(struct flashchip *flash); |
Uwe Hermann | 394131e | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 430 | int spi_command(unsigned int writecnt, unsigned int readcnt, |
| 431 | const unsigned char *writearr, unsigned char *readarr); |
Carl-Daniel Hailfinger | 4363439 | 2009-05-01 12:22:17 +0000 | [diff] [blame] | 432 | int spi_write_enable(void); |
| 433 | int spi_write_disable(void); |
Carl-Daniel Hailfinger | 6afb613 | 2008-11-03 00:02:11 +0000 | [diff] [blame] | 434 | int spi_chip_erase_60(struct flashchip *flash); |
Peter Stuge | fa8c550 | 2008-05-10 23:07:52 +0000 | [diff] [blame] | 435 | int spi_chip_erase_c7(struct flashchip *flash); |
Carl-Daniel Hailfinger | 598ec58 | 2008-11-18 00:41:02 +0000 | [diff] [blame] | 436 | int spi_chip_erase_60_c7(struct flashchip *flash); |
Stefan Reinauer | 424ed22 | 2008-10-29 22:13:20 +0000 | [diff] [blame] | 437 | int spi_chip_erase_d8(struct flashchip *flash); |
Carl-Daniel Hailfinger | 6afb613 | 2008-11-03 00:02:11 +0000 | [diff] [blame] | 438 | int spi_block_erase_52(const struct flashchip *flash, unsigned long addr); |
| 439 | int spi_block_erase_d8(const struct flashchip *flash, unsigned long addr); |
Carl-Daniel Hailfinger | 96930c3 | 2009-05-09 02:30:21 +0000 | [diff] [blame] | 440 | int spi_chip_write_1(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 8d49701 | 2009-05-09 02:34:18 +0000 | [diff] [blame] | 441 | int spi_chip_write_256(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 442 | int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 4363439 | 2009-05-01 12:22:17 +0000 | [diff] [blame] | 443 | uint8_t spi_read_status_register(void); |
Carl-Daniel Hailfinger | 598ec58 | 2008-11-18 00:41:02 +0000 | [diff] [blame] | 444 | int spi_disable_blockprotect(void); |
Carl-Daniel Hailfinger | bfe5b4a | 2008-05-13 23:03:12 +0000 | [diff] [blame] | 445 | void spi_byte_program(int address, uint8_t byte); |
Paul Fox | eb3acef | 2009-06-12 08:10:33 +0000 | [diff] [blame] | 446 | int spi_nbyte_program(int address, uint8_t *bytes, int len); |
Carl-Daniel Hailfinger | 598ec58 | 2008-11-18 00:41:02 +0000 | [diff] [blame] | 447 | int spi_nbyte_read(int address, uint8_t *bytes, int len); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 448 | int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); |
Peter Stuge | fd9217d | 2009-01-26 03:37:40 +0000 | [diff] [blame] | 449 | int spi_aai_write(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 3e9dbea | 2009-05-13 11:40:08 +0000 | [diff] [blame] | 450 | uint32_t spi_get_valid_read_addr(void); |
Carl-Daniel Hailfinger | e151499 | 2007-10-02 15:49:25 +0000 | [diff] [blame] | 451 | |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 452 | /* 82802ab.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 453 | int probe_82802ab(struct flashchip *flash); |
| 454 | int erase_82802ab(struct flashchip *flash); |
| 455 | int write_82802ab(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 456 | |
| 457 | /* am29f040b.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 458 | int probe_29f040b(struct flashchip *flash); |
| 459 | int erase_29f040b(struct flashchip *flash); |
| 460 | int write_29f040b(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 461 | |
Uwe Hermann | f983d9f | 2009-06-14 21:53:26 +0000 | [diff] [blame] | 462 | /* pm29f002.c */ |
| 463 | int write_pm29f002(struct flashchip *flash, uint8_t *buf); |
| 464 | |
Mats Erik Andersson | 44e1a19 | 2008-09-26 13:19:02 +0000 | [diff] [blame] | 465 | /* en29f002a.c */ |
| 466 | int probe_en29f002a(struct flashchip *flash); |
| 467 | int erase_en29f002a(struct flashchip *flash); |
| 468 | int write_en29f002a(struct flashchip *flash, uint8_t *buf); |
| 469 | |
Dominik Geyer | b46acba | 2008-05-16 12:55:55 +0000 | [diff] [blame] | 470 | /* ichspi.c */ |
Carl-Daniel Hailfinger | 4363439 | 2009-05-01 12:22:17 +0000 | [diff] [blame] | 471 | int ich_init_opcodes(void); |
Uwe Hermann | 394131e | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 472 | int ich_spi_command(unsigned int writecnt, unsigned int readcnt, |
| 473 | const unsigned char *writearr, unsigned char *readarr); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 474 | int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 96930c3 | 2009-05-09 02:30:21 +0000 | [diff] [blame] | 475 | int ich_spi_write_256(struct flashchip *flash, uint8_t * buf); |
Dominik Geyer | b46acba | 2008-05-16 12:55:55 +0000 | [diff] [blame] | 476 | |
Carl-Daniel Hailfinger | bfe5b4a | 2008-05-13 23:03:12 +0000 | [diff] [blame] | 477 | /* it87spi.c */ |
| 478 | extern uint16_t it8716f_flashport; |
Carl-Daniel Hailfinger | 24c1a16 | 2009-05-25 23:26:50 +0000 | [diff] [blame] | 479 | void enter_conf_mode_ite(uint16_t port); |
| 480 | void exit_conf_mode_ite(uint16_t port); |
Carl-Daniel Hailfinger | b8afecd | 2009-05-31 18:00:57 +0000 | [diff] [blame] | 481 | int it87spi_init(void); |
Dominik Geyer | b46acba | 2008-05-16 12:55:55 +0000 | [diff] [blame] | 482 | int it87xx_probe_spi_flash(const char *name); |
Uwe Hermann | 394131e | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 483 | int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt, |
| 484 | const unsigned char *writearr, unsigned char *readarr); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 485 | int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 96930c3 | 2009-05-09 02:30:21 +0000 | [diff] [blame] | 486 | int it8716f_spi_chip_write_1(struct flashchip *flash, uint8_t *buf); |
| 487 | int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | bfe5b4a | 2008-05-13 23:03:12 +0000 | [diff] [blame] | 488 | |
Jason Wang | a3f04be | 2008-11-28 21:36:51 +0000 | [diff] [blame] | 489 | /* sb600spi.c */ |
| 490 | int sb600_spi_command(unsigned int writecnt, unsigned int readcnt, |
| 491 | const unsigned char *writearr, unsigned char *readarr); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 492 | int sb600_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 96930c3 | 2009-05-09 02:30:21 +0000 | [diff] [blame] | 493 | int sb600_spi_write_1(struct flashchip *flash, uint8_t *buf); |
Jason Wang | a3f04be | 2008-11-28 21:36:51 +0000 | [diff] [blame] | 494 | uint8_t sb600_read_status_register(void); |
Carl-Daniel Hailfinger | 78185dc | 2009-05-17 15:49:24 +0000 | [diff] [blame] | 495 | extern uint8_t *sb600_spibar; |
Jason Wang | a3f04be | 2008-11-28 21:36:51 +0000 | [diff] [blame] | 496 | |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 497 | /* jedec.c */ |
Carl-Daniel Hailfinger | a758f51 | 2008-05-14 12:03:06 +0000 | [diff] [blame] | 498 | uint8_t oddparity(uint8_t val); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 499 | void toggle_ready_jedec(chipaddr dst); |
| 500 | void data_polling_jedec(chipaddr dst, uint8_t data); |
| 501 | void unprotect_jedec(chipaddr bios); |
| 502 | void protect_jedec(chipaddr bios); |
| 503 | int write_byte_program_jedec(chipaddr bios, uint8_t *src, |
| 504 | chipaddr dst); |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 505 | int probe_jedec(struct flashchip *flash); |
| 506 | int erase_chip_jedec(struct flashchip *flash); |
| 507 | int write_jedec(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 30f7cb2 | 2009-06-15 17:23:36 +0000 | [diff] [blame] | 508 | int erase_sector_jedec(struct flashchip *flash, unsigned int page, int pagesize); |
| 509 | int erase_block_jedec(struct flashchip *flash, unsigned int page, int blocksize); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 510 | int write_sector_jedec(chipaddr bios, uint8_t *src, |
| 511 | chipaddr dst, unsigned int page_size); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 512 | |
Peter Stuge | af8ffac | 2009-01-26 06:42:02 +0000 | [diff] [blame] | 513 | /* m29f002.c */ |
| 514 | int erase_m29f002(struct flashchip *flash); |
| 515 | int write_m29f002t(struct flashchip *flash, uint8_t *buf); |
| 516 | int write_m29f002b(struct flashchip *flash, uint8_t *buf); |
| 517 | |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 518 | /* m29f400bt.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 519 | int probe_m29f400bt(struct flashchip *flash); |
| 520 | int erase_m29f400bt(struct flashchip *flash); |
Carl-Daniel Hailfinger | 30f7cb2 | 2009-06-15 17:23:36 +0000 | [diff] [blame] | 521 | int block_erase_m29f400bt(struct flashchip *flash, int start, int len); |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 522 | int write_m29f400bt(struct flashchip *flash, uint8_t *buf); |
Stefan Reinauer | e3f3e2e | 2008-01-18 15:33:10 +0000 | [diff] [blame] | 523 | int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 524 | void toggle_ready_m29f400bt(chipaddr dst); |
| 525 | void data_polling_m29f400bt(chipaddr dst, uint8_t data); |
| 526 | void protect_m29f400bt(chipaddr bios); |
| 527 | void write_page_m29f400bt(chipaddr bios, uint8_t *src, |
| 528 | chipaddr dst, int page_size); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 529 | |
| 530 | /* mx29f002.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 531 | int probe_29f002(struct flashchip *flash); |
| 532 | int erase_29f002(struct flashchip *flash); |
| 533 | int write_29f002(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 534 | |
Nikolay Petukhov | 4784c47 | 2008-05-17 01:08:58 +0000 | [diff] [blame] | 535 | /* pm49fl00x.c */ |
| 536 | int probe_49fl00x(struct flashchip *flash); |
| 537 | int erase_49fl00x(struct flashchip *flash); |
| 538 | int write_49fl00x(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 539 | |
| 540 | /* sharplhf00l04.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 541 | int probe_lhf00l04(struct flashchip *flash); |
| 542 | int erase_lhf00l04(struct flashchip *flash); |
| 543 | int write_lhf00l04(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 544 | void toggle_ready_lhf00l04(chipaddr dst); |
| 545 | void data_polling_lhf00l04(chipaddr dst, uint8_t data); |
| 546 | void protect_lhf00l04(chipaddr bios); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 547 | |
| 548 | /* sst28sf040.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 549 | int probe_28sf040(struct flashchip *flash); |
| 550 | int erase_28sf040(struct flashchip *flash); |
| 551 | int write_28sf040(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 552 | |
| 553 | /* sst39sf020.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 554 | int probe_39sf020(struct flashchip *flash); |
| 555 | int write_39sf020(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 556 | |
| 557 | /* sst49lf040.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 558 | int erase_49lf040(struct flashchip *flash); |
| 559 | int write_49lf040(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 560 | |
| 561 | /* sst49lfxxxc.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 562 | int probe_49lfxxxc(struct flashchip *flash); |
| 563 | int erase_49lfxxxc(struct flashchip *flash); |
| 564 | int write_49lfxxxc(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 565 | |
| 566 | /* sst_fwhub.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 567 | int probe_sst_fwhub(struct flashchip *flash); |
| 568 | int erase_sst_fwhub(struct flashchip *flash); |
| 569 | int write_sst_fwhub(struct flashchip *flash, uint8_t *buf); |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 570 | |
Peter Stuge | cce2682 | 2008-07-21 17:48:40 +0000 | [diff] [blame] | 571 | /* w39v040c.c */ |
| 572 | int probe_w39v040c(struct flashchip *flash); |
| 573 | int erase_w39v040c(struct flashchip *flash); |
| 574 | int write_w39v040c(struct flashchip *flash, uint8_t *buf); |
| 575 | |
Stefan Reinauer | ac37897 | 2008-03-17 22:59:40 +0000 | [diff] [blame] | 576 | /* w39V080fa.c */ |
| 577 | int probe_winbond_fwhub(struct flashchip *flash); |
| 578 | int erase_winbond_fwhub(struct flashchip *flash); |
| 579 | int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf); |
| 580 | |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 581 | /* w29ee011.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 582 | int probe_w29ee011(struct flashchip *flash); |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 583 | |
Uwe Hermann | 0846f89 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 584 | /* w49f002u.c */ |
Uwe Hermann | a0cc53d | 2007-09-09 20:24:29 +0000 | [diff] [blame] | 585 | int write_49f002(struct flashchip *flash, uint8_t *buf); |
Stefan Reinauer | ff4f197 | 2007-05-24 08:48:10 +0000 | [diff] [blame] | 586 | |
Peter Stuge | bf196e9 | 2009-01-26 03:08:45 +0000 | [diff] [blame] | 587 | /* wbsio_spi.c */ |
| 588 | int wbsio_check_for_spi(const char *name); |
Uwe Hermann | d1129ac | 2009-05-28 15:07:42 +0000 | [diff] [blame] | 589 | int wbsio_spi_command(unsigned int writecnt, unsigned int readcnt, |
| 590 | const unsigned char *writearr, unsigned char *readarr); |
Carl-Daniel Hailfinger | cbf563c | 2009-06-16 08:55:44 +0000 | [diff] [blame] | 591 | int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 96930c3 | 2009-05-09 02:30:21 +0000 | [diff] [blame] | 592 | int wbsio_spi_write_1(struct flashchip *flash, uint8_t *buf); |
Peter Stuge | bf196e9 | 2009-01-26 03:08:45 +0000 | [diff] [blame] | 593 | |
Claus Gindhart | a7b3551 | 2008-04-28 17:51:09 +0000 | [diff] [blame] | 594 | /* stm50flw0x0x.c */ |
| 595 | int probe_stm50flw0x0x(struct flashchip *flash); |
| 596 | int erase_stm50flw0x0x(struct flashchip *flash); |
| 597 | int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf); |
Dominik Geyer | b46acba | 2008-05-16 12:55:55 +0000 | [diff] [blame] | 598 | |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 599 | #endif /* !__FLASH_H__ */ |