debuggers.hg

view xen/include/asm-x86/tboot.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 7d55cc23493b
children
line source
1 /*
2 * tboot.h: shared data structure with MLE and kernel and functions
3 * used by kernel for runtime support
4 *
5 * Copyright (c) 2006-2007, Intel Corporation
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of the Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33 * OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 */
37 #ifndef __TBOOT_H__
38 #define __TBOOT_H__
40 #include <xen/acpi.h>
42 #ifndef __packed
43 #define __packed __attribute__ ((packed))
44 #endif
46 typedef struct __packed {
47 uint32_t data1;
48 uint16_t data2;
49 uint16_t data3;
50 uint16_t data4;
51 uint8_t data5[6];
52 } uuid_t;
54 /* used to communicate between tboot and the launched kernel (i.e. Xen) */
56 #define TB_KEY_SIZE 64 /* 512 bits */
58 #define MAX_TB_MAC_REGIONS 32
59 typedef struct __packed {
60 uint64_t start; /* must be 64 byte -aligned */
61 uint32_t size; /* must be 64 byte -granular */
62 } tboot_mac_region_t;
64 /* GAS - Generic Address Structure (ACPI 2.0+) */
65 typedef struct __packed {
66 uint8_t space_id;
67 uint8_t bit_width;
68 uint8_t bit_offset;
69 uint8_t access_width;
70 uint64_t address;
71 } tboot_acpi_generic_address_t;
73 typedef struct __packed {
74 tboot_acpi_generic_address_t pm1a_cnt_blk;
75 tboot_acpi_generic_address_t pm1b_cnt_blk;
76 tboot_acpi_generic_address_t pm1a_evt_blk;
77 tboot_acpi_generic_address_t pm1b_evt_blk;
78 uint16_t pm1a_cnt_val;
79 uint16_t pm1b_cnt_val;
80 uint64_t wakeup_vector;
81 uint32_t vector_width;
82 uint64_t kernel_s3_resume_vector;
83 } tboot_acpi_sleep_info_t;
85 typedef struct __packed {
86 /* version 3+ fields: */
87 uuid_t uuid; /* {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} */
88 uint32_t version; /* Version number; currently supports 0.4 */
89 uint32_t log_addr; /* physical addr of tb_log_t log */
90 uint32_t shutdown_entry; /* entry point for tboot shutdown */
91 uint32_t shutdown_type; /* type of shutdown (TB_SHUTDOWN_*) */
92 tboot_acpi_sleep_info_t
93 acpi_sinfo; /* where kernel put acpi sleep info in Sx */
94 uint32_t tboot_base; /* starting addr for tboot */
95 uint32_t tboot_size; /* size of tboot */
96 uint8_t num_mac_regions; /* number mem regions to MAC on S3 */
97 /* contig regions memory to MAC on S3 */
98 tboot_mac_region_t mac_regions[MAX_TB_MAC_REGIONS];
99 /* version 4+ fields: */
100 /* populated by tboot; will be encrypted */
101 uint8_t s3_key[TB_KEY_SIZE];
102 } tboot_shared_t;
104 #define TB_SHUTDOWN_REBOOT 0
105 #define TB_SHUTDOWN_S5 1
106 #define TB_SHUTDOWN_S4 2
107 #define TB_SHUTDOWN_S3 3
108 #define TB_SHUTDOWN_HALT 4
110 /* {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} */
111 #define TBOOT_SHARED_UUID { 0x663c8dff, 0xe8b3, 0x4b82, 0xaabf, \
112 { 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8 } };
114 extern tboot_shared_t *g_tboot_shared;
116 void tboot_probe(void);
117 void tboot_shutdown(uint32_t shutdown_type);
118 int tboot_in_measured_env(void);
119 int tboot_protect_mem_regions(void);
120 int tboot_parse_dmar_table(acpi_table_handler dmar_handler);
121 int tboot_s3_resume(void);
123 #endif /* __TBOOT_H__ */
125 /*
126 * Local variables:
127 * mode: C
128 * c-set-style: "BSD"
129 * c-basic-offset: 4
130 * tab-width: 4
131 * indent-tabs-mode: nil
132 * End:
133 */