Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenhwacpi.c
Go to the documentation of this file.
00001 /* 00002 * FreeLoader 00003 * 00004 * Copyright (C) 2004 Eric Kohl 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #include <freeldr.h> 00022 #include <debug.h> 00023 00024 DBG_DEFAULT_CHANNEL(HWDETECT); 00025 00026 BOOLEAN AcpiPresent = FALSE; 00027 00028 static PRSDP_DESCRIPTOR 00029 FindAcpiBios(VOID) 00030 { 00031 PUCHAR Ptr; 00032 00033 /* Find the 'Root System Descriptor Table Pointer' */ 00034 Ptr = (PUCHAR)0xE0000; 00035 while ((ULONG_PTR)Ptr < 0x100000) 00036 { 00037 if (!memcmp(Ptr, "RSD PTR ", 8)) 00038 { 00039 TRACE("ACPI supported\n"); 00040 00041 return (PRSDP_DESCRIPTOR)Ptr; 00042 } 00043 00044 Ptr = (PUCHAR)((ULONG_PTR)Ptr + 0x10); 00045 } 00046 00047 TRACE("ACPI not supported\n"); 00048 00049 return NULL; 00050 } 00051 00052 00053 VOID 00054 DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) 00055 { 00056 PCONFIGURATION_COMPONENT_DATA BiosKey; 00057 PCM_PARTIAL_RESOURCE_LIST PartialResourceList; 00058 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; 00059 PRSDP_DESCRIPTOR Rsdp; 00060 PACPI_BIOS_DATA AcpiBiosData; 00061 ULONG TableSize; 00062 00063 Rsdp = FindAcpiBios(); 00064 00065 if (Rsdp) 00066 { 00067 /* Set up the flag in the loader block */ 00068 AcpiPresent = TRUE; 00069 00070 /* Calculate the table size */ 00071 TableSize = PcBiosMapCount * sizeof(BIOS_MEMORY_MAP) + 00072 sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP); 00073 00074 /* Set 'Configuration Data' value */ 00075 PartialResourceList = 00076 MmHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize); 00077 00078 if (PartialResourceList == NULL) 00079 { 00080 ERR("Failed to allocate resource descriptor\n"); 00081 return; 00082 } 00083 00084 memset(PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize); 00085 PartialResourceList->Version = 0; 00086 PartialResourceList->Revision = 0; 00087 PartialResourceList->Count = 1; 00088 00089 PartialDescriptor = &PartialResourceList->PartialDescriptors[0]; 00090 PartialDescriptor->Type = CmResourceTypeDeviceSpecific; 00091 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined; 00092 PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize; 00093 00094 /* Fill the table */ 00095 AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1]; 00096 AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address; 00097 AcpiBiosData->Count = PcBiosMapCount; 00098 memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap, 00099 PcBiosMapCount * sizeof(BIOS_MEMORY_MAP)); 00100 00101 TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address, 00102 TableSize); 00103 00104 /* Create new bus key */ 00105 FldrCreateComponentKey(SystemKey, 00106 AdapterClass, 00107 MultiFunctionAdapter, 00108 0x0, 00109 0x0, 00110 0xFFFFFFFF, 00111 "ACPI BIOS", 00112 PartialResourceList, 00113 sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize, 00114 &BiosKey); 00115 00116 /* Increment bus number */ 00117 (*BusNumber)++; 00118 00119 MmHeapFree(PartialResourceList); 00120 } 00121 } 00122 00123 /* EOF */ Generated on Sun May 27 2012 04:19:08 for ReactOS by
1.7.6.1
|