ReactOS  0.4.14-dev-384-g5b37caa
umamgr.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  UMA_DESC_TYPE {
  UMA_FREE = 0, UMA_SYSTEM, UMA_ROM, UMA_UMB,
  UMA_VDD
}
 

Functions

BOOLEAN UmaDescReserve (IN OUT PUSHORT UmbSegment, IN OUT PUSHORT Size)
 
BOOLEAN UmaDescRelease (IN USHORT UmbSegment)
 
BOOLEAN UmaDescReallocate (IN USHORT UmbSegment, IN OUT PUSHORT Size)
 
BOOLEAN UmaMgrInitialize (VOID)
 
VOID UmaMgrCleanup (VOID)
 

Enumeration Type Documentation

◆ UMA_DESC_TYPE

Enumerator
UMA_FREE 
UMA_SYSTEM 
UMA_ROM 
UMA_UMB 
UMA_VDD 

Definition at line 14 of file umamgr.h.

15 {
16  UMA_FREE = 0, // Free RAM block
17  UMA_SYSTEM, // System memory (eg. VGA memory, etc...)
18  UMA_ROM, // ROM block
19  UMA_UMB, // Upper memory block
20  UMA_VDD // VDD-reserved block
Definition: umamgr.h:19
Definition: umamgr.h:18
Definition: umamgr.h:20
UMA_DESC_TYPE
Definition: umamgr.h:14

Function Documentation

◆ UmaDescReallocate()

BOOLEAN UmaDescReallocate ( IN USHORT  UmbSegment,
IN OUT PUSHORT  Size 
)

Definition at line 260 of file umamgr.c.

261 {
262  ULONG Address = (Segment << 4); // Convert segment number into address.
263  ULONG RequestSize = (*Size << 4); // Convert size in paragraphs into size in bytes.
264  ULONG MaxSize = 0;
265  PLIST_ENTRY Entry, NextEntry;
266  PUMA_DESCRIPTOR UmaDesc, NextDesc = NULL, NewUmaDesc;
267  PUMA_DESCRIPTOR FoundUmaDesc = NULL;
268 
269  // FIXME: Check! What to do?
270  if (RequestSize == 0) DPRINT1("Resizing UMA descriptor %04X to null size?!\n", Segment);
271 
273  while (Entry != &UmaDescriptorList)
274  {
276  Entry = Entry->Flink;
277 
278  /* Only get the maximum size of free descriptors */
279  if (UmaDesc->Type == UMA_FREE)
280  {
281  /* Update the maximum descriptor size */
282  if (UmaDesc->Size > MaxSize) MaxSize = UmaDesc->Size;
283  }
284 
285  /* Search for the descriptor in the list */
286  if (UmaDesc->Start == Address && UmaDesc->Type == UMA_UMB)
287  {
288  /* We found it */
289  FoundUmaDesc = UmaDesc;
290  break;
291  }
292  }
293 
294  if (FoundUmaDesc)
295  {
296  /* If we do not resize anything, just quit with success */
297  if (FoundUmaDesc->Size == RequestSize) goto Success;
298 
299  NextEntry = FoundUmaDesc->Entry.Flink;
300 
301  if (NextEntry != &UmaDescriptorList)
302  NextDesc = (PUMA_DESCRIPTOR)CONTAINING_RECORD(NextEntry, UMA_DESCRIPTOR, Entry);
303 
304  /* Check for reduction or enlargement */
305  if (FoundUmaDesc->Size > RequestSize)
306  {
307  /* Reduction */
308 
309  /*
310  * Check if the next descriptor is free, in which case we
311  * extend it, otherwise we create a new free descriptor.
312  */
313  if (NextDesc && NextDesc->Type == UMA_FREE)
314  {
315  /* Yes it is, expand its size and move it down */
316  NextDesc->Size += (FoundUmaDesc->Size - RequestSize);
317  NextDesc->Start -= (FoundUmaDesc->Size - RequestSize);
318  }
319  else
320  {
321  // FIXME: It might be needed to consider a minimum size starting which we need to split.
322  // if (FoundUmaDesc->Size - RequestSize > (3 << 4))
323 
324  /* Create a new free descriptor and insert it after the current one */
325  NewUmaDesc = CreateUmaDescriptor(&FoundUmaDesc->Entry,
326  FoundUmaDesc->Start + RequestSize,
327  FoundUmaDesc->Size - RequestSize,
328  FoundUmaDesc->Type);
329  if (!NewUmaDesc)
330  {
331  DPRINT1("CreateUmaDescriptor failed, UMA descriptor list possibly corrupted!\n");
332  MaxSize = 0;
333  goto Fail;
334  }
335  }
336  }
337  else // if (FoundUmaDesc->Size <= RequestSize)
338  {
339  /* Enlargement */
340 
341  /* Check whether the next descriptor is free and large enough for merging */
342  if (NextDesc && NextDesc->Type == UMA_FREE &&
343  FoundUmaDesc->Size + NextDesc->Size >= RequestSize)
344  {
345  /* Yes it is, reduce its size and move it up, and enlarge the reallocated descriptor */
346  NextDesc->Size -= (RequestSize - FoundUmaDesc->Size);
347  NextDesc->Start += (RequestSize - FoundUmaDesc->Size);
348 
349  if (NextDesc->Size == 0) FreeUmaDescriptor(NextDesc);
350  }
351  else
352  {
353  MaxSize = 0;
354  goto Fail;
355  }
356  }
357 
358  /* Finally, resize the descriptor */
359  FoundUmaDesc->Size = RequestSize;
360 
361 Success:
362  /* Returned size is in paragraphs */
363  *Size = (FoundUmaDesc->Size >> 4);
364  return TRUE;
365  }
366  else
367  {
368 Fail:
369  /* Returned size is in paragraphs */
370  *Size = (MaxSize >> 4);
371  return FALSE;
372  }
373 }
#define TRUE
Definition: types.h:120
ULONG Size
Definition: umamgr.c:30
struct _Entry Entry
Definition: kefuncs.h:640
UMA_DESC_TYPE Type
Definition: umamgr.c:31
Definition: umamgr.h:19
static LIST_ENTRY UmaDescriptorList
Definition: umamgr.c:43
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Inout_ PVOID Segment
Definition: exfuncs.h:893
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
static PUMA_DESCRIPTOR CreateUmaDescriptor(IN OUT PLIST_ENTRY ListHead, IN ULONG Address, IN ULONG Size, IN UMA_DESC_TYPE Type)
Definition: umamgr.c:48
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
LIST_ENTRY Entry
Definition: umamgr.c:28
Definition: hiveinit.c:368
#define DPRINT1
Definition: precomp.h:8
static VOID FreeUmaDescriptor(PUMA_DESCRIPTOR UmaDesc)
Definition: umamgr.c:76
ULONG Start
Definition: umamgr.c:29
struct _UMA_DESCRIPTOR * PUMA_DESCRIPTOR
unsigned int ULONG
Definition: retypes.h:1
base of all file and directory entries
Definition: entries.h:82

Referenced by XmsBopProcedure().

◆ UmaDescRelease()

BOOLEAN UmaDescRelease ( IN USHORT  UmbSegment)

Definition at line 207 of file umamgr.c.

208 {
209  ULONG Address = (Segment << 4); // Convert segment number into address.
210  PLIST_ENTRY Entry, PrevEntry, NextEntry;
211  PUMA_DESCRIPTOR UmaDesc, PrevDesc = NULL, NextDesc = NULL;
212  PUMA_DESCRIPTOR FoundUmaDesc = NULL;
213 
215  while (Entry != &UmaDescriptorList)
216  {
218  Entry = Entry->Flink;
219 
220  /* Search for the descriptor in the list */
221  if (UmaDesc->Start == Address && UmaDesc->Type == UMA_UMB)
222  {
223  /* We found it */
224  FoundUmaDesc = UmaDesc;
225  break;
226  }
227  }
228 
229  if (FoundUmaDesc)
230  {
231  FoundUmaDesc->Type = UMA_FREE;
232 
233  /* Combine free descriptors adjacent to this one */
234  PrevEntry = FoundUmaDesc->Entry.Blink;
235  NextEntry = FoundUmaDesc->Entry.Flink;
236 
237  if (PrevEntry != &UmaDescriptorList)
238  PrevDesc = (PUMA_DESCRIPTOR)CONTAINING_RECORD(PrevEntry, UMA_DESCRIPTOR, Entry);
239  if (NextEntry != &UmaDescriptorList)
240  NextDesc = (PUMA_DESCRIPTOR)CONTAINING_RECORD(NextEntry, UMA_DESCRIPTOR, Entry);
241 
242  if (NextDesc && NextDesc->Type == FoundUmaDesc->Type) // UMA_FREE
243  {
244  FoundUmaDesc->Size += NextDesc->Size;
245  FreeUmaDescriptor(NextDesc);
246  }
247 
248  if (PrevDesc && PrevDesc->Type == FoundUmaDesc->Type) // UMA_FREE
249  {
250  PrevDesc->Size += FoundUmaDesc->Size;
251  FreeUmaDescriptor(FoundUmaDesc);
252  }
253 
254  return TRUE;
255  }
256 
257  return FALSE;
258 }
#define TRUE
Definition: types.h:120
ULONG Size
Definition: umamgr.c:30
struct _Entry Entry
Definition: kefuncs.h:640
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
UMA_DESC_TYPE Type
Definition: umamgr.c:31
Definition: umamgr.h:19
static LIST_ENTRY UmaDescriptorList
Definition: umamgr.c:43
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Inout_ PVOID Segment
Definition: exfuncs.h:893
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
LIST_ENTRY Entry
Definition: umamgr.c:28
static VOID FreeUmaDescriptor(PUMA_DESCRIPTOR UmaDesc)
Definition: umamgr.c:76
ULONG Start
Definition: umamgr.c:29
struct _UMA_DESCRIPTOR * PUMA_DESCRIPTOR
unsigned int ULONG
Definition: retypes.h:1
base of all file and directory entries
Definition: entries.h:82

Referenced by EmsDrvCleanup(), EmsDrvInitialize(), and XmsBopProcedure().

◆ UmaDescReserve()

BOOLEAN UmaDescReserve ( IN OUT PUSHORT  UmbSegment,
IN OUT PUSHORT  Size 
)

Definition at line 84 of file umamgr.c.

85 {
86  ULONG Address = (*Segment << 4); // Convert segment number into address.
87  ULONG RequestSize = (*Size << 4); // Convert size in paragraphs into size in bytes.
88  ULONG MaxSize = 0;
90  PUMA_DESCRIPTOR UmaDesc, NewUmaDesc;
91  PUMA_DESCRIPTOR FoundUmaDesc = NULL;
92 
93  // FIXME: Check! What to do?
94  if (RequestSize == 0) DPRINT1("Requesting UMA descriptor with null size?!\n");
95 
97  while (Entry != &UmaDescriptorList)
98  {
100  Entry = Entry->Flink;
101 
102  /* Only check free descriptors */
103  if (UmaDesc->Type != UMA_FREE) continue;
104 
105  /* Update the maximum descriptor size */
106  if (UmaDesc->Size > MaxSize) MaxSize = UmaDesc->Size;
107 
108  /* Descriptor too small, continue... */
109  if (UmaDesc->Size < RequestSize) continue;
110 
111  /* Do we want to reserve the descriptor at a precise address? */
112  if (Address)
113  {
114  /* If the descriptor ends before the desired region, try again */
115  if (UmaDesc->Start + UmaDesc->Size <= Address) continue;
116 
117  /*
118  * If we have a descriptor, but one of its boundaries crosses the
119  * desired region (it starts after the desired region, or ends
120  * before the end of the desired region), this means that there
121  * is already something inside the region, so that we cannot
122  * allocate the region here. Bail out.
123  */
124  if (UmaDesc->Start > Address ||
125  UmaDesc->Start + UmaDesc->Size < Address + RequestSize)
126  {
127  goto Fail;
128  }
129 
130  /* We now have a free descriptor that overlaps our desired region: split it */
131 
132  /*
133  * Here, UmaDesc->Start == Address or UmaDesc->Start < Address,
134  * in which case we need to split the descriptor to the left.
135  */
136  if (UmaDesc->Start < Address)
137  {
138  /* Create a new free descriptor and insert it after the current one */
139  NewUmaDesc = CreateUmaDescriptor(&UmaDesc->Entry,
140  Address,
141  UmaDesc->Size - (Address - UmaDesc->Start),
142  UmaDesc->Type); // UMA_FREE
143  if (!NewUmaDesc)
144  {
145  DPRINT1("CreateUmaDescriptor failed, UMA descriptor list possibly corrupted!\n");
146  goto Fail;
147  }
148 
149  /* Reduce the size of the splitted left descriptor */
150  UmaDesc->Size = (Address - UmaDesc->Start);
151 
152  /* Current descriptor is now the new created one */
153  UmaDesc = NewUmaDesc;
154  }
155 
156  /* Here, UmaDesc->Start == Address */
157  }
158 
159  /* Descriptor of large enough size: split it to the right if needed */
160  // FIXME: It might be needed to consider a minimum size starting which we need to split.
161  // if (UmaDesc->Size - RequestSize > (3 << 4))
162  if (UmaDesc->Size > RequestSize)
163  {
164  /*
165  * Create a new free descriptor and insert it after the current one.
166  * Because consecutive free descriptors are always merged together,
167  * the descriptor following 'UmaDesc' cannot be free, so that this
168  * new free descriptor does not need to be merged with some others.
169  */
170  NewUmaDesc = CreateUmaDescriptor(&UmaDesc->Entry,
171  UmaDesc->Start + RequestSize,
172  UmaDesc->Size - RequestSize,
173  UmaDesc->Type); // UMA_FREE
174  if (!NewUmaDesc)
175  {
176  DPRINT1("CreateUmaDescriptor failed, UMA descriptor list possibly corrupted!\n");
177  goto Fail;
178  }
179 
180  /* Reduce the size of the splitted left descriptor */
181  UmaDesc->Size = RequestSize;
182  }
183 
184  /* We have a descriptor of correct size, initialize it */
185  UmaDesc->Type = UMA_UMB;
186  FoundUmaDesc = UmaDesc;
187  break;
188  }
189 
190  if (FoundUmaDesc)
191  {
192  /* Returned address is a segment and size is in paragraphs */
193  *Segment = (FoundUmaDesc->Start >> 4);
194  *Size = (FoundUmaDesc->Size >> 4);
195  return TRUE;
196  }
197  else
198  {
199 Fail:
200  /* Returned address is a segment and size is in paragraphs */
201  *Segment = 0x0000;
202  *Size = (MaxSize >> 4);
203  return FALSE;
204  }
205 }
#define TRUE
Definition: types.h:120
ULONG Size
Definition: umamgr.c:30
struct _Entry Entry
Definition: kefuncs.h:640
UMA_DESC_TYPE Type
Definition: umamgr.c:31
Definition: umamgr.h:19
static LIST_ENTRY UmaDescriptorList
Definition: umamgr.c:43
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Inout_ PVOID Segment
Definition: exfuncs.h:893
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
static PUMA_DESCRIPTOR CreateUmaDescriptor(IN OUT PLIST_ENTRY ListHead, IN ULONG Address, IN ULONG Size, IN UMA_DESC_TYPE Type)
Definition: umamgr.c:48
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
LIST_ENTRY Entry
Definition: umamgr.c:28
Definition: hiveinit.c:368
#define DPRINT1
Definition: precomp.h:8
ULONG Start
Definition: umamgr.c:29
struct _UMA_DESCRIPTOR * PUMA_DESCRIPTOR
unsigned int ULONG
Definition: retypes.h:1
base of all file and directory entries
Definition: entries.h:82

Referenced by DosInitializeUmb(), EmsDrvInitialize(), and XmsBopProcedure().

◆ UmaMgrCleanup()

VOID UmaMgrCleanup ( VOID  )

Definition at line 616 of file umamgr.c.

617 {
618  PUMA_DESCRIPTOR UmaDesc;
619 
620  while (!IsListEmpty(&UmaDescriptorList))
621  {
623  FreeUmaDescriptor(UmaDesc);
624  }
625 }
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
static LIST_ENTRY UmaDescriptorList
Definition: umamgr.c:43
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
static VOID FreeUmaDescriptor(PUMA_DESCRIPTOR UmaDesc)
Definition: umamgr.c:76
struct _UMA_DESCRIPTOR * PUMA_DESCRIPTOR
base of all file and directory entries
Definition: entries.h:82

Referenced by BiosCleanup().

◆ UmaMgrInitialize()

BOOLEAN UmaMgrInitialize ( VOID  )

if (Address >= 0xE0000) { Increment = 0x10000; }

Definition at line 375 of file umamgr.c.

376 {
377 // See bios/rom.h
378 #define ROM_AREA_START 0xE0000
379 #define ROM_AREA_END 0xFFFFF
380 
381 #define OPTION_ROM_SIGNATURE 0xAA55
382 
383  PUMA_DESCRIPTOR UmaDesc = NULL;
384  ULONG StartAddress = 0;
385  ULONG Size = 0;
387 
388  UINT i;
389 
390  ULONG Start, End;
392 
393  ULONG Address;
394 
395  // ULONG RomStart[] = {};
396  // ULONG RomEnd[] = {};
397  ULONG RomBoundaries[] = {0xA0000, 0xC0000, /*0xC8000, 0xE0000,*/ 0xF0000, 0x100000};
398  ULONG SizeIncrement[] = {0x20000, 0x00800, /*0x00800, 0x10000,*/ 0x10000, 0x0000 };
399 
400  // InitializeListHead(&UmaDescriptorList);
401 
402  /* NOTE: There must be always one UMA descriptor at least */
403  // FIXME: Maybe it should be a static object?
404 
405  for (i = 0; i < ARRAYSIZE(RomBoundaries) - 1; i++)
406  {
407  Start = RomBoundaries[i]; // RomStart[i]
408  End = RomBoundaries[i+1]; // RomEnd[i]
409  Increment = SizeIncrement[i];
410 
411  for (Address = Start; Address < End; Address += Increment)
412  {
413  if (StartAddress == 0)
414  {
415  /* Initialize data for a new descriptor */
416  StartAddress = Address;
417  Size = 0;
418  Type = UMA_FREE;
419  }
420 
421  /* Is it a normal system zone/user-excluded zone? */
422  if (Address >= 0xA0000 && Address < 0xC0000)
423  {
424  // StartAddress = Address;
425  Size = Increment;
426  Type = UMA_SYSTEM;
427 
428  /* Create descriptor */
429  UmaDesc = CreateUmaDescriptor(NULL, StartAddress, Size, Type);
430  if (!UmaDesc) return FALSE;
431 
432  StartAddress = 0;
433  continue;
434  }
435  /* Is it the PC ROM BIOS? */
436  else if (Address >= 0xF0000)
437  {
438  // StartAddress = Address;
439  Size = 0x10000; // Increment;
440  Type = UMA_ROM;
441 
442  /* Create descriptor */
443  UmaDesc = CreateUmaDescriptor(NULL, StartAddress, Size, Type);
444  if (!UmaDesc) return FALSE;
445 
446  StartAddress = 0;
447  continue;
448  }
449  /* Is it an option ROM? */
450  else if (Address >= 0xC0000 && Address < 0xF0000)
451  {
452  ULONG RomSize;
453  ULONG PrevRomAddress = 0;
454  ULONG PrevRomSize = 0;
455 
456  // while (Address < 0xF0000)
457  for (; Address < 0xF0000; Address += Increment)
458  {
459 
460 #if 0 // FIXME: Is this block, better here...
461  {
462  // We may be looping inside a ROM block, if: Type == 2 and:
463  // (StartAddress <= Address &&) StartAddress + Size > Address.
464  // In this case, do nothing (do not increase size either)
465  // But if we are now outside of a ROM block, then we need
466  // to create the previous block, and initialize a new empty one!
467  // (and following the next passages, increase its size).
468 
469  // if (StartAddress < Address && Type != 2)
470  if (Type == UMA_ROM && StartAddress + Size > Address)
471  {
472  /* We are inside ROM, do nothing */
473  }
474  else if (Type == UMA_ROM && StartAddress + Size <= Address)
475  {
476  /* We finished a ROM descriptor */
477 
478  /* Create descriptor */
479  UmaDesc = CreateUmaDescriptor(NULL, StartAddress, Size, Type);
480  if (!UmaDesc) return FALSE;
481 
482  StartAddress = 0;
483  // goto Restart;
484  }
485  else if (Type != UMA_ROM)
486  {
487  Size += Increment;
488  }
489  }
490 #endif
491 
492 Restart:
494 
495  if (StartAddress == 0)
496  {
497  /* Initialize data for a new descriptor */
498  StartAddress = Address;
499  Size = 0;
500  Type = UMA_FREE;
501 
502  PrevRomAddress = 0;
503  PrevRomSize = 0;
504  }
505 
507  {
508  /*
509  * If this is an adapter ROM (Start: C8000, End: E0000),
510  * its reported size is stored in byte 2 of the ROM.
511  *
512  * If this is an expansion ROM (Start: E0000, End: F0000),
513  * its real length is 64kB.
514  */
515  RomSize = *(PUCHAR)REAL_TO_PHYS(Address + 2) * 512;
516  // if (Address >= 0xE0000) RomSize = 0x10000;
517  if (Address >= 0xE0000) { RomSize = 0x10000; Increment = RomSize; }
518 
519  DPRINT1("ROM present @ address 0x%p\n", Address);
520 
521  if (StartAddress != 0 && Size != 0 &&
522  StartAddress + Size <= Address)
523  {
524  /* Finish old descriptor */
525  UmaDesc = CreateUmaDescriptor(NULL, StartAddress, Size, Type);
526  if (!UmaDesc) return FALSE;
527  }
528 
529  /*
530  * We may have overlapping ROMs, when PrevRomAddress + PrevRomSize > RomAddress.
531  * They must be put inside the same UMA descriptor.
532  */
533  if (PrevRomAddress + PrevRomSize > /*Rom*/Address)
534  {
535  // Overlapping ROM
536 
537  /*
538  * PrevRomAddress remains the same, but adjust
539  * PrevRomSize (ROM descriptors merging).
540  */
541  PrevRomSize = max(PrevRomSize, RomSize + Address - PrevRomAddress);
542 
543  // FIX: Confirm that the start address is really
544  // the one of the previous descriptor.
545  StartAddress = PrevRomAddress;
546  Size = PrevRomSize;
547  Type = UMA_ROM;
548  }
549  else
550  {
551  // Non-overlapping ROM
552 
553  PrevRomAddress = Address;
554  PrevRomSize = RomSize;
555 
556  /* Initialize a new descriptor. We will create it when it's OK */
557  StartAddress = Address;
558  Size = RomSize;
559  Type = UMA_ROM;
560  // continue;
561  }
562  }
563 #if 1 // FIXME: ...or there??
564  else
565  {
566  // We may be looping inside a ROM block, if: Type == 2 and:
567  // (StartAddress <= Address &&) StartAddress + Size > Address.
568  // In this case, do nothing (do not increase size either)
569  // But if we are now outside of a ROM block, then we need
570  // to create the previous block, and initialize a new empty one!
571  // (and following the next passages, increase its size).
572 
573  // if (StartAddress < Address && Type != UMA_ROM)
574  if (Type == UMA_ROM && StartAddress + Size > Address)
575  {
576  // We are inside ROM, do nothing
577  }
578  else if (Type == UMA_ROM && StartAddress + Size <= Address)
579  {
580  // We finished a ROM descriptor.
581 
582  /* Create descriptor */
583  UmaDesc = CreateUmaDescriptor(NULL, StartAddress, Size, Type);
584  if (!UmaDesc) return FALSE;
585 
586  StartAddress = 0;
587  goto Restart;
588  }
589  else if (Type != UMA_ROM)
590  {
591  Size += Increment;
592  }
593  }
594 #endif
595 
596  // Fixed incroment; we may encounter again overlapping ROMs, etc.
597  // Address += Increment;
598  }
599 
600  if (StartAddress != 0 && Size != 0)
601  {
602  /* Create descriptor */
603  UmaDesc = CreateUmaDescriptor(NULL, StartAddress, Size, Type);
604  if (!UmaDesc) return FALSE;
605 
606  StartAddress = 0;
607  }
608 
609  }
610  }
611  }
612 
613  return TRUE;
614 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
Type
Definition: Type.h:6
#define OPTION_ROM_SIGNATURE
unsigned char * PUCHAR
Definition: retypes.h:3
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
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
Definition: glfuncs.h:248
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
Definition: umamgr.h:18
Definition: partlist.h:33
static PUMA_DESCRIPTOR CreateUmaDescriptor(IN OUT PLIST_ENTRY ListHead, IN ULONG Address, IN ULONG Size, IN UMA_DESC_TYPE Type)
Definition: umamgr.c:48
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned int UINT
Definition: ndis.h:50
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42
UMA_DESC_TYPE
Definition: umamgr.h:14
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by BiosInitialize().