Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/mv/mv_pci.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
static void mv_pcib_enable(struct mv_pcib_softc *, uint32_t); | static void mv_pcib_enable(struct mv_pcib_softc *, uint32_t); | ||||
static int mv_pcib_mem_init(struct mv_pcib_softc *); | static int mv_pcib_mem_init(struct mv_pcib_softc *); | ||||
/* Forward prototypes */ | /* Forward prototypes */ | ||||
static int mv_pcib_probe(device_t); | static int mv_pcib_probe(device_t); | ||||
static int mv_pcib_attach(device_t); | static int mv_pcib_attach(device_t); | ||||
static struct resource *mv_pcib_alloc_resource(device_t, device_t, int, int *, | static struct resource *mv_pcib_alloc_resource(device_t, device_t, int, int *, | ||||
u_long, u_long, u_long, u_int); | rman_res_t, rman_res_t, rman_res_t, u_int); | ||||
static int mv_pcib_release_resource(device_t, device_t, int, int, | static int mv_pcib_release_resource(device_t, device_t, int, int, | ||||
struct resource *); | struct resource *); | ||||
static int mv_pcib_read_ivar(device_t, device_t, int, uintptr_t *); | static int mv_pcib_read_ivar(device_t, device_t, int, uintptr_t *); | ||||
static int mv_pcib_write_ivar(device_t, device_t, int, uintptr_t); | static int mv_pcib_write_ivar(device_t, device_t, int, uintptr_t); | ||||
static int mv_pcib_maxslots(device_t); | static int mv_pcib_maxslots(device_t); | ||||
static uint32_t mv_pcib_read_config(device_t, u_int, u_int, u_int, u_int, int); | static uint32_t mv_pcib_read_config(device_t, u_int, u_int, u_int, u_int, int); | ||||
static void mv_pcib_write_config(device_t, u_int, u_int, u_int, u_int, | static void mv_pcib_write_config(device_t, u_int, u_int, u_int, u_int, | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
mv_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, | mv_pcib_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 mv_pcib_softc *sc = device_get_softc(dev); | struct mv_pcib_softc *sc = device_get_softc(dev); | ||||
struct rman *rm = NULL; | struct rman *rm = NULL; | ||||
struct resource *res; | struct resource *res; | ||||
switch (type) { | switch (type) { | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
rm = &sc->sc_io_rman; | rm = &sc->sc_io_rman; | ||||
break; | break; | ||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
rm = &sc->sc_mem_rman; | rm = &sc->sc_mem_rman; | ||||
break; | break; | ||||
default: | default: | ||||
return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, | return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, | ||||
type, rid, start, end, count, flags)); | type, rid, start, end, count, flags)); | ||||
}; | }; | ||||
if ((start == 0UL) && (end == ~0UL)) { | if ((start == 0) && (end == ~0)) { | ||||
start = sc->sc_mem_base; | start = sc->sc_mem_base; | ||||
end = sc->sc_mem_base + sc->sc_mem_size - 1; | end = sc->sc_mem_base + sc->sc_mem_size - 1; | ||||
count = sc->sc_mem_size; | count = sc->sc_mem_size; | ||||
} | } | ||||
if ((start < sc->sc_mem_base) || (start + count - 1 != end) || | if ((start < sc->sc_mem_base) || (start + count - 1 != end) || | ||||
(end > sc->sc_mem_base + sc->sc_mem_size - 1)) | (end > sc->sc_mem_base + sc->sc_mem_size - 1)) | ||||
return (NULL); | return (NULL); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |