stepan | 5c3f138 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 1 | /* |
uwe | b25f1ea | 2007-08-29 17:52:32 +0000 | [diff] [blame] | 2 | * This file is part of the flashrom project. |
stepan | 5c3f138 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 3 | * |
uwe | 555dd97 | 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> |
stepan | 6d42c0f | 2009-08-12 09:27:45 +0000 | [diff] [blame] | 6 | * Copyright (C) 2005-2009 coresystems GmbH |
hailfinger | 77c5d93 | 2009-06-15 12:10:57 +0000 | [diff] [blame] | 7 | * Copyright (C) 2006-2009 Carl-Daniel Hailfinger |
stepan | 5c3f138 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 8 | * |
uwe | b25f1ea | 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. |
stepan | 5c3f138 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 13 | * |
uwe | b25f1ea | 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. |
stepan | 5c3f138 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
rminnich | 8d3ff91 | 2003-10-25 17:01:29 +0000 | [diff] [blame] | 20 | #ifndef __FLASH_H__ |
| 21 | #define __FLASH_H__ 1 |
| 22 | |
Edward O'Callaghan | 407a2ef | 2020-12-03 16:24:54 +1100 | [diff] [blame] | 23 | #include "platform.h" |
| 24 | |
Edward O'Callaghan | 7b18871 | 2019-09-09 15:07:14 +1000 | [diff] [blame] | 25 | #include <inttypes.h> |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 26 | #include <stdio.h> |
ollie | 6a60099 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 27 | #include <stdint.h> |
hailfinger | d43a4e3 | 2010-06-03 00:49:50 +0000 | [diff] [blame] | 28 | #include <stddef.h> |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 29 | #include <stdarg.h> |
Edward O'Callaghan | a74ffcd | 2019-06-17 14:59:55 +1000 | [diff] [blame] | 30 | #include <stdbool.h> |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 31 | #if IS_WINDOWS |
oxygene | 3ad3b33 | 2010-01-06 22:14:39 +0000 | [diff] [blame] | 32 | #include <windows.h> |
| 33 | #undef min |
| 34 | #undef max |
| 35 | #endif |
hailfinger | e1f062f | 2008-05-22 13:22:45 +0000 | [diff] [blame] | 36 | |
Edward O'Callaghan | f0e8077 | 2020-12-04 15:36:04 +1100 | [diff] [blame] | 37 | #include "libflashrom.h" |
Edward O'Callaghan | 53ff4ad | 2020-12-16 20:36:28 +1100 | [diff] [blame] | 38 | #include "layout.h" |
| 39 | |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 40 | #define KiB (1024) |
| 41 | #define MiB (1024 * KiB) |
| 42 | |
| 43 | /* Assumes `n` and `a` are at most 64-bit wide (to avoid typeof() operator). */ |
| 44 | #define ALIGN_DOWN(n, a) ((n) & ~((uint64_t)(a) - 1)) |
| 45 | |
Edward O'Callaghan | 8bc8b09 | 2020-12-04 15:31:56 +1100 | [diff] [blame] | 46 | struct flashrom_flashctx; |
| 47 | #define flashctx flashrom_flashctx /* TODO: Agree on a name and convert all occurences. */ |
hailfinger | f294fa2 | 2010-09-25 22:53:44 +0000 | [diff] [blame] | 48 | #define ERROR_PTR ((void*)-1) |
| 49 | |
hailfinger | ee9ee13 | 2010-10-08 00:37:55 +0000 | [diff] [blame] | 50 | /* Error codes */ |
Nikolai Artemiev | 1e0291b | 2020-04-15 10:29:26 +1000 | [diff] [blame] | 51 | #define ERROR_OOM -100 |
hailfinger | ee9ee13 | 2010-10-08 00:37:55 +0000 | [diff] [blame] | 52 | #define TIMEOUT_ERROR -101 |
| 53 | |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 54 | /* TODO: check using code for correct usage of types */ |
Kangheui Won | 4974cc1 | 2019-10-18 12:59:01 +1100 | [diff] [blame] | 55 | typedef uintptr_t chipaddr; |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 56 | #define PRIxPTR_WIDTH ((int)(sizeof(uintptr_t)*2)) |
Pavol Marko | ef4c6e8 | 2019-09-09 12:43:44 +0000 | [diff] [blame] | 57 | |
David Hendricks | 93784b4 | 2016-08-09 17:00:38 -0700 | [diff] [blame] | 58 | int register_shutdown(int (*function) (void *data), void *data); |
Edward O'Callaghan | a5cfb4d | 2020-09-07 16:26:42 +1000 | [diff] [blame] | 59 | void *programmer_map_flash_region(const char *descr, uintptr_t phys_addr, size_t len); |
uwe | abe92a5 | 2009-05-16 22:36:00 +0000 | [diff] [blame] | 60 | void programmer_unmap_flash_region(void *virt_addr, size_t len); |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 61 | void programmer_delay(unsigned int usecs); |
hailfinger | ba3761a | 2009-03-05 19:24:22 +0000 | [diff] [blame] | 62 | |
uwe | 16f9909 | 2008-03-12 11:54:51 +0000 | [diff] [blame] | 63 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| 64 | |
hailfinger | 4016746 | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 65 | enum chipbustype { |
hailfinger | e1e41ea | 2011-07-27 07:13:06 +0000 | [diff] [blame] | 66 | BUS_NONE = 0, |
| 67 | BUS_PARALLEL = 1 << 0, |
| 68 | BUS_LPC = 1 << 1, |
| 69 | BUS_FWH = 1 << 2, |
| 70 | BUS_SPI = 1 << 3, |
hailfinger | fe7cd9e | 2011-11-04 21:35:26 +0000 | [diff] [blame] | 71 | BUS_PROG = 1 << 4, |
hailfinger | e1e41ea | 2011-07-27 07:13:06 +0000 | [diff] [blame] | 72 | BUS_NONSPI = BUS_PARALLEL | BUS_LPC | BUS_FWH, |
hailfinger | 4016746 | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 73 | }; |
| 74 | |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 75 | /* |
Edward O'Callaghan | f78fffc | 2019-06-17 12:40:12 +1000 | [diff] [blame] | 76 | * The following enum defines possible write granularities of flash chips. These tend to reflect the properties |
| 77 | * of the actual hardware not necesserily the write function(s) defined by the respective struct flashchip. |
| 78 | * The latter might (and should) be more precisely specified, e.g. they might bail out early if their execution |
| 79 | * would result in undefined chip contents. |
| 80 | */ |
| 81 | enum write_granularity { |
| 82 | /* We assume 256 byte granularity by default. */ |
| 83 | write_gran_256bytes = 0,/* If less than 256 bytes are written, the unwritten bytes are undefined. */ |
| 84 | write_gran_1bit, /* Each bit can be cleared individually. */ |
| 85 | write_gran_1byte, /* A byte can be written once. Further writes to an already written byte cause |
| 86 | * its contents to be either undefined or to stay unchanged. */ |
| 87 | write_gran_128bytes, /* If less than 128 bytes are written, the unwritten bytes are undefined. */ |
| 88 | write_gran_264bytes, /* If less than 264 bytes are written, the unwritten bytes are undefined. */ |
| 89 | write_gran_512bytes, /* If less than 512 bytes are written, the unwritten bytes are undefined. */ |
| 90 | write_gran_528bytes, /* If less than 528 bytes are written, the unwritten bytes are undefined. */ |
| 91 | write_gran_1024bytes, /* If less than 1024 bytes are written, the unwritten bytes are undefined. */ |
| 92 | write_gran_1056bytes, /* If less than 1056 bytes are written, the unwritten bytes are undefined. */ |
| 93 | write_gran_1byte_implicit_erase, /* EEPROMs and other chips with implicit erase and 1-byte writes. */ |
| 94 | }; |
| 95 | |
| 96 | /* |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 97 | * How many different contiguous runs of erase blocks with one size each do |
| 98 | * we have for a given erase function? |
| 99 | */ |
| 100 | #define NUM_ERASEREGIONS 5 |
| 101 | |
| 102 | /* |
| 103 | * How many different erase functions do we have per chip? |
Edward O'Callaghan | fadf15b | 2019-10-10 13:46:39 +1100 | [diff] [blame] | 104 | * Macronix MX25L25635F has 8 different functions. |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 105 | */ |
Edward O'Callaghan | fadf15b | 2019-10-10 13:46:39 +1100 | [diff] [blame] | 106 | #define NUM_ERASEFUNCTIONS 8 |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 107 | |
Nikolai Artemiev | 55f7a33 | 2020-11-05 13:54:27 +1100 | [diff] [blame] | 108 | #define MAX_CHIP_RESTORE_FUNCTIONS 4 |
| 109 | |
Edward O'Callaghan | f78fffc | 2019-06-17 12:40:12 +1000 | [diff] [blame] | 110 | /* Feature bits used for non-SPI only */ |
hailfinger | 80dea31 | 2010-01-09 03:15:50 +0000 | [diff] [blame] | 111 | #define FEATURE_REGISTERMAP (1 << 0) |
snelson | c685534 | 2010-01-28 23:55:12 +0000 | [diff] [blame] | 112 | #define FEATURE_LONG_RESET (0 << 4) |
| 113 | #define FEATURE_SHORT_RESET (1 << 4) |
| 114 | #define FEATURE_EITHER_RESET FEATURE_LONG_RESET |
hailfinger | b07dc97 | 2010-10-20 21:13:19 +0000 | [diff] [blame] | 115 | #define FEATURE_RESET_MASK (FEATURE_LONG_RESET | FEATURE_SHORT_RESET) |
hailfinger | 80dea31 | 2010-01-09 03:15:50 +0000 | [diff] [blame] | 116 | #define FEATURE_ADDR_FULL (0 << 2) |
| 117 | #define FEATURE_ADDR_MASK (3 << 2) |
snelson | c685534 | 2010-01-28 23:55:12 +0000 | [diff] [blame] | 118 | #define FEATURE_ADDR_2AA (1 << 2) |
| 119 | #define FEATURE_ADDR_AAA (2 << 2) |
mkarcher | 9ded5fe | 2010-04-03 10:27:08 +0000 | [diff] [blame] | 120 | #define FEATURE_ADDR_SHIFTED (1 << 5) |
Edward O'Callaghan | f78fffc | 2019-06-17 12:40:12 +1000 | [diff] [blame] | 121 | /* Feature bits used for SPI only */ |
hailfinger | c33d473 | 2010-07-29 13:09:18 +0000 | [diff] [blame] | 122 | #define FEATURE_WRSR_EWSR (1 << 6) |
| 123 | #define FEATURE_WRSR_WREN (1 << 7) |
| 124 | #define FEATURE_WRSR_EITHER (FEATURE_WRSR_EWSR | FEATURE_WRSR_WREN) |
David Hendricks | ff55cf6 | 2016-08-30 11:22:31 -0700 | [diff] [blame] | 125 | #define FEATURE_OTP (1 << 8) |
Edward O'Callaghan | 96a4f54 | 2020-06-29 16:51:24 +1000 | [diff] [blame] | 126 | #define FEATURE_QPI (1 << 9) |
| 127 | #define FEATURE_4BA_ENTER (1 << 10) /**< Can enter/exit 4BA mode with instructions 0xb7/0xe9 w/o WREN */ |
| 128 | #define FEATURE_4BA_ENTER_WREN (1 << 11) /**< Can enter/exit 4BA mode with instructions 0xb7/0xe9 after WREN */ |
| 129 | #define FEATURE_4BA_ENTER_EAR7 (1 << 12) /**< Can enter/exit 4BA mode by setting bit7 of the ext addr reg */ |
Edward O'Callaghan | 2748621 | 2019-07-26 21:59:55 +1000 | [diff] [blame] | 130 | #define FEATURE_4BA_EXT_ADDR (1 << 13) /**< Regular 3-byte operations can be used by writing the most |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 131 | significant address byte into an extended address register. */ |
Edward O'Callaghan | 2748621 | 2019-07-26 21:59:55 +1000 | [diff] [blame] | 132 | #define FEATURE_4BA_READ (1 << 14) /**< Native 4BA read instruction (0x13) is supported. */ |
| 133 | #define FEATURE_4BA_FAST_READ (1 << 15) /**< Native 4BA fast read instruction (0x0c) is supported. */ |
| 134 | #define FEATURE_4BA_WRITE (1 << 16) /**< Native 4BA byte program (0x12) is supported. */ |
Edward O'Callaghan | 3d0cbd4 | 2019-06-24 15:37:01 +1000 | [diff] [blame] | 135 | /* 4BA Shorthands */ |
| 136 | #define FEATURE_4BA_NATIVE (FEATURE_4BA_READ | FEATURE_4BA_FAST_READ | FEATURE_4BA_WRITE) |
| 137 | #define FEATURE_4BA (FEATURE_4BA_ENTER | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE) |
| 138 | #define FEATURE_4BA_WREN (FEATURE_4BA_ENTER_WREN | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE) |
Edward O'Callaghan | 96a4f54 | 2020-06-29 16:51:24 +1000 | [diff] [blame] | 139 | #define FEATURE_4BA_EAR7 (FEATURE_4BA_ENTER_EAR7 | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE) |
| 140 | /* |
| 141 | * Most flash chips are erased to ones and programmed to zeros. However, some |
| 142 | * other flash chips, such as the ENE KB9012 internal flash, work the opposite way. |
| 143 | */ |
| 144 | #define FEATURE_ERASED_ZERO (1 << 17) |
| 145 | #define FEATURE_NO_ERASE (1 << 18) |
Simon Glass | 4c21413 | 2013-07-16 10:09:28 -0600 | [diff] [blame] | 146 | |
Edward O'Callaghan | ef783e3 | 2020-08-10 19:54:27 +1000 | [diff] [blame] | 147 | #define ERASED_VALUE(flash) (((flash)->chip->feature_bits & FEATURE_ERASED_ZERO) ? 0x00 : 0xff) |
| 148 | #define UNERASED_VALUE(flash) (((flash)->chip->feature_bits & FEATURE_ERASED_ZERO) ? 0xff : 0x00) |
| 149 | |
David Hendricks | 8c08421 | 2015-11-17 22:29:36 -0800 | [diff] [blame] | 150 | struct voltage_range { |
| 151 | uint16_t min, max; |
| 152 | }; |
| 153 | |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 154 | enum test_state { |
| 155 | OK = 0, |
| 156 | NT = 1, /* Not tested */ |
| 157 | BAD, /* Known to not work */ |
| 158 | DEP, /* Support depends on configuration (e.g. Intel flash descriptor) */ |
| 159 | NA, /* Not applicable (e.g. write support on ROM chips) */ |
| 160 | }; |
| 161 | |
Alan Green | 5447a45 | 2019-07-30 13:57:52 +1000 | [diff] [blame] | 162 | #define TEST_UNTESTED (struct tested){ .probe = NT, .read = NT, .erase = NT, .write = NT } |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 163 | |
Alan Green | 5447a45 | 2019-07-30 13:57:52 +1000 | [diff] [blame] | 164 | #define TEST_OK_PROBE (struct tested){ .probe = OK, .read = NT, .erase = NT, .write = NT } |
| 165 | #define TEST_OK_PR (struct tested){ .probe = OK, .read = OK, .erase = NT, .write = NT } |
| 166 | #define TEST_OK_PRE (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = NT } |
| 167 | #define TEST_OK_PREW (struct tested){ .probe = OK, .read = OK, .erase = OK, .write = OK } |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 168 | |
Alan Green | 5447a45 | 2019-07-30 13:57:52 +1000 | [diff] [blame] | 169 | #define TEST_BAD_PROBE (struct tested){ .probe = BAD, .read = NT, .erase = NT, .write = NT } |
| 170 | #define TEST_BAD_PR (struct tested){ .probe = BAD, .read = BAD, .erase = NT, .write = NT } |
| 171 | #define TEST_BAD_PRE (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = NT } |
| 172 | #define TEST_BAD_PREW (struct tested){ .probe = BAD, .read = BAD, .erase = BAD, .write = BAD } |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 173 | |
Nikolai Artemiev | a66b6cd | 2020-08-31 18:07:13 +1000 | [diff] [blame] | 174 | typedef int (erasefunc_t)(struct flashctx *flash, unsigned int addr, unsigned int blocklen); |
| 175 | |
rminnich | 8d3ff91 | 2003-10-25 17:01:29 +0000 | [diff] [blame] | 176 | struct flashchip { |
uwe | dfcd15f | 2008-03-14 23:55:58 +0000 | [diff] [blame] | 177 | const char *vendor; |
uwe | 6ed6d95 | 2007-12-04 21:49:06 +0000 | [diff] [blame] | 178 | const char *name; |
hailfinger | 4016746 | 2009-05-31 17:57:34 +0000 | [diff] [blame] | 179 | |
| 180 | enum chipbustype bustype; |
| 181 | |
uwe | fa98ca1 | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 182 | /* |
| 183 | * With 32bit manufacture_id and model_id we can cover IDs up to |
hailfinger | 428f201 | 2007-12-31 01:49:00 +0000 | [diff] [blame] | 184 | * (including) the 4th bank of JEDEC JEP106W Standard Manufacturer's |
| 185 | * Identification code. |
| 186 | */ |
| 187 | uint32_t manufacture_id; |
| 188 | uint32_t model_id; |
rminnich | 8d3ff91 | 2003-10-25 17:01:29 +0000 | [diff] [blame] | 189 | |
stefanct | 707f13b | 2011-05-19 02:58:17 +0000 | [diff] [blame] | 190 | /* Total chip size in kilobytes */ |
stefanct | c5eb8a9 | 2011-11-23 09:13:48 +0000 | [diff] [blame] | 191 | unsigned int total_size; |
stefanct | 707f13b | 2011-05-19 02:58:17 +0000 | [diff] [blame] | 192 | /* Chip page size in bytes */ |
stefanct | c5eb8a9 | 2011-11-23 09:13:48 +0000 | [diff] [blame] | 193 | unsigned int page_size; |
snelson | 63133f9 | 2010-01-04 17:15:23 +0000 | [diff] [blame] | 194 | int feature_bits; |
rminnich | 8d3ff91 | 2003-10-25 17:01:29 +0000 | [diff] [blame] | 195 | |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 196 | /* Indicate how well flashrom supports different operations of this flash chip. */ |
| 197 | struct tested { |
| 198 | enum test_state probe; |
| 199 | enum test_state read; |
| 200 | enum test_state erase; |
| 201 | enum test_state write; |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 202 | } tested; |
stuge | 9cd64bd | 2008-05-03 04:34:37 +0000 | [diff] [blame] | 203 | |
Edward O'Callaghan | cc1d0c9 | 2019-02-24 15:35:07 +1100 | [diff] [blame] | 204 | /* |
| 205 | * Group chips that have common command sets. This should ensure that |
| 206 | * no chip gets confused by a probing command for a very different class |
| 207 | * of chips. |
| 208 | */ |
| 209 | enum { |
| 210 | /* SPI25 is very common. Keep it at zero so we don't have |
| 211 | to specify it for each and every chip in the database.*/ |
| 212 | SPI25 = 0, |
Edward O'Callaghan | a9c8100 | 2019-02-24 15:54:40 +1100 | [diff] [blame] | 213 | SPI_EDI = 1, |
Edward O'Callaghan | cc1d0c9 | 2019-02-24 15:35:07 +1100 | [diff] [blame] | 214 | } spi_cmd_set; |
| 215 | |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 216 | int (*probe) (struct flashctx *flash); |
hailfinger | d5b3592 | 2009-06-03 14:46:22 +0000 | [diff] [blame] | 217 | |
stefanct | c5eb8a9 | 2011-11-23 09:13:48 +0000 | [diff] [blame] | 218 | /* Delay after "enter/exit ID mode" commands in microseconds. |
| 219 | * NB: negative values have special meanings, see TIMING_* below. |
| 220 | */ |
| 221 | signed int probe_timing; |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 222 | |
| 223 | /* |
hailfinger | c4fac58 | 2009-12-22 13:04:53 +0000 | [diff] [blame] | 224 | * Erase blocks and associated erase function. Any chip erase function |
| 225 | * is stored as chip-sized virtual block together with said function. |
stefanct | 707f13b | 2011-05-19 02:58:17 +0000 | [diff] [blame] | 226 | * The first one that fits will be chosen. There is currently no way to |
| 227 | * influence that behaviour. For testing just comment out the other |
| 228 | * elements or set the function pointer to NULL. |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 229 | */ |
| 230 | struct block_eraser { |
Patrick Georgi | ac3423f | 2017-02-03 20:58:06 +0100 | [diff] [blame] | 231 | struct eraseblock { |
stefanct | 312d9ff | 2011-06-12 19:47:55 +0000 | [diff] [blame] | 232 | unsigned int size; /* Eraseblock size in bytes */ |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 233 | unsigned int count; /* Number of contiguous blocks with that size */ |
| 234 | } eraseblocks[NUM_ERASEREGIONS]; |
stefanct | 9e6b98a | 2011-05-28 02:37:14 +0000 | [diff] [blame] | 235 | /* a block_erase function should try to erase one block of size |
| 236 | * 'blocklen' at address 'blockaddr' and return 0 on success. */ |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 237 | int (*block_erase) (struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen); |
hailfinger | 7df2136 | 2009-09-05 02:30:58 +0000 | [diff] [blame] | 238 | } block_erasers[NUM_ERASEFUNCTIONS]; |
| 239 | |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 240 | int (*printlock) (struct flashctx *flash); |
| 241 | int (*unlock) (struct flashctx *flash); |
Patrick Georgi | ab8353e | 2017-02-03 18:32:01 +0100 | [diff] [blame] | 242 | int (*write) (struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 243 | int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); |
| 244 | uint8_t (*read_status) (const struct flashctx *flash); |
| 245 | int (*write_status) (const struct flashctx *flash, int status); |
Duncan Laurie | 25a4ca2 | 2019-04-25 12:08:52 -0700 | [diff] [blame] | 246 | int (*check_access) (const struct flashctx *flash, unsigned int start, unsigned int len, int read); |
David Hendricks | 8c08421 | 2015-11-17 22:29:36 -0800 | [diff] [blame] | 247 | struct voltage_range voltage; |
Edward O'Callaghan | 10e63d9 | 2019-06-17 14:12:52 +1000 | [diff] [blame] | 248 | enum write_granularity gran; |
Edward O'Callaghan | 2d00129 | 2019-06-26 14:35:03 +1000 | [diff] [blame] | 249 | |
| 250 | /* SPI specific options (TODO: Make it a union in case other bustypes get specific options.) */ |
| 251 | uint8_t wrea_override; /**< override opcode for write extended address register */ |
| 252 | |
David Hendricks | f7924d1 | 2010-06-10 21:26:44 -0700 | [diff] [blame] | 253 | struct wp *wp; |
rminnich | 8d3ff91 | 2003-10-25 17:01:29 +0000 | [diff] [blame] | 254 | }; |
| 255 | |
Nikolai Artemiev | 55f7a33 | 2020-11-05 13:54:27 +1100 | [diff] [blame] | 256 | typedef int (*chip_restore_fn_cb_t)(struct flashctx *flash, uint8_t status); |
| 257 | |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 258 | /* struct flashctx must always contain struct flashchip at the beginning. */ |
Edward O'Callaghan | 8bc8b09 | 2020-12-04 15:31:56 +1100 | [diff] [blame] | 259 | struct flashrom_flashctx { |
Patrick Georgi | f3fa299 | 2017-02-02 16:24:44 +0100 | [diff] [blame] | 260 | struct flashchip *chip; |
Edward O'Callaghan | 79357b3 | 2020-08-02 01:24:58 +1000 | [diff] [blame] | 261 | /* FIXME: The memory mappings should be saved in a more structured way. */ |
| 262 | /* The physical_* fields store the respective addresses in the physical address space of the CPU. */ |
| 263 | uintptr_t physical_memory; |
| 264 | /* The virtual_* fields store where the respective physical address is mapped into flashrom's address |
| 265 | * space. A value equivalent to (chipaddr)ERROR_PTR indicates an invalid mapping (or none at all). */ |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 266 | chipaddr virtual_memory; |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 267 | /* Some flash devices have an additional register space; semantics are like above. */ |
Edward O'Callaghan | 79357b3 | 2020-08-02 01:24:58 +1000 | [diff] [blame] | 268 | uintptr_t physical_registers; |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 269 | chipaddr virtual_registers; |
Edward O'Callaghan | 20596a8 | 2019-06-13 14:47:03 +1000 | [diff] [blame] | 270 | struct registered_master *mst; |
Edward O'Callaghan | 53ff4ad | 2020-12-16 20:36:28 +1100 | [diff] [blame] | 271 | const struct flashrom_layout *layout; |
| 272 | struct single_layout fallback_layout; |
Edward O'Callaghan | 2c67927 | 2020-09-23 22:41:01 +1000 | [diff] [blame] | 273 | struct { |
| 274 | bool force; |
| 275 | bool force_boardmismatch; |
| 276 | bool verify_after_write; |
| 277 | bool verify_whole_chip; |
Daniel Campello | 57dd072 | 2021-04-08 13:28:38 -0600 | [diff] [blame] | 278 | bool do_not_diff; |
Edward O'Callaghan | 2c67927 | 2020-09-23 22:41:01 +1000 | [diff] [blame] | 279 | } flags; |
Edward O'Callaghan | a74ffcd | 2019-06-17 14:59:55 +1000 | [diff] [blame] | 280 | /* We cache the state of the extended address register (highest byte |
| 281 | * of a 4BA for 3BA instructions) and the state of the 4BA mode here. |
| 282 | * If possible, we enter 4BA mode early. If that fails, we make use |
| 283 | * of the extended address register. |
| 284 | */ |
| 285 | int address_high_byte; |
| 286 | bool in_4ba_mode; |
Nikolai Artemiev | 55f7a33 | 2020-11-05 13:54:27 +1100 | [diff] [blame] | 287 | |
| 288 | int chip_restore_fn_count; |
| 289 | struct chip_restore_func_data { |
| 290 | chip_restore_fn_cb_t func; |
| 291 | uint8_t status; |
| 292 | } chip_restore_fn[MAX_CHIP_RESTORE_FUNCTIONS]; |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 293 | }; |
| 294 | |
hailfinger | d5b3592 | 2009-06-03 14:46:22 +0000 | [diff] [blame] | 295 | /* Timing used in probe routines. ZERO is -2 to differentiate between an unset |
| 296 | * field and zero delay. |
Simon Glass | 8dc8273 | 2013-07-16 10:13:51 -0600 | [diff] [blame] | 297 | * |
hailfinger | d5b3592 | 2009-06-03 14:46:22 +0000 | [diff] [blame] | 298 | * SPI devices will always have zero delay and ignore this field. |
| 299 | */ |
| 300 | #define TIMING_FIXME -1 |
| 301 | /* this is intentionally same value as fixme */ |
| 302 | #define TIMING_IGNORED -1 |
| 303 | #define TIMING_ZERO -2 |
| 304 | |
hailfinger | 48ed3e2 | 2011-05-04 00:39:50 +0000 | [diff] [blame] | 305 | extern const struct flashchip flashchips[]; |
Edward O'Callaghan | 6240c85 | 2019-07-02 15:49:58 +1000 | [diff] [blame] | 306 | extern const unsigned int flashchips_size; |
| 307 | |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 308 | void chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr); |
| 309 | void chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr); |
| 310 | void chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr); |
Stuart langley | c98e43f | 2020-03-26 20:27:36 +1100 | [diff] [blame] | 311 | void chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len); |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 312 | uint8_t chip_readb(const struct flashctx *flash, const chipaddr addr); |
| 313 | uint16_t chip_readw(const struct flashctx *flash, const chipaddr addr); |
| 314 | uint32_t chip_readl(const struct flashctx *flash, const chipaddr addr); |
| 315 | void chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len); |
| 316 | |
uwe | 884cc8b | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 317 | /* print.c */ |
Edward O'Callaghan | ab4993a | 2019-11-09 21:36:17 +1100 | [diff] [blame] | 318 | int print_supported(void); |
hailfinger | a50d60e | 2009-11-17 09:57:34 +0000 | [diff] [blame] | 319 | void print_supported_wiki(void); |
uwe | a3a82c9 | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 320 | |
Edward O'Callaghan | 8dd5792 | 2019-03-15 16:21:34 +1100 | [diff] [blame] | 321 | /* helpers.c */ |
| 322 | uint32_t address_to_bits(uint32_t addr); |
Edward O'Callaghan | 2fc166e | 2019-09-09 00:51:20 +1000 | [diff] [blame] | 323 | unsigned int bitcount(unsigned long a); |
Edward O'Callaghan | d2799ab | 2019-09-09 16:30:31 +1000 | [diff] [blame] | 324 | #undef MIN |
| 325 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
| 326 | #undef MAX |
| 327 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
Edward O'Callaghan | 8dd5792 | 2019-03-15 16:21:34 +1100 | [diff] [blame] | 328 | int max(int a, int b); |
Edward O'Callaghan | f78fffc | 2019-06-17 12:40:12 +1000 | [diff] [blame] | 329 | int min(int a, int b); |
Edward O'Callaghan | 8dd5792 | 2019-03-15 16:21:34 +1100 | [diff] [blame] | 330 | char *strcat_realloc(char *dest, const char *src); |
| 331 | void tolower_string(char *str); |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 332 | uint8_t reverse_byte(uint8_t x); |
| 333 | void reverse_bytes(uint8_t *dst, const uint8_t *src, size_t length); |
| 334 | #ifdef __MINGW32__ |
| 335 | char* strtok_r(char *str, const char *delim, char **nextp); |
| 336 | char *strndup(const char *str, size_t size); |
| 337 | #endif |
| 338 | #if defined(__DJGPP__) || (!defined(__LIBPAYLOAD__) && !defined(HAVE_STRNLEN)) |
| 339 | size_t strnlen(const char *str, size_t n); |
| 340 | #endif |
Edward O'Callaghan | 8dd5792 | 2019-03-15 16:21:34 +1100 | [diff] [blame] | 341 | |
uwe | 4529d20 | 2007-08-23 13:34:59 +0000 | [diff] [blame] | 342 | /* flashrom.c */ |
krause | 2eb7621 | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 343 | extern const char flashrom_version[]; |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 344 | extern const char *chip_to_probe; |
Edward O'Callaghan | f78fffc | 2019-06-17 12:40:12 +1000 | [diff] [blame] | 345 | char *flashbuses_to_text(enum chipbustype bustype); |
Edward O'Callaghan | 79357b3 | 2020-08-02 01:24:58 +1000 | [diff] [blame] | 346 | int map_flash(struct flashctx *flash); |
| 347 | void unmap_flash(struct flashctx *flash); |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 348 | int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); |
| 349 | int erase_flash(struct flashctx *flash); |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 350 | int probe_flash(struct registered_master *mst, int startchip, struct flashctx *fill_flash, int force); |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 351 | int read_flash_to_file(struct flashctx *flash, const char *filename); |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 352 | char *extract_param(const char *const *haystack, const char *needle, const char *delim); |
Edward O'Callaghan | 445b48b | 2020-08-13 12:25:17 +1000 | [diff] [blame] | 353 | int verify_range(struct flashctx *flash, const uint8_t *cmpbuf, unsigned int start, unsigned int len); |
hailfinger | 92cd8e3 | 2010-01-07 03:24:05 +0000 | [diff] [blame] | 354 | void print_version(void); |
Souvik Ghosh | 3c963a4 | 2016-07-19 18:48:15 -0700 | [diff] [blame] | 355 | void print_buildinfo(void); |
hailfinger | 74819ad | 2010-05-15 15:04:37 +0000 | [diff] [blame] | 356 | void print_banner(void); |
hailfinger | f79d171 | 2010-10-06 23:48:34 +0000 | [diff] [blame] | 357 | void list_programmers_linebreak(int startcol, int cols, int paren); |
hailfinger | 92cd8e3 | 2010-01-07 03:24:05 +0000 | [diff] [blame] | 358 | int selfcheck(void); |
Edward O'Callaghan | f78fffc | 2019-06-17 12:40:12 +1000 | [diff] [blame] | 359 | int read_buf_from_file(unsigned char *buf, unsigned long size, const char *filename); |
Edward O'Callaghan | b2257cc | 2020-07-25 22:19:47 +1000 | [diff] [blame] | 360 | int write_buf_to_file(const unsigned char *buf, unsigned long size, const char *filename); |
Edward O'Callaghan | a0176ff | 2020-08-18 15:49:23 +1000 | [diff] [blame] | 361 | int prepare_flash_access(struct flashctx *, bool read_it, bool write_it, bool erase_it, bool verify_it); |
| 362 | void finalize_flash_access(struct flashctx *); |
Edward O'Callaghan | 020dfa1 | 2020-09-23 23:12:55 +1000 | [diff] [blame] | 363 | int do_read(struct flashctx *, const char *filename); |
Daniel Campello | 83752f8 | 2021-04-16 14:54:27 -0600 | [diff] [blame] | 364 | int do_extract(struct flashctx *); |
Edward O'Callaghan | 6e573be | 2020-12-18 10:38:06 +1100 | [diff] [blame] | 365 | int do_erase(struct flashctx *); |
| 366 | int do_write(struct flashctx *, const char *const filename, const char *const referencefile); |
| 367 | int do_verify(struct flashctx *, const char *const filename); |
uwe | 884cc8b | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 368 | |
David Hendricks | 1ed1d35 | 2011-11-23 17:54:37 -0800 | [diff] [blame] | 369 | /* what to do in case of an error */ |
| 370 | enum error_action { |
| 371 | error_fail, /* fail immediately */ |
| 372 | error_ignore, /* non-fatal error; continue */ |
| 373 | }; |
Nikolai Artemiev | 55f7a33 | 2020-11-05 13:54:27 +1100 | [diff] [blame] | 374 | int register_chip_restore(chip_restore_fn_cb_t func, struct flashctx *flash, uint8_t status); |
David Hendricks | 1ed1d35 | 2011-11-23 17:54:37 -0800 | [diff] [blame] | 375 | |
uwe | 97e8e27 | 2011-09-03 17:15:00 +0000 | [diff] [blame] | 376 | /* Something happened that shouldn't happen, but we can go on. */ |
mkarcher | 74d3013 | 2010-07-22 18:04:15 +0000 | [diff] [blame] | 377 | #define ERROR_NONFATAL 0x100 |
| 378 | |
uwe | 97e8e27 | 2011-09-03 17:15:00 +0000 | [diff] [blame] | 379 | /* Something happened that shouldn't happen, we'll abort. */ |
| 380 | #define ERROR_FATAL -0xee |
Edward O'Callaghan | 20596a8 | 2019-06-13 14:47:03 +1000 | [diff] [blame] | 381 | #define ERROR_FLASHROM_BUG -200 |
| 382 | /* We reached one of the hardcoded limits of flashrom. This can be fixed by |
| 383 | * increasing the limit of a compile-time allocation or by switching to dynamic |
| 384 | * allocation. |
| 385 | * Note: If this warning is triggered, check first for runaway registrations. |
| 386 | */ |
| 387 | #define ERROR_FLASHROM_LIMIT -201 |
| 388 | |
David Hendricks | 1ed1d35 | 2011-11-23 17:54:37 -0800 | [diff] [blame] | 389 | /* convenience function for checking return codes */ |
| 390 | extern int ignore_error(int x); |
| 391 | |
Edward O'Callaghan | 83c7700 | 2019-06-04 15:56:19 +1000 | [diff] [blame] | 392 | /* cli_common.c */ |
Edward O'Callaghan | 71e30b4 | 2019-06-04 16:16:13 +1000 | [diff] [blame] | 393 | void print_chip_support_status(const struct flashchip *chip); |
Edward O'Callaghan | 83c7700 | 2019-06-04 15:56:19 +1000 | [diff] [blame] | 394 | |
snelson | 9cba3c6 | 2010-01-07 20:09:33 +0000 | [diff] [blame] | 395 | /* cli_output.c */ |
Edward O'Callaghan | 83c7700 | 2019-06-04 15:56:19 +1000 | [diff] [blame] | 396 | extern enum flashrom_log_level verbose_screen; |
| 397 | extern enum flashrom_log_level verbose_logfile; |
Souvik Ghosh | 3c963a4 | 2016-07-19 18:48:15 -0700 | [diff] [blame] | 398 | #ifndef STANDALONE |
| 399 | int open_logfile(const char * const filename); |
| 400 | int close_logfile(void); |
| 401 | void start_logging(void); |
| 402 | #endif |
Edward O'Callaghan | f0e8077 | 2020-12-04 15:36:04 +1100 | [diff] [blame] | 403 | int flashrom_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap); |
hailfinger | 63932d4 | 2010-06-04 23:20:21 +0000 | [diff] [blame] | 404 | /* Let gcc and clang check for correct printf-style format strings. */ |
Edward O'Callaghan | 8d8d397 | 2019-02-24 20:40:10 +1100 | [diff] [blame] | 405 | int print(enum flashrom_log_level level, const char *fmt, ...) |
Patrick Georgi | dbde2f1 | 2017-02-03 18:07:45 +0100 | [diff] [blame] | 406 | #ifdef __MINGW32__ |
Edward O'Callaghan | c4d1f1c | 2020-04-17 13:27:23 +1000 | [diff] [blame] | 407 | # ifndef __MINGW_PRINTF_FORMAT |
| 408 | # define __MINGW_PRINTF_FORMAT gnu_printf |
| 409 | # endif |
| 410 | __attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3))); |
Patrick Georgi | dbde2f1 | 2017-02-03 18:07:45 +0100 | [diff] [blame] | 411 | #else |
| 412 | __attribute__((format(printf, 2, 3))); |
| 413 | #endif |
Edward O'Callaghan | 8d8d397 | 2019-02-24 20:40:10 +1100 | [diff] [blame] | 414 | #define msg_gerr(...) print(FLASHROM_MSG_ERROR, __VA_ARGS__) /* general errors */ |
| 415 | #define msg_perr(...) print(FLASHROM_MSG_ERROR, __VA_ARGS__) /* programmer errors */ |
| 416 | #define msg_cerr(...) print(FLASHROM_MSG_ERROR, __VA_ARGS__) /* chip errors */ |
| 417 | #define msg_gwarn(...) print(FLASHROM_MSG_WARN, __VA_ARGS__) /* general warnings */ |
| 418 | #define msg_pwarn(...) print(FLASHROM_MSG_WARN, __VA_ARGS__) /* programmer warnings */ |
| 419 | #define msg_cwarn(...) print(FLASHROM_MSG_WARN, __VA_ARGS__) /* chip warnings */ |
| 420 | #define msg_ginfo(...) print(FLASHROM_MSG_INFO, __VA_ARGS__) /* general info */ |
| 421 | #define msg_pinfo(...) print(FLASHROM_MSG_INFO, __VA_ARGS__) /* programmer info */ |
| 422 | #define msg_cinfo(...) print(FLASHROM_MSG_INFO, __VA_ARGS__) /* chip info */ |
| 423 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */ |
| 424 | #define msg_pdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* programmer debug */ |
| 425 | #define msg_cdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* chip debug */ |
| 426 | #define msg_gdbg2(...) print(FLASHROM_MSG_DEBUG2, __VA_ARGS__) /* general debug2 */ |
| 427 | #define msg_pdbg2(...) print(FLASHROM_MSG_DEBUG2, __VA_ARGS__) /* programmer debug2 */ |
| 428 | #define msg_cdbg2(...) print(FLASHROM_MSG_DEBUG2, __VA_ARGS__) /* chip debug2 */ |
| 429 | #define msg_gspew(...) print(FLASHROM_MSG_SPEW, __VA_ARGS__) /* general debug spew */ |
| 430 | #define msg_pspew(...) print(FLASHROM_MSG_SPEW, __VA_ARGS__) /* programmer debug spew */ |
| 431 | #define msg_cspew(...) print(FLASHROM_MSG_SPEW, __VA_ARGS__) /* chip debug spew */ |
snelson | 9cba3c6 | 2010-01-07 20:09:33 +0000 | [diff] [blame] | 432 | |
Edward O'Callaghan | 1bbd6bf | 2020-12-16 20:25:35 +1100 | [diff] [blame] | 433 | /* layout.c */ |
Daniel Campello | 2fdc837 | 2021-04-16 17:52:51 -0600 | [diff] [blame] | 434 | int register_include_arg(struct layout_include_args **args, const char *arg); |
Edward O'Callaghan | 1bbd6bf | 2020-12-16 20:25:35 +1100 | [diff] [blame] | 435 | int read_romlayout(const char *name); |
| 436 | int normalize_romentries(const struct flashctx *flash); |
Edward O'Callaghan | 10bb9ae | 2020-12-17 13:06:10 +1100 | [diff] [blame] | 437 | void layout_cleanup(struct layout_include_args **args); |
Edward O'Callaghan | 1bbd6bf | 2020-12-16 20:25:35 +1100 | [diff] [blame] | 438 | |
stepan | 745615e | 2007-10-15 21:44:47 +0000 | [diff] [blame] | 439 | /* spi.c */ |
hailfinger | 68002c2 | 2009-07-10 21:08:55 +0000 | [diff] [blame] | 440 | struct spi_command { |
| 441 | unsigned int writecnt; |
| 442 | unsigned int readcnt; |
| 443 | const unsigned char *writearr; |
| 444 | unsigned char *readarr; |
| 445 | }; |
Nico Huber | 4c8a956 | 2017-10-15 11:20:58 +0200 | [diff] [blame] | 446 | #define NULL_SPI_CMD { 0, 0, NULL, NULL, } |
Edward O'Callaghan | cda796c | 2020-12-01 20:57:49 +1100 | [diff] [blame] | 447 | int spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 448 | int spi_send_multicommand(const struct flashctx *flash, struct spi_command *cmds); |
uwe | af9b4df | 2008-09-26 13:19:02 +0000 | [diff] [blame] | 449 | |
Edward O'Callaghan | 4b94057 | 2019-08-02 01:44:47 +1000 | [diff] [blame] | 450 | enum chipbustype get_buses_supported(void); |
ollie | 5b62157 | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 451 | #endif /* !__FLASH_H__ */ |