Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mca/mca_bus.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
if (device_get_desc(child)) { | if (device_get_desc(child)) { | ||||
snprintf(buf, sizeof(buf), "<%s>", device_get_desc(child)); | snprintf(buf, sizeof(buf), "<%s>", device_get_desc(child)); | ||||
mca_reg_print(child, buf, NULL, &column); | mca_reg_print(child, buf, NULL, &column); | ||||
} | } | ||||
rid = 0; | rid = 0; | ||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IOPORT, rid++))) { | while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IOPORT, rid++))) { | ||||
if (rle->count == 1) { | if (rle->count == 1) { | ||||
snprintf(buf, sizeof(buf), "%s%lx", | snprintf(buf, sizeof(buf), "%s%jx", | ||||
((rid == 1) ? "io 0x" : "0x"), | ((rid == 1) ? "io 0x" : "0x"), | ||||
rle->start); | rle->start); | ||||
} else { | } else { | ||||
snprintf(buf, sizeof(buf), "%s%lx-0x%lx", | snprintf(buf, sizeof(buf), "%s%jx-0x%jx", | ||||
((rid == 1) ? "io 0x" : "0x"), | ((rid == 1) ? "io 0x" : "0x"), | ||||
rle->start, | rle->start, | ||||
(rle->start + rle->count)); | (rle->start + rle->count)); | ||||
} | } | ||||
mca_reg_print(child, buf, | mca_reg_print(child, buf, | ||||
((rid == 2) ? &separator : NULL), &column); | ((rid == 2) ? &separator : NULL), &column); | ||||
} | } | ||||
rid = 0; | rid = 0; | ||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_MEMORY, rid++))) { | while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_MEMORY, rid++))) { | ||||
if (rle->count == 1) { | if (rle->count == 1) { | ||||
snprintf(buf, sizeof(buf), "%s%lx", | snprintf(buf, sizeof(buf), "%s%jx", | ||||
((rid == 1) ? "mem 0x" : "0x"), | ((rid == 1) ? "mem 0x" : "0x"), | ||||
rle->start); | rle->start); | ||||
} else { | } else { | ||||
snprintf(buf, sizeof(buf), "%s%lx-0x%lx", | snprintf(buf, sizeof(buf), "%s%jx-0x%jx", | ||||
((rid == 1) ? "mem 0x" : "0x"), | ((rid == 1) ? "mem 0x" : "0x"), | ||||
rle->start, | rle->start, | ||||
(rle->start + rle->count)); | (rle->start + rle->count)); | ||||
} | } | ||||
mca_reg_print(child, buf, | mca_reg_print(child, buf, | ||||
((rid == 2) ? &separator : NULL), &column); | ((rid == 2) ? &separator : NULL), &column); | ||||
} | } | ||||
rid = 0; | rid = 0; | ||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IRQ, rid++))) { | while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IRQ, rid++))) { | ||||
snprintf(buf, sizeof(buf), "irq %ld", rle->start); | snprintf(buf, sizeof(buf), "irq %jd", rle->start); | ||||
mca_reg_print(child, buf, | mca_reg_print(child, buf, | ||||
((rid == 1) ? &separator : NULL), &column); | ((rid == 1) ? &separator : NULL), &column); | ||||
} | } | ||||
rid = 0; | rid = 0; | ||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_DRQ, rid++))) { | while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_DRQ, rid++))) { | ||||
snprintf(buf, sizeof(buf), "drq %lx", rle->start); | snprintf(buf, sizeof(buf), "drq %jx", rle->start); | ||||
mca_reg_print(child, buf, | mca_reg_print(child, buf, | ||||
((rid == 1) ? &separator : NULL), &column); | ((rid == 1) ? &separator : NULL), &column); | ||||
} | } | ||||
snprintf(buf, sizeof(buf), "on %s id %04x slot %d\n", | snprintf(buf, sizeof(buf), "on %s id %04x slot %d\n", | ||||
device_get_nameunit(dev), | device_get_nameunit(dev), | ||||
mca_get_id(child), mca_get_slot(child)+1); | mca_get_id(child), mca_get_slot(child)+1); | ||||
mca_reg_print(child, buf, NULL, &column); | mca_reg_print(child, buf, NULL, &column); | ||||
Show All 36 Lines | |||||
break; | break; | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
mca_alloc_resource (device_t dev, device_t child, int type, int *rid, | mca_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 mca_device * m_dev = device_get_ivars(child); | struct mca_device * m_dev = device_get_ivars(child); | ||||
struct resource_list_entry * rle; | struct resource_list_entry * rle; | ||||
int isdefault; | int isdefault; | ||||
int passthrough; | int passthrough; | ||||
isdefault = (start == 0UL && end == ~0UL); | isdefault = (start == 0 && end == ~0); | ||||
passthrough = (device_get_parent(child) != dev); | passthrough = (device_get_parent(child) != dev); | ||||
if (!passthrough && !isdefault) { | if (!passthrough && !isdefault) { | ||||
rle = resource_list_find(&(m_dev->rl), type, *rid); | rle = resource_list_find(&(m_dev->rl), type, *rid); | ||||
if (!rle) { | if (!rle) { | ||||
resource_list_add(&(m_dev->rl), type, *rid, | resource_list_add(&(m_dev->rl), type, *rid, | ||||
start, end, count); | start, end, count); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |