hvm: e820 public header cleanup.

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
Keir Fraser committed 2007-06-10 19:49:44 +01:00
1 parent 21b1fa66ed
commit ebb19b1cc8
17 files changed
+85 -52

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
#ifndef __HVMLOADER_E820_H__
#define __HVMLOADER_E820_H__
#include <xen/hvm/e820.h>
/*
* PC BIOS standard E820 types and structure.
*/
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
struct e820entry {
uint64_t addr;
uint64_t size;
uint32_t type;
} __attribute__((packed));
#define HVM_E820_NR ((unsigned char *)HVM_E820_PAGE + HVM_E820_NR_OFFSET)
#define HVM_E820 ((struct e820entry *)(HVM_E820_PAGE + HVM_E820_OFFSET))
#endif /* __HVMLOADER_E820_H__ */
+3 -2
View File
@@ -27,6 +27,7 @@
#include "config.h"
#include "apic_regs.h"
#include "pci_regs.h"
#include "e820.h"
#include <xen/version.h>
#include <xen/hvm/params.h>
@@ -311,8 +312,8 @@ static int must_load_nic(void)
/* Replace possibly erroneous memory-size CMOS fields with correct values. */
static void cmos_write_memory_size(void)
{
struct e820entry *map = E820_MAP;
int i, nr = *E820_MAP_NR;
struct e820entry *map = HVM_E820;
int i, nr = *HVM_E820_NR;
uint32_t base_mem = 640, ext_mem = 0, alt_mem = 0;
for ( i = 0; i < nr; i++ )
+3 -2
View File
@@ -25,6 +25,7 @@
#include "smbios_types.h"
#include "util.h"
#include "hypercall.h"
#include "e820.h"
static int
write_smbios_tables(void *start,
@@ -131,8 +132,8 @@ write_smbios_tables(void *start,
static uint64_t
get_memsize(void)
{
struct e820entry *map = E820_MAP;
uint8_t num_entries = *E820_MAP_NR;
struct e820entry *map = HVM_E820;
uint8_t num_entries = *HVM_E820_NR;
uint64_t memsize = 0;
int i;
+9 -8
View File
@@ -20,6 +20,7 @@
#include "util.h"
#include "config.h"
#include "e820.h"
#include <stdint.h>
#include <xenctrl.h>
#include <xen/hvm/hvm_info_table.h>
@@ -286,16 +287,16 @@ uuid_to_string(char *dest, uint8_t *uuid)
static void e820_collapse(void)
{
int i = 0;
struct e820entry *ent = (struct e820entry *)E820_MAP;
struct e820entry *ent = (struct e820entry *)HVM_E820;
while ( i < (*E820_MAP_NR-1) )
while ( i < (*HVM_E820_NR-1) )
{
if ( (ent[i].type == ent[i+1].type) &&
((ent[i].addr + ent[i].size) == ent[i+1].addr) )
{
ent[i].size += ent[i+1].size;
memcpy(&ent[i+1], &ent[i+2], (*E820_MAP_NR-i-2) * sizeof(*ent));
(*E820_MAP_NR)--;
memcpy(&ent[i+1], &ent[i+2], (*HVM_E820_NR-i-2) * sizeof(*ent));
(*HVM_E820_NR)--;
}
else
{
@@ -308,12 +309,12 @@ uint32_t e820_malloc(uint32_t size)
{
uint32_t addr;
int i;
struct e820entry *ent = (struct e820entry *)E820_MAP;
struct e820entry *ent = (struct e820entry *)HVM_E820;
/* Align allocation request to a reasonable boundary (1kB). */
size = (size + 1023) & ~1023;
for ( i = *E820_MAP_NR - 1; i >= 0; i-- )
for ( i = *HVM_E820_NR - 1; i >= 0; i-- )
{
addr = ent[i].addr;
if ( (ent[i].type != E820_RAM) || /* not ram? */
@@ -324,8 +325,8 @@ uint32_t e820_malloc(uint32_t size)
if ( ent[i].size != size )
{
memmove(&ent[i+1], &ent[i], (*E820_MAP_NR-i) * sizeof(*ent));
(*E820_MAP_NR)++;
memmove(&ent[i+1], &ent[i], (*HVM_E820_NR-i) * sizeof(*ent));
(*HVM_E820_NR)++;
ent[i].size -= size;
addr += ent[i].size;
i++;
-5
View File
@@ -84,11 +84,6 @@ int vprintf(const char *fmt, va_list ap);
/* Reserve a RAM region in the e820 table. */
uint32_t e820_malloc(uint32_t size);
/* General e820 access. */
#include <xen/hvm/e820.h>
#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
#define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
/* Prepare the 32bit BIOS */
void highbios_setup(void);
+3 -3
View File
@@ -91,13 +91,13 @@ banner(void)
e820map[6].addr = memory_size;
e820map[7].addr += memory_size;
*E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
memcpy(E820_MAP, e820map, sizeof(e820map));
*HVM_E820_NR = sizeof(e820map)/sizeof(e820map[0]);
memcpy(HVM_E820, e820map, sizeof(e820map));
#endif
printf("Memory size %ld MB\n", memory_size >> 20);
printf("E820 map:\n");
print_e820_map(E820_MAP, *E820_MAP_NR);
print_e820_map(HVM_E820, *HVM_E820_NR);
printf("\n");
}
+2 -4
View File
@@ -23,14 +23,12 @@
#include <stdarg.h>
#include <vm86.h>
#include <xen/hvm/e820.h>
#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
#define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
#define offsetof(type, member) ((unsigned) &((type *)0)->member)
struct vmx_assist_context;
#include "../hvmloader/e820.h"
extern void cpuid_addr_value(uint64_t addr, uint64_t *value);
extern void hexdump(unsigned char *, int);
extern void dump_regs(struct regs *);
-2
View File
@@ -32,8 +32,6 @@
#include <unistd.h>
#include <inttypes.h>
#include <xen/hvm/e820.h>
#include "cpu.h"
#include "exec-all.h"
#include "vl.h"
-1
View File
@@ -39,7 +39,6 @@
#include <sys/stat.h>
#include "xenctrl.h"
#include "xs.h"
#include <xen/hvm/e820.h>
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
-1
View File
@@ -18,7 +18,6 @@
#include <xen/foreign/x86_32.h>
#include <xen/foreign/x86_64.h>
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/e820.h>
#include <xen/io/protocols.h>
#include "xg_private.h"
+1 -1
View File
@@ -372,7 +372,7 @@ int xc_domain_setmaxmem(int xc_handle,
}
#if defined(__i386__) || defined(__x86_64__)
#include <xen/hvm/e820.h>
#include "xc_e820.h"
int xc_domain_set_memmap_limit(int xc_handle,
uint32_t domid,
unsigned long map_limitkb)
+1 -1
View File
@@ -18,7 +18,7 @@
#include "xg_save_restore.h"
#include <xen/hvm/params.h>
#include <xen/hvm/e820.h>
#include "xc_e820.h"
/*
** Default values for important tuning parameters. Can override by passing
+20
View File
@@ -0,0 +1,20 @@
#ifndef __XC_E820_H__
#define __XC_E820_H__
#include <xen/hvm/e820.h>
/*
* PC BIOS standard E820 types and structure.
*/
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
struct e820entry {
uint64_t addr;
uint64_t size;
uint32_t type;
} __attribute__((packed));
#endif /* __XC_E820_H__ */
+4 -4
View File
@@ -15,7 +15,7 @@
#include <xen/foreign/x86_64.h>
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/params.h>
#include <xen/hvm/e820.h>
#include "xc_e820.h"
#include <xen/libelf.h>
@@ -32,7 +32,7 @@ typedef union
static void build_e820map(void *e820_page, unsigned long long mem_size)
{
struct e820entry *e820entry =
(struct e820entry *)(((unsigned char *)e820_page) + E820_MAP_OFFSET);
(struct e820entry *)(((unsigned char *)e820_page) + HVM_E820_OFFSET);
unsigned long long extra_mem_size = 0;
unsigned char nr_map = 0;
@@ -105,7 +105,7 @@ static void build_e820map(void *e820_page, unsigned long long mem_size)
nr_map++;
}
*(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
*(((unsigned char *)e820_page) + HVM_E820_NR_OFFSET) = nr_map;
}
static int loadelfimage(
@@ -226,7 +226,7 @@ static int setup_guest(int xc_handle,
if ( (e820_page = xc_map_foreign_range(
xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
E820_MAP_PAGE >> PAGE_SHIFT)) == NULL )
HVM_E820_PAGE >> PAGE_SHIFT)) == NULL )
goto error_out;
memset(e820_page, 0, PAGE_SIZE);
build_e820map(e820_page, v_end);
-1
View File
@@ -24,7 +24,6 @@
#include <asm/hvm/hvm.h>
#include <asm/hvm/support.h>
#include <asm/processor.h>
#include <public/hvm/e820.h>
long arch_do_domctl(
struct xen_domctl *domctl,
+13 -1
View File
@@ -1,7 +1,19 @@
#ifndef __E820_HEADER
#define __E820_HEADER
#include <public/hvm/e820.h>
/*
* PC BIOS standard E820 types and structure.
*/
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
struct e820entry {
uint64_t addr;
uint64_t size;
uint32_t type;
} __attribute__((packed));
#define E820MAX 128
+3 -16
View File
@@ -22,25 +22,12 @@
#ifndef __XEN_PUBLIC_HVM_E820_H__
#define __XEN_PUBLIC_HVM_E820_H__
/* PC BIOS standard E820 types. */
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
/* E820 location in HVM virtual address space. */
#define E820_MAP_PAGE 0x00090000
#define E820_MAP_NR_OFFSET 0x000001E8
#define E820_MAP_OFFSET 0x000002D0
struct e820entry {
uint64_t addr;
uint64_t size;
uint32_t type;
} __attribute__((packed));
#define HVM_E820_PAGE 0x00090000
#define HVM_E820_NR_OFFSET 0x000001E8
#define HVM_E820_OFFSET 0x000002D0
#define HVM_BELOW_4G_RAM_END 0xF0000000
#define HVM_BELOW_4G_MMIO_START HVM_BELOW_4G_RAM_END
#define HVM_BELOW_4G_MMIO_LENGTH ((1ULL << 32) - HVM_BELOW_4G_MMIO_START)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.