Author: fireball
Date: Wed Jun 27 00:46:34 2007
New Revision: 27284
URL:
http://svn.reactos.org/svn/reactos?rev=27284&view=rev
Log:
- Do some "hardware detection" for OLPC (so the kernel doesn't crash with
CONFIG_INITIALIZATION_FAILED bugcheck).
Added:
branches/olpc/boot/freeldr/freeldr/arch/i386/olpchw.c (with props)
Modified:
branches/olpc/boot/freeldr/freeldr/arch/i386/hwpci.c
branches/olpc/boot/freeldr/freeldr/arch/i386/macholpc.c
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/hwpci.c
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/hwpci.c (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/hwpci.c Wed Jun 27 00:46:34 2007
@@ -139,7 +139,7 @@
}
-static VOID
+VOID
DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/macholpc.c
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/macholpc.c (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/macholpc.c Wed Jun 27 00:46:34 2007
@@ -287,11 +287,6 @@
return 1;
}
-VOID OlpcHwDetect()
-{
- ofwprintf("OlpcHwDetect\n");
-}
-
/* Strategy:
*
* For now, it'll be easy enough to use the boot command line as our boot path.
Added: branches/olpc/boot/freeldr/freeldr/arch/i386/olpchw.c
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/olpchw.c (added)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/olpchw.c Wed Jun 27 00:46:34 2007
@@ -1,0 +1,142 @@
+/* $Id: olpchw.c 21339 2006-03-18 22:09:16Z peterw $
+ *
+ * FreeLoader
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <freeldr.h>
+
+#define NDEBUG
+#include <debug.h>
+
+VOID
+DetectPciIrqRoutingTable(FRLDRHKEY BusKey);
+
+VOID
+OlpcDetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
+{
+ PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
+ WCHAR Buffer[80];
+ FRLDRHKEY BiosKey;
+ ULONG Size;
+ LONG Error;
+
+ /* Report the PCI BIOS */
+ if (TRUE/*FindPciBios(&BusData)*/)
+ {
+ /* Create new bus key */
+ swprintf(Buffer,
+ L"MultifunctionAdapter\\%u", *BusNumber);
+ Error = RegCreateKey(SystemKey,
+ Buffer,
+ &BiosKey);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
+ return;
+ }
+
+ /* Set 'Component Information' */
+ SetComponentInformation(BiosKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
+
+ /* Increment bus number */
+ (*BusNumber)++;
+
+ /* Set 'Identifier' value */
+ Error = RegSetValue(BiosKey,
+ L"Identifier",
+ REG_SZ,
+ (PCHAR)L"PCI BIOS",
+ 9 * sizeof(WCHAR));
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
+ return;
+ }
+
+ /* Set 'Configuration Data' value */
+ Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+ FullResourceDescriptor = MmAllocateMemory(Size);
+ if (FullResourceDescriptor == NULL)
+ {
+ DbgPrint((DPRINT_HWDETECT,
+ "Failed to allocate resource descriptor\n"));
+ return;
+ }
+
+ /* Initialize resource descriptor */
+ memset(FullResourceDescriptor, 0, Size);
+ FullResourceDescriptor->InterfaceType = PCIBus;
+ FullResourceDescriptor->BusNumber = 0;
+ FullResourceDescriptor->PartialResourceList.Version = 1;
+ FullResourceDescriptor->PartialResourceList.Revision = 1;
+ FullResourceDescriptor->PartialResourceList.Count = 1;
+ FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type =
CmResourceTypeBusNumber;
+
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition =
CmResourceShareDeviceExclusive;
+
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Start =
0;
+
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Length =
1;
+
+ /* Set 'Configuration Data' value */
+ Error = RegSetValue(BiosKey,
+ L"Configuration Data",
+ REG_FULL_RESOURCE_DESCRIPTOR,
+ (PCHAR) FullResourceDescriptor,
+ Size);
+ MmFreeMemory(FullResourceDescriptor);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT,
+ "RegSetValue(Configuration Data) failed (Error %u)\n",
+ (int)Error));
+ return;
+ }
+
+ DetectPciIrqRoutingTable(BiosKey);
+ }
+}
+
+
+
+VOID OlpcHwDetect()
+{
+ FRLDRHKEY SystemKey;
+ ULONG BusNumber = 0;
+ LONG Error;
+
+ ofwprintf("OlpcHwDetect()\n");
+
+ /* Create the 'System' key */
+ Error = RegCreateKey(NULL,
+ L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
+ &SystemKey);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
+ return;
+ }
+
+ /* Detect buses */
+ OlpcDetectPciBios(SystemKey, &BusNumber);
+ //DetectApmBios(SystemKey, &BusNumber);
+ //DetectPnpBios(SystemKey, &BusNumber);
+ //DetectIsaBios(SystemKey, &BusNumber);
+ //DetectAcpiBios(SystemKey, &BusNumber);
+
+ ofwprintf("DetectHardware() Done\n");
+}
Propchange: branches/olpc/boot/freeldr/freeldr/arch/i386/olpchw.c
------------------------------------------------------------------------------
svn:eol-style = native