diff --git a/boot/freeldr/freeldr/arch/i386/hwapm.c b/boot/freeldr/freeldr/arch/i386/hwapm.c index 7339af9cdd1..313cf905419 100644 --- a/boot/freeldr/freeldr/arch/i386/hwapm.c +++ b/boot/freeldr/freeldr/arch/i386/hwapm.c @@ -1,21 +1,8 @@ /* - * FreeLoader - * - * Copyright (C) 2004 Eric Kohl - * - * 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. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: APM BIOS detection routines + * COPYRIGHT: Copyright 2004 Eric Kohl (eric.kohl@reactos.org) */ #include @@ -26,9 +13,9 @@ DBG_DEFAULT_CHANNEL(HWDETECT); static BOOLEAN FindApmBios(VOID) { - REGS RegsIn; - REGS RegsOut; + REGS RegsIn, RegsOut; + /* APM BIOS - Installation check */ #if defined(SARCH_PC98) RegsIn.w.ax = 0x9A00; RegsIn.w.bx = 0x0000; @@ -38,7 +25,7 @@ FindApmBios(VOID) RegsIn.w.bx = 0x0000; Int386(0x15, &RegsIn, &RegsOut); #endif - if (INT386_SUCCESS(RegsOut)) + if (INT386_SUCCESS(RegsOut) && RegsOut.w.bx == 'PM') { TRACE("Found APM BIOS\n"); TRACE("AH: %x\n", RegsOut.b.ah); @@ -55,7 +42,6 @@ FindApmBios(VOID) return FALSE; } - VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { @@ -63,35 +49,40 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) PCM_PARTIAL_RESOURCE_LIST PartialResourceList; ULONG Size; + if (!FindApmBios()) + return; + Size = sizeof(CM_PARTIAL_RESOURCE_LIST) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); - if (FindApmBios()) + /* Set 'Configuration Data' value */ + PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST); + if (PartialResourceList == NULL) { - /* Create 'Configuration Data' value */ - PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST); - memset(PartialResourceList, 0, Size); - PartialResourceList->Version = 0; - PartialResourceList->Revision = 0; - PartialResourceList->Count = 0; - - /* Create new bus key */ - FldrCreateComponentKey(SystemKey, - AdapterClass, - MultiFunctionAdapter, - 0x0, - 0x0, - 0xFFFFFFFF, - "APM", - PartialResourceList, - Size, - &BiosKey); - - /* Increment bus number */ - (*BusNumber)++; + ERR("Failed to allocate resource descriptor\n"); + return; } + RtlZeroMemory(PartialResourceList, Size); + PartialResourceList->Version = 0; + PartialResourceList->Revision = 0; + PartialResourceList->Count = 0; /* FIXME: Add configuration data */ + + /* Create new bus key */ + FldrCreateComponentKey(SystemKey, + AdapterClass, + MultiFunctionAdapter, + 0x0, + 0, + 0xFFFFFFFF, + "APM", + PartialResourceList, + Size, + &BiosKey); + + /* Increment bus number */ + (*BusNumber)++; } /* EOF */ diff --git a/boot/freeldr/freeldr/arch/i386/ntoskrnl.c b/boot/freeldr/freeldr/arch/i386/ntoskrnl.c index 33ce99b26f4..4a846f0eaf3 100644 --- a/boot/freeldr/freeldr/arch/i386/ntoskrnl.c +++ b/boot/freeldr/freeldr/arch/i386/ntoskrnl.c @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ -#include #include +#include /* FUNCTIONS *****************************************************************/ diff --git a/boot/freeldr/freeldr/arch/i386/pc/machpc.c b/boot/freeldr/freeldr/arch/i386/pc/machpc.c index d5b629f4600..8aea5d9d13f 100644 --- a/boot/freeldr/freeldr/arch/i386/pc/machpc.c +++ b/boot/freeldr/freeldr/arch/i386/pc/machpc.c @@ -1373,7 +1373,8 @@ PcHwDetect(VOID) /* Create the 'System' key */ FldrCreateSystemKey(&SystemKey); - // TODO: Discover and set the machine type as the Component->Identifier + // TODO: Discover and set the other machine types + FldrSetIdentifier(SystemKey, "AT/AT COMPATIBLE"); GetHarddiskConfigurationData = PcGetHarddiskConfigurationData; FindPciBios = PcFindPciBios; diff --git a/boot/freeldr/freeldr/arch/i386/pc/pchw.c b/boot/freeldr/freeldr/arch/i386/pc/pchw.c index 67074c0fd30..bed2a11f62b 100644 --- a/boot/freeldr/freeldr/arch/i386/pc/pchw.c +++ b/boot/freeldr/freeldr/arch/i386/pc/pchw.c @@ -426,7 +426,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PeripheralClass, DiskPeripheral, Output | Input, - 0x0, + i, 0xFFFFFFFF, Identifier, PartialResourceList, diff --git a/boot/freeldr/freeldr/arch/i386/pc98/pc98video.c b/boot/freeldr/freeldr/arch/i386/pc98/pc98video.c index cb21eaaa70a..a92038228a7 100644 --- a/boot/freeldr/freeldr/arch/i386/pc98/pc98video.c +++ b/boot/freeldr/freeldr/arch/i386/pc98/pc98video.c @@ -10,7 +10,7 @@ #include #include -extern UCHAR XboxFont8x16[]; +extern UCHAR BitmapFont8x16[]; extern BOOLEAN HiResoMachine; /* GLOBALS ********************************************************************/ @@ -241,7 +241,7 @@ Pc98VideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y) UCHAR R = (Attr & 0x40) ? 0xFF : 0; UCHAR I = (Attr & 0x80) ? 0xFF : 0; ULONG VramOffset = X + (Y * CHAR_HEIGHT) * BYTES_PER_SCANLINE; - PUCHAR FontPtr = XboxFont8x16 + Ch * 16; + PUCHAR FontPtr = BitmapFont8x16 + Ch * 16; for (Line = 0; Line < CHAR_HEIGHT; Line++) { diff --git a/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c b/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c index 4d84089b9fb..438e887d059 100644 --- a/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c +++ b/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c @@ -50,29 +50,29 @@ XboxGetSerialPort(ULONG Index, PULONG Irq) ULONG ComBase = 0; // Enter Configuration - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_ENTER_CONFIG_KEY); + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_ENTER_CONFIG_KEY); // Select serial device - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_CONFIG_DEVICE_NUMBER); - WRITE_PORT_UCHAR(LPC_IO_BASE + 1, Device[Index]); + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_CONFIG_DEVICE_NUMBER); + WRITE_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1), Device[Index]); // Check if selected device is active - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_CONFIG_DEVICE_ACTIVATE); - if (READ_PORT_UCHAR(LPC_IO_BASE + 1) == 1) + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_CONFIG_DEVICE_ACTIVATE); + if (READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1)) == 1) { // Read LSB - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_CONFIG_DEVICE_BASE_ADDRESS_LOW); - ComBase = READ_PORT_UCHAR(LPC_IO_BASE + 1); + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_CONFIG_DEVICE_BASE_ADDRESS_LOW); + ComBase = READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1)); // Read MSB - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_CONFIG_DEVICE_BASE_ADDRESS_HIGH); - ComBase |= (READ_PORT_UCHAR(LPC_IO_BASE + 1) << 8); + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_CONFIG_DEVICE_BASE_ADDRESS_HIGH); + ComBase |= (READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1)) << 8); // Read IRQ - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_CONFIG_DEVICE_INTERRUPT); - *Irq = READ_PORT_UCHAR(LPC_IO_BASE + 1); + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_CONFIG_DEVICE_INTERRUPT); + *Irq = READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1)); } // Exit Configuration - WRITE_PORT_UCHAR(LPC_IO_BASE, LPC_EXIT_CONFIG_KEY); + WRITE_PORT_UCHAR((PUCHAR)LPC_IO_BASE, LPC_EXIT_CONFIG_KEY); return ComBase; } diff --git a/boot/freeldr/freeldr/arch/i386/xbox/xboxfont.c b/boot/freeldr/freeldr/arch/i386/xbox/xboxfont.c index 0e67d1ff7ac..0a731d308bd 100644 --- a/boot/freeldr/freeldr/arch/i386/xbox/xboxfont.c +++ b/boot/freeldr/freeldr/arch/i386/xbox/xboxfont.c @@ -1,28 +1,17 @@ /* - * 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. - * - * Note: Converted from the XFree vga.bdf font + * PROJECT: FreeLoader + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: VGA font 8x16 + * COPYRIGHT: Copyright 2004 Gé van Geldorp (gvg@reactos.org) */ +/* Note: Converted from the XFree vga.bdf font */ + #include -UCHAR XboxFont8x16[256 * 16] = +UCHAR BitmapFont8x16[256 * 16] = { - 0x00,0x00,0x00,0x7c,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00, /* 0x00 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x00 */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xa5,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, /* 0x01 */ 0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xdb,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00, /* 0x02 */ 0x00,0x00,0x00,0x00,0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00, /* 0x03 */ @@ -281,4 +270,3 @@ UCHAR XboxFont8x16[256 * 16] = }; /* EOF */ - diff --git a/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c b/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c index b1fd2518d6d..b0e38a35247 100644 --- a/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c +++ b/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c @@ -50,7 +50,7 @@ XboxVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgC unsigned Line; unsigned Col; - FontPtr = XboxFont8x16 + Char * 16; + FontPtr = BitmapFont8x16 + Char * 16; Pixel = (PULONG) ((char *) FrameBuffer + (Y * CHAR_HEIGHT + TOP_BOTTOM_LINES) * Delta + X * CHAR_WIDTH * BytesPerPixel); for (Line = 0; Line < CHAR_HEIGHT; Line++) @@ -290,13 +290,6 @@ XboxVideoSync(VOID) /* Not supported */ } -VOID -XboxBeep(VOID) -{ - /* Call PC version */ - PcBeep(); -} - VOID XboxVideoPrepareForReactOS(VOID) { diff --git a/boot/freeldr/freeldr/include/arch/i386/machxbox.h b/boot/freeldr/freeldr/include/arch/i386/machxbox.h index 062d74ff85b..6a95fe6025d 100644 --- a/boot/freeldr/freeldr/include/arch/i386/machxbox.h +++ b/boot/freeldr/freeldr/include/arch/i386/machxbox.h @@ -46,7 +46,7 @@ #define NV2A_RAMDAC_FP_HVALID_END (0x838 + NV2A_RAMDAC_OFFSET) #define NV2A_RAMDAC_FP_VVALID_END (0x818 + NV2A_RAMDAC_OFFSET) -extern UCHAR XboxFont8x16[256 * 16]; +extern UCHAR BitmapFont8x16[256 * 16]; VOID XboxConsPutChar(int Ch); BOOLEAN XboxConsKbHit(VOID); diff --git a/boot/freeldr/freeldr/include/ui/gui.h b/boot/freeldr/freeldr/include/ui/gui.h index 516394b0b8a..a2ce9373ad3 100644 --- a/boot/freeldr/freeldr/include/ui/gui.h +++ b/boot/freeldr/freeldr/include/ui/gui.h @@ -19,7 +19,6 @@ #pragma once -#define TUI_SCREEN_MEM 0xB8000 #define TITLE_BOX_CHAR_HEIGHT 5 /////////////////////////////////////////////////////////////////////////////////////// diff --git a/boot/freeldr/freeldr/include/ui/tui.h b/boot/freeldr/freeldr/include/ui/tui.h index 6daf7c30c43..8959276bf61 100644 --- a/boot/freeldr/freeldr/include/ui/tui.h +++ b/boot/freeldr/freeldr/include/ui/tui.h @@ -19,7 +19,6 @@ #pragma once -#define TUI_SCREEN_MEM 0xB8000 #define TUI_TITLE_BOX_CHAR_HEIGHT 5 ///////////////////////////////////////////////////////////////////////////////////////