Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/cavium/thunder_pcie.c
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | |||||
* interface represents separate virtual function. | * interface represents separate virtual function. | ||||
*/ | */ | ||||
static int thunder_pcie_max_vfs = 4; | static int thunder_pcie_max_vfs = 4; | ||||
SYSCTL_INT(_hw, OID_AUTO, thunder_pcie_max_vfs, CTLFLAG_RWTUN, | SYSCTL_INT(_hw, OID_AUTO, thunder_pcie_max_vfs, CTLFLAG_RWTUN, | ||||
&thunder_pcie_max_vfs, 0, "Max VFs supported by ThunderX internal PCIe"); | &thunder_pcie_max_vfs, 0, "Max VFs supported by ThunderX internal PCIe"); | ||||
/* Forward prototypes */ | /* Forward prototypes */ | ||||
static struct resource *thunder_pcie_alloc_resource(device_t, | static struct resource *thunder_pcie_alloc_resource(device_t, | ||||
device_t, int, int *, u_long, u_long, u_long, u_int); | device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); | ||||
static int thunder_pcie_attach(device_t); | static int thunder_pcie_attach(device_t); | ||||
static int thunder_pcie_identify_pcib(device_t); | static int thunder_pcie_identify_pcib(device_t); | ||||
static int thunder_pcie_maxslots(device_t); | static int thunder_pcie_maxslots(device_t); | ||||
static int parse_pci_mem_ranges(struct thunder_pcie_softc *); | static int parse_pci_mem_ranges(struct thunder_pcie_softc *); | ||||
static int thunder_pcie_probe(device_t); | static int thunder_pcie_probe(device_t); | ||||
static uint32_t thunder_pcie_read_config(device_t, u_int, u_int, u_int, u_int, | static uint32_t thunder_pcie_read_config(device_t, u_int, u_int, u_int, u_int, | ||||
int); | int); | ||||
static int thunder_pcie_read_ivar(device_t, device_t, int, uintptr_t *); | static int thunder_pcie_read_ivar(device_t, device_t, int, uintptr_t *); | ||||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | if (type != SYS_RES_MEMORY) | ||||
return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, | return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, | ||||
type, rid, res)); | type, rid, res)); | ||||
return (rman_release_resource(res)); | return (rman_release_resource(res)); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, | thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct thunder_pcie_softc *sc = device_get_softc(dev); | struct thunder_pcie_softc *sc = device_get_softc(dev); | ||||
struct rman *rm = NULL; | struct rman *rm = NULL; | ||||
struct resource *res; | struct resource *res; | ||||
pci_addr_t map, testval; | pci_addr_t map, testval; | ||||
switch (type) { | switch (type) { | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | fail: | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
static int | static int | ||||
thunder_pcie_identify_pcib(device_t dev) | thunder_pcie_identify_pcib(device_t dev) | ||||
{ | { | ||||
struct thunder_pcie_softc *sc; | struct thunder_pcie_softc *sc; | ||||
u_long start; | rman_res_t start; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
start = bus_get_resource_start(dev, SYS_RES_MEMORY, 0); | start = bus_get_resource_start(dev, SYS_RES_MEMORY, 0); | ||||
switch(start) { | switch(start) { | ||||
case THUNDER_ECAM0_CFG_BASE: | case THUNDER_ECAM0_CFG_BASE: | ||||
sc->ecam = 0; | sc->ecam = 0; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |