Changeset View
Standalone View
sys/x86/x86/nexus.c
Context not available. | |||||
static device_t nexus_add_child(device_t bus, u_int order, const char *name, | static device_t nexus_add_child(device_t bus, u_int order, const char *name, | ||||
int unit); | int unit); | ||||
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, | static struct resource *nexus_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 nexus_adjust_resource(device_t, device_t, int, struct resource *, | static int nexus_adjust_resource(device_t, device_t, int, struct resource *, | ||||
u_long, u_long); | rman_res_t, rman_res_t); | ||||
#ifdef SMP | #ifdef SMP | ||||
static int nexus_bind_intr(device_t, device_t, struct resource *, int); | static int nexus_bind_intr(device_t, device_t, struct resource *, int); | ||||
#endif | #endif | ||||
Context not available. | |||||
static int nexus_teardown_intr(device_t, device_t, struct resource *, | static int nexus_teardown_intr(device_t, device_t, struct resource *, | ||||
void *); | void *); | ||||
static struct resource_list *nexus_get_reslist(device_t dev, device_t child); | static struct resource_list *nexus_get_reslist(device_t dev, device_t child); | ||||
static int nexus_set_resource(device_t, device_t, int, int, u_long, u_long); | static int nexus_set_resource(device_t, device_t, int, int, | ||||
static int nexus_get_resource(device_t, device_t, int, int, u_long *, u_long *); | rman_res_t, rman_res_t); | ||||
static int nexus_get_resource(device_t, device_t, int, int, | |||||
rman_res_t *, rman_res_t *); | |||||
static void nexus_delete_resource(device_t, device_t, int, int); | static void nexus_delete_resource(device_t, device_t, int, int); | ||||
#ifdef DEV_APIC | #ifdef DEV_APIC | ||||
static int nexus_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); | static int nexus_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); | ||||
Context not available. | |||||
panic("nexus_init_resources port_rman"); | panic("nexus_init_resources port_rman"); | ||||
mem_rman.rm_start = 0; | mem_rman.rm_start = 0; | ||||
mem_rman.rm_end = ~0ul; | mem_rman.rm_end = ~0; | ||||
mem_rman.rm_type = RMAN_ARRAY; | mem_rman.rm_type = RMAN_ARRAY; | ||||
mem_rman.rm_descr = "I/O memory addresses"; | mem_rman.rm_descr = "I/O memory addresses"; | ||||
if (rman_init(&mem_rman) | if (rman_init(&mem_rman) | ||||
Context not available. | |||||
*/ | */ | ||||
static struct resource * | static struct resource * | ||||
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, | nexus_alloc_resource(device_t bus, 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 nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
struct resource *rv; | struct resource *rv; | ||||
Context not available. | |||||
* (ie. they aren't maintained by a child bus), then work out | * (ie. they aren't maintained by a child bus), then work out | ||||
* the start/end values. | * the start/end values. | ||||
*/ | */ | ||||
if ((start == 0UL) && (end == ~0UL) && (count == 1)) { | if ((start == 0) && (end == ~0) && (count == 1)) { | ||||
if (device_get_parent(child) != bus || ndev == NULL) | if (device_get_parent(child) != bus || ndev == NULL) | ||||
return(NULL); | return(NULL); | ||||
rle = resource_list_find(&ndev->nx_resources, type, *rid); | rle = resource_list_find(&ndev->nx_resources, type, *rid); | ||||
Context not available. | |||||
static int | static int | ||||
nexus_adjust_resource(device_t bus, device_t child, int type, | nexus_adjust_resource(device_t bus, device_t child, int type, | ||||
struct resource *r, u_long start, u_long end) | struct resource *r, rman_res_t start, rman_res_t end) | ||||
{ | { | ||||
struct rman *rm; | struct rman *rm; | ||||
jhb: Again, please fix this when the rman is inited, not as a check here. | |||||
Context not available. | |||||
} | } | ||||
static int | static int | ||||
nexus_set_resource(device_t dev, device_t child, int type, int rid, u_long start, u_long count) | nexus_set_resource(device_t dev, device_t child, int type, int rid, | ||||
rman_res_t start, rman_res_t count) | |||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
struct resource_list *rl = &ndev->nx_resources; | struct resource_list *rl = &ndev->nx_resources; | ||||
Context not available. | |||||
} | } | ||||
static int | static int | ||||
nexus_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp) | nexus_get_resource(device_t dev, device_t child, int type, int rid, | ||||
rman_res_t *startp, rman_res_t *countp) | |||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
struct resource_list *rl = &ndev->nx_resources; | struct resource_list *rl = &ndev->nx_resources; | ||||
Not Done Inline ActionsNot sure what this is for, but if it is to fix ram0, then please put the changes back in. In ram_attach you should probably change the first one to still DTRT when booting a non-PAE kernel on a machine with RAM above 4G by having it do this: #ifdef __i386__ && !defined(PAE) /* * Address ranges above 4GB can't be accessed with * standard page tables. */ if (smap->base > BUS_SPACE_MAXADDR) continue; #endif However, for the non-SMAP case the check can be removed as it only covers addresses that are valid in a PAE kernel but just don't fit in a long. jhb: Not sure what this is for, but if it is to fix ram0, then please put the changes back in. In… | |||||
Not Done Inline ActionsSince I don't have a machine to test with, I removed these changes from my diff until someone is able to test. Better to err on the side of not breaking. jhibbits: Since I don't have a machine to test with, I removed these changes from my diff until someone… | |||||
Not Done Inline ActionsJust boot a PAE i386 kernel in a bhyve VM. PAE works fine in bhyve. You can create a bhyve VM with 4G of RAM and boot a PAE kernel and check that the resource ranges for ram0 include all of RAM via devinfo -r. This is one of the very few places that need a larger rman type. jhb: Just boot a PAE i386 kernel in a bhyve VM. PAE works fine in bhyve. You can create a bhyve VM… | |||||
Context not available. | |||||
if (smap->type != SMAP_TYPE_MEMORY || | if (smap->type != SMAP_TYPE_MEMORY || | ||||
smap->length == 0) | smap->length == 0) | ||||
continue; | continue; | ||||
#ifdef __i386__ | |||||
adrianUnsubmitted Done Inline ActionsI'd leave these in here unless someone does a sanity pass with an i386 PAE system. adrian: I'd leave these in here unless someone does a sanity pass with an i386 PAE system. | |||||
/* | |||||
* Resources use long's to track resources, so | |||||
* we can't include memory regions above 4GB. | |||||
*/ | |||||
if (smap->base > ~0ul) | |||||
continue; | |||||
#endif | |||||
error = bus_set_resource(dev, SYS_RES_MEMORY, rid, | error = bus_set_resource(dev, SYS_RES_MEMORY, rid, | ||||
smap->base, smap->length); | smap->base, smap->length); | ||||
if (error) | if (error) | ||||
Context not available. | |||||
* segment is 0. | * segment is 0. | ||||
*/ | */ | ||||
for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { | for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { | ||||
#ifdef PAE | |||||
/* | |||||
* Resources use long's to track resources, so we can't | |||||
* include memory regions above 4GB. | |||||
*/ | |||||
if (p[0] > ~0ul) | |||||
break; | |||||
#endif | |||||
error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0], | error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0], | ||||
p[1] - p[0]); | p[1] - p[0]); | ||||
if (error) | if (error) | ||||
Context not available. |
Again, please fix this when the rman is inited, not as a check here.