Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2009,2010 Carl-Daniel Hailfinger |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Stefan Tauner | b0eee9b | 2015-01-10 09:32:50 +0000 | [diff] [blame] | 17 | #include "platform.h" |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 18 | |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | #include <string.h> |
| 21 | #include <stdlib.h> |
Carl-Daniel Hailfinger | 11990da | 2013-07-13 23:21:05 +0000 | [diff] [blame] | 22 | #include <errno.h> |
Carl-Daniel Hailfinger | dcef67e | 2010-06-21 23:20:15 +0000 | [diff] [blame] | 23 | #include <sys/types.h> |
Patrick Georgi | a9095a9 | 2010-09-30 17:03:32 +0000 | [diff] [blame] | 24 | #if !defined (__DJGPP__) && !defined(__LIBPAYLOAD__) |
Carl-Daniel Hailfinger | 11990da | 2013-07-13 23:21:05 +0000 | [diff] [blame] | 25 | /* No file access needed/possible to get hardware access permissions. */ |
Carl-Daniel Hailfinger | 831e8f4 | 2010-05-30 22:24:40 +0000 | [diff] [blame] | 26 | #include <unistd.h> |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 27 | #include <fcntl.h> |
Patrick Georgi | a9095a9 | 2010-09-30 17:03:32 +0000 | [diff] [blame] | 28 | #endif |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 29 | #include "flash.h" |
Patrick Georgi | 32508eb | 2012-07-20 20:35:14 +0000 | [diff] [blame] | 30 | #include "hwaccess.h" |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 31 | |
Stefan Tauner | 8e65654 | 2016-03-06 22:32:16 +0000 | [diff] [blame] | 32 | #if !(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__DJGPP__) || defined(__LIBPAYLOAD__) || defined(__sun) || defined(__gnu_hurd__)) |
Stefan Tauner | b0eee9b | 2015-01-10 09:32:50 +0000 | [diff] [blame] | 33 | #error "Unknown operating system" |
| 34 | #endif |
| 35 | |
Patrick Georgi | d2a03b3 | 2017-03-13 13:48:03 +0100 | [diff] [blame] | 36 | #if IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) |
| 37 | #define USE_IOPL 1 |
| 38 | #else |
| 39 | #define USE_IOPL 0 |
| 40 | #endif |
| 41 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
| 42 | #define USE_DEV_IO 1 |
| 43 | #else |
| 44 | #define USE_DEV_IO 0 |
| 45 | #endif |
| 46 | #if defined(__gnu_hurd__) |
| 47 | #define USE_IOPERM 1 |
| 48 | #else |
| 49 | #define USE_IOPERM 0 |
| 50 | #endif |
Stefan Tauner | 8e65654 | 2016-03-06 22:32:16 +0000 | [diff] [blame] | 51 | |
| 52 | #if USE_IOPERM |
| 53 | #include <sys/io.h> |
| 54 | #endif |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 55 | |
| 56 | #if IS_X86 && USE_DEV_IO |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 57 | int io_fd; |
| 58 | #endif |
| 59 | |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 60 | /* Prevent reordering and/or merging of reads/writes to hardware. |
| 61 | * Such reordering and/or merging would break device accesses which depend on the exact access order. |
| 62 | */ |
| 63 | static inline void sync_primitive(void) |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 64 | { |
Stefan Tauner | fb2d77c | 2015-02-10 08:03:10 +0000 | [diff] [blame] | 65 | /* This is not needed for... |
| 66 | * - x86: uses uncached accesses which have a strongly ordered memory model. |
| 67 | * - MIPS: uses uncached accesses in mode 2 on /dev/mem which has also a strongly ordered memory model. |
| 68 | * - ARM: uses a strongly ordered memory model for device memories. |
| 69 | * |
| 70 | * See also https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/memory-barriers.txt |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 71 | */ |
Stefan Tauner | b0eee9b | 2015-01-10 09:32:50 +0000 | [diff] [blame] | 72 | #if IS_PPC // cf. http://lxr.free-electrons.com/source/arch/powerpc/include/asm/barrier.h |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 73 | asm("eieio" : : : "memory"); |
Stefan Tauner | fb2d77c | 2015-02-10 08:03:10 +0000 | [diff] [blame] | 74 | #elif IS_SPARC |
| 75 | #if defined(__sparc_v9__) || defined(__sparcv9) |
| 76 | /* Sparc V9 CPUs support three different memory orderings that range from x86-like TSO to PowerPC-like |
| 77 | * RMO. The modes can be switched at runtime thus to make sure we maintain the right order of access we |
| 78 | * use the strongest hardware memory barriers that exist on Sparc V9. */ |
| 79 | asm volatile ("membar #Sync" ::: "memory"); |
| 80 | #elif defined(__sparc_v8__) || defined(__sparcv8) |
| 81 | /* On SPARC V8 there is no RMO just PSO and that does not apply to I/O accesses... but if V8 code is run |
| 82 | * on V9 CPUs it might apply... or not... we issue a write barrier anyway. That's the most suitable |
| 83 | * operation in the V8 instruction set anyway. If you know better then please tell us. */ |
| 84 | asm volatile ("stbar"); |
| 85 | #else |
| 86 | #error Unknown and/or unsupported SPARC instruction set version detected. |
| 87 | #endif |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 88 | #endif |
| 89 | } |
| 90 | |
Carl-Daniel Hailfinger | 8225868 | 2013-01-08 22:49:12 +0000 | [diff] [blame] | 91 | #if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__)) |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 92 | static int release_io_perms(void *p) |
| 93 | { |
Carl-Daniel Hailfinger | 8225868 | 2013-01-08 22:49:12 +0000 | [diff] [blame] | 94 | #if defined (__sun) |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 95 | sysi86(SI86V86, V86SC_IOPL, 0); |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 96 | #elif USE_DEV_IO |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 97 | close(io_fd); |
Stefan Tauner | 8e65654 | 2016-03-06 22:32:16 +0000 | [diff] [blame] | 98 | #elif USE_IOPERM |
| 99 | ioperm(0, 65536, 0); |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 100 | #elif USE_IOPL |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 101 | iopl(0); |
| 102 | #endif |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 103 | return 0; |
| 104 | } |
Carl-Daniel Hailfinger | 8225868 | 2013-01-08 22:49:12 +0000 | [diff] [blame] | 105 | #endif |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 106 | |
| 107 | /* Get I/O permissions with automatic permission release on shutdown. */ |
| 108 | int rget_io_perms(void) |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 109 | { |
Carl-Daniel Hailfinger | 8225868 | 2013-01-08 22:49:12 +0000 | [diff] [blame] | 110 | #if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__)) |
| 111 | #if defined (__sun) |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 112 | if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) { |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 113 | #elif USE_DEV_IO |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 114 | if ((io_fd = open("/dev/io", O_RDWR)) < 0) { |
Stefan Tauner | 8e65654 | 2016-03-06 22:32:16 +0000 | [diff] [blame] | 115 | #elif USE_IOPERM |
| 116 | if (ioperm(0, 65536, 1) != 0) { |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 117 | #elif USE_IOPL |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 118 | if (iopl(3) != 0) { |
| 119 | #endif |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 120 | msg_perr("ERROR: Could not get I/O privileges (%s).\n", strerror(errno)); |
| 121 | msg_perr("You need to be root.\n"); |
Carl-Daniel Hailfinger | b63b067 | 2010-07-02 17:12:50 +0000 | [diff] [blame] | 122 | #if defined (__OpenBSD__) |
Stefan Tauner | 95b4b6d | 2013-07-13 20:55:33 +0000 | [diff] [blame] | 123 | msg_perr("If you are root already please set securelevel=-1 in /etc/rc.securelevel and\n" |
| 124 | "reboot, or reboot into single user mode.\n"); |
| 125 | #elif defined(__NetBSD__) |
| 126 | msg_perr("If you are root already please reboot into single user mode or make sure\n" |
| 127 | "that your kernel configuration has the option INSECURE enabled.\n"); |
Carl-Daniel Hailfinger | b63b067 | 2010-07-02 17:12:50 +0000 | [diff] [blame] | 128 | #endif |
Carl-Daniel Hailfinger | d6bb828 | 2012-07-21 17:27:08 +0000 | [diff] [blame] | 129 | return 1; |
| 130 | } else { |
| 131 | register_shutdown(release_io_perms, NULL); |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 132 | } |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 133 | #else |
Carl-Daniel Hailfinger | 8225868 | 2013-01-08 22:49:12 +0000 | [diff] [blame] | 134 | /* DJGPP and libpayload environments have full PCI port I/O permissions by default. */ |
| 135 | /* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */ |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 136 | #endif |
Peter Lemenkov | 6282966 | 2012-12-29 19:26:55 +0000 | [diff] [blame] | 137 | return 0; |
| 138 | } |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 139 | |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 140 | void mmio_writeb(uint8_t val, void *addr) |
| 141 | { |
| 142 | *(volatile uint8_t *) addr = val; |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 143 | sync_primitive(); |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | void mmio_writew(uint16_t val, void *addr) |
| 147 | { |
| 148 | *(volatile uint16_t *) addr = val; |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 149 | sync_primitive(); |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | void mmio_writel(uint32_t val, void *addr) |
| 153 | { |
| 154 | *(volatile uint32_t *) addr = val; |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 155 | sync_primitive(); |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 156 | } |
| 157 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 158 | uint8_t mmio_readb(const void *addr) |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 159 | { |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 160 | return *(volatile const uint8_t *) addr; |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 161 | } |
| 162 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 163 | uint16_t mmio_readw(const void *addr) |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 164 | { |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 165 | return *(volatile const uint16_t *) addr; |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 166 | } |
| 167 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 168 | uint32_t mmio_readl(const void *addr) |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 169 | { |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 170 | return *(volatile const uint32_t *) addr; |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 171 | } |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 172 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 173 | void mmio_readn(const void *addr, uint8_t *buf, size_t len) |
Carl-Daniel Hailfinger | ccd71c2 | 2012-03-01 22:38:27 +0000 | [diff] [blame] | 174 | { |
| 175 | memcpy(buf, addr, len); |
| 176 | return; |
| 177 | } |
| 178 | |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 179 | void mmio_le_writeb(uint8_t val, void *addr) |
| 180 | { |
| 181 | mmio_writeb(cpu_to_le8(val), addr); |
| 182 | } |
| 183 | |
| 184 | void mmio_le_writew(uint16_t val, void *addr) |
| 185 | { |
| 186 | mmio_writew(cpu_to_le16(val), addr); |
| 187 | } |
| 188 | |
| 189 | void mmio_le_writel(uint32_t val, void *addr) |
| 190 | { |
| 191 | mmio_writel(cpu_to_le32(val), addr); |
| 192 | } |
| 193 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 194 | uint8_t mmio_le_readb(const void *addr) |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 195 | { |
| 196 | return le_to_cpu8(mmio_readb(addr)); |
| 197 | } |
| 198 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 199 | uint16_t mmio_le_readw(const void *addr) |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 200 | { |
| 201 | return le_to_cpu16(mmio_readw(addr)); |
| 202 | } |
| 203 | |
Nico Huber | b4d8a2a | 2017-03-17 17:19:15 +0100 | [diff] [blame] | 204 | uint32_t mmio_le_readl(const void *addr) |
Carl-Daniel Hailfinger | cceafa2 | 2010-05-26 01:45:41 +0000 | [diff] [blame] | 205 | { |
| 206 | return le_to_cpu32(mmio_readl(addr)); |
| 207 | } |
Carl-Daniel Hailfinger | 54ce73a | 2011-05-03 21:49:41 +0000 | [diff] [blame] | 208 | |
| 209 | enum mmio_write_type { |
| 210 | mmio_write_type_b, |
| 211 | mmio_write_type_w, |
| 212 | mmio_write_type_l, |
| 213 | }; |
| 214 | |
| 215 | struct undo_mmio_write_data { |
| 216 | void *addr; |
| 217 | int reg; |
| 218 | enum mmio_write_type type; |
| 219 | union { |
| 220 | uint8_t bdata; |
| 221 | uint16_t wdata; |
| 222 | uint32_t ldata; |
| 223 | }; |
| 224 | }; |
| 225 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame^] | 226 | static int undo_mmio_write(void *p) |
Carl-Daniel Hailfinger | 54ce73a | 2011-05-03 21:49:41 +0000 | [diff] [blame] | 227 | { |
| 228 | struct undo_mmio_write_data *data = p; |
| 229 | msg_pdbg("Restoring MMIO space at %p\n", data->addr); |
| 230 | switch (data->type) { |
| 231 | case mmio_write_type_b: |
| 232 | mmio_writeb(data->bdata, data->addr); |
| 233 | break; |
| 234 | case mmio_write_type_w: |
| 235 | mmio_writew(data->wdata, data->addr); |
| 236 | break; |
| 237 | case mmio_write_type_l: |
| 238 | mmio_writel(data->ldata, data->addr); |
| 239 | break; |
| 240 | } |
| 241 | /* p was allocated in register_undo_mmio_write. */ |
| 242 | free(p); |
David Hendricks | 8bb2021 | 2011-06-14 01:35:36 +0000 | [diff] [blame] | 243 | return 0; |
Carl-Daniel Hailfinger | 54ce73a | 2011-05-03 21:49:41 +0000 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | #define register_undo_mmio_write(a, c) \ |
| 247 | { \ |
| 248 | struct undo_mmio_write_data *undo_mmio_write_data; \ |
| 249 | undo_mmio_write_data = malloc(sizeof(struct undo_mmio_write_data)); \ |
Stefan Tauner | 269de35 | 2011-07-12 22:35:21 +0000 | [diff] [blame] | 250 | if (!undo_mmio_write_data) { \ |
| 251 | msg_gerr("Out of memory!\n"); \ |
| 252 | exit(1); \ |
| 253 | } \ |
Carl-Daniel Hailfinger | 54ce73a | 2011-05-03 21:49:41 +0000 | [diff] [blame] | 254 | undo_mmio_write_data->addr = a; \ |
| 255 | undo_mmio_write_data->type = mmio_write_type_##c; \ |
| 256 | undo_mmio_write_data->c##data = mmio_read##c(a); \ |
| 257 | register_shutdown(undo_mmio_write, undo_mmio_write_data); \ |
| 258 | } |
| 259 | |
| 260 | #define register_undo_mmio_writeb(a) register_undo_mmio_write(a, b) |
| 261 | #define register_undo_mmio_writew(a) register_undo_mmio_write(a, w) |
| 262 | #define register_undo_mmio_writel(a) register_undo_mmio_write(a, l) |
| 263 | |
| 264 | void rmmio_writeb(uint8_t val, void *addr) |
| 265 | { |
| 266 | register_undo_mmio_writeb(addr); |
| 267 | mmio_writeb(val, addr); |
| 268 | } |
| 269 | |
| 270 | void rmmio_writew(uint16_t val, void *addr) |
| 271 | { |
| 272 | register_undo_mmio_writew(addr); |
| 273 | mmio_writew(val, addr); |
| 274 | } |
| 275 | |
| 276 | void rmmio_writel(uint32_t val, void *addr) |
| 277 | { |
| 278 | register_undo_mmio_writel(addr); |
| 279 | mmio_writel(val, addr); |
| 280 | } |
| 281 | |
| 282 | void rmmio_le_writeb(uint8_t val, void *addr) |
| 283 | { |
| 284 | register_undo_mmio_writeb(addr); |
| 285 | mmio_le_writeb(val, addr); |
| 286 | } |
| 287 | |
| 288 | void rmmio_le_writew(uint16_t val, void *addr) |
| 289 | { |
| 290 | register_undo_mmio_writew(addr); |
| 291 | mmio_le_writew(val, addr); |
| 292 | } |
| 293 | |
| 294 | void rmmio_le_writel(uint32_t val, void *addr) |
| 295 | { |
| 296 | register_undo_mmio_writel(addr); |
| 297 | mmio_le_writel(val, addr); |
| 298 | } |
| 299 | |
| 300 | void rmmio_valb(void *addr) |
| 301 | { |
| 302 | register_undo_mmio_writeb(addr); |
| 303 | } |
| 304 | |
| 305 | void rmmio_valw(void *addr) |
| 306 | { |
| 307 | register_undo_mmio_writew(addr); |
| 308 | } |
| 309 | |
| 310 | void rmmio_vall(void *addr) |
| 311 | { |
| 312 | register_undo_mmio_writel(addr); |
| 313 | } |