1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright (c) 2014, Joyent, Inc. All rights reserved. 14 */ 15 16 #ifndef _SYS_ATAG_H 17 #define _SYS_ATAG_H 18 19 /* 20 * Describe the purpose of the file here. 21 */ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #include <sys/types.h> 28 29 #define ATAG_NONE 0x0 30 #define ATAG_CORE 0x54410001 31 #define ATAG_MEM 0x54410002 32 #define ATAG_VIDEOTEXT 0x54410003 33 #define ATAG_RAMDISK 0x54410004 34 #define ATAG_INITRD2 0x54420005 35 #define ATAG_SERIAL 0x54410006 36 #define ATAG_REVISION 0x54410007 37 #define ATAG_VIDEOLFB 0x54410008 38 #define ATAG_CMDLINE 0x54410009 39 #define ATAG_ILLUMOS_STATUS 0x726d0000 40 #define ATAG_ILLUMOS_MAPPING 0x726d0001 41 42 typedef struct atag_header { 43 uint32_t ah_size; /* size in 4 byte words */ 44 uint32_t ah_tag; 45 } atag_header_t; 46 47 typedef struct atag_core { 48 atag_header_t ac_header; 49 uint32_t ac_flags; 50 uint32_t ac_pagesize; 51 uint32_t ac_rootdev; 52 } atag_core_t; 53 54 typedef struct atag_mem { 55 atag_header_t am_header; 56 uint32_t am_size; 57 uint32_t am_start; 58 } atag_mem_t; 59 60 typedef struct atag_ramdisk { 61 atag_header_t ar_header; 62 uint32_t ar_flags; 63 uint32_t ar_size; 64 uint32_t ar_start; 65 } atag_ramdisk_t; 66 67 typedef struct atag_initrd { 68 atag_header_t ai_header; 69 uint32_t ai_start; 70 uint32_t ai_size; 71 } atag_initrd_t; 72 73 typedef struct atag_serial { 74 atag_header_t as_header; 75 uint32_t as_low; 76 uint32_t as_high; 77 } atag_serial_t; 78 79 typedef struct atag_cmdline { 80 atag_header_t al_header; 81 char al_cmdline[1]; 82 } atag_cmdline_t; 83 84 typedef struct atag_illumos_status { 85 atag_header_t ais_header; 86 uint32_t ais_version; 87 uint32_t ais_ptbase; 88 uint32_t ais_freemem; 89 uint32_t ais_freeused; 90 uint32_t ais_archive; 91 uint32_t ais_archivelen; 92 uint32_t ais_pt_arena; 93 uint32_t ais_pt_arena_max; 94 uint32_t ais_stext; 95 uint32_t ais_etext; 96 uint32_t ais_sdata; 97 uint32_t ais_edata; 98 } atag_illumos_status_t; 99 100 typedef struct atag_illumos_mapping { 101 atag_header_t aim_header; 102 uint32_t aim_paddr; 103 uint32_t aim_plen; 104 uint32_t aim_vaddr; 105 uint32_t aim_vlen; 106 uint32_t aim_mapflags; 107 } atag_illumos_mapping_t; 108 109 #define ATAG_ILLUMOS_STATUS_SIZE 14 110 #define ATAG_ILLUMOS_MAPPING_SIZE 7 111 #define PF_NORELOC 0x08 112 #define PF_DEVICE 0x10 113 #define PF_LOADER 0x20 114 115 extern atag_header_t *atag_next(atag_header_t *); 116 extern const atag_header_t *atag_find(atag_header_t *, uint32_t); 117 extern void atag_append(atag_header_t *, atag_header_t *); 118 extern size_t atag_length(atag_header_t *); 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif /* _SYS_ATAG_H */