7 * Provides Services similar to the external General Services API, except
8 * suited to use within AGESA components. Socket, Core and PCI identification.
10 * @xrefitem bom "File Content Label" "Release Content"
12 * @e sub-project: Common
13 * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 02:16:51 -0700 (Wed, 22 Dec 2010) $
17 ******************************************************************************
19 * Copyright (C) 2012 Advanced Micro Devices, Inc.
20 * All rights reserved.
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions are met:
24 * * Redistributions of source code must retain the above copyright
25 * notice, this list of conditions and the following disclaimer.
26 * * Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in the
28 * documentation and/or other materials provided with the distribution.
29 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
30 * its contributors may be used to endorse or promote products derived
31 * from this software without specific prior written permission.
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36 * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
37 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
40 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 ******************************************************************************
47 #ifndef _GENERAL_SERVICES_H_
48 #define _GENERAL_SERVICES_H_
50 /*----------------------------------------------------------------------------------------
51 * M I X E D (Definitions And Macros / Typedefs, Structures, Enums)
52 *----------------------------------------------------------------------------------------
55 /*----------------------------------------------------------------------------------------
56 * D E F I N I T I O N S A N D M A C R O S
57 *----------------------------------------------------------------------------------------
59 #define NUMBER_OF_EVENT_DATA_PARAMS 4
62 * AMD Device id for MMIO check.
64 #define AMD_DEV_VEN_ID 0x1022
65 #define AMD_DEV_VEN_ID_ADDRESS 0
67 /*----------------------------------------------------------------------------------------
68 * T Y P E D E F S, S T R U C T U R E S, E N U M S
69 *----------------------------------------------------------------------------------------
73 * An AGESA Event Log entry.
76 AGESA_STATUS EventClass; ///< The severity of the event, its associated AGESA_STATUS.
77 UINT32 EventInfo; ///< Uniquely identifies the event.
78 UINT32 DataParam1; ///< Event specific additional data
79 UINT32 DataParam2; ///< Event specific additional data
80 UINT32 DataParam3; ///< Event specific additional data
81 UINT32 DataParam4; ///< Event specific additional data
84 /*----------------------------------------------------------------------------------------
85 * F U N C T I O N P R O T O T Y P E
86 *----------------------------------------------------------------------------------------
90 * Get a specified Core's APIC ID.
92 * @param[in] StdHeader Header for library and services.
93 * @param[in] Socket The Core's Socket.
94 * @param[in] Core The Core id.
95 * @param[out] ApicAddress The Core's APIC ID.
96 * @param[out] AgesaStatus Aggregates AGESA_STATUS for external interface, Always Succeeds.
98 * @retval TRUE The core is present, APIC Id valid
99 * @retval FALSE The core is not present, APIC Id not valid.
103 IN AMD_CONFIG_PARAMS *StdHeader,
106 OUT UINT8 *ApicAddress,
107 OUT AGESA_STATUS *AgesaStatus
111 * Get Processor Module's PCI Config Space address.
113 * @param[in] StdHeader Header for library and services.
114 * @param[in] Socket The Core's Socket.
115 * @param[in] Module The Module in that Processor
116 * @param[out] PciAddress The Processor's PCI Config Space address (Function 0, Register 0)
117 * @param[out] AgesaStatus Aggregates AGESA_STATUS for external interface, Always Succeeds.
119 * @retval TRUE The core is present, PCI Address valid
120 * @retval FALSE The core is not present, PCI Address not valid.
124 IN AMD_CONFIG_PARAMS *StdHeader,
127 OUT PCI_ADDR *PciAddress,
128 OUT AGESA_STATUS *AgesaStatus
132 * "Who am I" for the current running core.
134 * @param[in] StdHeader Header for library and services.
135 * @param[out] Socket The current Core's Socket
136 * @param[out] Module The current Core's Processor Module
137 * @param[out] Core The current Core's core id.
138 * @param[out] AgesaStatus Aggregates AGESA_STATUS for external interface, Always Succeeds.
143 IN AMD_CONFIG_PARAMS *StdHeader,
147 OUT AGESA_STATUS *AgesaStatus
151 * A boolean function determine executed CPU is BSP core.
155 IN OUT AMD_CONFIG_PARAMS *StdHeader,
156 OUT AGESA_STATUS *AgesaStatus
160 * This function logs AGESA events into the event log.
164 IN AGESA_STATUS EventClass,
166 IN UINT32 DataParam1,
167 IN UINT32 DataParam2,
168 IN UINT32 DataParam3,
169 IN UINT32 DataParam4,
170 IN AMD_CONFIG_PARAMS *StdHeader
174 * This function gets event logs from the circular buffer.
178 OUT AGESA_EVENT *EventRecord,
179 IN AMD_CONFIG_PARAMS *StdHeader
183 * This function gets event logs from the circular buffer without flushing the entry.
187 OUT AGESA_EVENT *EventRecord,
189 IN AMD_CONFIG_PARAMS *StdHeader
192 /*---------------------------------------------------------------------------------------*/
194 * This routine programs the registers necessary to get the PCI MMIO mechanism
195 * up and functioning.
199 IN AMD_CONFIG_PARAMS *StdHeader
202 #endif // _GENERAL_SERVICES_H_