|
53 | 53 | #include "system/system.h" |
54 | 54 | #include "target/arm/arm-powerctl.h" |
55 | 55 |
|
| 56 | +#define PROP_STR_GETTER_SETTER(_name) \ |
| 57 | + static char *s8000_get_##_name(Object *obj, Error **errp) \ |
| 58 | + { \ |
| 59 | + return g_strdup(S8000_MACHINE(obj)->_name); \ |
| 60 | + } \ |
| 61 | + \ |
| 62 | + static void s8000_set_##_name(Object *obj, const char *value, \ |
| 63 | + Error **errp) \ |
| 64 | + { \ |
| 65 | + S8000MachineState *s8000_machine; \ |
| 66 | + \ |
| 67 | + s8000_machine = S8000_MACHINE(obj); \ |
| 68 | + g_free(s8000_machine->_name); \ |
| 69 | + s8000_machine->_name = g_strdup(value); \ |
| 70 | + } |
| 71 | + |
| 72 | +#define PROP_GETTER_SETTER(_type, _name) \ |
| 73 | + static void s8000_set_##_name(Object *obj, _type value, Error **errp) \ |
| 74 | + { \ |
| 75 | + S8000_MACHINE(obj)->_name = value; \ |
| 76 | + } \ |
| 77 | + \ |
| 78 | + static _type s8000_get_##_name(Object *obj, Error **errp) \ |
| 79 | + { \ |
| 80 | + return S8000_MACHINE(obj)->_name; \ |
| 81 | + } |
| 82 | + |
56 | 83 | #define S8000_SPI0_IRQ 188 |
57 | 84 |
|
58 | 85 | #define S8000_GPIO_HOLD_KEY 97 |
|
76 | 103 | #define S8000_NVME_SART_BASE (S8000_DRAM_BASE + 0x7F400000ull) |
77 | 104 | #define S8000_NVME_SART_SIZE 0xc00000ull |
78 | 105 |
|
79 | | -// regions 0x1/0x7/0xa are in between, each with a size of 0x4000 bytes. |
| 106 | +// regions 0x1/0x7/0xa are in-between, each with a size of 0x4000 bytes. |
80 | 107 |
|
81 | 108 | // Carveout region 0xC |
82 | 109 | #define S8000_PANIC_SIZE 0x80000ull |
@@ -1506,100 +1533,12 @@ static void s8000_machine_init(MachineState *machine) |
1506 | 1533 | qemu_add_machine_init_done_notifier(&s8000_machine->init_done_notifier); |
1507 | 1534 | } |
1508 | 1535 |
|
1509 | | -static void s8000_set_kaslr_off(Object *obj, bool value, Error **errp) |
1510 | | -{ |
1511 | | - S8000MachineState *s8000_machine; |
1512 | | - |
1513 | | - s8000_machine = S8000_MACHINE(obj); |
1514 | | - s8000_machine->kaslr_off = value; |
1515 | | -} |
1516 | | - |
1517 | | -static bool s8000_get_kaslr_off(Object *obj, Error **errp) |
1518 | | -{ |
1519 | | - S8000MachineState *s8000_machine; |
1520 | | - |
1521 | | - s8000_machine = S8000_MACHINE(obj); |
1522 | | - return s8000_machine->kaslr_off; |
1523 | | -} |
1524 | | - |
1525 | 1536 | static ram_addr_t s8000_machine_fixup_ram_size(ram_addr_t size) |
1526 | 1537 | { |
1527 | 1538 | g_assert_cmpuint(size, ==, S8000_DRAM_SIZE); |
1528 | 1539 | return size; |
1529 | 1540 | } |
1530 | 1541 |
|
1531 | | -static void s8000_set_trustcache_filename(Object *obj, const char *value, |
1532 | | - Error **errp) |
1533 | | -{ |
1534 | | - S8000MachineState *s8000_machine; |
1535 | | - |
1536 | | - s8000_machine = S8000_MACHINE(obj); |
1537 | | - g_free(s8000_machine->trustcache_filename); |
1538 | | - s8000_machine->trustcache_filename = g_strdup(value); |
1539 | | -} |
1540 | | - |
1541 | | -static char *s8000_get_trustcache_filename(Object *obj, Error **errp) |
1542 | | -{ |
1543 | | - S8000MachineState *s8000_machine; |
1544 | | - |
1545 | | - s8000_machine = S8000_MACHINE(obj); |
1546 | | - return g_strdup(s8000_machine->trustcache_filename); |
1547 | | -} |
1548 | | - |
1549 | | -static void s8000_set_ticket_filename(Object *obj, const char *value, |
1550 | | - Error **errp) |
1551 | | -{ |
1552 | | - S8000MachineState *s8000_machine; |
1553 | | - |
1554 | | - s8000_machine = S8000_MACHINE(obj); |
1555 | | - g_free(s8000_machine->ticket_filename); |
1556 | | - s8000_machine->ticket_filename = g_strdup(value); |
1557 | | -} |
1558 | | - |
1559 | | -static char *s8000_get_ticket_filename(Object *obj, Error **errp) |
1560 | | -{ |
1561 | | - S8000MachineState *s8000_machine; |
1562 | | - |
1563 | | - s8000_machine = S8000_MACHINE(obj); |
1564 | | - return g_strdup(s8000_machine->ticket_filename); |
1565 | | -} |
1566 | | - |
1567 | | -static void s8000_set_seprom_filename(Object *obj, const char *value, |
1568 | | - Error **errp) |
1569 | | -{ |
1570 | | - S8000MachineState *s8000_machine; |
1571 | | - |
1572 | | - s8000_machine = S8000_MACHINE(obj); |
1573 | | - g_free(s8000_machine->seprom_filename); |
1574 | | - s8000_machine->seprom_filename = g_strdup(value); |
1575 | | -} |
1576 | | - |
1577 | | -static char *s8000_get_seprom_filename(Object *obj, Error **errp) |
1578 | | -{ |
1579 | | - S8000MachineState *s8000_machine; |
1580 | | - |
1581 | | - s8000_machine = S8000_MACHINE(obj); |
1582 | | - return g_strdup(s8000_machine->seprom_filename); |
1583 | | -} |
1584 | | - |
1585 | | -static void s8000_set_sepfw_filename(Object *obj, const char *value, |
1586 | | - Error **errp) |
1587 | | -{ |
1588 | | - S8000MachineState *s8000_machine; |
1589 | | - |
1590 | | - s8000_machine = S8000_MACHINE(obj); |
1591 | | - g_free(s8000_machine->sep_fw_filename); |
1592 | | - s8000_machine->sep_fw_filename = g_strdup(value); |
1593 | | -} |
1594 | | - |
1595 | | -static char *s8000_get_sepfw_filename(Object *obj, Error **errp) |
1596 | | -{ |
1597 | | - S8000MachineState *s8000_machine; |
1598 | | - |
1599 | | - s8000_machine = S8000_MACHINE(obj); |
1600 | | - return g_strdup(s8000_machine->sep_fw_filename); |
1601 | | -} |
1602 | | - |
1603 | 1542 | static void s8000_set_boot_mode(Object *obj, const char *value, Error **errp) |
1604 | 1543 | { |
1605 | 1544 | S8000MachineState *s8000_machine; |
@@ -1641,44 +1580,28 @@ static char *s8000_get_boot_mode(Object *obj, Error **errp) |
1641 | 1580 | static void s8000_get_ecid(Object *obj, Visitor *v, const char *name, |
1642 | 1581 | void *opaque, Error **errp) |
1643 | 1582 | { |
1644 | | - S8000MachineState *s8000_machine; |
1645 | | - int64_t value; |
| 1583 | + uint64_t value; |
1646 | 1584 |
|
1647 | | - s8000_machine = S8000_MACHINE(obj); |
1648 | | - value = s8000_machine->ecid; |
1649 | | - visit_type_int(v, name, &value, errp); |
| 1585 | + value = S8000_MACHINE(obj)->ecid; |
| 1586 | + visit_type_uint64(v, name, &value, errp); |
1650 | 1587 | } |
1651 | 1588 |
|
1652 | 1589 | static void s8000_set_ecid(Object *obj, Visitor *v, const char *name, |
1653 | 1590 | void *opaque, Error **errp) |
1654 | 1591 | { |
1655 | | - S8000MachineState *s8000_machine; |
1656 | | - int64_t value; |
| 1592 | + uint64_t value; |
1657 | 1593 |
|
1658 | | - s8000_machine = S8000_MACHINE(obj); |
1659 | | - |
1660 | | - if (!visit_type_int(v, name, &value, errp)) { |
1661 | | - return; |
| 1594 | + if (visit_type_uint64(v, name, &value, errp)) { |
| 1595 | + S8000_MACHINE(obj)->ecid = value; |
1662 | 1596 | } |
1663 | | - |
1664 | | - s8000_machine->ecid = value; |
1665 | | -} |
1666 | | - |
1667 | | -static void s8000_set_force_dfu(Object *obj, bool value, Error **errp) |
1668 | | -{ |
1669 | | - S8000MachineState *s8000_machine; |
1670 | | - |
1671 | | - s8000_machine = S8000_MACHINE(obj); |
1672 | | - s8000_machine->force_dfu = value; |
1673 | 1597 | } |
1674 | 1598 |
|
1675 | | -static bool s8000_get_force_dfu(Object *obj, Error **errp) |
1676 | | -{ |
1677 | | - S8000MachineState *s8000_machine; |
1678 | | - |
1679 | | - s8000_machine = S8000_MACHINE(obj); |
1680 | | - return s8000_machine->force_dfu; |
1681 | | -} |
| 1599 | +PROP_STR_GETTER_SETTER(trustcache_filename); |
| 1600 | +PROP_STR_GETTER_SETTER(ticket_filename); |
| 1601 | +PROP_STR_GETTER_SETTER(sep_rom_filename); |
| 1602 | +PROP_STR_GETTER_SETTER(sep_fw_filename); |
| 1603 | +PROP_GETTER_SETTER(bool, kaslr_off); |
| 1604 | +PROP_GETTER_SETTER(bool, force_dfu); |
1682 | 1605 |
|
1683 | 1606 | static void s8000_machine_class_init(ObjectClass *klass, const void *data) |
1684 | 1607 | { |
@@ -1707,13 +1630,14 @@ static void s8000_machine_class_init(ObjectClass *klass, const void *data) |
1707 | 1630 | s8000_set_ticket_filename); |
1708 | 1631 | object_class_property_set_description(klass, "ticket", |
1709 | 1632 | "APTicket to be loaded"); |
1710 | | - object_class_property_add_str(klass, "seprom", s8000_get_seprom_filename, |
1711 | | - s8000_set_seprom_filename); |
1712 | | - object_class_property_set_description(klass, "seprom", |
| 1633 | + object_class_property_add_str(klass, "sep-rom", s8000_get_sep_rom_filename, |
| 1634 | + s8000_set_sep_rom_filename); |
| 1635 | + object_class_property_set_description(klass, "sep-rom", |
1713 | 1636 | "SEPROM to be loaded"); |
1714 | | - object_class_property_add_str(klass, "sepfw", s8000_get_sepfw_filename, |
1715 | | - s8000_set_sepfw_filename); |
1716 | | - object_class_property_set_description(klass, "sepfw", "SEPFW to be loaded"); |
| 1637 | + object_class_property_add_str(klass, "sep-fw", s8000_get_sep_fw_filename, |
| 1638 | + s8000_set_sep_fw_filename); |
| 1639 | + object_class_property_set_description(klass, "sep-fw", |
| 1640 | + "SEPFW to be loaded"); |
1717 | 1641 | object_class_property_add_str(klass, "boot-mode", s8000_get_boot_mode, |
1718 | 1642 | s8000_set_boot_mode); |
1719 | 1643 | object_class_property_set_description(klass, "boot-mode", |
|
0 commit comments