2 *****************************************************************************
\r
4 * This file is part of the coreboot project.
\r
6 * Copyright (C) 2010 Advanced Micro Devices, Inc.
\r
8 * This program is free software; you can redistribute it and/or modify
\r
9 * it under the terms of the GNU General Public License as published by
\r
10 * the Free Software Foundation; version 2 of the License.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program; if not, write to the Free Software
\r
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
20 * ***************************************************************************
\r
24 #include "SBPLATFORM.h"
\r
28 // Routine Description:
\r
30 // Locate ACPI table
\r
34 // Signature - table signature
\r
38 // pointer to ACPI table
\r
50 DESCRIPTION_HEADER* CurrentTable;
\r
52 RsdPtr = (UINT32*) (UINTN)0xe0000;
\r
55 if ( *RsdPtr == Int32FromChar('R', 'S', 'D', ' ') && *(RsdPtr + 1) == Int32FromChar('P', 'T', 'R', ' ')) {
\r
56 Rsdt = (UINT32*) (UINTN) ((RSDP*)RsdPtr)->RsdtAddress;
\r
60 } while ( RsdPtr <= (UINT32*) (UINTN)0xffff0 );
\r
61 if ( Rsdt != NULL && ACPI_GetTableChecksum (Rsdt) == 0 ) {
\r
62 for ( i = 0; i < (((DESCRIPTION_HEADER*)Rsdt)->Length - sizeof (DESCRIPTION_HEADER)) / 4; i++ ) {
\r
63 tableOffset = *(UINTN*) ((UINT8*)Rsdt + sizeof (DESCRIPTION_HEADER) + i * 4);
\r
64 CurrentTable = (DESCRIPTION_HEADER*)tableOffset;
\r
65 if ( CurrentTable->Signature == Signature ) {
\r
66 return CurrentTable;
\r
75 // Routine Description:
\r
77 // Update table checksum
\r
81 // TablePtr - table pointer
\r
89 ACPI_SetTableChecksum (
\r
95 ((DESCRIPTION_HEADER*)TablePtr)->Checksum = 0;
\r
96 Checksum = ACPI_GetTableChecksum (TablePtr);
\r
97 ((DESCRIPTION_HEADER*)TablePtr)->Checksum = (UINT8)(0x100 - Checksum);
\r
102 // Routine Description:
\r
104 // Get table checksum
\r
108 // TablePtr - table pointer
\r
116 ACPI_GetTableChecksum (
\r
120 return GetByteSum (TablePtr, ((DESCRIPTION_HEADER*)TablePtr)->Length);
\r
133 for ( i = 0; i < Length; i++ ) {
\r
134 Checksum = Checksum + (*((UINT8*)pData + i));
\r
139 GetSbAcpiMmioBase (
\r
140 OUT UINT32* AcpiMmioBase
\r
145 ReadPMIO (SB_PMIOA_REG24 + 2, AccWidthUint16, &Value16);
\r
146 *AcpiMmioBase = Value16 << 16;
\r
151 OUT UINT16* AcpiPmBase
\r
154 ReadPMIO (SB_PMIOA_REG60, AccWidthUint16, AcpiPmBase);
\r