X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=PcAtChipsetPkg%2F8259InterruptControllerDxe%2F8259.c;h=7d8265dbd1da59885114e7e5cad49e5ede5f6bdf;hp=ec23bd9396087535419a32d1751adcd1751fedd6;hb=e78aab9d2f1423f2ec4a82e0e36eff4dfd7c56ea;hpb=dfaaa5a5eda92aafec7e4d14894c41541d4788fc diff --git a/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c b/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c index ec23bd9396..7d8265dbd1 100644 --- a/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c +++ b/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c @@ -1,7 +1,7 @@ /** @file This contains the installation function for the driver. -Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -38,9 +38,9 @@ UINT8 mMasterBase = 0xff; UINT8 mSlaveBase = 0xff; EFI_8259_MODE mMode = Efi8259ProtectedMode; UINT16 mProtectedModeMask = 0xffff; -UINT16 mLegacyModeMask = FixedPcdGet16(Pcd8259LegacyModeMask); +UINT16 mLegacyModeMask; UINT16 mProtectedModeEdgeLevel = 0x0000; -UINT16 mLegacyModeEdgeLevel = FixedPcdGet16(Pcd8259LegacyModeEdgeLevel); +UINT16 mLegacyModeEdgeLevel; // // Worker Functions @@ -123,8 +123,10 @@ Interrupt8259SetVectorBase ( IN UINT8 SlaveBase ) { - UINT8 Mask; + UINT8 Mask; + EFI_TPL OriginalTpl; + OriginalTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); // // Set vector base for slave PIC // @@ -137,7 +139,7 @@ Interrupt8259SetVectorBase ( // // Preserve interrtup mask register before initialization sequence - // because it will be cleared during intialization + // because it will be cleared during initialization // Mask = IoRead8 (LEGACY_8259_MASK_REGISTER_SLAVE); @@ -179,7 +181,7 @@ Interrupt8259SetVectorBase ( // // Preserve interrtup mask register before initialization sequence - // because it will be cleared during intialization + // because it will be cleared during initialization // Mask = IoRead8 (LEGACY_8259_MASK_REGISTER_MASTER); @@ -211,6 +213,8 @@ Interrupt8259SetVectorBase ( IoWrite8 (LEGACY_8259_CONTROL_REGISTER_SLAVE, LEGACY_8259_EOI); IoWrite8 (LEGACY_8259_CONTROL_REGISTER_MASTER, LEGACY_8259_EOI); + + gBS->RestoreTPL (OriginalTpl); return EFI_SUCCESS; } @@ -413,7 +417,7 @@ Interrupt8259GetVector ( OUT UINT8 *Vector ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -445,7 +449,7 @@ Interrupt8259EnableIrq ( IN BOOLEAN LevelTriggered ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -478,7 +482,7 @@ Interrupt8259DisableIrq ( IN EFI_8259_IRQ Irq ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -555,7 +559,7 @@ Interrupt8259EndOfInterrupt ( IN EFI_8259_IRQ Irq ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -588,6 +592,12 @@ Install8259 ( EFI_STATUS Status; EFI_8259_IRQ Irq; + // + // Initialze mask values from PCDs + // + mLegacyModeMask = PcdGet16 (Pcd8259LegacyModeMask); + mLegacyModeEdgeLevel = PcdGet16 (Pcd8259LegacyModeEdgeLevel); + // // Clear all pending interrupt //