summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c')
-rw-r--r--IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
index 45cdd037e6..1d09bb879d 100644
--- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
+++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
@@ -2380,7 +2380,7 @@ LegacyBiosInstallRom (
//
// Store current mode settings since PrepareToScanRom may change mode.
//
- VideoMode = *(UINT8 *) ((UINTN) 0x449);
+ VideoMode = *(UINT8 *) ((UINTN) (0x400 + BDA_VIDEO_MODE));
}
//
// Notify the platform that we are about to scan the ROM
@@ -2520,9 +2520,14 @@ LegacyBiosInstallRom (
//
// Set mode settings since PrepareToScanRom may change mode
//
- Regs.H.AH = 0x00;
- Regs.H.AL = VideoMode;
- Private->LegacyBios.Int86 (&Private->LegacyBios, 0x10, &Regs);
+ if (VideoMode != *(UINT8 *) ((UINTN) (0x400 + BDA_VIDEO_MODE))) {
+ //
+ // The active video mode is changed, restore it to original mode.
+ //
+ Regs.H.AH = 0x00;
+ Regs.H.AL = VideoMode;
+ Private->LegacyBios.Int86 (&Private->LegacyBios, 0x10, &Regs);
+ }
}
//
// Regs.X.AX from the adapter initializion is ignored since some adapters