xref: /freebsd/sys/x86/include/metadata.h (revision a3fa657eddade274a5cb684b5e5e890eef67ad25)
10e42ee5dSEd Maste /*-
20e42ee5dSEd Maste  * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
30e42ee5dSEd Maste  * All rights reserved.
40e42ee5dSEd Maste  *
50e42ee5dSEd Maste  * Redistribution and use in source and binary forms, with or without
60e42ee5dSEd Maste  * modification, are permitted provided that the following conditions
70e42ee5dSEd Maste  * are met:
80e42ee5dSEd Maste  * 1. Redistributions of source code must retain the above copyright
90e42ee5dSEd Maste  *    notice, this list of conditions and the following disclaimer.
100e42ee5dSEd Maste  * 2. Redistributions in binary form must reproduce the above copyright
110e42ee5dSEd Maste  *    notice, this list of conditions and the following disclaimer in the
120e42ee5dSEd Maste  *    documentation and/or other materials provided with the distribution.
130e42ee5dSEd Maste  *
140e42ee5dSEd Maste  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
150e42ee5dSEd Maste  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
160e42ee5dSEd Maste  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
170e42ee5dSEd Maste  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
180e42ee5dSEd Maste  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
190e42ee5dSEd Maste  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
200e42ee5dSEd Maste  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
210e42ee5dSEd Maste  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
220e42ee5dSEd Maste  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
230e42ee5dSEd Maste  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
240e42ee5dSEd Maste  * SUCH DAMAGE.
250e42ee5dSEd Maste  */
260e42ee5dSEd Maste 
270e42ee5dSEd Maste #ifndef _MACHINE_METADATA_H_
280e42ee5dSEd Maste #define	_MACHINE_METADATA_H_
290e42ee5dSEd Maste 
300e42ee5dSEd Maste #define	MODINFOMD_SMAP		0x1001
310e42ee5dSEd Maste #define	MODINFOMD_SMAP_XATTR	0x1002
320e42ee5dSEd Maste #define	MODINFOMD_DTBP		0x1003
330e42ee5dSEd Maste #define	MODINFOMD_EFI_MAP	0x1004
340e42ee5dSEd Maste #define	MODINFOMD_EFI_FB	0x1005
350e42ee5dSEd Maste #define	MODINFOMD_MODULEP	0x1006
36a4a10b37SToomas Soome #define	MODINFOMD_VBE_FB	0x1007
37b538d491SAhmad Khalifa #define	MODINFOMD_EFI_ARCH	0x1008
380e42ee5dSEd Maste 
39*a3fa657eSWarner Losh /*
40*a3fa657eSWarner Losh  * This is not the same as the UEFI standard EFI_MEMORY_ATTRIBUTES_TABLE, though
41*a3fa657eSWarner Losh  * memory_size / descritpr_size entries of EFI_MEMORY_DESCRIPTORS follow this table
42*a3fa657eSWarner Losh  * starting at a 16-byte alignment.
43*a3fa657eSWarner Losh  */
440e42ee5dSEd Maste struct efi_map_header {
45*a3fa657eSWarner Losh 	uint64_t	memory_size;		/* Numnber of bytes that follow */
46*a3fa657eSWarner Losh 	uint64_t	descriptor_size;	/* Size of each EFI_MEMORY_DESCRIPTOR */
47*a3fa657eSWarner Losh 	uint32_t	descriptor_version;	/* Currently '1' */
480e42ee5dSEd Maste };
490e42ee5dSEd Maste 
500e42ee5dSEd Maste struct efi_fb {
510e42ee5dSEd Maste 	uint64_t	fb_addr;
520e42ee5dSEd Maste 	uint64_t	fb_size;
530e42ee5dSEd Maste 	uint32_t	fb_height;
540e42ee5dSEd Maste 	uint32_t	fb_width;
550e42ee5dSEd Maste 	uint32_t	fb_stride;
560e42ee5dSEd Maste 	uint32_t	fb_mask_red;
570e42ee5dSEd Maste 	uint32_t	fb_mask_green;
580e42ee5dSEd Maste 	uint32_t	fb_mask_blue;
590e42ee5dSEd Maste 	uint32_t	fb_mask_reserved;
600e42ee5dSEd Maste };
610e42ee5dSEd Maste 
62a4a10b37SToomas Soome struct vbe_fb {
63a4a10b37SToomas Soome 	uint64_t	fb_addr;
64a4a10b37SToomas Soome 	uint64_t	fb_size;
65a4a10b37SToomas Soome 	uint32_t	fb_height;
66a4a10b37SToomas Soome 	uint32_t	fb_width;
67a4a10b37SToomas Soome 	uint32_t	fb_stride;
68a4a10b37SToomas Soome 	uint32_t	fb_mask_red;
69a4a10b37SToomas Soome 	uint32_t	fb_mask_green;
70a4a10b37SToomas Soome 	uint32_t	fb_mask_blue;
71a4a10b37SToomas Soome 	uint32_t	fb_mask_reserved;
72a4a10b37SToomas Soome 	uint32_t	fb_bpp;
73a4a10b37SToomas Soome };
74a4a10b37SToomas Soome 
75b6d85a5fSRoger Pau Monné /*
76b6d85a5fSRoger Pau Monné  * The structure below is used when FreeBSD kernel is booted as a dom0 kernel
77b6d85a5fSRoger Pau Monné  * from Xen. In such scenario we need to accommodate the modules and the
78b6d85a5fSRoger Pau Monné  * metadata as a contiguous memory region, so it can be passed as a multiboot
79b6d85a5fSRoger Pau Monné  * module, and some extra information is required which is conveyed from the
80b6d85a5fSRoger Pau Monné  * loader to the kernel using the xen_header structure below.
81b6d85a5fSRoger Pau Monné  *
82b6d85a5fSRoger Pau Monné  * See the comment in multiboot.c about how the structure below is packaged
83b6d85a5fSRoger Pau Monné  * together with the rest of the kernel payload data.
84b6d85a5fSRoger Pau Monné  */
85b6d85a5fSRoger Pau Monné struct xen_header {
86b6d85a5fSRoger Pau Monné 	uint64_t	flags;
87b6d85a5fSRoger Pau Monné #define XENHEADER_HAS_MODULEP_OFFSET (1ull << 0)
88b6d85a5fSRoger Pau Monné 
89b6d85a5fSRoger Pau Monné 	/*
90b6d85a5fSRoger Pau Monné 	 * Offset of the modulep location from the start of the multiboot
91b6d85a5fSRoger Pau Monné 	 * module blob.
92b6d85a5fSRoger Pau Monné 	 */
93b6d85a5fSRoger Pau Monné 	uint64_t	modulep_offset;
94b6d85a5fSRoger Pau Monné };
95b6d85a5fSRoger Pau Monné 
960e42ee5dSEd Maste #endif /* !_MACHINE_METADATA_H_ */
97