Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
[qemu/ar7.git] / hw / xtensa / bootparam.h
blobade7891ec5057e9df789562a96837a89792834e5
1 #ifndef HW_XTENSA_BOOTPARAM_H
2 #define HW_XTENSA_BOOTPARAM_H
4 #define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/
5 #define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */
6 #define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */
7 #define BP_TAG_SERIAL_BAUDRATE 0x1004 /* baud rate of current console. */
8 #define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */
9 #define BP_TAG_FDT 0x1006 /* flat device tree addr */
11 #define BP_TAG_FIRST 0x7B0B /* first tag with a version number */
12 #define BP_TAG_LAST 0x7E0B /* last tag */
14 typedef struct BpTag {
15 uint16_t tag;
16 uint16_t size;
17 } BpTag;
19 typedef struct BpMemInfo {
20 uint32_t type;
21 uint32_t start;
22 uint32_t end;
23 } BpMemInfo;
25 #define MEMORY_TYPE_CONVENTIONAL 0x1000
26 #define MEMORY_TYPE_NONE 0x2000
28 static inline size_t get_tag_size(size_t data_size)
30 return data_size + sizeof(BpTag) + 4;
33 static inline ram_addr_t put_tag(ram_addr_t addr, uint16_t tag,
34 size_t size, const void *data)
36 BpTag bp_tag = {
37 .tag = tswap16(tag),
38 .size = tswap16((size + 3) & ~3),
41 cpu_physical_memory_write(addr, &bp_tag, sizeof(bp_tag));
42 addr += sizeof(bp_tag);
43 cpu_physical_memory_write(addr, data, size);
44 addr += (size + 3) & ~3;
46 return addr;
49 #endif