X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=PcAtChipsetPkg%2F8259InterruptControllerDxe%2F8259.c;h=7d8265dbd1da59885114e7e5cad49e5ede5f6bdf;hp=9316c7ff0fba0009ba0641f953accc488f7d46c5;hb=e78aab9d2f1423f2ec4a82e0e36eff4dfd7c56ea;hpb=0547cf4b30b92b2909d279589c9c0c5e3337cbf2 diff --git a/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c b/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c index 9316c7ff0f..7d8265dbd1 100644 --- a/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c +++ b/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c @@ -1,14 +1,14 @@ -/**@file +/** @file This contains the installation function for the driver. - -Copyright (c) 2005 - 2009, 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 -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +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 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ @@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // Global for the Legacy 8259 Protocol that is produced by this driver // -EFI_LEGACY_8259_PROTOCOL m8259 = { +EFI_LEGACY_8259_PROTOCOL mInterrupt8259 = { Interrupt8259SetVectorBase, Interrupt8259GetMask, Interrupt8259SetMask, @@ -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 = 0x0000; +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,17 +592,23 @@ Install8259 ( EFI_STATUS Status; EFI_8259_IRQ Irq; + // + // Initialze mask values from PCDs + // + mLegacyModeMask = PcdGet16 (Pcd8259LegacyModeMask); + mLegacyModeEdgeLevel = PcdGet16 (Pcd8259LegacyModeEdgeLevel); + // // Clear all pending interrupt // for (Irq = Efi8259Irq0; Irq <= Efi8259Irq15; Irq++) { - Interrupt8259EndOfInterrupt (&m8259, Irq); + Interrupt8259EndOfInterrupt (&mInterrupt8259, Irq); } // // Set the 8259 Master base to 0x68 and the 8259 Slave base to 0x70 // - Status = Interrupt8259SetVectorBase (&m8259, PROTECTED_MODE_BASE_VECTOR_MASTER, PROTECTED_MODE_BASE_VECTOR_SLAVE); + Status = Interrupt8259SetVectorBase (&mInterrupt8259, PROTECTED_MODE_BASE_VECTOR_MASTER, PROTECTED_MODE_BASE_VECTOR_SLAVE); // // Set all 8259 interrupts to edge triggered and disabled @@ -612,8 +622,7 @@ Install8259 ( &m8259Handle, &gEfiLegacy8259ProtocolGuid, EFI_NATIVE_INTERFACE, - &m8259 + &mInterrupt8259 ); return Status; } -