ia64/xen-unstable

changeset 9496:d16c16f64060

[IA64] dom0 vp model xen part: moved efi.h from linux to linux-xen to modify.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Fri Apr 07 13:41:32 2006 -0600 (2006-04-07)
parents 8e0b9f31cf3f
children 119effd15792
files xen/include/asm-ia64/linux-xen/linux/efi.h xen/include/asm-ia64/linux/efi.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xen/include/asm-ia64/linux-xen/linux/efi.h	Fri Apr 07 13:41:32 2006 -0600
     1.3 @@ -0,0 +1,398 @@
     1.4 +#ifndef _LINUX_EFI_H
     1.5 +#define _LINUX_EFI_H
     1.6 +
     1.7 +/*
     1.8 + * Extensible Firmware Interface
     1.9 + * Based on 'Extensible Firmware Interface Specification' version 0.9, April 30, 1999
    1.10 + *
    1.11 + * Copyright (C) 1999 VA Linux Systems
    1.12 + * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
    1.13 + * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
    1.14 + *	David Mosberger-Tang <davidm@hpl.hp.com>
    1.15 + *	Stephane Eranian <eranian@hpl.hp.com>
    1.16 + */
    1.17 +#include <linux/init.h>
    1.18 +#include <linux/string.h>
    1.19 +#include <linux/time.h>
    1.20 +#include <linux/types.h>
    1.21 +#include <linux/proc_fs.h>
    1.22 +#include <linux/rtc.h>
    1.23 +#include <linux/ioport.h>
    1.24 +
    1.25 +#include <asm/page.h>
    1.26 +#include <asm/system.h>
    1.27 +
    1.28 +#define EFI_SUCCESS		0
    1.29 +#define EFI_LOAD_ERROR          ( 1 | (1UL << (BITS_PER_LONG-1)))
    1.30 +#define EFI_INVALID_PARAMETER	( 2 | (1UL << (BITS_PER_LONG-1)))
    1.31 +#define EFI_UNSUPPORTED		( 3 | (1UL << (BITS_PER_LONG-1)))
    1.32 +#define EFI_BAD_BUFFER_SIZE     ( 4 | (1UL << (BITS_PER_LONG-1)))
    1.33 +#define EFI_BUFFER_TOO_SMALL	( 5 | (1UL << (BITS_PER_LONG-1)))
    1.34 +#define EFI_NOT_FOUND		(14 | (1UL << (BITS_PER_LONG-1)))
    1.35 +
    1.36 +typedef unsigned long efi_status_t;
    1.37 +typedef u8 efi_bool_t;
    1.38 +typedef u16 efi_char16_t;		/* UNICODE character */
    1.39 +
    1.40 +
    1.41 +typedef struct {
    1.42 +	u8 b[16];
    1.43 +} efi_guid_t;
    1.44 +
    1.45 +#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
    1.46 +((efi_guid_t) \
    1.47 +{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
    1.48 +  (b) & 0xff, ((b) >> 8) & 0xff, \
    1.49 +  (c) & 0xff, ((c) >> 8) & 0xff, \
    1.50 +  (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
    1.51 +
    1.52 +/*
    1.53 + * Generic EFI table header
    1.54 + */
    1.55 +typedef	struct {
    1.56 +	u64 signature;
    1.57 +	u32 revision;
    1.58 +	u32 headersize;
    1.59 +	u32 crc32;
    1.60 +	u32 reserved;
    1.61 +} efi_table_hdr_t;
    1.62 +
    1.63 +/*
    1.64 + * Memory map descriptor:
    1.65 + */
    1.66 +
    1.67 +/* Memory types: */
    1.68 +#define EFI_RESERVED_TYPE		 0
    1.69 +#define EFI_LOADER_CODE			 1
    1.70 +#define EFI_LOADER_DATA			 2
    1.71 +#define EFI_BOOT_SERVICES_CODE		 3
    1.72 +#define EFI_BOOT_SERVICES_DATA		 4
    1.73 +#define EFI_RUNTIME_SERVICES_CODE	 5
    1.74 +#define EFI_RUNTIME_SERVICES_DATA	 6
    1.75 +#define EFI_CONVENTIONAL_MEMORY		 7
    1.76 +#define EFI_UNUSABLE_MEMORY		 8
    1.77 +#define EFI_ACPI_RECLAIM_MEMORY		 9
    1.78 +#define EFI_ACPI_MEMORY_NVS		10
    1.79 +#define EFI_MEMORY_MAPPED_IO		11
    1.80 +#define EFI_MEMORY_MAPPED_IO_PORT_SPACE	12
    1.81 +#define EFI_PAL_CODE			13
    1.82 +#define EFI_MAX_MEMORY_TYPE		14
    1.83 +
    1.84 +/* Attribute values: */
    1.85 +#define EFI_MEMORY_UC		((u64)0x0000000000000001ULL)	/* uncached */
    1.86 +#define EFI_MEMORY_WC		((u64)0x0000000000000002ULL)	/* write-coalescing */
    1.87 +#define EFI_MEMORY_WT		((u64)0x0000000000000004ULL)	/* write-through */
    1.88 +#define EFI_MEMORY_WB		((u64)0x0000000000000008ULL)	/* write-back */
    1.89 +#define EFI_MEMORY_WP		((u64)0x0000000000001000ULL)	/* write-protect */
    1.90 +#define EFI_MEMORY_RP		((u64)0x0000000000002000ULL)	/* read-protect */
    1.91 +#define EFI_MEMORY_XP		((u64)0x0000000000004000ULL)	/* execute-protect */
    1.92 +#define EFI_MEMORY_RUNTIME	((u64)0x8000000000000000ULL)	/* range requires runtime mapping */
    1.93 +#define EFI_MEMORY_DESCRIPTOR_VERSION	1
    1.94 +
    1.95 +#define EFI_PAGE_SHIFT		12
    1.96 +
    1.97 +/*
    1.98 + * For current x86 implementations of EFI, there is
    1.99 + * additional padding in the mem descriptors.  This is not
   1.100 + * the case in ia64.  Need to have this fixed in the f/w.
   1.101 + */
   1.102 +typedef struct {
   1.103 +	u32 type;
   1.104 +	u32 pad;
   1.105 +	u64 phys_addr;
   1.106 +	u64 virt_addr;
   1.107 +	u64 num_pages;
   1.108 +	u64 attribute;
   1.109 +#if defined (__i386__)
   1.110 +	u64 pad1;
   1.111 +#endif
   1.112 +} efi_memory_desc_t;
   1.113 +
   1.114 +typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg);
   1.115 +
   1.116 +/*
   1.117 + * Types and defines for Time Services
   1.118 + */
   1.119 +#define EFI_TIME_ADJUST_DAYLIGHT 0x1
   1.120 +#define EFI_TIME_IN_DAYLIGHT     0x2
   1.121 +#define EFI_UNSPECIFIED_TIMEZONE 0x07ff
   1.122 +
   1.123 +typedef struct {
   1.124 +	u16 year;
   1.125 +	u8 month;
   1.126 +	u8 day;
   1.127 +	u8 hour;
   1.128 +	u8 minute;
   1.129 +	u8 second;
   1.130 +	u8 pad1;
   1.131 +	u32 nanosecond;
   1.132 +	s16 timezone;
   1.133 +	u8 daylight;
   1.134 +	u8 pad2;
   1.135 +} efi_time_t;
   1.136 +
   1.137 +typedef struct {
   1.138 +	u32 resolution;
   1.139 +	u32 accuracy;
   1.140 +	u8 sets_to_zero;
   1.141 +} efi_time_cap_t;
   1.142 +
   1.143 +/*
   1.144 + * Types and defines for EFI ResetSystem
   1.145 + */
   1.146 +#define EFI_RESET_COLD 0
   1.147 +#define EFI_RESET_WARM 1
   1.148 +#define EFI_RESET_SHUTDOWN 2
   1.149 +
   1.150 +/*
   1.151 + * EFI Runtime Services table
   1.152 + */
   1.153 +#define EFI_RUNTIME_SERVICES_SIGNATURE ((u64)0x5652453544e5552ULL)
   1.154 +#define EFI_RUNTIME_SERVICES_REVISION  0x00010000
   1.155 +
   1.156 +typedef struct {
   1.157 +	efi_table_hdr_t hdr;
   1.158 +	unsigned long get_time;
   1.159 +	unsigned long set_time;
   1.160 +	unsigned long get_wakeup_time;
   1.161 +	unsigned long set_wakeup_time;
   1.162 +	unsigned long set_virtual_address_map;
   1.163 +	unsigned long convert_pointer;
   1.164 +	unsigned long get_variable;
   1.165 +	unsigned long get_next_variable;
   1.166 +	unsigned long set_variable;
   1.167 +	unsigned long get_next_high_mono_count;
   1.168 +	unsigned long reset_system;
   1.169 +} efi_runtime_services_t;
   1.170 +
   1.171 +typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
   1.172 +typedef efi_status_t efi_set_time_t (efi_time_t *tm);
   1.173 +typedef efi_status_t efi_get_wakeup_time_t (efi_bool_t *enabled, efi_bool_t *pending,
   1.174 +					    efi_time_t *tm);
   1.175 +typedef efi_status_t efi_set_wakeup_time_t (efi_bool_t enabled, efi_time_t *tm);
   1.176 +typedef efi_status_t efi_get_variable_t (efi_char16_t *name, efi_guid_t *vendor, u32 *attr,
   1.177 +					 unsigned long *data_size, void *data);
   1.178 +typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char16_t *name,
   1.179 +					      efi_guid_t *vendor);
   1.180 +typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 
   1.181 +					 unsigned long attr, unsigned long data_size, 
   1.182 +					 void *data);
   1.183 +typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
   1.184 +typedef void efi_reset_system_t (int reset_type, efi_status_t status,
   1.185 +				 unsigned long data_size, efi_char16_t *data);
   1.186 +typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_size,
   1.187 +						unsigned long descriptor_size,
   1.188 +						u32 descriptor_version,
   1.189 +						efi_memory_desc_t *virtual_map);
   1.190 +
   1.191 +/*
   1.192 + *  EFI Configuration Table and GUID definitions
   1.193 + */
   1.194 +#define NULL_GUID \
   1.195 +    EFI_GUID(  0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 )
   1.196 +
   1.197 +#define MPS_TABLE_GUID    \
   1.198 +    EFI_GUID(  0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   1.199 +
   1.200 +#define ACPI_TABLE_GUID    \
   1.201 +    EFI_GUID(  0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   1.202 +
   1.203 +#define ACPI_20_TABLE_GUID    \
   1.204 +    EFI_GUID(  0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 )
   1.205 +
   1.206 +#define SMBIOS_TABLE_GUID    \
   1.207 +    EFI_GUID(  0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   1.208 +
   1.209 +#define SAL_SYSTEM_TABLE_GUID    \
   1.210 +    EFI_GUID(  0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   1.211 +
   1.212 +#define HCDP_TABLE_GUID	\
   1.213 +    EFI_GUID(  0xf951938d, 0x620b, 0x42ef, 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 )
   1.214 +
   1.215 +#define UGA_IO_PROTOCOL_GUID \
   1.216 +    EFI_GUID(  0x61a4d49e, 0x6f68, 0x4f1b, 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 )
   1.217 +
   1.218 +#define EFI_GLOBAL_VARIABLE_GUID \
   1.219 +    EFI_GUID(  0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c )
   1.220 +
   1.221 +typedef struct {
   1.222 +	efi_guid_t guid;
   1.223 +	unsigned long table;
   1.224 +} efi_config_table_t;
   1.225 +
   1.226 +#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
   1.227 +#define EFI_SYSTEM_TABLE_REVISION  ((1 << 16) | 00)
   1.228 +
   1.229 +typedef struct {
   1.230 +	efi_table_hdr_t hdr;
   1.231 +	unsigned long fw_vendor;	/* physical addr of CHAR16 vendor string */
   1.232 +	u32 fw_revision;
   1.233 +	unsigned long con_in_handle;
   1.234 +	unsigned long con_in;
   1.235 +	unsigned long con_out_handle;
   1.236 +	unsigned long con_out;
   1.237 +	unsigned long stderr_handle;
   1.238 +	unsigned long stderr;
   1.239 +	efi_runtime_services_t *runtime;
   1.240 +	unsigned long boottime;
   1.241 +	unsigned long nr_tables;
   1.242 +	unsigned long tables;
   1.243 +} efi_system_table_t;
   1.244 +
   1.245 +struct efi_memory_map {
   1.246 +	efi_memory_desc_t *phys_map;
   1.247 +	efi_memory_desc_t *map;
   1.248 +	int nr_map;
   1.249 +	unsigned long desc_version;
   1.250 +};
   1.251 +
   1.252 +/*
   1.253 + * All runtime access to EFI goes through this structure:
   1.254 + */
   1.255 +extern struct efi {
   1.256 +	efi_system_table_t *systab;	/* EFI system table */
   1.257 +	void *mps;			/* MPS table */
   1.258 +	void *acpi;			/* ACPI table  (IA64 ext 0.71) */
   1.259 +	void *acpi20;			/* ACPI table  (ACPI 2.0) */
   1.260 +	void *smbios;			/* SM BIOS table */
   1.261 +	void *sal_systab;		/* SAL system table */
   1.262 +	void *boot_info;		/* boot info table */
   1.263 +	void *hcdp;			/* HCDP table */
   1.264 +	void *uga;			/* UGA table */
   1.265 +	efi_get_time_t *get_time;
   1.266 +	efi_set_time_t *set_time;
   1.267 +	efi_get_wakeup_time_t *get_wakeup_time;
   1.268 +	efi_set_wakeup_time_t *set_wakeup_time;
   1.269 +	efi_get_variable_t *get_variable;
   1.270 +	efi_get_next_variable_t *get_next_variable;
   1.271 +	efi_set_variable_t *set_variable;
   1.272 +	efi_get_next_high_mono_count_t *get_next_high_mono_count;
   1.273 +	efi_reset_system_t *reset_system;
   1.274 +	efi_set_virtual_address_map_t *set_virtual_address_map;
   1.275 +} efi;
   1.276 +
   1.277 +static inline int
   1.278 +efi_guidcmp (efi_guid_t left, efi_guid_t right)
   1.279 +{
   1.280 +	return memcmp(&left, &right, sizeof (efi_guid_t));
   1.281 +}
   1.282 +
   1.283 +static inline char *
   1.284 +efi_guid_unparse(efi_guid_t *guid, char *out)
   1.285 +{
   1.286 +	sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
   1.287 +		guid->b[3], guid->b[2], guid->b[1], guid->b[0],
   1.288 +		guid->b[5], guid->b[4], guid->b[7], guid->b[6],
   1.289 +		guid->b[8], guid->b[9], guid->b[10], guid->b[11],
   1.290 +		guid->b[12], guid->b[13], guid->b[14], guid->b[15]);
   1.291 +        return out;
   1.292 +}
   1.293 +
   1.294 +extern void efi_init (void);
   1.295 +extern void *efi_get_pal_addr (void);
   1.296 +extern void efi_map_pal_code (void);
   1.297 +extern void efi_map_memmap(void);
   1.298 +extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
   1.299 +extern void efi_gettimeofday (struct timespec *ts);
   1.300 +extern void efi_enter_virtual_mode (void);	/* switch EFI to virtual mode, if possible */
   1.301 +extern u64 efi_get_iobase (void);
   1.302 +extern u32 efi_mem_type (unsigned long phys_addr);
   1.303 +extern u64 efi_mem_attributes (unsigned long phys_addr);
   1.304 +extern int __init efi_uart_console_only (void);
   1.305 +extern void efi_initialize_iomem_resources(struct resource *code_resource,
   1.306 +					struct resource *data_resource);
   1.307 +extern unsigned long __init efi_get_time(void);
   1.308 +extern int __init efi_set_rtc_mmss(unsigned long nowtime);
   1.309 +extern struct efi_memory_map memmap;
   1.310 +
   1.311 +/**
   1.312 + * efi_range_is_wc - check the WC bit on an address range
   1.313 + * @start: starting kvirt address
   1.314 + * @len: length of range
   1.315 + *
   1.316 + * Consult the EFI memory map and make sure it's ok to set this range WC.
   1.317 + * Returns true or false.
   1.318 + */
   1.319 +static inline int efi_range_is_wc(unsigned long start, unsigned long len)
   1.320 +{
   1.321 +	unsigned long i;
   1.322 +
   1.323 +	for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) {
   1.324 +		unsigned long paddr = __pa(start + i);
   1.325 +		if (!(efi_mem_attributes(paddr) & EFI_MEMORY_WC))
   1.326 +			return 0;
   1.327 +	}
   1.328 +	/* The range checked out */
   1.329 +	return 1;
   1.330 +}
   1.331 +
   1.332 +#ifdef CONFIG_EFI_PCDP
   1.333 +extern int __init efi_setup_pcdp_console(char *);
   1.334 +#endif
   1.335 +
   1.336 +/*
   1.337 + * We play games with efi_enabled so that the compiler will, if possible, remove
   1.338 + * EFI-related code altogether.
   1.339 + */
   1.340 +#ifdef CONFIG_EFI
   1.341 +# ifdef CONFIG_X86
   1.342 +   extern int efi_enabled;
   1.343 +# else
   1.344 +#  define efi_enabled 1
   1.345 +# endif
   1.346 +#else
   1.347 +# define efi_enabled 0
   1.348 +#endif
   1.349 +
   1.350 +/*
   1.351 + * Variable Attributes
   1.352 + */
   1.353 +#define EFI_VARIABLE_NON_VOLATILE       0x0000000000000001
   1.354 +#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
   1.355 +#define EFI_VARIABLE_RUNTIME_ACCESS     0x0000000000000004
   1.356 +
   1.357 +/*
   1.358 + * EFI Device Path information
   1.359 + */
   1.360 +#define EFI_DEV_HW			0x01
   1.361 +#define  EFI_DEV_PCI				 1
   1.362 +#define  EFI_DEV_PCCARD				 2
   1.363 +#define  EFI_DEV_MEM_MAPPED			 3
   1.364 +#define  EFI_DEV_VENDOR				 4
   1.365 +#define  EFI_DEV_CONTROLLER			 5
   1.366 +#define EFI_DEV_ACPI			0x02
   1.367 +#define   EFI_DEV_BASIC_ACPI			 1
   1.368 +#define   EFI_DEV_EXPANDED_ACPI			 2
   1.369 +#define EFI_DEV_MSG			0x03
   1.370 +#define   EFI_DEV_MSG_ATAPI			 1
   1.371 +#define   EFI_DEV_MSG_SCSI			 2
   1.372 +#define   EFI_DEV_MSG_FC			 3
   1.373 +#define   EFI_DEV_MSG_1394			 4
   1.374 +#define   EFI_DEV_MSG_USB			 5
   1.375 +#define   EFI_DEV_MSG_USB_CLASS			15
   1.376 +#define   EFI_DEV_MSG_I20			 6
   1.377 +#define   EFI_DEV_MSG_MAC			11
   1.378 +#define   EFI_DEV_MSG_IPV4			12
   1.379 +#define   EFI_DEV_MSG_IPV6			13
   1.380 +#define   EFI_DEV_MSG_INFINIBAND		 9
   1.381 +#define   EFI_DEV_MSG_UART			14
   1.382 +#define   EFI_DEV_MSG_VENDOR			10
   1.383 +#define EFI_DEV_MEDIA			0x04
   1.384 +#define   EFI_DEV_MEDIA_HARD_DRIVE		 1
   1.385 +#define   EFI_DEV_MEDIA_CDROM			 2
   1.386 +#define   EFI_DEV_MEDIA_VENDOR			 3
   1.387 +#define   EFI_DEV_MEDIA_FILE			 4
   1.388 +#define   EFI_DEV_MEDIA_PROTOCOL		 5
   1.389 +#define EFI_DEV_BIOS_BOOT		0x05
   1.390 +#define EFI_DEV_END_PATH		0x7F
   1.391 +#define EFI_DEV_END_PATH2		0xFF
   1.392 +#define   EFI_DEV_END_INSTANCE			0x01
   1.393 +#define   EFI_DEV_END_ENTIRE			0xFF
   1.394 +
   1.395 +struct efi_generic_dev_path {
   1.396 +	u8 type;
   1.397 +	u8 sub_type;
   1.398 +	u16 length;
   1.399 +} __attribute ((packed));
   1.400 +
   1.401 +#endif /* _LINUX_EFI_H */
     2.1 --- a/xen/include/asm-ia64/linux/efi.h	Fri Apr 07 11:40:33 2006 -0600
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,398 +0,0 @@
     2.4 -#ifndef _LINUX_EFI_H
     2.5 -#define _LINUX_EFI_H
     2.6 -
     2.7 -/*
     2.8 - * Extensible Firmware Interface
     2.9 - * Based on 'Extensible Firmware Interface Specification' version 0.9, April 30, 1999
    2.10 - *
    2.11 - * Copyright (C) 1999 VA Linux Systems
    2.12 - * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
    2.13 - * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
    2.14 - *	David Mosberger-Tang <davidm@hpl.hp.com>
    2.15 - *	Stephane Eranian <eranian@hpl.hp.com>
    2.16 - */
    2.17 -#include <linux/init.h>
    2.18 -#include <linux/string.h>
    2.19 -#include <linux/time.h>
    2.20 -#include <linux/types.h>
    2.21 -#include <linux/proc_fs.h>
    2.22 -#include <linux/rtc.h>
    2.23 -#include <linux/ioport.h>
    2.24 -
    2.25 -#include <asm/page.h>
    2.26 -#include <asm/system.h>
    2.27 -
    2.28 -#define EFI_SUCCESS		0
    2.29 -#define EFI_LOAD_ERROR          ( 1 | (1UL << (BITS_PER_LONG-1)))
    2.30 -#define EFI_INVALID_PARAMETER	( 2 | (1UL << (BITS_PER_LONG-1)))
    2.31 -#define EFI_UNSUPPORTED		( 3 | (1UL << (BITS_PER_LONG-1)))
    2.32 -#define EFI_BAD_BUFFER_SIZE     ( 4 | (1UL << (BITS_PER_LONG-1)))
    2.33 -#define EFI_BUFFER_TOO_SMALL	( 5 | (1UL << (BITS_PER_LONG-1)))
    2.34 -#define EFI_NOT_FOUND		(14 | (1UL << (BITS_PER_LONG-1)))
    2.35 -
    2.36 -typedef unsigned long efi_status_t;
    2.37 -typedef u8 efi_bool_t;
    2.38 -typedef u16 efi_char16_t;		/* UNICODE character */
    2.39 -
    2.40 -
    2.41 -typedef struct {
    2.42 -	u8 b[16];
    2.43 -} efi_guid_t;
    2.44 -
    2.45 -#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
    2.46 -((efi_guid_t) \
    2.47 -{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
    2.48 -  (b) & 0xff, ((b) >> 8) & 0xff, \
    2.49 -  (c) & 0xff, ((c) >> 8) & 0xff, \
    2.50 -  (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
    2.51 -
    2.52 -/*
    2.53 - * Generic EFI table header
    2.54 - */
    2.55 -typedef	struct {
    2.56 -	u64 signature;
    2.57 -	u32 revision;
    2.58 -	u32 headersize;
    2.59 -	u32 crc32;
    2.60 -	u32 reserved;
    2.61 -} efi_table_hdr_t;
    2.62 -
    2.63 -/*
    2.64 - * Memory map descriptor:
    2.65 - */
    2.66 -
    2.67 -/* Memory types: */
    2.68 -#define EFI_RESERVED_TYPE		 0
    2.69 -#define EFI_LOADER_CODE			 1
    2.70 -#define EFI_LOADER_DATA			 2
    2.71 -#define EFI_BOOT_SERVICES_CODE		 3
    2.72 -#define EFI_BOOT_SERVICES_DATA		 4
    2.73 -#define EFI_RUNTIME_SERVICES_CODE	 5
    2.74 -#define EFI_RUNTIME_SERVICES_DATA	 6
    2.75 -#define EFI_CONVENTIONAL_MEMORY		 7
    2.76 -#define EFI_UNUSABLE_MEMORY		 8
    2.77 -#define EFI_ACPI_RECLAIM_MEMORY		 9
    2.78 -#define EFI_ACPI_MEMORY_NVS		10
    2.79 -#define EFI_MEMORY_MAPPED_IO		11
    2.80 -#define EFI_MEMORY_MAPPED_IO_PORT_SPACE	12
    2.81 -#define EFI_PAL_CODE			13
    2.82 -#define EFI_MAX_MEMORY_TYPE		14
    2.83 -
    2.84 -/* Attribute values: */
    2.85 -#define EFI_MEMORY_UC		((u64)0x0000000000000001ULL)	/* uncached */
    2.86 -#define EFI_MEMORY_WC		((u64)0x0000000000000002ULL)	/* write-coalescing */
    2.87 -#define EFI_MEMORY_WT		((u64)0x0000000000000004ULL)	/* write-through */
    2.88 -#define EFI_MEMORY_WB		((u64)0x0000000000000008ULL)	/* write-back */
    2.89 -#define EFI_MEMORY_WP		((u64)0x0000000000001000ULL)	/* write-protect */
    2.90 -#define EFI_MEMORY_RP		((u64)0x0000000000002000ULL)	/* read-protect */
    2.91 -#define EFI_MEMORY_XP		((u64)0x0000000000004000ULL)	/* execute-protect */
    2.92 -#define EFI_MEMORY_RUNTIME	((u64)0x8000000000000000ULL)	/* range requires runtime mapping */
    2.93 -#define EFI_MEMORY_DESCRIPTOR_VERSION	1
    2.94 -
    2.95 -#define EFI_PAGE_SHIFT		12
    2.96 -
    2.97 -/*
    2.98 - * For current x86 implementations of EFI, there is
    2.99 - * additional padding in the mem descriptors.  This is not
   2.100 - * the case in ia64.  Need to have this fixed in the f/w.
   2.101 - */
   2.102 -typedef struct {
   2.103 -	u32 type;
   2.104 -	u32 pad;
   2.105 -	u64 phys_addr;
   2.106 -	u64 virt_addr;
   2.107 -	u64 num_pages;
   2.108 -	u64 attribute;
   2.109 -#if defined (__i386__)
   2.110 -	u64 pad1;
   2.111 -#endif
   2.112 -} efi_memory_desc_t;
   2.113 -
   2.114 -typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg);
   2.115 -
   2.116 -/*
   2.117 - * Types and defines for Time Services
   2.118 - */
   2.119 -#define EFI_TIME_ADJUST_DAYLIGHT 0x1
   2.120 -#define EFI_TIME_IN_DAYLIGHT     0x2
   2.121 -#define EFI_UNSPECIFIED_TIMEZONE 0x07ff
   2.122 -
   2.123 -typedef struct {
   2.124 -	u16 year;
   2.125 -	u8 month;
   2.126 -	u8 day;
   2.127 -	u8 hour;
   2.128 -	u8 minute;
   2.129 -	u8 second;
   2.130 -	u8 pad1;
   2.131 -	u32 nanosecond;
   2.132 -	s16 timezone;
   2.133 -	u8 daylight;
   2.134 -	u8 pad2;
   2.135 -} efi_time_t;
   2.136 -
   2.137 -typedef struct {
   2.138 -	u32 resolution;
   2.139 -	u32 accuracy;
   2.140 -	u8 sets_to_zero;
   2.141 -} efi_time_cap_t;
   2.142 -
   2.143 -/*
   2.144 - * Types and defines for EFI ResetSystem
   2.145 - */
   2.146 -#define EFI_RESET_COLD 0
   2.147 -#define EFI_RESET_WARM 1
   2.148 -#define EFI_RESET_SHUTDOWN 2
   2.149 -
   2.150 -/*
   2.151 - * EFI Runtime Services table
   2.152 - */
   2.153 -#define EFI_RUNTIME_SERVICES_SIGNATURE ((u64)0x5652453544e5552ULL)
   2.154 -#define EFI_RUNTIME_SERVICES_REVISION  0x00010000
   2.155 -
   2.156 -typedef struct {
   2.157 -	efi_table_hdr_t hdr;
   2.158 -	unsigned long get_time;
   2.159 -	unsigned long set_time;
   2.160 -	unsigned long get_wakeup_time;
   2.161 -	unsigned long set_wakeup_time;
   2.162 -	unsigned long set_virtual_address_map;
   2.163 -	unsigned long convert_pointer;
   2.164 -	unsigned long get_variable;
   2.165 -	unsigned long get_next_variable;
   2.166 -	unsigned long set_variable;
   2.167 -	unsigned long get_next_high_mono_count;
   2.168 -	unsigned long reset_system;
   2.169 -} efi_runtime_services_t;
   2.170 -
   2.171 -typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
   2.172 -typedef efi_status_t efi_set_time_t (efi_time_t *tm);
   2.173 -typedef efi_status_t efi_get_wakeup_time_t (efi_bool_t *enabled, efi_bool_t *pending,
   2.174 -					    efi_time_t *tm);
   2.175 -typedef efi_status_t efi_set_wakeup_time_t (efi_bool_t enabled, efi_time_t *tm);
   2.176 -typedef efi_status_t efi_get_variable_t (efi_char16_t *name, efi_guid_t *vendor, u32 *attr,
   2.177 -					 unsigned long *data_size, void *data);
   2.178 -typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char16_t *name,
   2.179 -					      efi_guid_t *vendor);
   2.180 -typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 
   2.181 -					 unsigned long attr, unsigned long data_size, 
   2.182 -					 void *data);
   2.183 -typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
   2.184 -typedef void efi_reset_system_t (int reset_type, efi_status_t status,
   2.185 -				 unsigned long data_size, efi_char16_t *data);
   2.186 -typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_size,
   2.187 -						unsigned long descriptor_size,
   2.188 -						u32 descriptor_version,
   2.189 -						efi_memory_desc_t *virtual_map);
   2.190 -
   2.191 -/*
   2.192 - *  EFI Configuration Table and GUID definitions
   2.193 - */
   2.194 -#define NULL_GUID \
   2.195 -    EFI_GUID(  0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 )
   2.196 -
   2.197 -#define MPS_TABLE_GUID    \
   2.198 -    EFI_GUID(  0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   2.199 -
   2.200 -#define ACPI_TABLE_GUID    \
   2.201 -    EFI_GUID(  0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   2.202 -
   2.203 -#define ACPI_20_TABLE_GUID    \
   2.204 -    EFI_GUID(  0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 )
   2.205 -
   2.206 -#define SMBIOS_TABLE_GUID    \
   2.207 -    EFI_GUID(  0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   2.208 -
   2.209 -#define SAL_SYSTEM_TABLE_GUID    \
   2.210 -    EFI_GUID(  0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
   2.211 -
   2.212 -#define HCDP_TABLE_GUID	\
   2.213 -    EFI_GUID(  0xf951938d, 0x620b, 0x42ef, 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 )
   2.214 -
   2.215 -#define UGA_IO_PROTOCOL_GUID \
   2.216 -    EFI_GUID(  0x61a4d49e, 0x6f68, 0x4f1b, 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 )
   2.217 -
   2.218 -#define EFI_GLOBAL_VARIABLE_GUID \
   2.219 -    EFI_GUID(  0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c )
   2.220 -
   2.221 -typedef struct {
   2.222 -	efi_guid_t guid;
   2.223 -	unsigned long table;
   2.224 -} efi_config_table_t;
   2.225 -
   2.226 -#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
   2.227 -#define EFI_SYSTEM_TABLE_REVISION  ((1 << 16) | 00)
   2.228 -
   2.229 -typedef struct {
   2.230 -	efi_table_hdr_t hdr;
   2.231 -	unsigned long fw_vendor;	/* physical addr of CHAR16 vendor string */
   2.232 -	u32 fw_revision;
   2.233 -	unsigned long con_in_handle;
   2.234 -	unsigned long con_in;
   2.235 -	unsigned long con_out_handle;
   2.236 -	unsigned long con_out;
   2.237 -	unsigned long stderr_handle;
   2.238 -	unsigned long stderr;
   2.239 -	efi_runtime_services_t *runtime;
   2.240 -	unsigned long boottime;
   2.241 -	unsigned long nr_tables;
   2.242 -	unsigned long tables;
   2.243 -} efi_system_table_t;
   2.244 -
   2.245 -struct efi_memory_map {
   2.246 -	efi_memory_desc_t *phys_map;
   2.247 -	efi_memory_desc_t *map;
   2.248 -	int nr_map;
   2.249 -	unsigned long desc_version;
   2.250 -};
   2.251 -
   2.252 -/*
   2.253 - * All runtime access to EFI goes through this structure:
   2.254 - */
   2.255 -extern struct efi {
   2.256 -	efi_system_table_t *systab;	/* EFI system table */
   2.257 -	void *mps;			/* MPS table */
   2.258 -	void *acpi;			/* ACPI table  (IA64 ext 0.71) */
   2.259 -	void *acpi20;			/* ACPI table  (ACPI 2.0) */
   2.260 -	void *smbios;			/* SM BIOS table */
   2.261 -	void *sal_systab;		/* SAL system table */
   2.262 -	void *boot_info;		/* boot info table */
   2.263 -	void *hcdp;			/* HCDP table */
   2.264 -	void *uga;			/* UGA table */
   2.265 -	efi_get_time_t *get_time;
   2.266 -	efi_set_time_t *set_time;
   2.267 -	efi_get_wakeup_time_t *get_wakeup_time;
   2.268 -	efi_set_wakeup_time_t *set_wakeup_time;
   2.269 -	efi_get_variable_t *get_variable;
   2.270 -	efi_get_next_variable_t *get_next_variable;
   2.271 -	efi_set_variable_t *set_variable;
   2.272 -	efi_get_next_high_mono_count_t *get_next_high_mono_count;
   2.273 -	efi_reset_system_t *reset_system;
   2.274 -	efi_set_virtual_address_map_t *set_virtual_address_map;
   2.275 -} efi;
   2.276 -
   2.277 -static inline int
   2.278 -efi_guidcmp (efi_guid_t left, efi_guid_t right)
   2.279 -{
   2.280 -	return memcmp(&left, &right, sizeof (efi_guid_t));
   2.281 -}
   2.282 -
   2.283 -static inline char *
   2.284 -efi_guid_unparse(efi_guid_t *guid, char *out)
   2.285 -{
   2.286 -	sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
   2.287 -		guid->b[3], guid->b[2], guid->b[1], guid->b[0],
   2.288 -		guid->b[5], guid->b[4], guid->b[7], guid->b[6],
   2.289 -		guid->b[8], guid->b[9], guid->b[10], guid->b[11],
   2.290 -		guid->b[12], guid->b[13], guid->b[14], guid->b[15]);
   2.291 -        return out;
   2.292 -}
   2.293 -
   2.294 -extern void efi_init (void);
   2.295 -extern void *efi_get_pal_addr (void);
   2.296 -extern void efi_map_pal_code (void);
   2.297 -extern void efi_map_memmap(void);
   2.298 -extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
   2.299 -extern void efi_gettimeofday (struct timespec *ts);
   2.300 -extern void efi_enter_virtual_mode (void);	/* switch EFI to virtual mode, if possible */
   2.301 -extern u64 efi_get_iobase (void);
   2.302 -extern u32 efi_mem_type (unsigned long phys_addr);
   2.303 -extern u64 efi_mem_attributes (unsigned long phys_addr);
   2.304 -extern int __init efi_uart_console_only (void);
   2.305 -extern void efi_initialize_iomem_resources(struct resource *code_resource,
   2.306 -					struct resource *data_resource);
   2.307 -extern unsigned long __init efi_get_time(void);
   2.308 -extern int __init efi_set_rtc_mmss(unsigned long nowtime);
   2.309 -extern struct efi_memory_map memmap;
   2.310 -
   2.311 -/**
   2.312 - * efi_range_is_wc - check the WC bit on an address range
   2.313 - * @start: starting kvirt address
   2.314 - * @len: length of range
   2.315 - *
   2.316 - * Consult the EFI memory map and make sure it's ok to set this range WC.
   2.317 - * Returns true or false.
   2.318 - */
   2.319 -static inline int efi_range_is_wc(unsigned long start, unsigned long len)
   2.320 -{
   2.321 -	unsigned long i;
   2.322 -
   2.323 -	for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) {
   2.324 -		unsigned long paddr = __pa(start + i);
   2.325 -		if (!(efi_mem_attributes(paddr) & EFI_MEMORY_WC))
   2.326 -			return 0;
   2.327 -	}
   2.328 -	/* The range checked out */
   2.329 -	return 1;
   2.330 -}
   2.331 -
   2.332 -#ifdef CONFIG_EFI_PCDP
   2.333 -extern int __init efi_setup_pcdp_console(char *);
   2.334 -#endif
   2.335 -
   2.336 -/*
   2.337 - * We play games with efi_enabled so that the compiler will, if possible, remove
   2.338 - * EFI-related code altogether.
   2.339 - */
   2.340 -#ifdef CONFIG_EFI
   2.341 -# ifdef CONFIG_X86
   2.342 -   extern int efi_enabled;
   2.343 -# else
   2.344 -#  define efi_enabled 1
   2.345 -# endif
   2.346 -#else
   2.347 -# define efi_enabled 0
   2.348 -#endif
   2.349 -
   2.350 -/*
   2.351 - * Variable Attributes
   2.352 - */
   2.353 -#define EFI_VARIABLE_NON_VOLATILE       0x0000000000000001
   2.354 -#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
   2.355 -#define EFI_VARIABLE_RUNTIME_ACCESS     0x0000000000000004
   2.356 -
   2.357 -/*
   2.358 - * EFI Device Path information
   2.359 - */
   2.360 -#define EFI_DEV_HW			0x01
   2.361 -#define  EFI_DEV_PCI				 1
   2.362 -#define  EFI_DEV_PCCARD				 2
   2.363 -#define  EFI_DEV_MEM_MAPPED			 3
   2.364 -#define  EFI_DEV_VENDOR				 4
   2.365 -#define  EFI_DEV_CONTROLLER			 5
   2.366 -#define EFI_DEV_ACPI			0x02
   2.367 -#define   EFI_DEV_BASIC_ACPI			 1
   2.368 -#define   EFI_DEV_EXPANDED_ACPI			 2
   2.369 -#define EFI_DEV_MSG			0x03
   2.370 -#define   EFI_DEV_MSG_ATAPI			 1
   2.371 -#define   EFI_DEV_MSG_SCSI			 2
   2.372 -#define   EFI_DEV_MSG_FC			 3
   2.373 -#define   EFI_DEV_MSG_1394			 4
   2.374 -#define   EFI_DEV_MSG_USB			 5
   2.375 -#define   EFI_DEV_MSG_USB_CLASS			15
   2.376 -#define   EFI_DEV_MSG_I20			 6
   2.377 -#define   EFI_DEV_MSG_MAC			11
   2.378 -#define   EFI_DEV_MSG_IPV4			12
   2.379 -#define   EFI_DEV_MSG_IPV6			13
   2.380 -#define   EFI_DEV_MSG_INFINIBAND		 9
   2.381 -#define   EFI_DEV_MSG_UART			14
   2.382 -#define   EFI_DEV_MSG_VENDOR			10
   2.383 -#define EFI_DEV_MEDIA			0x04
   2.384 -#define   EFI_DEV_MEDIA_HARD_DRIVE		 1
   2.385 -#define   EFI_DEV_MEDIA_CDROM			 2
   2.386 -#define   EFI_DEV_MEDIA_VENDOR			 3
   2.387 -#define   EFI_DEV_MEDIA_FILE			 4
   2.388 -#define   EFI_DEV_MEDIA_PROTOCOL		 5
   2.389 -#define EFI_DEV_BIOS_BOOT		0x05
   2.390 -#define EFI_DEV_END_PATH		0x7F
   2.391 -#define EFI_DEV_END_PATH2		0xFF
   2.392 -#define   EFI_DEV_END_INSTANCE			0x01
   2.393 -#define   EFI_DEV_END_ENTIRE			0xFF
   2.394 -
   2.395 -struct efi_generic_dev_path {
   2.396 -	u8 type;
   2.397 -	u8 sub_type;
   2.398 -	u16 length;
   2.399 -} __attribute ((packed));
   2.400 -
   2.401 -#endif /* _LINUX_EFI_H */