1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <zircon/compiler.h>
8 #include <stdint.h>
9 
10 // BOOTDATA_KERNEL_DRIVER bootdata types
11 #define KDRV_ARM_PSCI           0x49435350  // 'PSCI'
12 #define KDRV_ARM_GIC_V2         0x32434947  // 'GIC2'
13 #define KDRV_ARM_GIC_V3         0x33434947  // 'GIC3'
14 #define KDRV_ARM_GENERIC_TIMER  0x4D495441  // 'ATIM'
15 #define KDRV_PL011_UART         0x55304C50  // 'PL0U'
16 #define KDRV_AMLOGIC_UART       0x554C4D41  // 'AMLU'
17 #define KDRV_NXP_IMX_UART       0x55584D49  // 'IMXU'
18 #define KDRV_MT8167_UART        0x5538544D  // 'MT8U'
19 #define KDRV_HISILICON_POWER    0x4F505348  // 'HSPO'
20 #define KDRV_AMLOGIC_HDCP       0x484C4D41  // 'AMLH'
21 
22 // kernel driver struct that can be used for simple drivers
23 // used by KDRV_PL011_UART, KDRV_AMLOGIC_UART and KDRV_NXP_IMX_UART
24 typedef struct {
25     uint64_t mmio_phys;
26     uint32_t irq;
27 } dcfg_simple_t;
28 
29 // for KDRV_MT8167_UART
30 typedef struct {
31     uint64_t soc_mmio_phys;
32     uint64_t uart_mmio_phys;
33     uint32_t irq;
34 } dcfg_soc_uart_t;
35 
36 // for KDRV_ARM_PSCI
37 typedef struct {
38     bool use_hvc;
39     uint64_t shutdown_args[3];
40     uint64_t reboot_args[3];
41     uint64_t reboot_bootloader_args[3];
42     uint64_t reboot_recovery_args[3];
43 } dcfg_arm_psci_driver_t;
44 
45 // for KDRV_ARM_GIC_V2
46 typedef struct {
47     uint64_t mmio_phys;
48     uint64_t msi_frame_phys;
49     uint64_t gicd_offset;
50     uint64_t gicc_offset;
51     uint64_t gich_offset;
52     uint64_t gicv_offset;
53     uint32_t ipi_base;
54     bool optional;
55     bool use_msi;
56 } dcfg_arm_gicv2_driver_t;
57 
58 // for KDRV_ARM_GIC_V3
59 typedef struct {
60     uint64_t mmio_phys;
61     uint64_t gicd_offset;
62     uint64_t gicr_offset;
63     uint64_t gicr_stride;
64     uint64_t mx8_gpr_phys;
65     uint32_t ipi_base;
66     bool optional;
67 } dcfg_arm_gicv3_driver_t;
68 
69 // for KDRV_ARM_GENERIC_TIMER
70 typedef struct {
71     uint32_t irq_phys;
72     uint32_t irq_virt;
73     uint32_t irq_sphys;
74     uint32_t freq_override;
75 } dcfg_arm_generic_timer_driver_t;
76 
77 // for KDRV_HISILICON_POWER
78 typedef struct {
79     uint64_t sctrl_phys;
80     uint64_t pmu_phys;
81 } dcfg_hisilicon_power_driver_t;
82 
83 // for KDRV_AMLOGIC_HDCP
84 typedef struct {
85     uint64_t preset_phys;
86     uint64_t hiu_phys;
87     uint64_t hdmitx_phys;
88 } dcfg_amlogic_hdcp_driver_t;
89