ReactOS 0.4.16-dev-1946-g52006dd
machpc.h File Reference
#include "mm.h"
Include dependency graph for machpc.h:

Go to the source code of this file.

Functions

VOID PcBeep (VOID)
 
VOID PcConsPutChar (int Ch)
 
BOOLEAN PcConsKbHit (VOID)
 
int PcConsGetCh (VOID)
 
VOID PcVideoClearScreen (UCHAR Attr)
 
VIDEODISPLAYMODE PcVideoSetDisplayMode (char *DisplayMode, BOOLEAN Init)
 
VOID PcVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
ULONG PcVideoGetBufferSize (VOID)
 
VOID PcVideoGetFontsFromFirmware (PULONG RomFontPointers)
 
VOID PcVideoSetTextCursorPosition (UCHAR X, UCHAR Y)
 
VOID PcVideoHideShowTextCursor (BOOLEAN Show)
 
VOID PcVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
VOID PcVideoCopyOffScreenBufferToVRAM (PVOID Buffer)
 
BOOLEAN PcVideoIsPaletteFixed (VOID)
 
VOID PcVideoSetPaletteColor (UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 
VOID PcVideoGetPaletteColor (UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 
VOID PcVideoSync (VOID)
 
VOID PcVideoPrepareForReactOS (VOID)
 
VOID PcPrepareForReactOS (VOID)
 
PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap (ULONG *MemoryMapSize)
 
BOOLEAN PcFindPciBios (PPCI_REGISTRY_INFO BusData)
 
CONFIGURATION_TYPE DiskGetConfigType (_In_ UCHAR DriveNumber)
 
LONG DiskReportError (BOOLEAN bShowError)
 
BOOLEAN DiskResetController (UCHAR DriveNumber)
 
BOOLEAN PcDiskReadLogicalSectors (UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 
BOOLEAN PcDiskGetDriveGeometry (UCHAR DriveNumber, PGEOMETRY DriveGeometry)
 
ULONG PcDiskGetCacheableBlockCount (UCHAR DriveNumber)
 
TIMEINFOPcGetTime (VOID)
 
BOOLEAN PcInitializeBootDevices (VOID)
 
PCONFIGURATION_COMPONENT_DATA PcHwDetect (_In_opt_ PCSTR Options)
 
VOID PcHwIdle (VOID)
 

Variables

UCHAR FrldrBootDrive
 
ULONG FrldrBootPartition
 
BIOS_MEMORY_MAP PcBiosMemoryMap []
 
ULONG PcBiosMapCount
 

Function Documentation

◆ DiskGetConfigType()

CONFIGURATION_TYPE DiskGetConfigType ( _In_ UCHAR  DriveNumber)

Definition at line 402 of file pcdisk.c.

404{
405 if ((DriveNumber == FrldrBootDrive)/* && DiskIsDriveRemovable(DriveNumber) */ && (FrldrBootPartition == 0xFF))
406 return CdromController; /* This is our El Torito boot CD-ROM */
407 else if (DiskIsDriveRemovable(DriveNumber))
409 else
410 return DiskPeripheral;
411}
static BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber)
Definition: pcdisk.c:220
@ DiskPeripheral
Definition: arc.h:138
@ FloppyDiskPeripheral
Definition: arc.h:139
@ CdromController
Definition: arc.h:128
UCHAR FrldrBootDrive
Definition: uefidisk.c:47
ULONG FrldrBootPartition
Definition: uefidisk.c:48

Referenced by DiskOpen(), and PcInitializeBootDevices().

◆ DiskReportError()

LONG DiskReportError ( BOOLEAN  bShowError)

Definition at line 136 of file pcdisk.c.

137{
138 /* Set the reference count */
139 if (bShowError) ++lReportError;
140 else --lReportError;
141 return lReportError;
142}
static LONG lReportError
Definition: pcdisk.c:134

Referenced by EnumerateHarddisks(), and GetHarddiskInformation().

◆ DiskResetController()

BOOLEAN DiskResetController ( UCHAR  DriveNumber)

Definition at line 195 of file pcdisk.c.

196{
197 REGS RegsIn, RegsOut;
198
199 WARN("DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
200
201 /*
202 * BIOS Int 13h, function 0 - Reset disk system
203 * AH = 00h
204 * DL = drive (if bit 7 is set both hard disks and floppy disks reset)
205 * Return:
206 * AH = status
207 * CF clear if successful
208 * CF set on error
209 */
210 RegsIn.b.ah = 0x00;
211 RegsIn.b.dl = DriveNumber;
212
213 /* Reset the disk controller */
214 Int386(0x13, &RegsIn, &RegsOut);
215
216 return INT386_SUCCESS(RegsOut);
217}
#define WARN(fmt,...)
Definition: precomp.h:61
#define INT386_SUCCESS(regs)
Definition: pcbios.h:181
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:142
unsigned char ah
Definition: pcbios.h:134
Definition: pcbios.h:161
BYTEREGS b
Definition: pcbios.h:165

Referenced by DetectBiosFloppyPeripheral(), PcDiskReadLogicalSectorsCHS(), and PcDiskReadLogicalSectorsLBA().

◆ PcBeep()

VOID PcBeep ( VOID  )

Definition at line 34 of file pcbeep.c.

35{
36 Sound(700);
38 Sound(0);
39}
static VOID Sound(USHORT Frequency)
Definition: pcbeep.c:17
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60

Referenced by MachInit().

◆ PcConsGetCh()

int PcConsGetCh ( VOID  )

Definition at line 90 of file pccons.c.

91{
92 REGS Regs;
93 static BOOLEAN ExtendedKey = FALSE;
94 static char ExtendedScanCode = 0;
95
96 /* If the last time we were called an
97 * extended key was pressed then return
98 * that keys scan code. */
99 if (ExtendedKey)
100 {
102 return ExtendedScanCode;
103 }
104
105 /* Int 16h AH=00h
106 * KEYBOARD - GET KEYSTROKE
107 *
108 * AH = 00h
109 * Return:
110 * AH = BIOS scan code
111 * AL = ASCII character
112 */
113 Regs.b.ah = 0x00;
114 Int386(0x16, &Regs, &Regs);
115
116 /* Check for an extended keystroke */
117 if (0 == Regs.b.al)
118 {
120 ExtendedScanCode = Regs.b.ah;
121 }
122
123 /* Return keystroke */
124 return Regs.b.al;
125}
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned char al
Definition: pcbios.h:133
static BOOLEAN ExtendedKey
Definition: ueficon.c:20
static char ExtendedScanCode
Definition: ueficon.c:21

Referenced by MachInit(), and PcVideoSetDisplayMode().

◆ PcConsKbHit()

BOOLEAN PcConsKbHit ( VOID  )

Definition at line 69 of file pccons.c.

70{
71 REGS Regs;
72
73 /* Int 16h AH=01h
74 * KEYBOARD - CHECK FOR KEYSTROKE
75 *
76 * AH = 01h
77 * Return:
78 * ZF set if no keystroke available
79 * ZF clear if keystroke available
80 * AH = BIOS scan code
81 * AL = ASCII character
82 */
83 Regs.b.ah = 0x01;
84 Int386(0x16, &Regs, &Regs);
85
86 return 0 == (Regs.x.eflags & EFLAGS_ZF);
87}
#define EFLAGS_ZF
Definition: ketypes.h:194
unsigned long eflags
Definition: pcbios.h:107
DWORDREGS x
Definition: pcbios.h:162

Referenced by MachInit().

◆ PcConsPutChar()

VOID PcConsPutChar ( int  Ch)

Definition at line 28 of file pccons.c.

29{
30 REGS Regs;
31
32 /* If we are displaying a CR '\n' then do a LF also */
33 if ('\n' == Ch)
34 {
35 /* Display the LF */
36 PcConsPutChar('\r');
37 }
38
39 /* If we are displaying a TAB '\t' then display 8 spaces ' ' */
40 if ('\t' == Ch)
41 {
42 /* Display the 8 spaces ' ' */
43 PcConsPutChar(' ');
44 PcConsPutChar(' ');
45 PcConsPutChar(' ');
46 PcConsPutChar(' ');
47 PcConsPutChar(' ');
48 PcConsPutChar(' ');
49 PcConsPutChar(' ');
50 PcConsPutChar(' ');
51 return;
52 }
53
54 /* Int 10h AH=0Eh
55 * VIDEO - TELETYPE OUTPUT
56 *
57 * AH = 0Eh
58 * AL = character to write
59 * BH = page number
60 * BL = foreground color (graphics modes only)
61 */
62 Regs.b.ah = 0x0E;
63 Regs.b.al = Ch;
64 Regs.w.bx = 1;
65 Int386(0x10, &Regs, &Regs);
66}
VOID PcConsPutChar(int Ch)
Definition: pccons.c:28
#define Ch(x, y, z)
Definition: sha2.c:141
unsigned short bx
Definition: pcbios.h:114
WORDREGS w
Definition: pcbios.h:164

Referenced by MachInit(), and PcConsPutChar().

◆ PcDiskGetCacheableBlockCount()

ULONG PcDiskGetCacheableBlockCount ( UCHAR  DriveNumber)

Definition at line 856 of file pcdisk.c.

857{
858 PPC_DISK_DRIVE DiskDrive;
859
860 DiskDrive = PcDiskDriveNumberToDrive(DriveNumber);
861 if (!DiskDrive)
862 return 1; // Unknown count.
863
864 /*
865 * If LBA is supported then the block size will be 64 sectors (32k).
866 * If not then the block size is the size of one track.
867 */
868 if (DiskDrive->Int13ExtensionsSupported)
869 return 64;
870 else
871 return DiskDrive->Geometry.SectorsPerTrack;
872}
static PPC_DISK_DRIVE PcDiskDriveNumberToDrive(IN UCHAR DriveNumber)
Definition: pcdisk.c:538
ULONG SectorsPerTrack
Number of sectors per track.
Definition: disk.h:29
BOOLEAN Int13ExtensionsSupported
Definition: pcdisk.c:102
GEOMETRY Geometry
Definition: pcdisk.c:98

Referenced by MachInit().

◆ PcDiskGetDriveGeometry()

BOOLEAN PcDiskGetDriveGeometry ( UCHAR  DriveNumber,
PGEOMETRY  DriveGeometry 
)

Definition at line 826 of file pcdisk.c.

827{
828 PPC_DISK_DRIVE DiskDrive;
829
830 TRACE("PcDiskGetDriveGeometry(0x%x)\n", DriveNumber);
831
832 DiskDrive = PcDiskDriveNumberToDrive(DriveNumber);
833 if (!DiskDrive)
834 return FALSE;
835
836 /* Try to get the extended geometry first */
837 if (DiskDrive->ExtGeometry.Size == sizeof(DiskDrive->ExtGeometry))
838 {
839 /* Extended geometry has been initialized, return it */
840 Geometry->Cylinders = DiskDrive->ExtGeometry.Cylinders;
841 Geometry->Heads = DiskDrive->ExtGeometry.Heads;
842 Geometry->SectorsPerTrack = DiskDrive->ExtGeometry.SectorsPerTrack;
843 Geometry->BytesPerSector = DiskDrive->ExtGeometry.BytesPerSector;
844 Geometry->Sectors = DiskDrive->ExtGeometry.Sectors;
845 }
846 else
847 /* Fall back to legacy BIOS geometry */
848 {
849 *Geometry = DiskDrive->Geometry;
850 }
851
852 return TRUE;
853}
#define TRACE(s)
Definition: solgame.cpp:4
ULONGLONG Sectors
Definition: pcdisk.c:88
USHORT BytesPerSector
Definition: pcdisk.c:89
ULONG SectorsPerTrack
Definition: pcdisk.c:87
ULONG Cylinders
Definition: pcdisk.c:85
EXTENDED_GEOMETRY ExtGeometry
Definition: pcdisk.c:99

Referenced by MachInit(), and PcGetHarddiskConfigurationData().

◆ PcDiskReadLogicalSectors()

BOOLEAN PcDiskReadLogicalSectors ( UCHAR  DriveNumber,
ULONGLONG  SectorNumber,
ULONG  SectorCount,
PVOID  Buffer 
)

◆ PcFindPciBios()

BOOLEAN PcFindPciBios ( PPCI_REGISTRY_INFO  BusData)

Definition at line 80 of file hwpci.c.

81{
82 REGS RegsIn;
83 REGS RegsOut;
84
85 RegsIn.b.ah = 0xB1; /* Subfunction B1h */
86 RegsIn.b.al = 0x01; /* PCI BIOS present */
87
88 Int386(0x1A, &RegsIn, &RegsOut);
89
90 if (INT386_SUCCESS(RegsOut) &&
91 (RegsOut.d.edx == ' ICP') &&
92 (RegsOut.b.ah == 0))
93 {
94 TRACE("Found PCI bios\n");
95
96 TRACE("AL: %x\n", RegsOut.b.al);
97 TRACE("BH: %x\n", RegsOut.b.bh);
98 TRACE("BL: %x\n", RegsOut.b.bl);
99 TRACE("CL: %x\n", RegsOut.b.cl);
100
101 BusData->NoBuses = RegsOut.b.cl + 1;
102 BusData->MajorRevision = RegsOut.b.bh;
103 BusData->MinorRevision = RegsOut.b.bl;
104 BusData->HardwareMechanism = RegsOut.b.al;
105
106 return TRUE;
107 }
108
109 TRACE("No PCI bios found\n");
110
111 return FALSE;
112}
unsigned char bl
Definition: pcbios.h:136
unsigned char cl
Definition: pcbios.h:139
unsigned char bh
Definition: pcbios.h:137
unsigned long edx
Definition: pcbios.h:96
UCHAR MajorRevision
Definition: pci.h:107
UCHAR NoBuses
Definition: pci.h:109
UCHAR HardwareMechanism
Definition: pci.h:110
UCHAR MinorRevision
Definition: pci.h:108
DWORDREGS d
Definition: pcbios.h:163

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ PcGetTime()

TIMEINFO * PcGetTime ( VOID  )

Definition at line 24 of file pcrtc.c.

25{
26 static TIMEINFO TimeInfo;
27 REGS Regs;
28
29 for (;;)
30 {
31 /* Some BIOSes, such as the 1998/07/25 system ROM
32 * in the Compaq Deskpro EP/SB, leave CF unchanged
33 * if successful, so CF should be cleared before
34 * calling this function. */
35 Regs.x.eflags = 0;
36// __writeeflags(__readeflags() & ~EFLAGS_CF);
37
38 /* Int 1Ah AH=04h
39 * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
40 *
41 * AH = 04h
42 * CF clear to avoid bug
43 * Return:
44 * CF clear if successful
45 * CH = century (BCD)
46 * CL = year (BCD)
47 * DH = month (BCD)
48 * DL = day (BCD)
49 * CF set on error
50 */
51 Regs.b.ah = 0x04;
52 Int386(0x1A, &Regs, &Regs);
53
54 if (!INT386_SUCCESS(Regs)) continue;
55
56 TimeInfo.Year = 100 * BCD_INT(Regs.b.ch) + BCD_INT(Regs.b.cl);
57 TimeInfo.Month = BCD_INT(Regs.b.dh);
58 TimeInfo.Day = BCD_INT(Regs.b.dl);
59
60 /* Some BIOSes leave CF unchanged if successful,
61 * so CF should be cleared before calling this function. */
62 Regs.x.eflags = 0;
63// __writeeflags(__readeflags() & ~EFLAGS_CF);
64
65 /* Int 1Ah AH=02h
66 * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
67 *
68 * AH = 02h
69 * CF clear to avoid bug
70 * Return:
71 * CF clear if successful
72 * CH = hour (BCD)
73 * CL = minutes (BCD)
74 * DH = seconds (BCD)
75 * DL = daylight savings flag (00h standard time, 01h daylight time)
76 * CF set on error (i.e. clock not running or in middle of update)
77 */
78 Regs.b.ah = 0x02;
79 Int386(0x1A, &Regs, &Regs);
80
81 if (!INT386_SUCCESS(Regs)) continue;
82
83 TimeInfo.Hour = BCD_INT(Regs.b.ch);
84 TimeInfo.Minute = BCD_INT(Regs.b.cl);
85 TimeInfo.Second = BCD_INT(Regs.b.dh);
86
87 break;
88 }
89 return &TimeInfo;
90}
#define BCD_INT(bcd)
Definition: pcrtc.c:21
unsigned char ch
Definition: pcbios.h:140
unsigned char dh
Definition: pcbios.h:143
Definition: fw.h:10
USHORT Month
Definition: fw.h:12
USHORT Day
Definition: fw.h:13
USHORT Minute
Definition: fw.h:15
USHORT Hour
Definition: fw.h:14
USHORT Second
Definition: fw.h:16
USHORT Year
Definition: fw.h:11

Referenced by MachInit().

◆ PcHwDetect()

PCONFIGURATION_COMPONENT_DATA PcHwDetect ( _In_opt_ PCSTR  Options)

Definition at line 1691 of file machpc.c.

1693{
1695 ULONG BusNumber = 0;
1696
1697 TRACE("DetectHardware()\n");
1698
1699 /* Create the 'System' key */
1700 // TODO: Discover and set the other machine types
1701 FldrCreateSystemKey(&SystemKey, "AT/AT COMPATIBLE");
1702
1705
1706 /* Detect buses */
1707 DetectPciBios(SystemKey, &BusNumber);
1708 DetectApmBios(SystemKey, &BusNumber);
1709 DetectPnpBios(SystemKey, &BusNumber);
1710 DetectIsaBios(Options, SystemKey, &BusNumber); // TODO: Detect first EISA or MCA, before ISA
1711 DetectAcpiBios(SystemKey, &BusNumber);
1712
1713 // TODO: Collect the ROM blocks from 0xC0000 to 0xF0000 and append their
1714 // CM_ROM_BLOCK data into the 'System' key's configuration data.
1715
1716 TRACE("DetectHardware() Done\n");
1717 return SystemKey;
1718}
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
Definition: archwsup.c:135
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwacpi.c:59
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: hwpci.c:80
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwapm.c:46
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:254
static VOID DetectIsaBios(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA SystemKey, _Out_ ULONG *BusNumber)
Definition: machpc.c:1621
static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machpc.c:128
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
uint32_t ULONG
Definition: typedefs.h:59
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3540
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by MachInit().

◆ PcHwIdle()

VOID PcHwIdle ( VOID  )

Definition at line 1721 of file machpc.c.

1722{
1723 REGS Regs;
1724
1725 /* Select APM 1.0+ function */
1726 Regs.b.ah = 0x53;
1727
1728 /* Function 05h: CPU idle */
1729 Regs.b.al = 0x05;
1730
1731 /* Call INT 15h */
1732 Int386(0x15, &Regs, &Regs);
1733
1734 /* Check if successfull (CF set on error) */
1735 if (INT386_SUCCESS(Regs))
1736 return;
1737
1738 /*
1739 * No futher processing here.
1740 * Optionally implement HLT instruction handling.
1741 */
1742}

Referenced by MachInit().

◆ PcInitializeBootDevices()

BOOLEAN PcInitializeBootDevices ( VOID  )

Definition at line 458 of file hwdisk.c.

459{
460 UCHAR DiskCount;
461 BOOLEAN BootDriveReported = FALSE;
463
464 DiskCount = EnumerateHarddisks(&BootDriveReported);
465
466 /* Initialize FrLdrBootPath, the boot path we're booting from (the "SystemPartition") */
468
469 /* Add it, if it's a floppy or CD-ROM */
471 if ((FrldrBootDrive >= FIRST_BIOS_DISK && !BootDriveReported) ||
473 {
474 /* TODO: Check if it's really a CD-ROM drive */
475
478 ULONG Checksum = 0;
480 ULONG i;
481
482 /* Read the MBR */
484 {
485 ERR("Reading MBR failed\n");
486 return FALSE;
487 }
488
491
492 Signature = Mbr->Signature;
493 TRACE("Signature: %x\n", Signature);
494
495 /* Calculate the MBR checksum */
496 for (i = 0; i < 2048 / sizeof(ULONG); i++)
497 {
498 Checksum += Buffer[i];
499 }
500 Checksum = ~Checksum + 1;
501 TRACE("Checksum: %x\n", Checksum);
502
503 /* Fill out the ARC disk block */
505
507 DiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
508 TRACE("Additional boot drive detected: 0x%02X\n", (int)FrldrBootDrive);
509 }
510
511 return (DiskCount != 0);
512}
UINT DriveType
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
Definition: archwsup.c:77
#define ERR(fmt,...)
Definition: precomp.h:57
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
VOID FsRegisterDevice(_In_ PCSTR DeviceName, _In_ const DEVVTBL *FuncTable)
Definition: fs.c:673
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
Definition: machine.h:120
Definition: bufpool.h:45
static const WCHAR Signature[]
Definition: parser.c:141
CCHAR FrLdrBootPath[MAX_PATH]
Definition: freeldr.c:29
BOOLEAN PxeInit(VOID)
Definition: pxe.c:376
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
static const DEVVTBL DiskVtbl
Definition: hwdisk.c:243
static BOOLEAN DiskGetBootPath(BOOLEAN IsPxe)
Definition: hwdisk.c:405
PVOID DiskReadBuffer
Definition: hwdisk.c:50
#define FIRST_BIOS_DISK
Definition: hwdisk.c:31
static UCHAR EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
Definition: hwdisk.c:347
CONFIGURATION_TYPE DiskGetConfigType(_In_ UCHAR DriveNumber)
Definition: pcdisk.c:402
enum _CONFIGURATION_TYPE CONFIGURATION_TYPE
ULONG Signature
Definition: disk.h:60
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by MachInit(), and Pc98InitializeBootDevices().

◆ PcMemGetMemoryMap()

PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap ( ULONG MemoryMapSize)

Definition at line 599 of file pcmem.c.

600{
601 ULONG EntryCount;
602 ULONG ExtendedMemorySizeAtOneMB;
603 ULONG ExtendedMemorySizeAtSixteenMB;
604 ULONG EbdaBase, EbdaSize;
605
606 TRACE("PcMemGetMemoryMap()\n");
607
609
611
612 /* If the BIOS didn't provide a memory map, synthesize one */
613 if (EntryCount == 0)
614 {
615 GetExtendedMemoryConfiguration(&ExtendedMemorySizeAtOneMB,
616 &ExtendedMemorySizeAtSixteenMB);
617
618 /* Conventional memory */
621 0,
623 LoaderFree);
624
625 /* Extended memory */
628 1024 * 1024 / PAGE_SIZE,
629 ExtendedMemorySizeAtOneMB * 1024 / PAGE_SIZE,
630 LoaderFree);
631
632 if (ExtendedMemorySizeAtSixteenMB != 0)
633 {
634 /* Extended memory at 16MB */
637 0x1000000 / PAGE_SIZE,
638 ExtendedMemorySizeAtSixteenMB * 64 * 1024 / PAGE_SIZE,
639 LoaderFree);
640 }
641
642 /* Check if we have an EBDA and get it's location */
643 if (GetEbdaLocation(&EbdaBase, &EbdaSize))
644 {
645 /* Add the descriptor */
648 (EbdaBase / PAGE_SIZE),
649 ADDRESS_AND_SIZE_TO_SPAN_PAGES(EbdaBase, EbdaSize),
651 }
652 }
653
654 /* Setup some protected ranges */
655 SetMemory(PcMemoryMap, 0x000000, 0x01000, LoaderFirmwarePermanent); // Realmode IVT / BDA
656 SetMemory(PcMemoryMap, 0x0A0000, 0x50000, LoaderFirmwarePermanent); // Video memory
657 SetMemory(PcMemoryMap, 0x0F0000, 0x10000, LoaderSpecialMemory); // ROM
658 SetMemory(PcMemoryMap, 0xFFF000, 0x01000, LoaderSpecialMemory); // unusable memory (do we really need this?)
659
660 *MemoryMapSize = PcMemFinalizeMemoryMap(PcMemoryMap);
661 return PcMemoryMap;
662}
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define MAX_BIOS_DESCRIPTORS
Definition: pcbios.h:12
FREELDR_MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS+1]
Definition: pcmem.c:40
ULONG PcMemFinalizeMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap)
Definition: pcmem.c:547
static VOID PcMemCheckUsableMemorySize(VOID)
Definition: pcmem.c:209
static BOOLEAN GetExtendedMemoryConfiguration(ULONG *pMemoryAtOneMB, ULONG *pMemoryAtSixteenMB)
Definition: pcmem.c:53
static ULONG PcMemGetConventionalMemorySize(VOID)
Definition: pcmem.c:149
ULONG AddMemoryDescriptor(IN OUT PFREELDR_MEMORY_DESCRIPTOR List, IN ULONG MaxCount, IN PFN_NUMBER BasePage, IN PFN_NUMBER PageCount, IN TYPE_OF_MEMORY MemoryType)
Definition: meminit.c:123
ULONG PcMapCount
Definition: pcmem.c:41
static ULONG PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
Definition: pcmem.c:235
VOID SetMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType)
Definition: pcmem.c:527
static BOOLEAN GetEbdaLocation(PULONG BaseAddress, PULONG Size)
Definition: pcmem.c:175
@ LoaderFree
Definition: arc.h:295
@ LoaderFirmwarePermanent
Definition: arc.h:299
@ LoaderSpecialMemory
Definition: arc.h:315
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)

Referenced by MachInit().

◆ PcPrepareForReactOS()

VOID PcPrepareForReactOS ( VOID  )

Definition at line 1813 of file machpc.c.

1814{
1815 /* On PC, prepare video and turn off the floppy motor */
1818}
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1235
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1161

Referenced by MachInit().

◆ PcVideoClearScreen()

VOID PcVideoClearScreen ( UCHAR  Attr)

Definition at line 1089 of file pcvideo.c.

1090{
1091 USHORT AttrChar;
1092 USHORT *BufPtr;
1093
1094 AttrChar = ((USHORT) Attr << 8) | ' ';
1095 for (BufPtr = (USHORT *) VIDEOTEXT_MEM_ADDRESS;
1097 BufPtr++)
1098 {
1100 *BufPtr = AttrChar;
1101 }
1102}
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
#define VIDEOTEXT_MEM_SIZE
Definition: pcvideo.c:32
unsigned short USHORT
Definition: pedump.c:61
#define __WARNING_DEREF_NULL_PTR
Definition: suppress.h:32
#define _PRAGMA_WARNING_SUPPRESS(x)
Definition: suppress.h:28

Referenced by MachInit().

◆ PcVideoCopyOffScreenBufferToVRAM()

VOID PcVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 1048 of file pcvideo.c.

1049{
1050 USHORT BanksToCopy;
1051 ULONG BytesInLastBank;
1052 USHORT CurrentBank;
1053 ULONG BankSize;
1054
1055 /* PcVideoWaitForVerticalRetrace(); */
1056
1057 /* Text mode (BIOS or VESA) */
1059 {
1061 }
1062 /* VESA graphics mode */
1064 {
1068
1069 /* Copy all the banks but the last one because
1070 * it is probably a partial bank */
1071 for (CurrentBank = 0; CurrentBank < BanksToCopy; CurrentBank++)
1072 {
1073 PcVideoSetMemoryBank(CurrentBank);
1074 RtlCopyMemory((PVOID) VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BankSize);
1075 }
1076
1077 /* Copy the remaining bytes into the last bank */
1078 PcVideoSetMemoryBank(CurrentBank);
1079 RtlCopyMemory((PVOID)VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BytesInLastBank);
1080 }
1081 /* BIOS graphics mode */
1082 else
1083 {
1085 }
1086}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
@ VideoTextMode
Definition: machine.h:35
@ VideoGraphicsMode
Definition: machine.h:36
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:119
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:117
#define VIDEOVGA_MEM_ADDRESS
Definition: pcvideo.c:30
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:118
static VOID PcVideoSetMemoryBank(USHORT BankNumber)
Definition: pcvideo.c:850
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:970
USHORT HeightInPixels
Definition: pcvideo.c:68
USHORT BytesPerScanLine
Definition: pcvideo.c:65
USHORT WindowGranularity
Definition: pcvideo.c:60
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by MachInit().

◆ PcVideoGetBufferSize()

ULONG PcVideoGetBufferSize ( VOID  )

Definition at line 970 of file pcvideo.c.

971{
973}
static ULONG ScreenHeight
Definition: pcvideo.c:115
static ULONG BytesPerScanLine
Definition: pcvideo.c:116

Referenced by MachInit(), and PcVideoCopyOffScreenBufferToVRAM().

◆ PcVideoGetDisplaySize()

VOID PcVideoGetDisplaySize ( PULONG  Width,
PULONG  Height,
PULONG  Depth 
)

Definition at line 946 of file pcvideo.c.

947{
951 {
953 {
954 /* 16-bit color modes give green an extra bit (5:6:5)
955 * 15-bit color modes have just 5:5:5 for R:G:B */
956 *Depth = (6 == VesaVideoModeInformation.GreenMaskSize ? 16 : 15);
957 }
958 else
959 {
961 }
962 }
963 else
964 {
965 *Depth = 0;
966 }
967}
static ULONG ScreenWidth
Definition: pcvideo.c:114
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819

Referenced by MachInit().

◆ PcVideoGetFontsFromFirmware()

VOID PcVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 976 of file pcvideo.c.

977{
978 REGS BiosRegs;
979
980 /* Get the address of the BIOS ROM fonts.
981 Int 10h, AX=1130h, BH = pointer specifier
982 returns: es:bp = address */
983 BiosRegs.d.eax = 0x1130;
984 BiosRegs.b.bh = ROM_8x14CharacterFont;
985 Int386(0x10, &BiosRegs, &BiosRegs);
986 RomFontPointers[0] = BiosRegs.w.es << 4 | BiosRegs.w.bp;
987
988 BiosRegs.b.bh = ROM_8x8DoubleDotFontLo;
989 Int386(0x10, &BiosRegs, &BiosRegs);
990 RomFontPointers[1] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
991
992 BiosRegs.b.bh = ROM_8x8DoubleDotFontHi;
993 Int386(0x10, &BiosRegs, &BiosRegs);
994 RomFontPointers[2] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
995
996 BiosRegs.b.bh = ROM_AlphaAlternate;
997 Int386(0x10, &BiosRegs, &BiosRegs);
998 RomFontPointers[3] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
999
1000 BiosRegs.b.bh = ROM_8x16Font;
1001 Int386(0x10, &BiosRegs, &BiosRegs);
1002 RomFontPointers[4] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1003
1004 BiosRegs.b.bh = ROM_Alternate9x16Font;
1005 Int386(0x10, &BiosRegs, &BiosRegs);
1006 RomFontPointers[5] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1007}
#define RomFontPointers
Definition: winldr.c:348
@ ROM_AlphaAlternate
Definition: pcvideo.c:129
@ ROM_8x16Font
Definition: pcvideo.c:130
@ ROM_8x14CharacterFont
Definition: pcvideo.c:126
@ ROM_8x8DoubleDotFontHi
Definition: pcvideo.c:128
@ ROM_8x8DoubleDotFontLo
Definition: pcvideo.c:127
@ ROM_Alternate9x16Font
Definition: pcvideo.c:131
unsigned long eax
Definition: pcbios.h:93
unsigned short bp
Definition: pcbios.h:120
unsigned short es
Definition: pcbios.h:123

Referenced by MachInit().

◆ PcVideoGetPaletteColor()

VOID PcVideoGetPaletteColor ( UCHAR  Color,
UCHAR Red,
UCHAR Green,
UCHAR Blue 
)

Definition at line 1129 of file pcvideo.c.

1130{
1135}
@ Green
Definition: bl.h:199
@ Red
Definition: bl.h:201
@ Blue
Definition: bl.h:198
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define VIDEOPORT_PALETTE_READ
Definition: pcvideo.c:25
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:27

Referenced by MachInit().

◆ PcVideoHideShowTextCursor()

VOID PcVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 1035 of file pcvideo.c.

1036{
1037 if (Show)
1038 {
1039 PcVideoDefineCursor(0x0D, 0x0E);
1040 }
1041 else
1042 {
1043 PcVideoDefineCursor(0x20, 0x00);
1044 }
1045}
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:317

Referenced by MachInit(), and PcVideoPrepareForReactOS().

◆ PcVideoIsPaletteFixed()

BOOLEAN PcVideoIsPaletteFixed ( VOID  )

Definition at line 1114 of file pcvideo.c.

1115{
1116 return FALSE;
1117}

Referenced by MachInit().

◆ PcVideoPrepareForReactOS()

VOID PcVideoPrepareForReactOS ( VOID  )

Definition at line 1161 of file pcvideo.c.

1162{
1163 // PcVideoSetMode80x50_80x43();
1166}
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:603
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1035

Referenced by PcPrepareForReactOS().

◆ PcVideoPutChar()

VOID PcVideoPutChar ( int  Ch,
UCHAR  Attr,
unsigned  X,
unsigned  Y 
)

Definition at line 1105 of file pcvideo.c.

1106{
1107 USHORT *BufPtr;
1108
1109 BufPtr = (USHORT *) (ULONG_PTR)(VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
1110 *BufPtr = ((USHORT) Attr << 8) | (Ch & 0xff);
1111}
#define Y(I)
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by MachInit().

◆ PcVideoSetDisplayMode()

VIDEODISPLAYMODE PcVideoSetDisplayMode ( char DisplayMode,
BOOLEAN  Init 
)

Definition at line 888 of file pcvideo.c.

889{
891
892 if (NULL == DisplayModeName || '\0' == *DisplayModeName)
893 {
895 return DisplayMode;
896 }
897
899 {
900 TRACE("CGA or other display adapter detected.\n");
901 printf("CGA or other display adapter detected.\n");
902 printf("Using 80x25 text mode.\n");
904 }
906 {
907 TRACE("EGA display adapter detected.\n");
908 printf("EGA display adapter detected.\n");
909 printf("Using 80x25 text mode.\n");
911 }
912 else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
913 {
914 TRACE("VGA display adapter detected.\n");
915
916 if (0 == _stricmp(DisplayModeName, "NORMAL_VGA"))
917 {
919 }
920 else if (0 == _stricmp(DisplayModeName, "EXTENDED_VGA"))
921 {
923 }
924 else
925 {
926 VideoMode = (USHORT)strtoul(DisplayModeName, NULL, 0);
927 }
928 }
929
931 {
932 printf("Error: unable to set video display mode 0x%x\n", (int) VideoMode);
933 printf("Defaulting to 80x25 text mode.\n");
934 printf("Press any key to continue.\n");
935 PcConsGetCh();
936
938 }
939
941
942 return DisplayMode;
943}
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
#define _stricmp
Definition: cat.c:22
#define NULL
Definition: types.h:112
#define printf
Definition: freeldr.h:97
int PcConsGetCh(void)
Definition: pccons.c:90
#define VIDEOCARD_CGA_OR_OTHER
Definition: pcvideo.c:34
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:137
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:38
static BOOLEAN PcVideoSetMode(USHORT NewMode)
Definition: pcvideo.c:717
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:39
#define VIDEOCARD_EGA
Definition: pcvideo.c:35
static VOID PcVideoSetBlinkBit(BOOLEAN Enable)
Definition: pcvideo.c:825

Referenced by MachInit().

◆ PcVideoSetPaletteColor()

VOID PcVideoSetPaletteColor ( UCHAR  Color,
UCHAR  Red,
UCHAR  Green,
UCHAR  Blue 
)

◆ PcVideoSetTextCursorPosition()

VOID PcVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 1010 of file pcvideo.c.

1011{
1012 REGS Regs;
1013
1014 /* Int 10h AH=02h
1015 * VIDEO - SET CURSOR POSITION
1016 *
1017 * AH = 02h
1018 * BH = page number
1019 * 0-3 in modes 2&3
1020 * 0-7 in modes 0&1
1021 * 0 in graphics modes
1022 * DH = row (00h is top)
1023 * DL = column (00h is left)
1024 * Return:
1025 * Nothing
1026 */
1027 Regs.b.ah = 0x02;
1028 Regs.b.bh = 0x00;
1029 Regs.b.dh = Y;
1030 Regs.b.dl = X;
1031 Int386(0x10, &Regs, &Regs);
1032}
#define X(b, s)

Referenced by MachInit().

◆ PcVideoSync()

VOID PcVideoSync ( VOID  )

Definition at line 1138 of file pcvideo.c.

1139{
1141 {
1142 /*
1143 * Keep reading the port until bit 3 is clear
1144 * This waits for the current retrace to end and
1145 * we can catch the next one so we know we are
1146 * getting a full retrace.
1147 */
1148 }
1149
1151 {
1152 /*
1153 * Keep reading the port until bit 3 is set
1154 * Now that we know we aren't doing a vertical
1155 * retrace we need to wait for the next one.
1156 */
1157 }
1158}
#define VIDEOPORT_VERTICAL_RETRACE
Definition: pcvideo.c:28

Referenced by MachInit().

Variable Documentation

◆ FrldrBootDrive

◆ FrldrBootPartition

◆ PcBiosMapCount

ULONG PcBiosMapCount
extern

Definition at line 38 of file pcmem.c.

Referenced by DetectAcpiBios(), Pc98MemGetMemoryMap(), and PcMemGetBiosMemoryMap().

◆ PcBiosMemoryMap

BIOS_MEMORY_MAP PcBiosMemoryMap[]
extern

Definition at line 37 of file pcmem.c.

Referenced by DetectAcpiBios(), Pc98MemGetMemoryMap(), and PcMemGetBiosMemoryMap().