Home | History | Annotate | Line # | Download | only in efi
      1 /* $NetBSD: defs.h,v 1.2 2025/03/30 14:36:48 riastradh Exp $ */
      2 
      3 /*
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  * 1. Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  * 2. Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
     14  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     16  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     19  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     23  * SUCH DAMAGE.
     24  */
     25 
     26 #ifndef _DEFS_H_
     27 #define _DEFS_H_
     28 
     29 #ifndef lint
     30 __RCSID("$NetBSD: defs.h,v 1.2 2025/03/30 14:36:48 riastradh Exp $");
     31 #endif /* not lint */
     32 
     33 #define PUBLIC
     34 #define VERSION 18
     35 
     36 /* debug bit flags */
     37 
     38 #define DEBUG_STRUCT_BIT	__BIT(0)
     39 #define DEBUG_DATA_BIT		__BIT(1)
     40 #define DEBUG_EFI_IOC_BIT	__BIT(2)
     41 #define DEBUG_MASK		__BITS(15,0)
     42 #define DEBUG_BRIEF_BIT		__BIT(16)
     43 #define DEBUG_VERBOSE_BIT	__BIT(17)
     44 
     45 #define EFI_GLOBAL_VARIABLE \
     46 	((uuid_t){0x8be4df61,0x93ca,0x11d2,0xaa,0x0d,\
     47 	  {0x00,0xe0,0x98,0x03,0x2b,0x8c}})
     48 #if 0
     49 /* XXX: same as EFI_GLOBAL_VARIABLE */
     50 #define EFI_VARIABLE_GUID \
     51 	((uuid_t){0x8be4df61,0x93ca,0x11d2,0xaa,0x0d,\
     52 	  {0x00,0xe0,0x98,0x03,0x2b,0x8c}})
     53 #endif
     54 
     55 #define	EFI_TABLE_SMBIOS \
     56 	((uuid_t){0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,\
     57 	  {0x00,0x90,0x27,0x3f,0xc1,0x4d}}
     58 
     59 #define	EFI_TABLE_SMBIOS3 \
     60 	((uuid_t){0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,\
     61 	  {0xe5,0xbb,0xcf,0x20,0xe3,0x94}}
     62 
     63 #define LINUX_EFI_MEMRESERVE_TABLE \
     64 	((uuid_t){0x888eb0c6,0x8ede,0x4ff5,0xa8,0xf0,\
     65 	  {0x9a,0xee,0x5c,0xb9,0x77,0xc2}}
     66 
     67 #define EFI_UNKNOWN_GUID \
     68 	((uuid_t){0x47c7b225,0xc42a,0x11d2,0x57,0x8e,\
     69 	  {0x00,0xa0,0xc9,0x69,0x72,0x3b}}
     70 
     71 #define EFI_ADDRESS_RANGE_MIRROR_VARIABLE_GUID \
     72 	((uuid_t){0x7b9be2e0,0xe28a,0x4197,0x3e,0xad,\
     73 	  {0x32,0xf0,0x62,0xf9,0x46,0x2c}}
     74 
     75 /*
     76  * XXX: It would be nice to have QueryVariableInfo() support to get
     77  * maximum variable size ... or at least export EFI_VARNAME_MAXBYTES
     78  * from efi.h!
     79  */
     80 /* From sys/arch/x86/include/efi.h */
     81 #define	EFI_PAGE_SHIFT		12
     82 #define	EFI_PAGE_SIZE		(1 << EFI_PAGE_SHIFT)
     83 #define	EFI_VARNAME_MAXBYTES	EFI_PAGE_SIZE
     84 
     85 /* XXX: Why is this not exposed in sys/uuid.h? */
     86 #define	UUID_STR_LEN	_UUID_STR_LEN
     87 
     88 #endif /* _DEFS_H_ */
     89