Revision 4c5b10b7 hw/pc.c

b/hw/pc.c
59 59
#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
60 60
#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
61 61
#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2)
62
#define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3)
62 63

  
63 64
#define MAX_IDE_BUS 2
64 65

  
......
67 68
static PITState *pit;
68 69
static PCII440FXState *i440fx_state;
69 70

  
71
#define E820_NR_ENTRIES		16
72

  
73
struct e820_entry {
74
    uint64_t address;
75
    uint64_t length;
76
    uint32_t type;
77
};
78

  
79
struct e820_table {
80
    uint32_t count;
81
    struct e820_entry entry[E820_NR_ENTRIES];
82
};
83

  
84
static struct e820_table e820_table;
85

  
70 86
typedef struct isa_irq_state {
71 87
    qemu_irq *i8259;
72 88
    qemu_irq *ioapic;
......
435 451
    }
436 452
}
437 453

  
454
int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
455
{
456
    int index = e820_table.count;
457
    struct e820_entry *entry;
458

  
459
    if (index >= E820_NR_ENTRIES)
460
        return -EBUSY;
461
    entry = &e820_table.entry[index];
462

  
463
    entry->address = address;
464
    entry->length = length;
465
    entry->type = type;
466

  
467
    e820_table.count++;
468
    return e820_table.count;
469
}
470

  
438 471
static void *bochs_bios_init(void)
439 472
{
440 473
    void *fw_cfg;
......
466 499
    if (smbios_table)
467 500
        fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
468 501
                         smbios_table, smbios_len);
502
    fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, (uint8_t *)&e820_table,
503
                     sizeof(struct e820_table));
469 504

  
470 505
    /* allocate memory for the NUMA channel: one (64bit) word for the number
471 506
     * of nodes, one word for each VCPU->node and one word for each node to

Also available in: Unified diff