Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Yao Jiewen<jiewen.yao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13609
6f19259b-4bc3-4df7-8a09-
765794883524
#define LEGACY_PCI_TRACE_00E LEGACY_PCI_TRACE + 0x0E\r
#define LEGACY_PCI_TRACE_00F LEGACY_PCI_TRACE + 0x0F\r
\r
#define LEGACY_PCI_TRACE_00E LEGACY_PCI_TRACE + 0x0E\r
#define LEGACY_PCI_TRACE_00F LEGACY_PCI_TRACE + 0x0F\r
\r
+#define BDA_VIDEO_MODE 0x49\r
\r
typedef struct {\r
UINTN PciSegment;\r
\r
typedef struct {\r
UINTN PciSegment;\r
//\r
// Store current mode settings since PrepareToScanRom may change mode.\r
//\r
//\r
// Store current mode settings since PrepareToScanRom may change mode.\r
//\r
- VideoMode = *(UINT8 *) ((UINTN) 0x449);\r
+ VideoMode = *(UINT8 *) ((UINTN) (0x400 + BDA_VIDEO_MODE));\r
}\r
//\r
// Notify the platform that we are about to scan the ROM\r
}\r
//\r
// Notify the platform that we are about to scan the ROM\r
//\r
// Set mode settings since PrepareToScanRom may change mode\r
//\r
//\r
// Set mode settings since PrepareToScanRom may change mode\r
//\r
- Regs.H.AH = 0x00;\r
- Regs.H.AL = VideoMode;\r
- Private->LegacyBios.Int86 (&Private->LegacyBios, 0x10, &Regs);\r
+ if (VideoMode != *(UINT8 *) ((UINTN) (0x400 + BDA_VIDEO_MODE))) {\r
+ //\r
+ // The active video mode is changed, restore it to original mode.\r
+ //\r
+ Regs.H.AH = 0x00;\r
+ Regs.H.AL = VideoMode;\r
+ Private->LegacyBios.Int86 (&Private->LegacyBios, 0x10, &Regs);\r
+ }\r
}\r
//\r
// Regs.X.AX from the adapter initializion is ignored since some adapters\r
}\r
//\r
// Regs.X.AX from the adapter initializion is ignored since some adapters\r