MCPcopy Create free account
hub / github.com/F-Stack/f-stack / octopci_read_config

Function octopci_read_config

freebsd/mips/cavium/octopci.c:336–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336static uint32_t
337octopci_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
379static void
380octopci_write_config(device_t dev, u_int bus, u_int slot, u_int func,

Callers 3

octopci_init_barFunction · 0.85
octopci_init_deviceFunction · 0.85
octopci_init_busFunction · 0.85

Calls 6

device_get_softcFunction · 0.85
octeon_has_featureFunction · 0.85
cvmx_pcie_config_read32Function · 0.85
cvmx_pcie_config_read16Function · 0.85
cvmx_pcie_config_read8Function · 0.85
octopci_cs_addrFunction · 0.85

Tested by

no test coverage detected