#include <freeldr.h>
#include <debug.h>
Go to the source code of this file.
◆ TEST_PATTERN1
◆ TEST_PATTERN2
◆ TEST_SIZE
◆ DBG_DEFAULT_CHANNEL()
DBG_DEFAULT_CHANNEL |
( |
MEMORY |
| ) |
|
◆ PcMemFinalizeMemoryMap()
Definition at line 547 of file pcmem.c.
549{
551
552
556
557
560
561
563 {
566 {
567
571 break;
572 }
573 }
574
575 TRACE(
"DiskReadBuffer=0x%p, DiskReadBufferSize=0x%lx\n",
577
579
580
585 "Disk read buffer");
586
587 TRACE(
"Dumping resulting memory map:\n");
589 {
590 TRACE(
"BasePage=0x%lx, PageCount=0x%lx, Type=%s\n",
593 MmGetSystemMemoryMapTypeString(
MemoryMap[
i].MemoryType));
594 }
596}
#define ALIGN_UP_BY(size, align)
BIOS_MEMORY_MAP MemoryMap[32]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
SIZE_T DiskReadBufferSize
VOID ReserveMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType, PCHAR Usage)
@ LoaderFirmwareTemporary
#define MAX_DISKREADBUFFER_SIZE
Referenced by PcMemGetMemoryMap(), and XboxMemGetMemoryMap().
◆ ReserveMemory()
Definition at line 484 of file pcmem.c.
490{
493
496
498 {
499
500 if ((
MemoryMap[
i].BasePage < BasePage + PageCount) &&
502 {
503
505 {
508 __FILE__,
509 __LINE__,
510 "Failed to reserve memory in the range 0x%Ix - 0x%Ix for %s",
514 }
515 }
516 }
517
518
521 BasePage,
522 PageCount,
523 MemoryType);
524}
VOID FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PSTR Format,...)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
#define MAX_BIOS_DESCRIPTORS
ULONG AddMemoryDescriptor(IN OUT PFREELDR_MEMORY_DESCRIPTOR List, IN ULONG MaxCount, IN PFN_NUMBER BasePage, IN PFN_NUMBER PageCount, IN TYPE_OF_MEMORY MemoryType)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
Referenced by PcMemFinalizeMemoryMap(), and XboxMemGetMemoryMap().
◆ SetMemory()
◆ XboxGetMultibootMemoryMap()
Definition at line 175 of file xboxmem.c.
176{
178
180 {
181 ERR(
"Multiboot info structure not found!\n");
183 }
184
186 {
187 ERR(
"Multiboot memory map is not passed!\n");
189 }
190
192
196 {
197 ERR(
"Multiboot memory map structure is malformed!\n");
199 }
200
203}
#define MB_INFO_FLAG_MEMORY_MAP
struct memory_map memory_map_t
unsigned long mmap_length
multiboot_info_t * MultibootInfoPtr
Referenced by XboxMemGetMemoryMap().
◆ XboxInitializePCI()
Definition at line 59 of file xboxmem.c.
60{
63
64
65 PciCfg1.
u.
bits.Enable = 1;
66 PciCfg1.
u.
bits.BusNumber = 0;
67 PciCfg1.
u.
bits.DeviceNumber = 8;
68 PciCfg1.
u.
bits.FunctionNumber = 0;
69
70 PciCfg1.
u.
bits.RegisterNumber = 0x00;
71 PciCfg1.
u.
bits.Reserved = 0;
72
75
76 if (PciData == 0x01B810DE)
77 {
78
79 PciCfg1.
u.
bits.RegisterNumber = 0x18;
81
82
83
85 PciData &= 0xFF0000FF;
86 PciData |= 0x00020200;
88 }
89
90
91 PciCfg1.
u.
bits.DeviceNumber = 30;
92
93 PciCfg1.
u.
bits.RegisterNumber = 0x00;
94
97
98 if (PciData == 0x01B710DE)
99 {
100
101
102
103 PciCfg1.
u.
bits.RegisterNumber = 0x10;
105
107
108
109 PciCfg1.
u.
bits.RegisterNumber = 0x14;
111
113 }
114}
#define PCI_TYPE1_DATA_PORT
#define PCI_TYPE1_ADDRESS_PORT
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
struct _PCI_TYPE1_CFG_BITS::@157::@158 bits
union _PCI_TYPE1_CFG_BITS::@157 u
Referenced by XboxMemInit().
◆ XboxMemGetMemoryMap()
Definition at line 228 of file xboxmem.c.
229{
232
233 TRACE(
"XboxMemGetMemoryMap()\n");
234
236 if (MbMap)
237 {
238
239
240 for (
i = 0;
i <
Count;
i++, MbMap++)
241 {
243
245 {
246 ERR(
"Memory descriptor base or size is greater than 4 GB, should not happen on Xbox!\n");
248 }
249
254 }
255 }
256 else
257 {
258
259
260
262 0,
265
267 {
268
273 "Video memory");
274 }
275 }
276
279}
@ LoaderFirmwarePermanent
unsigned long base_addr_low
unsigned long base_addr_high
unsigned long length_high
memory_map_t * XboxGetMultibootMemoryMap(INT *Count)
FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[MAX_BIOS_DESCRIPTORS+1]
ULONG PcMemFinalizeMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap)
static ULONG AvailableMemoryMb
VOID ReserveMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType, PCHAR Usage)
TYPE_OF_MEMORY XboxMultibootMemoryType(ULONG Type)
VOID SetMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType)
Referenced by MachInit().
◆ XboxMemInit()
Definition at line 117 of file xboxmem.c.
118{
123
126
127
128 PciCfg1.
u.
bits.Enable = 1;
129 PciCfg1.
u.
bits.BusNumber = 0;
130 PciCfg1.
u.
bits.DeviceNumber = 0;
131 PciCfg1.
u.
bits.FunctionNumber = 0;
132 PciCfg1.
u.
bits.Reserved = 0;
133
134 PciCfg1.
u.
bits.RegisterNumber = 0x84;
135
138
143
145 {
146
151 {
152
154 {
155
157 }
158 else
159 {
161 }
162 }
163 }
164
165
168
170
172}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define WRITE_REGISTER_ULONG(r, v)
PPC_QUAL void __wbinvd(void)
static VOID XboxInitializePCI(VOID)
static ULONG InstalledMemoryMb
Referenced by MachInit().
◆ XboxMultibootMemoryType()
Definition at line 206 of file xboxmem.c.
207{
209 {
210 case 0:
212 case 1:
214 case 3:
216 case 4:
218 case 5:
220 default:
222 }
223}
Referenced by XboxMemGetMemoryMap().
◆ AvailableMemoryMb
ULONG AvailableMemoryMb = 0 |
|
static |
◆ FrameBuffer
◆ FrameBufferSize
◆ InstalledMemoryMb
ULONG InstalledMemoryMb = 0 |
|
static |
◆ MultibootInfoPtr
◆ NvBase
◆ XboxMemoryMap