xref: /freebsd/sys/x86/include/metadata.h (revision b6d85a5f51e4147452b35d76478fb9e191b7734b)
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  * $FreeBSD$
270e42ee5dSEd Maste  */
280e42ee5dSEd Maste 
290e42ee5dSEd Maste #ifndef _MACHINE_METADATA_H_
300e42ee5dSEd Maste #define	_MACHINE_METADATA_H_
310e42ee5dSEd Maste 
320e42ee5dSEd Maste #define	MODINFOMD_SMAP		0x1001
330e42ee5dSEd Maste #define	MODINFOMD_SMAP_XATTR	0x1002
340e42ee5dSEd Maste #define	MODINFOMD_DTBP		0x1003
350e42ee5dSEd Maste #define	MODINFOMD_EFI_MAP	0x1004
360e42ee5dSEd Maste #define	MODINFOMD_EFI_FB	0x1005
370e42ee5dSEd Maste #define	MODINFOMD_MODULEP	0x1006
38a4a10b37SToomas Soome #define	MODINFOMD_VBE_FB	0x1007
390e42ee5dSEd Maste 
400e42ee5dSEd Maste struct efi_map_header {
410e42ee5dSEd Maste 	uint64_t	memory_size;
420e42ee5dSEd Maste 	uint64_t	descriptor_size;
430e42ee5dSEd Maste 	uint32_t	descriptor_version;
440e42ee5dSEd Maste };
450e42ee5dSEd Maste 
460e42ee5dSEd Maste struct efi_fb {
470e42ee5dSEd Maste 	uint64_t	fb_addr;
480e42ee5dSEd Maste 	uint64_t	fb_size;
490e42ee5dSEd Maste 	uint32_t	fb_height;
500e42ee5dSEd Maste 	uint32_t	fb_width;
510e42ee5dSEd Maste 	uint32_t	fb_stride;
520e42ee5dSEd Maste 	uint32_t	fb_mask_red;
530e42ee5dSEd Maste 	uint32_t	fb_mask_green;
540e42ee5dSEd Maste 	uint32_t	fb_mask_blue;
550e42ee5dSEd Maste 	uint32_t	fb_mask_reserved;
560e42ee5dSEd Maste };
570e42ee5dSEd Maste 
58a4a10b37SToomas Soome struct vbe_fb {
59a4a10b37SToomas Soome 	uint64_t	fb_addr;
60a4a10b37SToomas Soome 	uint64_t	fb_size;
61a4a10b37SToomas Soome 	uint32_t	fb_height;
62a4a10b37SToomas Soome 	uint32_t	fb_width;
63a4a10b37SToomas Soome 	uint32_t	fb_stride;
64a4a10b37SToomas Soome 	uint32_t	fb_mask_red;
65a4a10b37SToomas Soome 	uint32_t	fb_mask_green;
66a4a10b37SToomas Soome 	uint32_t	fb_mask_blue;
67a4a10b37SToomas Soome 	uint32_t	fb_mask_reserved;
68a4a10b37SToomas Soome 	uint32_t	fb_bpp;
69a4a10b37SToomas Soome };
70a4a10b37SToomas Soome 
71*b6d85a5fSRoger Pau Monné /*
72*b6d85a5fSRoger Pau Monné  * The structure below is used when FreeBSD kernel is booted as a dom0 kernel
73*b6d85a5fSRoger Pau Monné  * from Xen. In such scenario we need to accommodate the modules and the
74*b6d85a5fSRoger Pau Monné  * metadata as a contiguous memory region, so it can be passed as a multiboot
75*b6d85a5fSRoger Pau Monné  * module, and some extra information is required which is conveyed from the
76*b6d85a5fSRoger Pau Monné  * loader to the kernel using the xen_header structure below.
77*b6d85a5fSRoger Pau Monné  *
78*b6d85a5fSRoger Pau Monné  * See the comment in multiboot.c about how the structure below is packaged
79*b6d85a5fSRoger Pau Monné  * together with the rest of the kernel payload data.
80*b6d85a5fSRoger Pau Monné  */
81*b6d85a5fSRoger Pau Monné struct xen_header {
82*b6d85a5fSRoger Pau Monné 	uint64_t	flags;
83*b6d85a5fSRoger Pau Monné #define XENHEADER_HAS_MODULEP_OFFSET (1ull << 0)
84*b6d85a5fSRoger Pau Monné 
85*b6d85a5fSRoger Pau Monné 	/*
86*b6d85a5fSRoger Pau Monné 	 * Offset of the modulep location from the start of the multiboot
87*b6d85a5fSRoger Pau Monné 	 * module blob.
88*b6d85a5fSRoger Pau Monné 	 */
89*b6d85a5fSRoger Pau Monné 	uint64_t	modulep_offset;
90*b6d85a5fSRoger Pau Monné };
91*b6d85a5fSRoger Pau Monné 
920e42ee5dSEd Maste #endif /* !_MACHINE_METADATA_H_ */
93