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; | ||||
Context not available. | |||||
rman_set_bustag(r, X86_BUS_SPACE_IO); | rman_set_bustag(r, X86_BUS_SPACE_IO); | ||||
break; | break; | ||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
if (rman_get_end(r) > BUS_SPACE_MAXADDR) | |||||
jhb: Again, please fix this when the rman is inited, not as a check here. | |||||
return (ENOMEM); | |||||
#ifdef PC98 | #ifdef PC98 | ||||
error = i386_bus_space_handle_alloc(X86_BUS_SPACE_MEM, | error = i386_bus_space_handle_alloc(X86_BUS_SPACE_MEM, | ||||
rman_get_start(r), rman_get_size(r), &bh); | rman_get_start(r), rman_get_size(r), &bh); | ||||
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; | ||||
Context not available. | |||||
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. | |||||
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… |
Again, please fix this when the rman is inited, not as a check here.