diff options
author | kmacy <kmacy@FreeBSD.org> | 2006-12-12 02:50:12 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2006-12-12 02:50:12 +0000 |
commit | 143e23a6dc43bd7c1f3d72190bb7e0a57b4d68b9 (patch) | |
tree | 38c392e45e171a41f2c843acbd112371af3f26ae | |
parent | 33b85a172af8c4da52f8b663d0f4bd62fa91d580 (diff) | |
download | FreeBSD-src-143e23a6dc43bd7c1f3d72190bb7e0a57b4d68b9.zip FreeBSD-src-143e23a6dc43bd7c1f3d72190bb7e0a57b4d68b9.tar.gz |
- provide a more informative panic if mdesc_update() fails
- handle some cases where the return value of mdesc_update() is not zero
when it should be
-rw-r--r-- | sys/sun4v/mdesc/mdesc_init.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/sun4v/mdesc/mdesc_init.c b/sys/sun4v/mdesc/mdesc_init.c index eed9493..a18008e 100644 --- a/sys/sun4v/mdesc/mdesc_init.c +++ b/sys/sun4v/mdesc/mdesc_init.c @@ -197,19 +197,22 @@ mdesc_update(void) (mdesc_memops->mm_buf_free)(buf, mdesc_buf_size); mdesc_size = 0LL; - hv_mach_desc((uint64_t)0, &mdesc_size); + do { + rv = hv_mach_desc((uint64_t)0, &mdesc_size); + if (rv != H_EOK && rv != H_EINVAL) + printf("retrying to fetch mdesc size\n"); + } while (rv != H_EOK && rv != H_EINVAL); mdesc_size = mdesc_buf_size = round_page(mdesc_size); if ((buf = (*mdesc_memops->mm_buf_alloc)(mdesc_buf_size, PAGE_SIZE)) == NULL) { - rv = -1; + rv = ENOMEM; goto done; } rv = hv_mach_desc(vtophys(buf), &mdesc_size); if (rv != H_EOK && rv != H_EINVAL) { - rv = -1; goto done; } } while (mdesc_size > mdesc_buf_size); @@ -235,7 +238,7 @@ mdesc_update(void) curr_mdesc->md_buf_size = mdesc_buf_size; mtx_unlock(&curr_mdesc_lock); - return (rv); + return (0); done: if (buf != NULL) @@ -247,16 +250,16 @@ md_t * md_get(void) { md_t *mdp; + int rc; - /* * XXX This should actually happen in init */ if (curr_mdesc == NULL) { if ((curr_mdesc = mdesc_alloc()) == NULL) panic("machine description allocation failed"); - if (mdesc_update()) - panic("machine description update failed"); + if ((rc = mdesc_update()) != 0) + panic("machine description update failed: %d", rc); } mtx_lock(&curr_mdesc_lock); |