hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/**
*
*  Copyright (C) 2018, Marvell International Ltd. and its affiliates
*
*  SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#ifndef __ARMADA_BOARD_DESC_LIB_H__
#define __ARMADA_BOARD_DESC_LIB_H__
 
#include <Library/ArmadaSoCDescLib.h>
#include <Library/MvGpioLib.h>
 
//
// General purpose routine for per-board initalization
//
EFI_STATUS
EFIAPI
ArmadaBoardInit (
  VOID
  );
 
//
// COMPHY controllers per-board description
//
typedef struct {
  MV_SOC_COMPHY_DESC *SoC;
  UINTN               ComPhyDevCount;
} MV_BOARD_COMPHY_DESC;
 
//
// GPIO devices per-board description
//
typedef struct {
  UINTN ChipId;
  UINTN I2cAddress;
  UINTN I2cBus;
} MV_GPIO_EXPANDER;
 
typedef struct {
  GPIO_CONTROLLER  *SoCGpio;
  UINTN             GpioDeviceCount;
  MV_GPIO_EXPANDER *GpioExpanders;
  UINTN             GpioExpanderCount;
} MV_BOARD_GPIO_DESCRIPTION;
 
EFI_STATUS
EFIAPI
ArmadaBoardGpioExpanderGet (
  IN OUT MV_GPIO_EXPANDER **GpioExpanders,
  IN OUT UINTN             *GpioExpanderCount
  );
 
//
// I2C devices per-board description
//
typedef struct {
  MV_SOC_I2C_DESC *SoC;
  UINTN            I2cDevCount;
} MV_BOARD_I2C_DESC;
 
//
// MDIO devices per-board description
//
typedef struct {
  MV_SOC_MDIO_DESC *SoC;
  UINTN             MdioDevCount;
} MV_BOARD_MDIO_DESC;
 
//
// NonDiscoverableDevices per-board description
//
 
//
// AHCI devices per-board description
//
typedef struct {
  MV_SOC_AHCI_DESC *SoC;
  UINTN             AhciDevCount;
} MV_BOARD_AHCI_DESC;
 
//
// SDMMC devices per-board description
//
typedef enum {
  RemovableSlot,
  EmbeddedSlot,
  SharedBusSlot,
  UnknownSlot
} MV_SDMMC_SLOT_TYPE;
 
typedef struct {
  MV_SOC_SDMMC_DESC *SoC;
  UINTN    SdMmcDevCount;
  BOOLEAN  Xenon1v8Enabled;
  BOOLEAN  Xenon8BitBusEnabled;
  BOOLEAN  XenonSlowModeEnabled;
  UINT8    XenonTuningStepDivisor;
  MV_SDMMC_SLOT_TYPE SlotType;
} MV_BOARD_SDMMC_DESC;
 
EFI_STATUS
EFIAPI
ArmadaBoardDescSdMmcGet (
  OUT UINTN               *SdMmcDevCount,
  OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
  );
 
//
// XHCI devices per-board description
//
typedef struct {
  MV_SOC_XHCI_DESC *SoC;
  UINTN             XhciDevCount;
} MV_BOARD_XHCI_DESC;
 
//
// PCIE controllers description
//
typedef struct {
  EFI_PHYSICAL_ADDRESS PcieDbiAddress;
  EFI_PHYSICAL_ADDRESS ConfigSpaceAddress;
  UINT64 ConfigSpaceSize;
  BOOLEAN HaveResetGpio;
  MV_GPIO_PIN PcieResetGpio;
  UINT64 PcieBusMin;
  UINT64 PcieBusMax;
  UINT64 PcieIoTranslation;
  UINT64 PcieIoWinBase;
  UINT64 PcieIoWinSize;
  UINT64 PcieMmio32Translation;
  UINT64 PcieMmio32WinBase;
  UINT64 PcieMmio32WinSize;
  UINT64 PcieMmio64Translation;
  UINT64 PcieMmio64WinBase;
  UINT64 PcieMmio64WinSize;
} MV_PCIE_CONTROLLER;
 
typedef struct {
  MV_PCIE_CONTROLLER CONST *PcieControllers;
  UINTN                     PcieControllerCount;
} MV_BOARD_PCIE_DESCRIPTION;
 
/**
  Return the number and description of PCIE controllers used on the platform.
 
  @param[in out] **PcieControllers      Array containing PCIE controllers'
                                        description.
  @param[in out]  *PcieControllerCount  Amount of used PCIE controllers.
 
  @retval EFI_SUCCESS                   The data were obtained successfully.
  @retval EFI_NOT_FOUND                 None of the controllers is used.
  @retval other                         Return error status.
 
**/
EFI_STATUS
EFIAPI
ArmadaBoardPcieControllerGet (
  IN OUT MV_PCIE_CONTROLLER CONST **PcieControllers,
  IN OUT UINTN                     *PcieControllerCount
  );
 
//
// PP2 NIC devices per-board description
//
typedef struct {
  MV_SOC_PP2_DESC *SoC;
  UINT8            Pp2DevCount;
} MV_BOARD_PP2_DESC;
 
//
// UTMI PHY devices per-board description
//
typedef struct {
  MV_SOC_UTMI_DESC *SoC;
  UINTN             UtmiDevCount;
  UINTN             UtmiPortType;
} MV_BOARD_UTMI_DESC;
#endif /* __ARMADA_SOC_DESC_LIB_H__ */