5 /* --- target physical address --- */
7 static int parse_taddr(DeviceState
*dev
, Property
*prop
, const char *str
)
9 hwaddr
*ptr
= qdev_get_prop_ptr(dev
, prop
);
11 *ptr
= strtoull(str
, NULL
, 16);
15 static int print_taddr(DeviceState
*dev
, Property
*prop
, char *dest
, size_t len
)
17 hwaddr
*ptr
= qdev_get_prop_ptr(dev
, prop
);
18 return snprintf(dest
, len
, "0x" TARGET_FMT_plx
, *ptr
);
21 static void get_taddr(Object
*obj
, Visitor
*v
, void *opaque
,
22 const char *name
, Error
**errp
)
24 DeviceState
*dev
= DEVICE(obj
);
25 Property
*prop
= opaque
;
26 hwaddr
*ptr
= qdev_get_prop_ptr(dev
, prop
);
30 visit_type_int64(v
, &value
, name
, errp
);
33 static void set_taddr(Object
*obj
, Visitor
*v
, void *opaque
,
34 const char *name
, Error
**errp
)
36 DeviceState
*dev
= DEVICE(obj
);
37 Property
*prop
= opaque
;
38 hwaddr
*ptr
= qdev_get_prop_ptr(dev
, prop
);
39 Error
*local_err
= NULL
;
42 if (dev
->state
!= DEV_STATE_CREATED
) {
43 error_set(errp
, QERR_PERMISSION_DENIED
);
47 visit_type_int64(v
, &value
, name
, &local_err
);
49 error_propagate(errp
, local_err
);
52 if ((uint64_t)value
<= (uint64_t) ~(hwaddr
)0) {
55 error_set(errp
, QERR_PROPERTY_VALUE_OUT_OF_RANGE
,
56 dev
->id
?:"", name
, value
, (uint64_t) 0,
57 (uint64_t) ~(hwaddr
)0);
62 PropertyInfo qdev_prop_taddr
= {
70 void qdev_prop_set_taddr(DeviceState
*dev
, const char *name
, hwaddr value
)
73 object_property_set_int(OBJECT(dev
), value
, name
, &errp
);