mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[FREELDR] Replace CONFIG_CMD macro with a straightforward bitfield struct
Also fix magic values related to PCI registers.
This commit is contained in:
parent
5caa59b31a
commit
f1410d2b09
4 changed files with 50 additions and 13 deletions
|
@ -301,14 +301,25 @@ VOID XboxHwIdle(VOID)
|
|||
VOID
|
||||
MachInit(const char *CmdLine)
|
||||
{
|
||||
PCI_TYPE1_CFG_BITS PciCfg1;
|
||||
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((PULONG)0xCF8, CONFIG_CMD(0, 0, 0));
|
||||
PciId = READ_PORT_ULONG((PULONG)0xCFC);
|
||||
|
||||
/* Select Host to PCI bridge */
|
||||
PciCfg1.u.bits.Enable = 1;
|
||||
PciCfg1.u.bits.BusNumber = 0;
|
||||
PciCfg1.u.bits.DeviceNumber = 0;
|
||||
PciCfg1.u.bits.FunctionNumber = 0;
|
||||
/* Select register VendorID & DeviceID */
|
||||
PciCfg1.u.bits.RegisterNumber = 0x00;
|
||||
PciCfg1.u.bits.Reserved = 0;
|
||||
|
||||
WRITE_PORT_ULONG(PCI_TYPE1_ADDRESS_PORT, PciCfg1.u.AsULONG);
|
||||
PciId = READ_PORT_ULONG((PULONG)PCI_TYPE1_DATA_PORT);
|
||||
if (PciId != 0x02A510DE)
|
||||
{
|
||||
ERR("This is not original Xbox!\n");
|
||||
|
|
|
@ -57,6 +57,7 @@ PcMemFinalizeMemoryMap(
|
|||
VOID
|
||||
XboxMemInit(VOID)
|
||||
{
|
||||
PCI_TYPE1_CFG_BITS PciCfg1;
|
||||
UCHAR ControlRegion[TEST_SIZE];
|
||||
PVOID MembaseTop = (PVOID)(64 * 1024 * 1024);
|
||||
PVOID MembaseLow = (PVOID)0;
|
||||
|
@ -64,9 +65,17 @@ XboxMemInit(VOID)
|
|||
WRITE_REGISTER_ULONG((PULONG)(NvBase + NV2A_FB_CFG0), 0x03070103);
|
||||
WRITE_REGISTER_ULONG((PULONG)(NvBase + NV2A_FB_CFG0 + 4), 0x11448000);
|
||||
|
||||
/* Prep hardware for 128 Mb */
|
||||
WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0x84));
|
||||
WRITE_PORT_ULONG((PULONG)0xCFC, 0x7FFFFFF);
|
||||
/* Select Host to PCI bridge */
|
||||
PciCfg1.u.bits.Enable = 1;
|
||||
PciCfg1.u.bits.BusNumber = 0;
|
||||
PciCfg1.u.bits.DeviceNumber = 0;
|
||||
PciCfg1.u.bits.FunctionNumber = 0;
|
||||
PciCfg1.u.bits.Reserved = 0;
|
||||
/* Prepare hardware for 128 MB */
|
||||
PciCfg1.u.bits.RegisterNumber = 0x84;
|
||||
|
||||
WRITE_PORT_ULONG(PCI_TYPE1_ADDRESS_PORT, PciCfg1.u.AsULONG);
|
||||
WRITE_PORT_ULONG((PULONG)PCI_TYPE1_DATA_PORT, 0x7FFFFFF);
|
||||
|
||||
InstalledMemoryMb = 64;
|
||||
memset(ControlRegion, TEST_PATTERN1, TEST_SIZE);
|
||||
|
@ -95,8 +104,8 @@ XboxMemInit(VOID)
|
|||
}
|
||||
|
||||
/* Set hardware for amount of memory detected */
|
||||
WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0x84));
|
||||
WRITE_PORT_ULONG((PULONG)0xCFC, InstalledMemoryMb * 1024 * 1024 - 1);
|
||||
WRITE_PORT_ULONG(PCI_TYPE1_ADDRESS_PORT, PciCfg1.u.AsULONG);
|
||||
WRITE_PORT_ULONG((PULONG)PCI_TYPE1_DATA_PORT, InstalledMemoryMb * 1024 * 1024 - 1);
|
||||
|
||||
AvailableMemoryMb = InstalledMemoryMb;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define CONFIG_CMD(bus, dev_fn, where) \
|
||||
(0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
|
||||
|
||||
#define TAG_HW_RESOURCE_LIST 'lRwH'
|
||||
#define TAG_HW_DISK_CONTEXT 'cDwH'
|
||||
|
||||
|
@ -32,6 +29,29 @@
|
|||
VOID StallExecutionProcessor(ULONG Microseconds);
|
||||
VOID HalpCalibrateStallExecution(VOID);
|
||||
|
||||
/* PCI Type 1 Ports */
|
||||
#define PCI_TYPE1_ADDRESS_PORT (PULONG)0xCF8
|
||||
#define PCI_TYPE1_DATA_PORT 0xCFC
|
||||
|
||||
/* PCI Type 1 Configuration Register */
|
||||
typedef struct _PCI_TYPE1_CFG_BITS
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ULONG RegisterNumber:8;
|
||||
ULONG FunctionNumber:3;
|
||||
ULONG DeviceNumber:5;
|
||||
ULONG BusNumber:8;
|
||||
ULONG Reserved:7;
|
||||
ULONG Enable:1;
|
||||
} bits;
|
||||
|
||||
ULONG AsULONG;
|
||||
} u;
|
||||
} PCI_TYPE1_CFG_BITS, *PPCI_TYPE1_CFG_BITS;
|
||||
|
||||
typedef
|
||||
PCM_PARTIAL_RESOURCE_LIST
|
||||
(*GET_HARDDISK_CONFIG_DATA)(UCHAR DriveNumber, ULONG* pSize);
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
#include "../../reactos/registry.h"
|
||||
#endif
|
||||
|
||||
#define CONFIG_CMD(bus, dev_fn, where) \
|
||||
(0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
|
||||
|
||||
/* PROTOTYPES ***************************************************************/
|
||||
|
||||
/* hardware.c */
|
||||
|
|
Loading…
Reference in a new issue