1 /** @file
2  *
3  *  RPi defines for constructing ACPI tables
4  *
5  *  Copyright (c) 2020, Pete Batard <pete@akeo.ie>
6  *  Copyright (c) 2019, ARM Ltd. All rights reserved.
7  *  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
8  *  Copyright (c) Microsoft Corporation. All rights reserved.
9  *
10  *  SPDX-License-Identifier: BSD-2-Clause-Patent
11  *
12  **/
13 
14 #ifndef __RPI_ACPITABLES_H__
15 #define __RPI_ACPITABLES_H__
16 
17 #include <acpi/acpi_table.h>
18 
19 // The ASL compiler can't perform arithmetic on MEMORY32FIXED ()
20 // parameters so you can't pass a constant like BASE + OFFSET.
21 // We therefore define a macro that can perform arithmetic base
22 // address update with an offset.
23 #define MEMORY32SETBASE(BufName, MemName, VarName, Offset)       \
24     CreateDwordField (^BufName, ^MemName._BAS, VarName)          \
25     Add (BCM2836_SOC_REGISTERS, Offset, VarName)
26 
27 //------------------------------------------------------------------------
28 // Interrupts. These are specific to each platform
29 //------------------------------------------------------------------------
30 #if defined(CONFIG_TARGET_RPI_3)
31 #define BCM2836_V3D_BUS_INTERRUPT               0x2A
32 #define BCM2836_DMA_INTERRUPT                   0x3B
33 #define BCM2836_SPI1_INTERRUPT                  0x3D
34 #define BCM2836_SPI2_INTERRUPT                  0x3D
35 #define BCM2836_HVS_INTERRUPT                   0x41
36 #define BCM2836_HDMI0_INTERRUPT                 0x48
37 #define BCM2836_HDMI1_INTERRUPT                 0x49
38 #define BCM2836_PV2_INTERRUPT                   0x4A
39 #define BCM2836_PV0_INTERRUPT                   0x4D
40 #define BCM2836_PV1_INTERRUPT                   0x4E
41 #define BCM2836_MBOX_INTERRUPT                  0x61
42 #define BCM2836_VCHIQ_INTERRUPT                 0x62
43 #define BCM2386_GPIO_INTERRUPT0                 0x51
44 #define BCM2386_GPIO_INTERRUPT1                 0x52
45 #define BCM2386_GPIO_INTERRUPT2                 0x53
46 #define BCM2386_GPIO_INTERRUPT3                 0x54
47 #define BCM2836_I2C1_INTERRUPT                  0x55
48 #define BCM2836_I2C2_INTERRUPT                  0x55
49 #define BCM2836_SPI0_INTERRUPT                  0x56
50 #define BCM2836_USB_INTERRUPT                   0x29
51 #define BCM2836_SDHOST_INTERRUPT                0x58
52 #define BCM2836_MMCHS1_INTERRUPT                0x5E
53 #define BCM2836_MINI_UART_INTERRUPT             0x3D
54 #define BCM2836_PL011_UART_INTERRUPT            0x59
55 #elif defined(CONFIG_TARGET_RPI_4)
56 #define BCM2836_V3D_BUS_INTERRUPT               0x2A
57 #define BCM2836_DMA_INTERRUPT                   0x3B
58 #define BCM2836_SPI1_INTERRUPT                  0x7D
59 #define BCM2836_SPI2_INTERRUPT                  0x7D
60 #define BCM2836_HVS_INTERRUPT                   0x41
61 #define BCM2836_HDMI0_INTERRUPT                 0x48
62 #define BCM2836_HDMI1_INTERRUPT                 0x49
63 #define BCM2836_PV2_INTERRUPT                   0x4A
64 #define BCM2836_PV0_INTERRUPT                   0x4D
65 #define BCM2836_PV1_INTERRUPT                   0x4E
66 #define BCM2836_MBOX_INTERRUPT                  0x41
67 #define BCM2836_VCHIQ_INTERRUPT                 0x42
68 #define BCM2386_GPIO_INTERRUPT0                 0x91
69 #define BCM2386_GPIO_INTERRUPT1                 0x92
70 #define BCM2386_GPIO_INTERRUPT2                 0x93
71 #define BCM2386_GPIO_INTERRUPT3                 0x94
72 #define BCM2836_I2C1_INTERRUPT                  0x95
73 #define BCM2836_I2C2_INTERRUPT                  0x95
74 #define BCM2836_SPI0_INTERRUPT                  0x96
75 #define BCM2836_USB_INTERRUPT                   0x69
76 #define BCM2836_SDHOST_INTERRUPT                0x98
77 #define BCM2836_MMCHS1_INTERRUPT                0x9E
78 #define BCM2836_MINI_UART_INTERRUPT             0x7D
79 #define BCM2836_PL011_UART_INTERRUPT            0x99
80 #define GENET_INTERRUPT0                        0xBD
81 #define GENET_INTERRUPT1                        0xBE
82 #define GENET_BASE_ADDRESS                      0xFD580000
83 #define GENET_LENGTH                            0x10000
84 #define THERM_SENSOR_BASE_ADDRESS               0xFD5d2200
85 #define THERM_SENSOR_LENGTH                     0x8
86 #else
87 #error "Unsupported rpi module for ACPI tables"
88 #endif
89 
90 #endif // __ACPITABLES_H__
91