Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de> |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 5 | * Copyright (C) 2010, 2011 Carl-Daniel Hailfinger |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include <stdlib.h> |
| 23 | #include <string.h> |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 24 | #include "flash.h" |
Carl-Daniel Hailfinger | 5b997c3 | 2010-07-27 22:41:39 +0000 | [diff] [blame] | 25 | #include "programmer.h" |
Patrick Georgi | 32508eb | 2012-07-20 20:35:14 +0000 | [diff] [blame] | 26 | #include "hwaccess.h" |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 27 | |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 28 | struct pci_access *pacc; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 29 | |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 30 | enum pci_bartype { |
| 31 | TYPE_MEMBAR, |
| 32 | TYPE_IOBAR, |
| 33 | TYPE_ROMBAR, |
| 34 | TYPE_UNKNOWN |
| 35 | }; |
| 36 | |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 37 | uintptr_t pcidev_readbar(struct pci_dev *dev, int bar) |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 38 | { |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 39 | uint64_t addr; |
| 40 | uint32_t upperaddr; |
| 41 | uint8_t headertype; |
| 42 | uint16_t supported_cycles; |
| 43 | enum pci_bartype bartype = TYPE_UNKNOWN; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 44 | |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 45 | |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 46 | headertype = pci_read_byte(dev, PCI_HEADER_TYPE) & 0x7f; |
| 47 | msg_pspew("PCI header type 0x%02x\n", headertype); |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 48 | |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 49 | /* Don't use dev->base_addr[x] (as value for 'bar'), won't work on older libpci. */ |
| 50 | addr = pci_read_long(dev, bar); |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 51 | |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 52 | /* Sanity checks. */ |
| 53 | switch (headertype) { |
| 54 | case PCI_HEADER_TYPE_NORMAL: |
| 55 | switch (bar) { |
| 56 | case PCI_BASE_ADDRESS_0: |
| 57 | case PCI_BASE_ADDRESS_1: |
| 58 | case PCI_BASE_ADDRESS_2: |
| 59 | case PCI_BASE_ADDRESS_3: |
| 60 | case PCI_BASE_ADDRESS_4: |
| 61 | case PCI_BASE_ADDRESS_5: |
| 62 | if ((addr & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) |
| 63 | bartype = TYPE_IOBAR; |
| 64 | else |
| 65 | bartype = TYPE_MEMBAR; |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 66 | break; |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 67 | case PCI_ROM_ADDRESS: |
| 68 | bartype = TYPE_ROMBAR; |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 69 | break; |
| 70 | } |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 71 | break; |
| 72 | case PCI_HEADER_TYPE_BRIDGE: |
| 73 | switch (bar) { |
| 74 | case PCI_BASE_ADDRESS_0: |
| 75 | case PCI_BASE_ADDRESS_1: |
| 76 | if ((addr & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) |
| 77 | bartype = TYPE_IOBAR; |
| 78 | else |
| 79 | bartype = TYPE_MEMBAR; |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 80 | break; |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 81 | case PCI_ROM_ADDRESS1: |
| 82 | bartype = TYPE_ROMBAR; |
Carl-Daniel Hailfinger | 8a19ef1 | 2011-02-15 22:44:27 +0000 | [diff] [blame] | 83 | break; |
Carl-Daniel Hailfinger | 295b3af | 2010-03-17 00:47:56 +0000 | [diff] [blame] | 84 | } |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 85 | break; |
| 86 | case PCI_HEADER_TYPE_CARDBUS: |
| 87 | break; |
| 88 | default: |
| 89 | msg_perr("Unknown PCI header type 0x%02x, BAR type cannot be determined reliably.\n", |
| 90 | headertype); |
| 91 | break; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 92 | } |
| 93 | |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 94 | supported_cycles = pci_read_word(dev, PCI_COMMAND); |
| 95 | |
Niklas Söderlund | 89edf36 | 2013-08-23 23:29:23 +0000 | [diff] [blame] | 96 | msg_pdbg("Requested BAR is of type "); |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 97 | switch (bartype) { |
| 98 | case TYPE_MEMBAR: |
| 99 | msg_pdbg("MEM"); |
| 100 | if (!(supported_cycles & PCI_COMMAND_MEMORY)) { |
| 101 | msg_perr("MEM BAR access requested, but device has MEM space accesses disabled.\n"); |
| 102 | /* TODO: Abort here? */ |
| 103 | } |
| 104 | msg_pdbg(", %sbit, %sprefetchable\n", |
| 105 | ((addr & 0x6) == 0x0) ? "32" : (((addr & 0x6) == 0x4) ? "64" : "reserved"), |
| 106 | (addr & 0x8) ? "" : "not "); |
| 107 | if ((addr & 0x6) == 0x4) { |
| 108 | /* The spec says that a 64-bit register consumes |
| 109 | * two subsequent dword locations. |
| 110 | */ |
| 111 | upperaddr = pci_read_long(dev, bar + 4); |
| 112 | if (upperaddr != 0x00000000) { |
| 113 | /* Fun! A real 64-bit resource. */ |
| 114 | if (sizeof(uintptr_t) != sizeof(uint64_t)) { |
| 115 | msg_perr("BAR unreachable!"); |
| 116 | /* TODO: Really abort here? If multiple PCI devices match, |
| 117 | * we might never tell the user about the other devices. |
| 118 | */ |
| 119 | return 0; |
| 120 | } |
| 121 | addr |= (uint64_t)upperaddr << 32; |
| 122 | } |
| 123 | } |
| 124 | addr &= PCI_BASE_ADDRESS_MEM_MASK; |
| 125 | break; |
| 126 | case TYPE_IOBAR: |
| 127 | msg_pdbg("I/O\n"); |
| 128 | #if __FLASHROM_HAVE_OUTB__ |
| 129 | if (!(supported_cycles & PCI_COMMAND_IO)) { |
| 130 | msg_perr("I/O BAR access requested, but device has I/O space accesses disabled.\n"); |
| 131 | /* TODO: Abort here? */ |
| 132 | } |
| 133 | #else |
| 134 | msg_perr("I/O BAR access requested, but flashrom does not support I/O BAR access on this " |
| 135 | "platform (yet).\n"); |
| 136 | #endif |
| 137 | addr &= PCI_BASE_ADDRESS_IO_MASK; |
| 138 | break; |
| 139 | case TYPE_ROMBAR: |
| 140 | msg_pdbg("ROM\n"); |
| 141 | /* Not sure if this check is needed. */ |
| 142 | if (!(supported_cycles & PCI_COMMAND_MEMORY)) { |
| 143 | msg_perr("MEM BAR access requested, but device has MEM space accesses disabled.\n"); |
| 144 | /* TODO: Abort here? */ |
| 145 | } |
| 146 | addr &= PCI_ROM_ADDRESS_MASK; |
| 147 | break; |
| 148 | case TYPE_UNKNOWN: |
| 149 | msg_perr("BAR type unknown, please report a bug at flashrom@flashrom.org\n"); |
| 150 | } |
| 151 | |
| 152 | return (uintptr_t)addr; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Stefan Tauner | 5561955 | 2013-01-04 22:24:58 +0000 | [diff] [blame] | 155 | static int pcidev_shutdown(void *data) |
| 156 | { |
Stefan Tauner | 5561955 | 2013-01-04 22:24:58 +0000 | [diff] [blame] | 157 | if (pacc == NULL) { |
| 158 | msg_perr("%s: Tried to cleanup an invalid PCI context!\n" |
| 159 | "Please report a bug at flashrom@flashrom.org\n", __func__); |
| 160 | return 1; |
| 161 | } |
| 162 | pci_cleanup(pacc); |
| 163 | return 0; |
| 164 | } |
| 165 | |
| 166 | int pci_init_common(void) |
| 167 | { |
| 168 | if (pacc != NULL) { |
| 169 | msg_perr("%s: Tried to allocate a new PCI context, but there is still an old one!\n" |
| 170 | "Please report a bug at flashrom@flashrom.org\n", __func__); |
| 171 | return 1; |
| 172 | } |
| 173 | pacc = pci_alloc(); /* Get the pci_access structure */ |
| 174 | pci_init(pacc); /* Initialize the PCI library */ |
| 175 | if (register_shutdown(pcidev_shutdown, NULL)) |
| 176 | return 1; |
| 177 | pci_scan_bus(pacc); /* We want to get the list of devices */ |
| 178 | return 0; |
| 179 | } |
| 180 | |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 181 | /* pcidev_init gets an array of allowed PCI device IDs and returns a pointer to struct pci_dev iff exactly one |
| 182 | * match was found. If the "pci=bb:dd.f" programmer parameter was specified, a match is only considered if it |
| 183 | * also matches the specified bus:device.function. |
| 184 | * For convenience, this function also registers its own undo handlers. |
| 185 | */ |
| 186 | struct pci_dev *pcidev_init(const struct dev_entry *devs, int bar) |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 187 | { |
| 188 | struct pci_dev *dev; |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 189 | struct pci_dev *found_dev = NULL; |
Carl-Daniel Hailfinger | ad3cc55 | 2010-07-03 11:02:10 +0000 | [diff] [blame] | 190 | struct pci_filter filter; |
Carl-Daniel Hailfinger | 744132a | 2010-07-06 09:55:48 +0000 | [diff] [blame] | 191 | char *pcidev_bdf; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 192 | char *msg = NULL; |
| 193 | int found = 0; |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 194 | int i; |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 195 | uintptr_t addr = 0; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 196 | |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 197 | if (pci_init_common() != 0) |
| 198 | return NULL; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 199 | pci_filter_init(pacc, &filter); |
| 200 | |
Carl-Daniel Hailfinger | 40446ee | 2011-03-07 01:08:09 +0000 | [diff] [blame] | 201 | /* Filter by bb:dd.f (if supplied by the user). */ |
Carl-Daniel Hailfinger | 2b6dcb3 | 2010-07-08 10:13:37 +0000 | [diff] [blame] | 202 | pcidev_bdf = extract_programmer_param("pci"); |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 203 | if (pcidev_bdf != NULL) { |
| 204 | if ((msg = pci_filter_parse_slot(&filter, pcidev_bdf))) { |
Sean Nelson | 316a29f | 2010-05-07 20:09:04 +0000 | [diff] [blame] | 205 | msg_perr("Error: %s\n", msg); |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 206 | return NULL; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 207 | } |
| 208 | } |
Carl-Daniel Hailfinger | 744132a | 2010-07-06 09:55:48 +0000 | [diff] [blame] | 209 | free(pcidev_bdf); |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 210 | |
| 211 | for (dev = pacc->devices; dev; dev = dev->next) { |
| 212 | if (pci_filter_match(&filter, dev)) { |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 213 | /* Check against list of supported devices. */ |
| 214 | for (i = 0; devs[i].device_name != NULL; i++) |
| 215 | if ((dev->vendor_id == devs[i].vendor_id) && |
| 216 | (dev->device_id == devs[i].device_id)) |
| 217 | break; |
| 218 | /* Not supported, try the next one. */ |
| 219 | if (devs[i].device_name == NULL) |
| 220 | continue; |
| 221 | |
| 222 | msg_pdbg("Found \"%s %s\" (%04x:%04x, BDF %02x:%02x.%x).\n", devs[i].vendor_name, |
| 223 | devs[i].device_name, dev->vendor_id, dev->device_id, dev->bus, dev->dev, |
| 224 | dev->func); |
| 225 | if (devs[i].status == NT) |
| 226 | msg_pinfo("===\nThis PCI device is UNTESTED. Please report the 'flashrom -p " |
| 227 | "xxxx' output \n" |
| 228 | "to flashrom@flashrom.org if it works for you. Please add the name " |
| 229 | "of your\n" |
| 230 | "PCI device to the subject. Thank you for your help!\n===\n"); |
| 231 | |
Carl-Daniel Hailfinger | 40446ee | 2011-03-07 01:08:09 +0000 | [diff] [blame] | 232 | /* FIXME: We should count all matching devices, not |
| 233 | * just those with a valid BAR. |
| 234 | */ |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 235 | if ((addr = pcidev_readbar(dev, bar)) != 0) { |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 236 | found_dev = dev; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 237 | found++; |
Uwe Hermann | 8403ccb | 2009-05-16 21:39:19 +0000 | [diff] [blame] | 238 | } |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 239 | } |
| 240 | } |
| 241 | |
| 242 | /* Only continue if exactly one supported PCI dev has been found. */ |
| 243 | if (found == 0) { |
Sean Nelson | 316a29f | 2010-05-07 20:09:04 +0000 | [diff] [blame] | 244 | msg_perr("Error: No supported PCI device found.\n"); |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 245 | return NULL; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 246 | } else if (found > 1) { |
Carl-Daniel Hailfinger | 3834c2d | 2012-07-16 21:32:19 +0000 | [diff] [blame] | 247 | msg_perr("Error: Multiple supported PCI devices found. Use 'flashrom -p xxxx:pci=bb:dd.f' \n" |
| 248 | "to explicitly select the card with the given BDF (PCI bus, device, function).\n"); |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 249 | return NULL; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 250 | } |
| 251 | |
Carl-Daniel Hailfinger | a2faddf | 2013-01-05 23:52:45 +0000 | [diff] [blame] | 252 | return found_dev; |
Uwe Hermann | 515ab3d | 2009-05-15 17:02:34 +0000 | [diff] [blame] | 253 | } |
| 254 | |
Carl-Daniel Hailfinger | 2bee8cf | 2010-11-10 15:25:18 +0000 | [diff] [blame] | 255 | enum pci_write_type { |
| 256 | pci_write_type_byte, |
| 257 | pci_write_type_word, |
| 258 | pci_write_type_long, |
| 259 | }; |
| 260 | |
| 261 | struct undo_pci_write_data { |
| 262 | struct pci_dev dev; |
| 263 | int reg; |
| 264 | enum pci_write_type type; |
| 265 | union { |
| 266 | uint8_t bytedata; |
| 267 | uint16_t worddata; |
| 268 | uint32_t longdata; |
| 269 | }; |
| 270 | }; |
| 271 | |
David Hendricks | 8bb2021 | 2011-06-14 01:35:36 +0000 | [diff] [blame] | 272 | int undo_pci_write(void *p) |
Carl-Daniel Hailfinger | 2bee8cf | 2010-11-10 15:25:18 +0000 | [diff] [blame] | 273 | { |
| 274 | struct undo_pci_write_data *data = p; |
Stefan Tauner | 5561955 | 2013-01-04 22:24:58 +0000 | [diff] [blame] | 275 | if (pacc == NULL) { |
| 276 | msg_perr("%s: Tried to undo PCI writes without a valid PCI context!\n" |
| 277 | "Please report a bug at flashrom@flashrom.org\n", __func__); |
| 278 | return 1; |
| 279 | } |
Carl-Daniel Hailfinger | 2bee8cf | 2010-11-10 15:25:18 +0000 | [diff] [blame] | 280 | msg_pdbg("Restoring PCI config space for %02x:%02x:%01x reg 0x%02x\n", |
| 281 | data->dev.bus, data->dev.dev, data->dev.func, data->reg); |
| 282 | switch (data->type) { |
| 283 | case pci_write_type_byte: |
| 284 | pci_write_byte(&data->dev, data->reg, data->bytedata); |
| 285 | break; |
| 286 | case pci_write_type_word: |
| 287 | pci_write_word(&data->dev, data->reg, data->worddata); |
| 288 | break; |
| 289 | case pci_write_type_long: |
| 290 | pci_write_long(&data->dev, data->reg, data->longdata); |
| 291 | break; |
| 292 | } |
| 293 | /* p was allocated in register_undo_pci_write. */ |
| 294 | free(p); |
David Hendricks | 8bb2021 | 2011-06-14 01:35:36 +0000 | [diff] [blame] | 295 | return 0; |
Carl-Daniel Hailfinger | 2bee8cf | 2010-11-10 15:25:18 +0000 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | #define register_undo_pci_write(a, b, c) \ |
| 299 | { \ |
| 300 | struct undo_pci_write_data *undo_pci_write_data; \ |
| 301 | undo_pci_write_data = malloc(sizeof(struct undo_pci_write_data)); \ |
Stefan Tauner | 269de35 | 2011-07-12 22:35:21 +0000 | [diff] [blame] | 302 | if (!undo_pci_write_data) { \ |
| 303 | msg_gerr("Out of memory!\n"); \ |
| 304 | exit(1); \ |
| 305 | } \ |
Carl-Daniel Hailfinger | 2bee8cf | 2010-11-10 15:25:18 +0000 | [diff] [blame] | 306 | undo_pci_write_data->dev = *a; \ |
| 307 | undo_pci_write_data->reg = b; \ |
| 308 | undo_pci_write_data->type = pci_write_type_##c; \ |
| 309 | undo_pci_write_data->c##data = pci_read_##c(dev, reg); \ |
| 310 | register_shutdown(undo_pci_write, undo_pci_write_data); \ |
| 311 | } |
| 312 | |
| 313 | #define register_undo_pci_write_byte(a, b) register_undo_pci_write(a, b, byte) |
| 314 | #define register_undo_pci_write_word(a, b) register_undo_pci_write(a, b, word) |
| 315 | #define register_undo_pci_write_long(a, b) register_undo_pci_write(a, b, long) |
| 316 | |
| 317 | int rpci_write_byte(struct pci_dev *dev, int reg, uint8_t data) |
| 318 | { |
| 319 | register_undo_pci_write_byte(dev, reg); |
| 320 | return pci_write_byte(dev, reg, data); |
| 321 | } |
| 322 | |
| 323 | int rpci_write_word(struct pci_dev *dev, int reg, uint16_t data) |
| 324 | { |
| 325 | register_undo_pci_write_word(dev, reg); |
| 326 | return pci_write_word(dev, reg, data); |
| 327 | } |
| 328 | |
| 329 | int rpci_write_long(struct pci_dev *dev, int reg, uint32_t data) |
| 330 | { |
| 331 | register_undo_pci_write_long(dev, reg); |
| 332 | return pci_write_long(dev, reg, data); |
| 333 | } |