Skip to content

Commit

Permalink
7734 uts: update properties with correct type
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tsoome authored and hrosenfeld committed Jan 7, 2017
1 parent b130c20 commit d98490e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 30 deletions.
28 changes: 8 additions & 20 deletions usr/src/uts/common/fs/bootfs/bootfs_construct.c
Expand Up @@ -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);
Expand All @@ -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,
Expand Down
43 changes: 33 additions & 10 deletions usr/src/uts/i86pc/os/ddi_impl.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d98490e

Please sign in to comment.