Path: blob/main/sys/contrib/xen/arch-x86/hvm/start_info.h
48378 views
/*1* Permission is hereby granted, free of charge, to any person obtaining a copy2* of this software and associated documentation files (the "Software"), to3* deal in the Software without restriction, including without limitation the4* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or5* sell copies of the Software, and to permit persons to whom the Software is6* furnished to do so, subject to the following conditions:7*8* The above copyright notice and this permission notice shall be included in9* all copies or substantial portions of the Software.10*11* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR12* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,13* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE14* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER15* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING16* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER17* DEALINGS IN THE SOFTWARE.18*19* Copyright (c) 2016, Citrix Systems, Inc.20*/2122#ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__23#define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__2425/*26* Start of day structure passed to PVH guests and to HVM guests in %ebx.27*28* NOTE: nothing will be loaded at physical address 0, so a 0 value in any29* of the address fields should be treated as not present.30*31* 0 +----------------+32* | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE33* | | ("xEn3" with the 0x80 bit of the "E" set).34* 4 +----------------+35* | version | Version of this structure. Current version is 1. New36* | | versions are guaranteed to be backwards-compatible.37* 8 +----------------+38* | flags | SIF_xxx flags.39* 12 +----------------+40* | nr_modules | Number of modules passed to the kernel.41* 16 +----------------+42* | modlist_paddr | Physical address of an array of modules43* | | (layout of the structure below).44* 24 +----------------+45* | cmdline_paddr | Physical address of the command line,46* | | a zero-terminated ASCII string.47* 32 +----------------+48* | rsdp_paddr | Physical address of the RSDP ACPI data structure.49* 40 +----------------+50* | memmap_paddr | Physical address of the (optional) memory map. Only51* | | present in version 1 and newer of the structure.52* 48 +----------------+53* | memmap_entries | Number of entries in the memory map table. Zero54* | | if there is no memory map being provided. Only55* | | present in version 1 and newer of the structure.56* 52 +----------------+57* | reserved | Version 1 and newer only.58* 56 +----------------+59*60* The layout of each entry in the module structure is the following:61*62* 0 +----------------+63* | paddr | Physical address of the module.64* 8 +----------------+65* | size | Size of the module in bytes.66* 16 +----------------+67* | cmdline_paddr | Physical address of the command line,68* | | a zero-terminated ASCII string.69* 24 +----------------+70* | reserved |71* 32 +----------------+72*73* The layout of each entry in the memory map table is as follows:74*75* 0 +----------------+76* | addr | Base address77* 8 +----------------+78* | size | Size of mapping in bytes79* 16 +----------------+80* | type | Type of mapping as defined between the hypervisor81* | | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.82* 20 +----------------|83* | reserved |84* 24 +----------------+85*86* The address and sizes are always a 64bit little endian unsigned integer.87*88* NB: Xen on x86 will always try to place all the data below the 4GiB89* boundary.90*91* Version numbers of the hvm_start_info structure have evolved like this:92*93* Version 0: Initial implementation.94*95* Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes of96* padding) to the end of the hvm_start_info struct. These new97* fields can be used to pass a memory map to the guest. The98* memory map is optional and so guests that understand version 199* of the structure must check that memmap_entries is non-zero100* before trying to read the memory map.101*/102#define XEN_HVM_START_MAGIC_VALUE 0x336ec578103104/*105* The values used in the type field of the memory map table entries are106* defined below and match the Address Range Types as defined in the "System107* Address Map Interfaces" section of the ACPI Specification. Please refer to108* section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications109*/110#define XEN_HVM_MEMMAP_TYPE_RAM 1111#define XEN_HVM_MEMMAP_TYPE_RESERVED 2112#define XEN_HVM_MEMMAP_TYPE_ACPI 3113#define XEN_HVM_MEMMAP_TYPE_NVS 4114#define XEN_HVM_MEMMAP_TYPE_UNUSABLE 5115#define XEN_HVM_MEMMAP_TYPE_DISABLED 6116#define XEN_HVM_MEMMAP_TYPE_PMEM 7117118/*119* C representation of the x86/HVM start info layout.120*121* The canonical definition of this layout is above, this is just a way to122* represent the layout described there using C types.123*/124struct hvm_start_info {125uint32_t magic; /* Contains the magic value 0x336ec578 */126/* ("xEn3" with the 0x80 bit of the "E" set).*/127uint32_t version; /* Version of this structure. */128uint32_t flags; /* SIF_xxx flags. */129uint32_t nr_modules; /* Number of modules passed to the kernel. */130uint64_t modlist_paddr; /* Physical address of an array of */131/* hvm_modlist_entry. */132uint64_t cmdline_paddr; /* Physical address of the command line. */133uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */134/* structure. */135/* All following fields only present in version 1 and newer */136uint64_t memmap_paddr; /* Physical address of an array of */137/* hvm_memmap_table_entry. */138uint32_t memmap_entries; /* Number of entries in the memmap table. */139/* Value will be zero if there is no memory */140/* map being provided. */141uint32_t reserved; /* Must be zero. */142};143144struct hvm_modlist_entry {145uint64_t paddr; /* Physical address of the module. */146uint64_t size; /* Size of the module in bytes. */147uint64_t cmdline_paddr; /* Physical address of the command line. */148uint64_t reserved;149};150151struct hvm_memmap_table_entry {152uint64_t addr; /* Base address of the memory region */153uint64_t size; /* Size of the memory region in bytes */154uint32_t type; /* Mapping type */155uint32_t reserved; /* Must be zero for Version 1. */156};157158#endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */159160161