diff options
author | Toomas Soome <tsoome@me.com> | 2016-12-19 00:17:13 +0200 |
---|---|---|
committer | Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> | 2017-01-07 16:38:36 +0100 |
commit | d98490e4c04a9cb28c4a2c73887e16e5da1d9468 (patch) | |
tree | 58bbc6a67def30b032cba9ae8b43423a8b0b861f | |
parent | b130c20454b5d071292134d42cf34c9f5938c1d5 (diff) | |
download | illumos-joyent-d98490e4c04a9cb28c4a2c73887e16e5da1d9468.tar.gz |
7734 uts: update properties with correct type
7735 uts: bootfs should use ddi_prop_get_int64()
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
-rw-r--r-- | usr/src/uts/common/fs/bootfs/bootfs_construct.c | 28 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/ddi_impl.c | 43 |
2 files changed, 41 insertions, 30 deletions
diff --git a/usr/src/uts/common/fs/bootfs/bootfs_construct.c b/usr/src/uts/common/fs/bootfs/bootfs_construct.c index b909b5d121..e94c967b13 100644 --- a/usr/src/uts/common/fs/bootfs/bootfs_construct.c +++ b/usr/src/uts/common/fs/bootfs/bootfs_construct.c @@ -292,11 +292,10 @@ bootfs_construct_entry(bootfs_t *bfs, uintptr_t addr, uint64_t size, void bootfs_construct(bootfs_t *bfs) { - uint_t id = 0, ndata; + uint_t id = 0; char paddr[64], psize[64], pname[64], *mname; dev_info_t *root; - uchar_t *datap; - uint64_t size = 0, addr = 0; + uint64_t size, addr; int ret; bootfs_mkroot(bfs); @@ -318,25 +317,14 @@ bootfs_construct(bootfs_t *bfs) sizeof (paddr)) break; - if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, root, - DDI_PROP_DONTPASS, paddr, &datap, &ndata) != - DDI_PROP_SUCCESS) + addr = (uint64_t)ddi_prop_get_int64(DDI_DEV_T_ANY, root, + DDI_PROP_DONTPASS, paddr, 0); + if (addr == 0 || addr == DDI_PROP_NOT_FOUND) break; - if (ndata == 8) - bcopy(datap, &addr, sizeof (uint64_t)); - ddi_prop_free(datap); - if (ndata != 8) - break; - - if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, root, - DDI_PROP_DONTPASS, psize, &datap, &ndata) != - DDI_PROP_SUCCESS) - break; - if (ndata == 8) - bcopy(datap, &size, sizeof (uint64_t)); - ddi_prop_free(datap); - if (ndata != 8) + size = (uint64_t)ddi_prop_get_int64(DDI_DEV_T_ANY, root, + DDI_PROP_DONTPASS, psize, 0); + if (size == 0 || size == DDI_PROP_NOT_FOUND) break; if (ddi_prop_lookup_string(DDI_DEV_T_ANY, root, diff --git a/usr/src/uts/i86pc/os/ddi_impl.c b/usr/src/uts/i86pc/os/ddi_impl.c index fa65b87441..ff8935f3a9 100644 --- a/usr/src/uts/i86pc/os/ddi_impl.c +++ b/usr/src/uts/i86pc/os/ddi_impl.c @@ -1407,7 +1407,7 @@ contig_free(void *addr, size_t size) */ static void * kalloca(size_t size, size_t align, int cansleep, int physcontig, - ddi_dma_attr_t *attr) + ddi_dma_attr_t *attr) { size_t *addr, *raddr, rsize; size_t hdrsize = 4 * sizeof (size_t); /* must be power of 2 */ @@ -1606,9 +1606,9 @@ i_ddi_cacheattr_to_hatacc(uint_t flags, uint_t *hataccp) /*ARGSUSED*/ int i_ddi_mem_alloc(dev_info_t *dip, ddi_dma_attr_t *attr, - size_t length, int cansleep, int flags, - ddi_device_acc_attr_t *accattrp, caddr_t *kaddrp, - size_t *real_length, ddi_acc_hdl_t *ap) + size_t length, int cansleep, int flags, + ddi_device_acc_attr_t *accattrp, caddr_t *kaddrp, + size_t *real_length, ddi_acc_hdl_t *ap) { caddr_t a; int iomin; @@ -1905,6 +1905,29 @@ get_boot_properties(void) } else if (strcmp(name, "stdout") == 0) { (void) ndi_prop_update_int(DDI_DEV_T_NONE, devi, property_name, *((int *)bop_staging_area)); + } else if (strcmp(name, "boot-args") == 0) { + copy_boot_str(bop_staging_area, property_val, 50); + (void) e_ddi_prop_update_string(DDI_DEV_T_NONE, devi, + property_name, property_val); + } else if (strcmp(name, "bootargs") == 0) { + copy_boot_str(bop_staging_area, property_val, 50); + (void) e_ddi_prop_update_string(DDI_DEV_T_NONE, devi, + property_name, property_val); + } else if (strcmp(name, "bootp-response") == 0) { + (void) e_ddi_prop_update_byte_array(DDI_DEV_T_NONE, + devi, property_name, bop_staging_area, length); + } else if (strcmp(name, "ramdisk_start") == 0) { + (void) e_ddi_prop_update_int64(DDI_DEV_T_NONE, devi, + property_name, *((int64_t *)bop_staging_area)); + } else if (strcmp(name, "ramdisk_end") == 0) { + (void) e_ddi_prop_update_int64(DDI_DEV_T_NONE, devi, + property_name, *((int64_t *)bop_staging_area)); + } else if (strncmp(name, "module-addr-", 12) == 0) { + (void) e_ddi_prop_update_int64(DDI_DEV_T_NONE, devi, + property_name, *((int64_t *)bop_staging_area)); + } else if (strncmp(name, "module-size-", 12) == 0) { + (void) e_ddi_prop_update_int64(DDI_DEV_T_NONE, devi, + property_name, *((int64_t *)bop_staging_area)); } else { /* Property type unknown, use old prop interface */ (void) e_ddi_prop_create(DDI_DEV_T_NONE, devi, @@ -2431,10 +2454,10 @@ pci_peekpoke_check_nofma(void *arg, ddi_ctl_enum_t ctlop) int pci_peekpoke_check(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t ctlop, void *arg, void *result, - int (*handler)(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, - void *), kmutex_t *err_mutexp, kmutex_t *peek_poke_mutexp, - void (*scan)(dev_info_t *, ddi_fm_error_t *)) + ddi_ctl_enum_t ctlop, void *arg, void *result, + int (*handler)(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, + void *), kmutex_t *err_mutexp, kmutex_t *peek_poke_mutexp, + void (*scan)(dev_info_t *, ddi_fm_error_t *)) { int rval; peekpoke_ctlops_t *in_args = (peekpoke_ctlops_t *)arg; @@ -2769,7 +2792,7 @@ i_ddi_caut_put64(ddi_acc_impl_t *hp, uint64_t *addr, uint64_t value) void i_ddi_caut_rep_get8(ddi_acc_impl_t *hp, uint8_t *host_addr, uint8_t *dev_addr, - size_t repcount, uint_t flags) + size_t repcount, uint_t flags) { i_ddi_caut_getput_ctlops(hp, (uintptr_t)host_addr, (uintptr_t)dev_addr, sizeof (uint8_t), repcount, flags, DDI_CTLOPS_PEEK); @@ -2801,7 +2824,7 @@ i_ddi_caut_rep_get64(ddi_acc_impl_t *hp, uint64_t *host_addr, void i_ddi_caut_rep_put8(ddi_acc_impl_t *hp, uint8_t *host_addr, uint8_t *dev_addr, - size_t repcount, uint_t flags) + size_t repcount, uint_t flags) { i_ddi_caut_getput_ctlops(hp, (uintptr_t)host_addr, (uintptr_t)dev_addr, sizeof (uint8_t), repcount, flags, DDI_CTLOPS_POKE); |