Also require the table to be present.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
offset += sizeof(*io_apic);
lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
- for ( i = 0; i < get_vcpu_nr(); i++ )
+ for ( i = 0; i < hvm_info->nr_vcpus; i++ )
{
memset(lapic, 0, sizeof(*lapic));
lapic->type = ACPI_PROCESSOR_LOCAL_APIC;
uint16_t *tis_hdr;
/* MADT. */
- if ( (get_vcpu_nr() > 1) || get_apic_mode() )
+ if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
{
madt = (struct acpi_20_madt *)&buf[offset];
offset += construct_madt(madt);
apic_setup();
pci_setup();
- if ( (get_vcpu_nr() > 1) || get_apic_mode() )
+ if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
create_mp_tables();
switch ( virtual_vga )
option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
option_rom_sz = pci_load_option_roms(option_rom_phys_addr);
- if ( get_acpi_enabled() )
+ if ( hvm_info->acpi_enabled )
{
printf("Loading ACPI ...\n");
acpi_build_tables();
int vcpu_nr, i;
uint8_t checksum;
- vcpu_nr = get_vcpu_nr();
+ vcpu_nr = hvm_info->nr_vcpus;
/* fill in the MP configuration table signature, "PCMP" */
mpct->signature[0] = 'P';
char *p;
int vcpu_nr, i, length;
- vcpu_nr = get_vcpu_nr();
+ vcpu_nr = hvm_info->nr_vcpus;
printf("Creating MP tables ...\n");
/* SCRATCH_PHYSICAL_ADDRESS is a safe large memory area for scratch. */
len = write_smbios_tables((void *)SCRATCH_PHYSICAL_ADDRESS,
- get_vcpu_nr(), get_memsize(),
+ hvm_info->nr_vcpus, get_memsize(),
uuid, xen_version_str,
xen_major_version, xen_minor_version);
if ( len > SMBIOS_MAXIMUM_SIZE )
void smp_initialise(void)
{
- unsigned int i, nr_cpus = get_vcpu_nr();
+ unsigned int i, nr_cpus = hvm_info->nr_vcpus;
memcpy((void *)AP_BOOT_EIP, ap_boot_start, ap_boot_end - ap_boot_start);
#include <stdint.h>
#include <xen/xen.h>
#include <xen/memory.h>
-#include <xen/hvm/hvm_info_table.h>
void wrmsr(uint32_t idx, uint64_t v)
{
return (sum == 0);
}
-static struct hvm_info_table *get_hvm_info_table(void)
+struct hvm_info_table *get_hvm_info_table(void)
{
static struct hvm_info_table *table;
struct hvm_info_table *t;
if ( !validate_hvm_info(t) )
{
printf("Bad hvm info table\n");
- return NULL;
+ BUG();
}
table = t;
return table;
}
-int get_vcpu_nr(void)
-{
- struct hvm_info_table *t = get_hvm_info_table();
- return (t ? t->nr_vcpus : 1);
-}
-
-int get_acpi_enabled(void)
-{
- struct hvm_info_table *t = get_hvm_info_table();
- return (t ? t->acpi_enabled : 1);
-}
-
-int get_apic_mode(void)
-{
- struct hvm_info_table *t = get_hvm_info_table();
- return (t ? t->apic_mode : 1);
-}
-
uint16_t get_cpu_mhz(void)
{
struct xen_add_to_physmap xatp;
#include <stdarg.h>
#include <stdint.h>
+#include <xen/hvm/hvm_info_table.h>
#undef offsetof
#define offsetof(t, m) ((unsigned long)&((t *)0)->m)
})
/* HVM-builder info. */
-int get_vcpu_nr(void);
-int get_acpi_enabled(void);
-int get_apic_mode(void);
+struct hvm_info_table *get_hvm_info_table(void);
+#define hvm_info (get_hvm_info_table())
/* String and memory functions */
int strcmp(const char *cs, const char *ct);