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 == ' DSR' && *(RsdPtr + 1) == ' RTP' ) { //gcc multi-character character constant warning
\r
56 if ( *RsdPtr == 0x20445352 && *(RsdPtr + 1) == 0x20525450) {
\r
58 Rsdt = (UINT32*) (UINTN) ((RSDP*)RsdPtr)->RsdtAddress;
\r
62 } while ( RsdPtr <= (UINT32*) (UINTN)0xffff0 );
\r
63 if ( Rsdt != NULL && ACPI_GetTableChecksum (Rsdt) == 0 ) {
\r
64 for ( i = 0; i < (((DESCRIPTION_HEADER*)Rsdt)->Length - sizeof (DESCRIPTION_HEADER)) / 4; i++ ) {
\r
65 tableOffset = *(UINTN*) ((UINT8*)Rsdt + sizeof (DESCRIPTION_HEADER) + i * 4);
\r
66 CurrentTable = (DESCRIPTION_HEADER*)tableOffset;
\r
67 if ( CurrentTable->Signature == Signature ) {
\r
68 return CurrentTable;
\r
77 // Routine Description:
\r
79 // Update table checksum
\r
83 // TablePtr - table pointer
\r
91 ACPI_SetTableChecksum (
\r
97 ((DESCRIPTION_HEADER*)TablePtr)->Checksum = 0;
\r
98 Checksum = ACPI_GetTableChecksum (TablePtr);
\r
99 ((DESCRIPTION_HEADER*)TablePtr)->Checksum = (UINT8)(0x100 - Checksum);
\r
104 // Routine Description:
\r
106 // Get table checksum
\r
110 // TablePtr - table pointer
\r
118 ACPI_GetTableChecksum (
\r
122 return GetByteSum (TablePtr, ((DESCRIPTION_HEADER*)TablePtr)->Length);
\r
135 for ( i = 0; i < Length; i++ ) {
\r
136 Checksum = Checksum + (*((UINT8*)pData + i));
\r
141 GetSbAcpiMmioBase (
\r
142 OUT UINT32* AcpiMmioBase
\r
147 ReadPMIO (SB_PMIOA_REG24 + 2, AccWidthUint16, &Value16);
\r
148 *AcpiMmioBase = Value16 << 16;
\r
153 OUT UINT16* AcpiPmBase
\r
156 ReadPMIO (SB_PMIOA_REG60, AccWidthUint16, AcpiPmBase);
\r