Fix bug where S3 LFB base alignment can misalign and cause disabling of PCI VGA if clipping against system memory

This commit is contained in:
Jonathan Campbell 2024-11-11 06:01:53 -08:00
parent c4093eda69
commit be88cbc919

View File

@ -768,6 +768,10 @@ void VGA_Reset(Section*) {
enable_pci_vga = false;
}
/* must not overlap system RAM */
if (S3_LFB_BASE < (MEM_TotalPages()*4096))
S3_LFB_BASE = (MEM_TotalPages()*4096);
if (enable_pci_vga && has_pcibus_enable()) {
/* must be 32MB aligned (PCI) */
S3_LFB_BASE += 0x0FFFFFFUL;
@ -779,10 +783,6 @@ void VGA_Reset(Section*) {
S3_LFB_BASE &= ~0xFFFFUL;
}
/* must not overlap system RAM */
if (S3_LFB_BASE < (MEM_TotalPages()*4096))
S3_LFB_BASE = (MEM_TotalPages()*4096);
/* if the constraints we imposed make it impossible to maintain the alignment required for PCI,
* then just switch off PCI VGA emulation. */
if (IS_VGA_ARCH && enable_pci_vga && has_pcibus_enable()) {