mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +00:00
[FREELDR] Separate PC and Xbox platform-specific code (#2185)
CORE-16216
This commit is contained in:
parent
6c4e591ea9
commit
571407c7d2
7 changed files with 58 additions and 67 deletions
|
@ -113,7 +113,6 @@ if(ARCH STREQUAL "i386")
|
||||||
lib/fs/pxe.c
|
lib/fs/pxe.c
|
||||||
arch/i386/halstub.c
|
arch/i386/halstub.c
|
||||||
arch/i386/ntoskrnl.c
|
arch/i386/ntoskrnl.c
|
||||||
arch/i386/archmach.c
|
|
||||||
arch/i386/drivemap.c
|
arch/i386/drivemap.c
|
||||||
arch/i386/hardware.c
|
arch/i386/hardware.c
|
||||||
arch/i386/hwacpi.c
|
arch/i386/hwacpi.c
|
||||||
|
@ -124,12 +123,14 @@ if(ARCH STREQUAL "i386")
|
||||||
arch/i386/i386idt.c
|
arch/i386/i386idt.c
|
||||||
arch/i386/i386rtl.c
|
arch/i386/i386rtl.c
|
||||||
arch/i386/i386vid.c
|
arch/i386/i386vid.c
|
||||||
arch/i386/pc/machpc.c
|
disk/scsiport.c)
|
||||||
arch/i386/pc/pccons.c
|
|
||||||
arch/i386/pc/pcdisk.c
|
if(SARCH STREQUAL "xbox")
|
||||||
arch/i386/pc/pcmem.c
|
list(APPEND FREELDR_ARC_SOURCE
|
||||||
arch/i386/pc/pcrtc.c
|
# FIXME: Abstract things better so we don't need to include /pc/* here
|
||||||
arch/i386/pc/pcvideo.c
|
arch/i386/pc/machpc.c # machxbox.c depends on it
|
||||||
|
arch/i386/pc/pcdisk.c # hwdisk.c depends on it
|
||||||
|
arch/i386/pc/pcmem.c # hwacpi.c/xboxmem.c depends on it
|
||||||
arch/i386/xbox/machxbox.c
|
arch/i386/xbox/machxbox.c
|
||||||
arch/i386/xbox/xboxcons.c
|
arch/i386/xbox/xboxcons.c
|
||||||
arch/i386/xbox/xboxdisk.c
|
arch/i386/xbox/xboxdisk.c
|
||||||
|
@ -137,8 +138,16 @@ if(ARCH STREQUAL "i386")
|
||||||
arch/i386/xbox/xboxi2c.c
|
arch/i386/xbox/xboxi2c.c
|
||||||
arch/i386/xbox/xboxmem.c
|
arch/i386/xbox/xboxmem.c
|
||||||
arch/i386/xbox/xboxrtc.c
|
arch/i386/xbox/xboxrtc.c
|
||||||
arch/i386/xbox/xboxvideo.c
|
arch/i386/xbox/xboxvideo.c)
|
||||||
disk/scsiport.c)
|
else()
|
||||||
|
list(APPEND FREELDR_ARC_SOURCE
|
||||||
|
arch/i386/pc/machpc.c
|
||||||
|
arch/i386/pc/pccons.c
|
||||||
|
arch/i386/pc/pcdisk.c
|
||||||
|
arch/i386/pc/pcmem.c
|
||||||
|
arch/i386/pc/pcrtc.c
|
||||||
|
arch/i386/pc/pcvideo.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
elseif(ARCH STREQUAL "amd64")
|
elseif(ARCH STREQUAL "amd64")
|
||||||
list(APPEND FREELDR_COMMON_ASM_SOURCE
|
list(APPEND FREELDR_COMMON_ASM_SOURCE
|
||||||
|
@ -196,7 +205,7 @@ if(USE_CLANG_CL)
|
||||||
# We need to reduce the binary size
|
# We need to reduce the binary size
|
||||||
add_target_compile_flags(freeldr_common "/Os")
|
add_target_compile_flags(freeldr_common "/Os")
|
||||||
endif()
|
endif()
|
||||||
if(NOT MSVC AND ARCH STREQUAL "i386")
|
if(NOT MSVC AND ARCH STREQUAL "i386" AND SARCH STREQUAL "xbox")
|
||||||
# Prevent a warning when doing a memcmp with address 0
|
# Prevent a warning when doing a memcmp with address 0
|
||||||
set_source_files_properties(arch/i386/xbox/xboxmem.c PROPERTIES COMPILE_FLAGS "-Wno-nonnull")
|
set_source_files_properties(arch/i386/xbox/xboxmem.c PROPERTIES COMPILE_FLAGS "-Wno-nonnull")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <freeldr.h>
|
|
||||||
|
|
||||||
VOID
|
|
||||||
MachInit(const char *CmdLine)
|
|
||||||
{
|
|
||||||
ULONG PciId;
|
|
||||||
|
|
||||||
memset(&MachVtbl, 0, sizeof(MACHVTBL));
|
|
||||||
|
|
||||||
/* Check for Xbox by identifying device at PCI 0:0:0, if it's
|
|
||||||
* 0x10de/0x02a5 then we're running on an Xbox */
|
|
||||||
WRITE_PORT_ULONG((ULONG*)0xcf8, CONFIG_CMD(0, 0, 0));
|
|
||||||
PciId = READ_PORT_ULONG((ULONG*)0xcfc);
|
|
||||||
if (PciId == 0x02a510de)
|
|
||||||
{
|
|
||||||
XboxMachInit(CmdLine);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PcMachInit(CmdLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
HalpCalibrateStallExecution();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1348,6 +1348,8 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
/* FIXME: Detect more ISA devices */
|
/* FIXME: Detect more ISA devices */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: Abstract things better so we don't need to place define here */
|
||||||
|
#if !defined(SARCH_XBOX)
|
||||||
static
|
static
|
||||||
UCHAR
|
UCHAR
|
||||||
PcGetFloppyCount(VOID)
|
PcGetFloppyCount(VOID)
|
||||||
|
@ -1359,6 +1361,7 @@ PcGetFloppyCount(VOID)
|
||||||
|
|
||||||
return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0);
|
return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PCONFIGURATION_COMPONENT_DATA
|
PCONFIGURATION_COMPONENT_DATA
|
||||||
PcHwDetect(VOID)
|
PcHwDetect(VOID)
|
||||||
|
@ -1416,9 +1419,13 @@ PcHwIdle(VOID)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* FIXME: Abstract things better so we don't need to place define here */
|
||||||
|
#if !defined(SARCH_XBOX)
|
||||||
VOID
|
VOID
|
||||||
PcMachInit(const char *CmdLine)
|
MachInit(const char *CmdLine)
|
||||||
{
|
{
|
||||||
|
memset(&MachVtbl, 0, sizeof(MACHVTBL));
|
||||||
|
|
||||||
/* Setup vtbl */
|
/* Setup vtbl */
|
||||||
MachVtbl.ConsPutChar = PcConsPutChar;
|
MachVtbl.ConsPutChar = PcConsPutChar;
|
||||||
MachVtbl.ConsKbHit = PcConsKbHit;
|
MachVtbl.ConsKbHit = PcConsKbHit;
|
||||||
|
@ -1448,6 +1455,8 @@ PcMachInit(const char *CmdLine)
|
||||||
MachVtbl.InitializeBootDevices = PcInitializeBootDevices;
|
MachVtbl.InitializeBootDevices = PcInitializeBootDevices;
|
||||||
MachVtbl.HwDetect = PcHwDetect;
|
MachVtbl.HwDetect = PcHwDetect;
|
||||||
MachVtbl.HwIdle = PcHwIdle;
|
MachVtbl.HwIdle = PcHwIdle;
|
||||||
|
|
||||||
|
HalpCalibrateStallExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -1457,5 +1466,6 @@ PcPrepareForReactOS(VOID)
|
||||||
PcVideoPrepareForReactOS();
|
PcVideoPrepareForReactOS();
|
||||||
DiskStopFloppyMotor();
|
DiskStopFloppyMotor();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -253,8 +253,27 @@ VOID XboxHwIdle(VOID)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
XboxMachInit(const char *CmdLine)
|
MachInit(const char *CmdLine)
|
||||||
{
|
{
|
||||||
|
ULONG PciId;
|
||||||
|
|
||||||
|
memset(&MachVtbl, 0, sizeof(MACHVTBL));
|
||||||
|
|
||||||
|
/* Check for Xbox by identifying device at PCI 0:0:0, if it's
|
||||||
|
* 0x10DE/0x02A5 then we're running on an Xbox */
|
||||||
|
WRITE_PORT_ULONG((ULONG *)0xCF8, CONFIG_CMD(0, 0, 0));
|
||||||
|
PciId = READ_PORT_ULONG((ULONG *)0xCFC);
|
||||||
|
if (PciId != 0x02A510DE)
|
||||||
|
{
|
||||||
|
ERR("This is not original Xbox!\n");
|
||||||
|
|
||||||
|
/* Disable and halt the CPU */
|
||||||
|
_disable();
|
||||||
|
__halt();
|
||||||
|
|
||||||
|
while (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set LEDs to red before anything is initialized */
|
/* Set LEDs to red before anything is initialized */
|
||||||
XboxSetLED("rrrr");
|
XboxSetLED("rrrr");
|
||||||
|
|
||||||
|
@ -294,6 +313,8 @@ XboxMachInit(const char *CmdLine)
|
||||||
|
|
||||||
/* Set LEDs to orange after init */
|
/* Set LEDs to orange after init */
|
||||||
XboxSetLED("oooo");
|
XboxSetLED("oooo");
|
||||||
|
|
||||||
|
HalpCalibrateStallExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#ifndef ASM
|
#ifndef ASM
|
||||||
|
|
||||||
VOID FrLdrSetupGdtIdt(VOID);
|
VOID FrLdrSetupGdtIdt(VOID);
|
||||||
#define MachInit PcMachInit
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -48,8 +48,6 @@
|
||||||
|
|
||||||
extern UCHAR XboxFont8x16[256 * 16];
|
extern UCHAR XboxFont8x16[256 * 16];
|
||||||
|
|
||||||
VOID XboxMachInit(const char *CmdLine);
|
|
||||||
|
|
||||||
VOID XboxConsPutChar(int Ch);
|
VOID XboxConsPutChar(int Ch);
|
||||||
BOOLEAN XboxConsKbHit(VOID);
|
BOOLEAN XboxConsKbHit(VOID);
|
||||||
int XboxConsGetCh(VOID);
|
int XboxConsGetCh(VOID);
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "mm.h"
|
#include "mm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VOID PcMachInit(const char *CmdLine);
|
|
||||||
|
|
||||||
VOID PcBeep(VOID);
|
VOID PcBeep(VOID);
|
||||||
|
|
||||||
VOID PcConsPutChar(int Ch);
|
VOID PcConsPutChar(int Ch);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue