1 /* 2 * Copyright 2021, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _FWCFG_H_ 6 #define _FWCFG_H_ 7 8 9 #include <stddef.h> 10 #include <stdint.h> 11 12 13 enum { 14 fwCfgSelectSignature = 0x0000, 15 fwCfgSelectId = 0x0001, 16 fwCfgSelectFileDir = 0x0019, 17 fwCfgSelectFileFirst = 0x0020, 18 }; 19 20 enum { 21 fwCfgSignature = 0x554D4551, 22 23 fwCfgIdTraditional = 0, 24 fwCfgIdDma = 1, 25 }; 26 27 enum { 28 fwCfgDmaFlagsError = 0, 29 fwCfgDmaFlagsRead = 1, 30 fwCfgDmaFlagsSkip = 2, 31 fwCfgDmaFlagsSelect = 3, 32 fwCfgDmaFlagsWrite = 4, 33 }; 34 35 36 // integer values are big endian 37 struct __attribute__((packed)) FwCfgFile { 38 uint32_t size; 39 uint16_t select; 40 uint16_t reserved; 41 char name[56]; // '/0' terminated 42 }; 43 44 struct __attribute__((packed)) FwCfgFiles { 45 uint32_t count; 46 FwCfgFile f[]; 47 }; 48 49 struct __attribute__((packed)) FwCfgDmaAccess { 50 uint32_t control; 51 uint32_t length; 52 uint64_t address; 53 }; 54 55 56 struct __attribute__((packed)) FwCfgRegs { 57 uint64_t data; 58 uint16_t selector; 59 uint16_t unused1; 60 uint32_t unused2; 61 uint64_t dmaAdr; 62 }; 63 64 65 // ramfb 66 67 enum { 68 ramFbFormatXrgb8888 = ((uint32_t)('X') | ((uint32_t)('R') << 8) 69 | ((uint32_t)('2') << 16) | ((uint32_t)('4') << 24)), 70 }; 71 72 // all fields are big endian 73 struct __attribute__((packed)) RamFbCfg { 74 uint64_t addr; 75 uint32_t fourcc; 76 uint32_t flags; 77 uint32_t width; 78 uint32_t height; 79 uint32_t stride; 80 }; 81 82 83 extern FwCfgRegs *volatile gFwCfgRegs; 84 85 86 namespace FwCfg { 87 88 void Init(); 89 90 }; 91 92 93 #endif // _FWCFG_H_ 94