Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cy/cy_pci.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
u_char plx_ver; | u_char plx_ver; | ||||
ioport_res = NULL; | ioport_res = NULL; | ||||
irq_res = NULL; | irq_res = NULL; | ||||
mem_res = NULL; | mem_res = NULL; | ||||
ioport_rid = CY_PCI_BASE_ADDR1; | ioport_rid = CY_PCI_BASE_ADDR1; | ||||
ioport_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &ioport_rid, | ioport_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &ioport_rid, | ||||
0ul, ~0ul, 0ul, RF_ACTIVE); | 0, ~0, 0, RF_ACTIVE); | ||||
if (ioport_res == NULL) { | if (ioport_res == NULL) { | ||||
device_printf(dev, "ioport resource allocation failed\n"); | device_printf(dev, "ioport resource allocation failed\n"); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
ioport = rman_get_start(ioport_res); | ioport = rman_get_start(ioport_res); | ||||
mem_rid = CY_PCI_BASE_ADDR2; | mem_rid = CY_PCI_BASE_ADDR2; | ||||
mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, | mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, | ||||
0ul, ~0ul, 0ul, RF_ACTIVE); | 0, ~0, 0, RF_ACTIVE); | ||||
if (mem_res == NULL) { | if (mem_res == NULL) { | ||||
device_printf(dev, "memory resource allocation failed\n"); | device_printf(dev, "memory resource allocation failed\n"); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
vaddr = rman_get_virtual(mem_res); | vaddr = rman_get_virtual(mem_res); | ||||
vsc = cyattach_common(vaddr, 1); | vsc = cyattach_common(vaddr, 1); | ||||
if (vsc == NULL) { | if (vsc == NULL) { | ||||
device_printf(dev, "no ports found!\n"); | device_printf(dev, "no ports found!\n"); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
irq_rid = 0; | irq_rid = 0; | ||||
irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, 0ul, ~0ul, 0ul, | irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, 0, ~0, 0, | ||||
RF_SHAREABLE | RF_ACTIVE); | RF_SHAREABLE | RF_ACTIVE); | ||||
if (irq_res == NULL) { | if (irq_res == NULL) { | ||||
device_printf(dev, "interrupt resource allocation failed\n"); | device_printf(dev, "interrupt resource allocation failed\n"); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
#ifdef CY_PCI_FASTINTR | #ifdef CY_PCI_FASTINTR | ||||
irq_setup = bus_setup_intr(dev, irq_res, INTR_TYPE_TTY, | irq_setup = bus_setup_intr(dev, irq_res, INTR_TYPE_TTY, | ||||
cyintr, NULL, vsc, &irq_cookie); | cyintr, NULL, vsc, &irq_cookie); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |