Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /*
0003  * Copyright (c) 2016, Citrix Systems, Inc.
0004  */
0005 
0006 #ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__
0007 #define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__
0008 
0009 /*
0010  * Start of day structure passed to PVH guests and to HVM guests in %ebx.
0011  *
0012  * NOTE: nothing will be loaded at physical address 0, so a 0 value in any
0013  * of the address fields should be treated as not present.
0014  *
0015  *  0 +----------------+
0016  *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
0017  *    |                | ("xEn3" with the 0x80 bit of the "E" set).
0018  *  4 +----------------+
0019  *    | version        | Version of this structure. Current version is 1. New
0020  *    |                | versions are guaranteed to be backwards-compatible.
0021  *  8 +----------------+
0022  *    | flags          | SIF_xxx flags.
0023  * 12 +----------------+
0024  *    | nr_modules     | Number of modules passed to the kernel.
0025  * 16 +----------------+
0026  *    | modlist_paddr  | Physical address of an array of modules
0027  *    |                | (layout of the structure below).
0028  * 24 +----------------+
0029  *    | cmdline_paddr  | Physical address of the command line,
0030  *    |                | a zero-terminated ASCII string.
0031  * 32 +----------------+
0032  *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
0033  * 40 +----------------+
0034  *    | memmap_paddr   | Physical address of the (optional) memory map. Only
0035  *    |                | present in version 1 and newer of the structure.
0036  * 48 +----------------+
0037  *    | memmap_entries | Number of entries in the memory map table. Zero
0038  *    |                | if there is no memory map being provided. Only
0039  *    |                | present in version 1 and newer of the structure.
0040  * 52 +----------------+
0041  *    | reserved       | Version 1 and newer only.
0042  * 56 +----------------+
0043  *
0044  * The layout of each entry in the module structure is the following:
0045  *
0046  *  0 +----------------+
0047  *    | paddr          | Physical address of the module.
0048  *  8 +----------------+
0049  *    | size           | Size of the module in bytes.
0050  * 16 +----------------+
0051  *    | cmdline_paddr  | Physical address of the command line,
0052  *    |                | a zero-terminated ASCII string.
0053  * 24 +----------------+
0054  *    | reserved       |
0055  * 32 +----------------+
0056  *
0057  * The layout of each entry in the memory map table is as follows:
0058  *
0059  *  0 +----------------+
0060  *    | addr           | Base address
0061  *  8 +----------------+
0062  *    | size           | Size of mapping in bytes
0063  * 16 +----------------+
0064  *    | type           | Type of mapping as defined between the hypervisor
0065  *    |                | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.
0066  * 20 +----------------|
0067  *    | reserved       |
0068  * 24 +----------------+
0069  *
0070  * The address and sizes are always a 64bit little endian unsigned integer.
0071  *
0072  * NB: Xen on x86 will always try to place all the data below the 4GiB
0073  * boundary.
0074  *
0075  * Version numbers of the hvm_start_info structure have evolved like this:
0076  *
0077  * Version 0:  Initial implementation.
0078  *
0079  * Version 1:  Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
0080  *             padding) to the end of the hvm_start_info struct. These new
0081  *             fields can be used to pass a memory map to the guest. The
0082  *             memory map is optional and so guests that understand version 1
0083  *             of the structure must check that memmap_entries is non-zero
0084  *             before trying to read the memory map.
0085  */
0086 #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
0087 
0088 /*
0089  * The values used in the type field of the memory map table entries are
0090  * defined below and match the Address Range Types as defined in the "System
0091  * Address Map Interfaces" section of the ACPI Specification. Please refer to
0092  * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
0093  */
0094 #define XEN_HVM_MEMMAP_TYPE_RAM       1
0095 #define XEN_HVM_MEMMAP_TYPE_RESERVED  2
0096 #define XEN_HVM_MEMMAP_TYPE_ACPI      3
0097 #define XEN_HVM_MEMMAP_TYPE_NVS       4
0098 #define XEN_HVM_MEMMAP_TYPE_UNUSABLE  5
0099 #define XEN_HVM_MEMMAP_TYPE_DISABLED  6
0100 #define XEN_HVM_MEMMAP_TYPE_PMEM      7
0101 
0102 /*
0103  * C representation of the x86/HVM start info layout.
0104  *
0105  * The canonical definition of this layout is above, this is just a way to
0106  * represent the layout described there using C types.
0107  */
0108 struct hvm_start_info {
0109     uint32_t magic;             /* Contains the magic value 0x336ec578       */
0110                                 /* ("xEn3" with the 0x80 bit of the "E" set).*/
0111     uint32_t version;           /* Version of this structure.                */
0112     uint32_t flags;             /* SIF_xxx flags.                            */
0113     uint32_t nr_modules;        /* Number of modules passed to the kernel.   */
0114     uint64_t modlist_paddr;     /* Physical address of an array of           */
0115                                 /* hvm_modlist_entry.                        */
0116     uint64_t cmdline_paddr;     /* Physical address of the command line.     */
0117     uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
0118                                 /* structure.                                */
0119     /* All following fields only present in version 1 and newer */
0120     uint64_t memmap_paddr;      /* Physical address of an array of           */
0121                                 /* hvm_memmap_table_entry.                   */
0122     uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
0123                                 /* Value will be zero if there is no memory  */
0124                                 /* map being provided.                       */
0125     uint32_t reserved;          /* Must be zero.                             */
0126 };
0127 
0128 struct hvm_modlist_entry {
0129     uint64_t paddr;             /* Physical address of the module.           */
0130     uint64_t size;              /* Size of the module in bytes.              */
0131     uint64_t cmdline_paddr;     /* Physical address of the command line.     */
0132     uint64_t reserved;
0133 };
0134 
0135 struct hvm_memmap_table_entry {
0136     uint64_t addr;              /* Base address of the memory region         */
0137     uint64_t size;              /* Size of the memory region in bytes        */
0138     uint32_t type;              /* Mapping type                              */
0139     uint32_t reserved;          /* Must be zero for Version 1.               */
0140 };
0141 
0142 #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */