| 334 | } |
| 335 | |
| 336 | static uint32_t |
| 337 | octopci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, |
| 338 | int bytes) |
| 339 | { |
| 340 | struct octopci_softc *sc; |
| 341 | uint64_t addr; |
| 342 | uint32_t data; |
| 343 | |
| 344 | sc = device_get_softc(dev); |
| 345 | |
| 346 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) { |
| 347 | if (bus == 0 && slot == 0 && func == 0) |
| 348 | return ((uint32_t)-1); |
| 349 | |
| 350 | switch (bytes) { |
| 351 | case 4: |
| 352 | return (cvmx_pcie_config_read32(sc->sc_domain, bus, slot, func, reg)); |
| 353 | case 2: |
| 354 | return (cvmx_pcie_config_read16(sc->sc_domain, bus, slot, func, reg)); |
| 355 | case 1: |
| 356 | return (cvmx_pcie_config_read8(sc->sc_domain, bus, slot, func, reg)); |
| 357 | default: |
| 358 | return ((uint32_t)-1); |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | addr = octopci_cs_addr(bus, slot, func, reg); |
| 363 | |
| 364 | switch (bytes) { |
| 365 | case 4: |
| 366 | data = le32toh(cvmx_read64_uint32(addr)); |
| 367 | return (data); |
| 368 | case 2: |
| 369 | data = le16toh(cvmx_read64_uint16(addr)); |
| 370 | return (data); |
| 371 | case 1: |
| 372 | data = cvmx_read64_uint8(addr); |
| 373 | return (data); |
| 374 | default: |
| 375 | return ((uint32_t)-1); |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | static void |
| 380 | octopci_write_config(device_t dev, u_int bus, u_int slot, u_int func, |
no test coverage detected