2009-07-15 11:43:31 +00:00
|
|
|
#include "qdev.h"
|
|
|
|
#include "qdev-addr.h"
|
|
|
|
#include "targphys.h"
|
|
|
|
|
|
|
|
/* --- target physical address --- */
|
|
|
|
|
|
|
|
static int parse_taddr(DeviceState *dev, Property *prop, const char *str)
|
|
|
|
{
|
2009-10-01 21:12:16 +00:00
|
|
|
target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop);
|
2009-07-15 11:43:31 +00:00
|
|
|
|
|
|
|
*ptr = strtoull(str, NULL, 16);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int print_taddr(DeviceState *dev, Property *prop, char *dest, size_t len)
|
|
|
|
{
|
2009-10-01 21:12:16 +00:00
|
|
|
target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop);
|
2009-07-15 11:43:31 +00:00
|
|
|
return snprintf(dest, len, "0x" TARGET_FMT_plx, *ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyInfo qdev_prop_taddr = {
|
|
|
|
.name = "taddr",
|
|
|
|
.type = PROP_TYPE_TADDR,
|
2009-10-01 21:12:16 +00:00
|
|
|
.size = sizeof(target_phys_addr_t),
|
2009-07-15 11:43:31 +00:00
|
|
|
.parse = parse_taddr,
|
|
|
|
.print = print_taddr,
|
|
|
|
};
|
|
|
|
|
2009-10-01 21:12:16 +00:00
|
|
|
void qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value)
|
2009-07-15 11:43:31 +00:00
|
|
|
{
|
|
|
|
qdev_prop_set(dev, name, &value, PROP_TYPE_TADDR);
|
|
|
|
}
|