xref: /xnu-8020.140.41/pexpert/pexpert/arm64/boot.h (revision 27b03b360a988dfd3dfdf34262bb0042026747cc)
1 /*
2  * Copyright (c) 2007-2009 Apple Inc. All rights reserved.
3  * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
4  */
5 /*
6  * @OSF_COPYRIGHT@
7  */
8 
9 #ifndef _PEXPERT_ARM64_BOOT_H_
10 #define _PEXPERT_ARM64_BOOT_H_
11 
12 #ifdef KERNEL
13 #include <kern/kern_types.h>
14 #endif
15 #include <pexpert/arm/consistent_debug.h>
16 #include <pexpert/arm/protos.h>
17 
18 /*
19  * Maximum size of an environment variable value. This particular value is
20  * chosen to accommodate the maximum encoded size of the system token as
21  * computed in https://confluence.sd.apple.com/display/TK/System+Token.
22  *
23  * This value matches iBoot's IBOOT_MAX_ENV_VAR_DATA_SIZE.
24  * There are no iBoot headers so have to duplicate it here for now.
25  */
26 #define BOOT_LINE_LENGTH        608
27 
28 /*
29  * Video information..
30  */
31 
32 struct Boot_Video {
33 	unsigned long   v_baseAddr;     /* Base address of video memory */
34 	unsigned long   v_display;      /* Display Code (if Applicable */
35 	unsigned long   v_rowBytes;     /* Number of bytes per pixel row */
36 	unsigned long   v_width;        /* Width */
37 	unsigned long   v_height;       /* Height */
38 	unsigned long   v_depth;        /* Pixel Depth and other parameters */
39 };
40 
41 #define kBootVideoDepthMask             (0xFF)
42 #define kBootVideoDepthDepthShift       (0)
43 #define kBootVideoDepthRotateShift      (8)
44 #define kBootVideoDepthScaleShift       (16)
45 #define kBootVideoDepthBootRotateShift  (24)
46 
47 #define kBootFlagsDarkBoot              (1ULL << 0)
48 
49 typedef struct Boot_Video       Boot_Video;
50 
51 /* Boot argument structure - passed into Mach kernel at boot time.
52  */
53 #define kBootArgsRevision               1
54 #define kBootArgsRevision2              2       /* added boot_args.bootFlags */
55 #define kBootArgsVersion1               1
56 #define kBootArgsVersion2               2
57 
58 typedef struct boot_args {
59 	uint16_t                Revision;                       /* Revision of boot_args structure */
60 	uint16_t                Version;                        /* Version of boot_args structure */
61 	uint64_t                virtBase;                       /* Virtual base of memory */
62 	uint64_t                physBase;                       /* Physical base of memory */
63 	uint64_t                memSize;                        /* Size of memory */
64 	uint64_t                topOfKernelData;        /* Highest physical address used in kernel data area */
65 	Boot_Video              Video;                          /* Video Information */
66 	uint32_t                machineType;            /* Machine Type */
67 	void                    *deviceTreeP;           /* Base of flattened device tree */
68 	uint32_t                deviceTreeLength;       /* Length of flattened tree */
69 	char                    CommandLine[BOOT_LINE_LENGTH];  /* Passed in command line */
70 	uint64_t                bootFlags;              /* Additional flags specified by the bootloader */
71 	uint64_t                memSizeActual;          /* Actual size of memory */
72 } boot_args;
73 
74 #define SOC_DEVICE_TYPE_BUFFER_SIZE     32
75 
76 #define PC_TRACE_BUF_SIZE               1024
77 
78 #define CDBG_MEM ((sizeof(dbg_registry_t) + PAGE_SIZE - 1) & ~PAGE_MASK)
79 
80 #define PE_EARLY_BOOT_VA (CDBG_MEM)
81 
82 #endif /* _PEXPERT_ARM64_BOOT_H_ */
83