- Fixed some compiler warnings.

- Detect and report PCI-BIOS.

svn path=/trunk/; revision=10742
This commit is contained in:
Eric Kohl 2004-08-30 10:53:38 +00:00
parent 3dd13e9ba0
commit 6277a93862
11 changed files with 592 additions and 230 deletions

View file

@ -1,3 +1,8 @@
Changes in v1.8.23 (30/08/2004) (ekohl)
- Fixed some compiler warnings.
- Detect and report PCI-BIOS.
Changes in v1.8.22 (21/05/2004) (navaraf) Changes in v1.8.22 (21/05/2004) (navaraf)
- Fixed lots of bugs in NTFS code and added correct update sequence - Fixed lots of bugs in NTFS code and added correct update sequence

View file

@ -188,24 +188,25 @@ endif
# fathelp.o must come first in the link line because it contains bootsector helper code # fathelp.o must come first in the link line because it contains bootsector helper code
# arch.o must come second in the link line because it contains the startup code # arch.o must come second in the link line because it contains the startup code
ARCH_OBJS = fathelp.o \ ARCH_OBJS = fathelp.o \
arch.o \ arch.o \
i386idt.o \ i386idt.o \
i386trap.o \ i386trap.o \
i386cpu.o \ i386cpu.o \
i386pnp.o \ i386pnp.o \
boot.o \ boot.o \
linux.o \ linux.o \
mb.o \ mb.o \
i386mem.o \ i386mem.o \
i386rtl.o \ i386rtl.o \
i386vid.o \ i386vid.o \
drvmap.o \ drvmap.o \
int386.o \ int386.o \
i386disk.o \ i386disk.o \
portio.o \ portio.o \
hardware.o \ hardware.o \
hwcpu.o \ hwcpu.o \
_alloca.o # For Mingw32 builds hwpci.o \
_alloca.o # For Mingw32 builds
RTL_OBJS = print.o \ RTL_OBJS = print.o \

View file

@ -374,6 +374,12 @@ DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
/* Increment bus number */ /* Increment bus number */
(*BusNumber)++; (*BusNumber)++;
/* Set 'Component Information' value similar to my NT4 box */
SetComponentInformation(BusKey,
0x0,
0x0,
0xFFFFFFFF);
/* Set 'Identifier' value */ /* Set 'Identifier' value */
Error = RegSetValue(BusKey, Error = RegSetValue(BusKey,
"Identifier", "Identifier",
@ -1334,9 +1340,10 @@ DetectSerialPorts(HKEY BusKey)
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PCM_SERIAL_DEVICE_DATA SerialDeviceData; PCM_SERIAL_DEVICE_DATA SerialDeviceData;
U32 Base[4] = {0x3F8, 0x2F8, 0x3E8, 0x2E8};
U32 Irq[4] = {4, 3, 4, 3}; U32 Irq[4] = {4, 3, 4, 3};
U32 Base;
char Buffer[80]; char Buffer[80];
PU16 BasePtr;
U32 ControllerNumber = 0; U32 ControllerNumber = 0;
HKEY ControllerKey; HKEY ControllerKey;
U32 i; U32 i;
@ -1345,122 +1352,124 @@ DetectSerialPorts(HKEY BusKey)
DbgPrint((DPRINT_HWDETECT, "DetectSerialPorts()\n")); DbgPrint((DPRINT_HWDETECT, "DetectSerialPorts()\n"));
for (i = 0; i < 4; i++) ControllerNumber = 0;
BasePtr = (PU16)0x400;
for (i = 0; i < 4; i++, BasePtr++)
{ {
WRITE_PORT_UCHAR ((PUCHAR)(Base[i] + 4), 0x10); Base = (U32)*BasePtr;
if (!(READ_PORT_UCHAR((PUCHAR)Base[i] + 6) & 0xf0)) if (Base == 0)
continue;
DbgPrint((DPRINT_HWDETECT,
"Found COM%u port at 0x%x\n",
i + 1,
Base));
/* Create controller key */
sprintf(Buffer,
"SerialController\\%u",
ControllerNumber);
Error = RegCreateKey(BusKey,
Buffer,
&ControllerKey);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
continue;
}
DbgPrint((DPRINT_HWDETECT, "Created key: %s\n", Buffer));
/* Set 'ComponentInformation' value */
SetComponentInformation(ControllerKey,
0x78,
ControllerNumber,
0xFFFFFFFF);
/* Build full device descriptor */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
sizeof(CM_SERIAL_DEVICE_DATA);
FullResourceDescriptor = MmAllocateMemory(Size);
if (FullResourceDescriptor == NULL)
{ {
DbgPrint((DPRINT_HWDETECT, DbgPrint((DPRINT_HWDETECT,
"Found COM%u port at 0x%x\n", "Failed to allocate resource descriptor\n"));
i + 1, continue;
Base[i]));
/* Create controller key */
sprintf(Buffer,
"SerialController\\%u",
ControllerNumber);
Error = RegCreateKey(BusKey,
Buffer,
&ControllerKey);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
continue;
}
DbgPrint((DPRINT_HWDETECT, "Created key: %s\n", Buffer));
/* Set 'ComponentInformation' value */
SetComponentInformation(ControllerKey,
0x78,
ControllerNumber,
0xFFFFFFFF);
/* Build full device descriptor */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
sizeof(CM_SERIAL_DEVICE_DATA);
FullResourceDescriptor = MmAllocateMemory(Size);
if (FullResourceDescriptor == NULL)
{
DbgPrint((DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n"));
continue;
}
memset(FullResourceDescriptor, 0, Size);
/* Initialize resource descriptor */
FullResourceDescriptor->InterfaceType = Isa;
FullResourceDescriptor->BusNumber = 0;
FullResourceDescriptor->PartialResourceList.Count = 3;
/* Set IO Port */
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[0];
PartialDescriptor->Type = CmResourceTypePort;
PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
PartialDescriptor->u.Port.Start = (U64)Base[i];
PartialDescriptor->u.Port.Length = 7;
/* Set Interrupt */
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[1];
PartialDescriptor->Type = CmResourceTypeInterrupt;
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
PartialDescriptor->u.Interrupt.Level = Irq[i];
PartialDescriptor->u.Interrupt.Vector = Irq[i];
PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
/* Set serial data (device specific) */
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[2];
PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->Flags = 0;
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
SerialDeviceData =
(PCM_SERIAL_DEVICE_DATA)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[3];
SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PU8) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
"RegSetValue(Configuration Data) failed (Error %u)\n",
(int)Error));
}
/* Set 'Identifier' value */
sprintf(Buffer,
"COM%u",
i + 1);
Error = RegSetValue(ControllerKey,
"Identifier",
REG_SZ,
(PU8)Buffer,
strlen(Buffer) + 1);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
"RegSetValue() failed (Error %u)\n",
(int)Error));
continue;
}
DbgPrint((DPRINT_HWDETECT,
"Created value: Identifier %s\n",
Buffer));
/* Detect serial mouse */
DetectSerialPointerPeripheral(ControllerKey, Base[i]);
ControllerNumber++;
} }
memset(FullResourceDescriptor, 0, Size);
/* Initialize resource descriptor */
FullResourceDescriptor->InterfaceType = Isa;
FullResourceDescriptor->BusNumber = 0;
FullResourceDescriptor->PartialResourceList.Count = 3;
/* Set IO Port */
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[0];
PartialDescriptor->Type = CmResourceTypePort;
PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
PartialDescriptor->u.Port.Start = (U64)Base;
PartialDescriptor->u.Port.Length = 7;
/* Set Interrupt */
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[1];
PartialDescriptor->Type = CmResourceTypeInterrupt;
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
PartialDescriptor->u.Interrupt.Level = Irq[i];
PartialDescriptor->u.Interrupt.Vector = Irq[i];
PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
/* Set serial data (device specific) */
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[2];
PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->Flags = 0;
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
SerialDeviceData =
(PCM_SERIAL_DEVICE_DATA)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[3];
SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PU8) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
"RegSetValue(Configuration Data) failed (Error %u)\n",
(int)Error));
}
/* Set 'Identifier' value */
sprintf(Buffer,
"COM%u",
i + 1);
Error = RegSetValue(ControllerKey,
"Identifier",
REG_SZ,
(PU8)Buffer,
strlen(Buffer) + 1);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
"RegSetValue() failed (Error %u)\n",
(int)Error));
continue;
}
DbgPrint((DPRINT_HWDETECT,
"Created value: Identifier %s\n",
Buffer));
/* Detect serial mouse */
DetectSerialPointerPeripheral(ControllerKey, Base);
ControllerNumber++;
} }
} }
@ -1474,6 +1483,7 @@ DetectParallelPorts(HKEY BusKey)
char Buffer[80]; char Buffer[80];
HKEY ControllerKey; HKEY ControllerKey;
PU16 BasePtr; PU16 BasePtr;
U32 Base;
U32 ControllerNumber; U32 ControllerNumber;
U32 i; U32 i;
S32 Error; S32 Error;
@ -1485,13 +1495,14 @@ DetectParallelPorts(HKEY BusKey)
BasePtr = (PU16)0x408; BasePtr = (PU16)0x408;
for (i = 0; i < 3; i++, BasePtr++) for (i = 0; i < 3; i++, BasePtr++)
{ {
if (*BasePtr == 0) Base = (U32)*BasePtr;
if (Base == 0)
continue; continue;
DbgPrint((DPRINT_HWDETECT, DbgPrint((DPRINT_HWDETECT,
"Parallel port %u: %x\n", "Parallel port %u: %x\n",
ControllerNumber, ControllerNumber,
*BasePtr)); Base));
/* Create controller key */ /* Create controller key */
sprintf(Buffer, sprintf(Buffer,
@ -1510,7 +1521,7 @@ DetectParallelPorts(HKEY BusKey)
/* Set 'ComponentInformation' value */ /* Set 'ComponentInformation' value */
SetComponentInformation(ControllerKey, SetComponentInformation(ControllerKey,
0x78, /* FIXME */ 0x40,
ControllerNumber, ControllerNumber,
0xFFFFFFFF); 0xFFFFFFFF);
@ -1538,7 +1549,7 @@ DetectParallelPorts(HKEY BusKey)
PartialDescriptor->Type = CmResourceTypePort; PartialDescriptor->Type = CmResourceTypePort;
PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive; PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
PartialDescriptor->Flags = CM_RESOURCE_PORT_IO; PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
PartialDescriptor->u.Port.Start = (U64)*BasePtr; PartialDescriptor->u.Port.Start = (U64)Base;
PartialDescriptor->u.Port.Length = 3; PartialDescriptor->u.Port.Length = 3;
/* Set Interrupt */ /* Set Interrupt */
@ -2245,8 +2256,8 @@ DetectHardware(VOID)
DetectCPUs(SystemKey); DetectCPUs(SystemKey);
/* Detect buses */ /* Detect buses */
DetectPciBios(SystemKey, &BusNumber);
#if 0 #if 0
DetectPciBios(&BusNumber);
DetectApmBios(&BusNumber); DetectApmBios(&BusNumber);
#endif #endif
DetectPnpBios(SystemKey, &BusNumber); DetectPnpBios(SystemKey, &BusNumber);

View file

@ -163,6 +163,9 @@ VOID SetComponentInformation(HKEY ComponentKey,
/* hwcpu.c */ /* hwcpu.c */
VOID DetectCPUs(HKEY SystemKey); VOID DetectCPUs(HKEY SystemKey);
/* hwpci.c */
VOID DetectPciBios(HKEY SystemKey, U32 *BusNumber);
/* i386cpu.S */ /* i386cpu.S */
U32 CpuidSupported(VOID); U32 CpuidSupported(VOID);
VOID GetCpuid(U32 Level, VOID GetCpuid(U32 Level,

View file

@ -0,0 +1,366 @@
/*
* FreeLoader
*
* Copyright (C) 2004 Eric Kohl
*
* 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>
#include <arch.h>
#include <rtl.h>
#include <debug.h>
#include <mm.h>
#include <portio.h>
#include "../../reactos/registry.h"
#include "hardware.h"
typedef struct _ROUTING_SLOT
{
U8 BusNumber;
U8 DeviceNumber;
U8 LinkA;
U16 BitmapA;
U8 LinkB;
U16 BitmapB;
U8 LinkC;
U16 BitmapC;
U8 LinkD;
U16 BitmapD;
U8 SlotNumber;
U8 Reserved;
} __attribute__((packed)) ROUTING_SLOT, *PROUTING_SLOT;
typedef struct _PCI_IRQ_ROUTING_TABLE
{
U32 Signature;
U16 Version;
U16 Size;
U8 RouterBus;
U8 RouterSlot;
U16 ExclusiveIRQs;
U32 CompatibleRouter;
U32 MiniportData;
U8 Reserved[11];
U8 Checksum;
ROUTING_SLOT Slot[1];
} __attribute__((packed)) PCI_IRQ_ROUTING_TABLE, *PPCI_IRQ_ROUTING_TABLE;
typedef struct _CM_PCI_BUS_DATA
{
U8 BusCount;
U16 PciVersion;
U8 HardwareMechanism;
} __attribute__((packed)) CM_PCI_BUS_DATA, *PCM_PCI_BUS_DATA;
static PPCI_IRQ_ROUTING_TABLE
GetPciIrqRoutingTable(VOID)
{
PPCI_IRQ_ROUTING_TABLE Table;
PU8 Ptr;
U32 Sum;
U32 i;
Table = (PPCI_IRQ_ROUTING_TABLE)0xF0000;
while ((U32)Table < 0x100000)
{
if (Table->Signature == 0x52495024)
{
DbgPrint((DPRINT_HWDETECT,
"Found signature\n"));
Ptr = (PU8)Table;
Sum = 0;
for (i = 0; i < Table->Size; i++)
{
Sum += Ptr[i];
}
if ((Sum & 0xFF) != 0)
{
DbgPrint((DPRINT_HWDETECT,
"Invalid routing table\n"));
return NULL;
}
DbgPrint((DPRINT_HWDETECT,
"Valid checksum\n"));
return Table;
}
Table = (PPCI_IRQ_ROUTING_TABLE)((U32)Table + 0x10);
}
return NULL;
}
static BOOL
FindPciBios(PCM_PCI_BUS_DATA BusData)
{
REGS RegsIn;
REGS RegsOut;
RegsIn.b.ah = 0xB1; /* Subfunction B1h */
RegsIn.b.al = 0x01; /* PCI BIOS present */
Int386(0x1A, &RegsIn, &RegsOut);
if (INT386_SUCCESS(RegsOut) && RegsOut.d.edx == 0x20494350 && RegsOut.b.ah == 0)
{
// printf("Found PCI bios\n");
// printf("AL: %x\n", RegsOut.b.al);
// printf("BH: %x\n", RegsOut.b.bh);
// printf("BL: %x\n", RegsOut.b.bl);
// printf("CL: %x\n", RegsOut.b.cl);
BusData->BusCount = RegsOut.b.cl + 1;
BusData->PciVersion = RegsOut.w.bx;
BusData->HardwareMechanism = RegsOut.b.cl;
return TRUE;
}
// printf("No PCI bios found\n");
return FALSE;
}
static VOID
DetectPciIrqRoutingTable(HKEY BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PPCI_IRQ_ROUTING_TABLE Table;
HKEY TableKey;
U32 Size;
S32 Error;
Table = GetPciIrqRoutingTable();
if (Table != NULL)
{
DbgPrint((DPRINT_HWDETECT, "Table size: %u\n", Table->Size));
Error = RegCreateKey(BusKey,
"RealModeIrqRoutingTable\\0",
&TableKey);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
return;
}
/* Set 'Component Information' */
SetComponentInformation(TableKey,
0x0,
0x0,
0xFFFFFFFF);
/* Set 'Identifier' value */
Error = RegSetValue(TableKey,
"Identifier",
REG_SZ,
(PU8)"PCI Real-mode IRQ Routing Table",
32);
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) +
Table->Size;
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 = Isa;
FullResourceDescriptor->BusNumber = 0;
FullResourceDescriptor->PartialResourceList.Count = 1;
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[0];
PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->u.DeviceSpecificData.DataSize = Table->Size;
memcpy(((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR),
Table,
Table->Size);
/* Set 'Configuration Data' value */
Error = RegSetValue(TableKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PU8) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
"RegSetValue(Configuration Data) failed (Error %u)\n",
(int)Error));
return;
}
}
}
VOID
DetectPciBios(HKEY SystemKey, U32 *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
CM_PCI_BUS_DATA BusData;
char Buffer[80];
HKEY BiosKey;
U32 Size;
S32 Error;
#if 0
HKEY BusKey;
U32 i;
#endif
/* Report the PCI BIOS */
if (FindPciBios(&BusData))
{
/* Create new bus key */
sprintf(Buffer,
"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,
"Identifier",
REG_SZ,
(PU8)"PCI BIOS",
9);
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) -
sizeof(CM_PARTIAL_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 = Internal;
FullResourceDescriptor->BusNumber = 0;
FullResourceDescriptor->PartialResourceList.Count = 0;
/* Set 'Configuration Data' value */
Error = RegSetValue(BiosKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PU8) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
"RegSetValue(Configuration Data) failed (Error %u)\n",
(int)Error));
return;
}
DetectPciIrqRoutingTable(BiosKey);
#if 0
/*
* FIXME:
* Enabling this piece of code will corrupt the boot sequence!
* This is probably caused by a bug in the registry code!
*/
/* Report PCI buses */
for (i = 0; i < (U32)BusData.BusCount; i++)
{
sprintf(Buffer,
"MultifunctionAdapter\\%u", *BusNumber);
Error = RegCreateKey(SystemKey,
Buffer,
&BusKey);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
printf("RegCreateKey() failed (Error %u)\n", (int)Error);
return;
}
/* Set 'Component Information' */
SetComponentInformation(BusKey,
0x0,
0x0,
0xFFFFFFFF);
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
Error = RegSetValue(BusKey,
"Identifier",
REG_SZ,
(PU8)"PCI",
4);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
return;
}
}
#endif
}
}
/* EOF */

View file

@ -38,39 +38,39 @@ EXTERN(_CpuidSupported)
pushl %ecx /* save ECX */ pushl %ecx /* save ECX */
pushfl /* push original EFLAGS */ pushfl /* push original EFLAGS */
popl %eax /* get original EFLAGS */ popl %eax /* get original EFLAGS */
movl %eax,%ecx /* save original EFLAGS */ movl %eax,%ecx /* save original EFLAGS */
xorl $0x40000,%eax /* flip AC bit in EFLAGS */ xorl $0x40000,%eax /* flip AC bit in EFLAGS */
pushl %eax /* save new EFLAGS value on stack */ pushl %eax /* save new EFLAGS value on stack */
popfl /* replace current EFLAGS value */ popfl /* replace current EFLAGS value */
pushfl /* get new EFLAGS */ pushfl /* get new EFLAGS */
popl %eax /* store new EFLAGS in EAX */ popl %eax /* store new EFLAGS in EAX */
xorl %ecx, %eax /* can't toggle AC bit, processor=80386 */ xorl %ecx, %eax /* can't toggle AC bit, processor=80386 */
movl $0x300,%eax /* return processor id */ movl $0x300,%eax /* return processor id */
jz NoCpuid /* jump if 80386 processor */ jz NoCpuid /* jump if 80386 processor */
pushl %ecx pushl %ecx
popfl /* restore AC bit in EFLAGS first */ popfl /* restore AC bit in EFLAGS first */
movl %ecx,%eax /* get original EFLAGS */ movl %ecx,%eax /* get original EFLAGS */
xorl $0x200000,%eax /* flip ID bit in EFLAGS */ xorl $0x200000,%eax /* flip ID bit in EFLAGS */
pushl %eax /* save new EFLAGS value on stack */ pushl %eax /* save new EFLAGS value on stack */
popfl /* replace current EFLAGS value */ popfl /* replace current EFLAGS value */
pushfl /* get new EFLAGS */ pushfl /* get new EFLAGS */
popl %eax /* store new EFLAGS in EAX */ popl %eax /* store new EFLAGS in EAX */
xorl %ecx,%eax /* can't toggle ID bit, */ xorl %ecx,%eax /* can't toggle ID bit, */
movl $0x400,%eax /* return processor id */ movl $0x400,%eax /* return processor id */
je NoCpuid /* processor=80486 */ je NoCpuid /* processor=80486 */
movl $1,%eax /* CPUID supported */ movl $1,%eax /* CPUID supported */
NoCpuid: NoCpuid:
pushl %ecx pushl %ecx
popfl /* restore EFLAGS */ popfl /* restore EFLAGS */
popl %ecx /* retore ECX */ popl %ecx /* retore ECX */
ret ret
@ -97,16 +97,16 @@ EXTERN(_GetCpuid)
cpuid cpuid
movl 0x0C(%ebp),%esi movl 0x0C(%ebp),%esi
movl %eax, (%esi) movl %eax,(%esi)
movl 0x10(%ebp),%esi movl 0x10(%ebp),%esi
movl %ebx, (%esi) movl %ebx,(%esi)
movl 0x14(%ebp),%esi movl 0x14(%ebp),%esi
movl %ecx, (%esi) movl %ecx,(%esi)
movl 0x18(%ebp),%esi movl 0x18(%ebp),%esi
movl %edx, (%esi) movl %edx,(%esi)
popl %esi popl %esi
popl %edx popl %edx

View file

@ -22,7 +22,7 @@
/* just some stuff */ /* just some stuff */
#define VERSION "FreeLoader v1.8.22" #define VERSION "FreeLoader v1.8.23"
#define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>" #define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>"
#define AUTHOR_EMAIL "<brianp@sginet.com>" #define AUTHOR_EMAIL "<brianp@sginet.com>"
#define BY_AUTHOR "by Brian Palmer" #define BY_AUTHOR "by Brian Palmer"
@ -36,7 +36,7 @@
// //
#define FREELOADER_MAJOR_VERSION 1 #define FREELOADER_MAJOR_VERSION 1
#define FREELOADER_MINOR_VERSION 8 #define FREELOADER_MINOR_VERSION 8
#define FREELOADER_PATCH_VERSION 22 #define FREELOADER_PATCH_VERSION 23
#ifndef ASM #ifndef ASM

View file

@ -780,7 +780,7 @@ CmiAllocateCell (PREGISTRY_HIVE RegistryHive,
/* Add a new block */ /* Add a new block */
if (!CmiAddBin(RegistryHive, if (!CmiAddBin(RegistryHive,
((sizeof(HBIN) + CellSize - 1) / REG_BLOCK_SIZE) + 1, ((sizeof(HBIN) + CellSize - 1) / REG_BLOCK_SIZE) + 1,
(PVOID *)&NewBlock, (PVOID *)(PVOID)&NewBlock,
pBlockOffset)) pBlockOffset))
return FALSE; return FALSE;
} }
@ -844,7 +844,7 @@ CmiAllocateHashTableCell (PREGISTRY_HIVE Hive,
(SubKeyCount * sizeof(HASH_RECORD)); (SubKeyCount * sizeof(HASH_RECORD));
Status = CmiAllocateCell (Hive, Status = CmiAllocateCell (Hive,
NewHashSize, NewHashSize,
(PVOID*) &HashCell, (PVOID*)(PVOID)&HashCell,
HBOffset); HBOffset);
if ((HashCell == NULL) || (Status == FALSE)) if ((HashCell == NULL) || (Status == FALSE))
{ {
@ -937,7 +937,7 @@ CmiAllocateValueCell(PREGISTRY_HIVE Hive,
NameSize = (ValueName == NULL) ? 0 : strlen (ValueName); NameSize = (ValueName == NULL) ? 0 : strlen (ValueName);
Status = CmiAllocateCell (Hive, Status = CmiAllocateCell (Hive,
sizeof(VALUE_CELL) + NameSize, sizeof(VALUE_CELL) + NameSize,
(PVOID*)&NewValueCell, (PVOID*)(PVOID)&NewValueCell,
ValueCellOffset); ValueCellOffset);
if ((NewValueCell == NULL) || (Status == FALSE)) if ((NewValueCell == NULL) || (Status == FALSE))
{ {
@ -1081,7 +1081,7 @@ CmiExportValue (PREGISTRY_HIVE Hive,
/* Allocate data cell */ /* Allocate data cell */
if (!CmiAllocateCell (Hive, if (!CmiAllocateCell (Hive,
sizeof(CELL_HEADER) + DstDataSize, sizeof(CELL_HEADER) + DstDataSize,
(PVOID *)&DataCell, (PVOID *)(PVOID)&DataCell,
&DataCellOffset)) &DataCellOffset))
{ {
return FALSE; return FALSE;

View file

@ -468,16 +468,14 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
char szFileName[1024]; char szFileName[1024];
char szBootPath[256]; char szBootPath[256];
int i; int i;
// int nNumDriverFiles=0;
// int nNumFilesLoaded=0;
char MsgBuffer[256]; char MsgBuffer[256];
U32 SectionId; U32 SectionId;
char* Base; char* Base;
U32 Size; U32 Size;
PARTITION_TABLE_ENTRY PartitionTableEntry; PARTITION_TABLE_ENTRY PartitionTableEntry;
U32 rosPartition; U32 rosPartition;
// //
// Open the operating system section // Open the operating system section
@ -500,7 +498,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
mb_info.cmdline = (unsigned long)multiboot_kernel_cmdline; mb_info.cmdline = (unsigned long)multiboot_kernel_cmdline;
mb_info.mods_count = 0; mb_info.mods_count = 0;
mb_info.mods_addr = (unsigned long)multiboot_modules; mb_info.mods_addr = (unsigned long)multiboot_modules;
mb_info.mmap_length = (unsigned long)GetBiosMemoryMap((PBIOS_MEMORY_MAP)&multiboot_memory_map, 32) * sizeof(memory_map_t); mb_info.mmap_length = (unsigned long)GetBiosMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&multiboot_memory_map, 32) * sizeof(memory_map_t);
if (mb_info.mmap_length) if (mb_info.mmap_length)
{ {
mb_info.mmap_addr = (unsigned long)&multiboot_memory_map; mb_info.mmap_addr = (unsigned long)&multiboot_memory_map;
@ -556,7 +554,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
UiMessageBox(MsgBuffer); UiMessageBox(MsgBuffer);
return; return;
} }
/* recalculate the boot partition for freeldr */ /* recalculate the boot partition for freeldr */
i = 0; i = 0;
rosPartition = 0; rosPartition = 0;
@ -576,17 +574,18 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
} }
} }
} }
if (BootPartition == 0) if (BootPartition == 0)
{ {
sprintf(MsgBuffer,"Invalid system path: '%s'", value); sprintf(MsgBuffer,"Invalid system path: '%s'", value);
UiMessageBox(MsgBuffer); UiMessageBox(MsgBuffer);
return; return;
} }
/* copy ARC path into kernel command line */ /* copy ARC path into kernel command line */
strcpy(multiboot_kernel_cmdline, value); strcpy(multiboot_kernel_cmdline, value);
} }
/* Set boot drive and partition */ /* Set boot drive and partition */
((char *)(&mb_info.boot_device))[0] = (char)BootDrive; ((char *)(&mb_info.boot_device))[0] = (char)BootDrive;
((char *)(&mb_info.boot_device))[1] = (char)BootPartition; ((char *)(&mb_info.boot_device))[1] = (char)BootPartition;

View file

@ -251,7 +251,7 @@ VOID RunLoader(VOID)
mb_info.cmdline = (unsigned long)multiboot_kernel_cmdline; mb_info.cmdline = (unsigned long)multiboot_kernel_cmdline;
mb_info.mods_count = 0; mb_info.mods_count = 0;
mb_info.mods_addr = (unsigned long)multiboot_modules; mb_info.mods_addr = (unsigned long)multiboot_modules;
mb_info.mmap_length = (unsigned long)GetBiosMemoryMap((PBIOS_MEMORY_MAP)&multiboot_memory_map, 32) * sizeof(memory_map_t); mb_info.mmap_length = (unsigned long)GetBiosMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&multiboot_memory_map, 32) * sizeof(memory_map_t);
if (mb_info.mmap_length) if (mb_info.mmap_length)
{ {
mb_info.mmap_addr = (unsigned long)&multiboot_memory_map; mb_info.mmap_addr = (unsigned long)&multiboot_memory_map;
@ -497,77 +497,56 @@ for(;;);
return; return;
} }
#if 0
/* Load isapnp.sys */
if (!LoadDriver(SourcePath, "isapnp.sys"))
return;
#endif
/* Load drivers */ #if 0
if (BootDrive < 0x80) /* Load pci.sys */
{ if (!LoadDriver(SourcePath, "pci.sys"))
/* return;
* Load floppy.sys #endif
*/
if (!LoadDriver(SourcePath, "floppy.sys"))
return;
/* /* Load scsiport.sys */
* Load vfatfs.sys (could be loaded by the setup prog!) if (!LoadDriver(SourcePath, "scsiport.sys"))
*/ return;
if (!LoadDriver(SourcePath, "vfatfs.sys"))
return;
}
else
{
/*
* Load scsiport.sys
*/
if (!LoadDriver(SourcePath, "scsiport.sys"))
return;
/* /* Load atapi.sys (depends on hardware detection) */
* Load atapi.sys (depends on hardware detection) if (!LoadDriver(SourcePath, "atapi.sys"))
*/ return;
if (!LoadDriver(SourcePath, "atapi.sys"))
return;
/* /* Load class2.sys */
* Load class2.sys if (!LoadDriver(SourcePath, "class2.sys"))
*/ return;
if (!LoadDriver(SourcePath, "class2.sys"))
return;
/* /* Load cdrom.sys */
* Load cdrom.sys if (!LoadDriver(SourcePath, "cdrom.sys"))
*/ return;
if (!LoadDriver(SourcePath, "cdrom.sys"))
return;
/* /* Load cdfs.sys */
* Load cdfs.sys if (!LoadDriver(SourcePath, "cdfs.sys"))
*/ return;
if (!LoadDriver(SourcePath, "cdfs.sys"))
return;
/* /* Load disk.sys */
* Load disk.sys if (!LoadDriver(SourcePath, "disk.sys"))
*/ return;
if (!LoadDriver(SourcePath, "disk.sys"))
return;
/* /* Load floppy.sys */
* Load vfatfs.sys (could be loaded by the setup prog!) if (!LoadDriver(SourcePath, "floppy.sys"))
*/ return;
if (!LoadDriver(SourcePath, "vfatfs.sys"))
return; /* Load vfatfs.sys (could be loaded by the setup prog!) */
} if (!LoadDriver(SourcePath, "vfatfs.sys"))
return;
/* /* Load keyboard driver */
* Load keyboard driver
*/
if (!LoadDriver(SourcePath, "keyboard.sys")) if (!LoadDriver(SourcePath, "keyboard.sys"))
return; return;
/* /* Load screen driver */
* Load screen driver
*/
if (!LoadDriver(SourcePath, "blue.sys")) if (!LoadDriver(SourcePath, "blue.sys"))
return; return;
@ -575,9 +554,7 @@ for(;;);
UiUnInitialize("Booting ReactOS..."); UiUnInitialize("Booting ReactOS...");
#endif #endif
/* /* Now boot the kernel */
* Now boot the kernel
*/
DiskStopFloppyMotor(); DiskStopFloppyMotor();
boot_reactos(); boot_reactos();
} }

View file

@ -26,7 +26,7 @@ void print(char *str)
{ {
int i; int i;
for(i=0; i<strlen(str); i++) for (i = 0; i < strlen(str); i++)
putchar(str[i]); putchar(str[i]);
} }
@ -36,7 +36,7 @@ void print(char *str)
*/ */
void printf(char *format, ... ) void printf(char *format, ... )
{ {
int *dataptr = (int *) &format; int *dataptr = (int *)(void *)&format;
char c, *ptr, str[16]; char c, *ptr, str[16];
int ll; int ll;
@ -102,7 +102,7 @@ void printf(char *format, ... )
void sprintf(char *buffer, char *format, ... ) void sprintf(char *buffer, char *format, ... )
{ {
int *dataptr = (int *) &format; int *dataptr = (int *)(void *)&format;
char c, *ptr, str[16]; char c, *ptr, str[16];
char *p = buffer; char *p = buffer;
int ll; int ll;