/* * * Copyright (c) Microsoft Corporation. All rights reserved. * * VLSI.C - VLSI Wildcat PCI chipset routines. * * Notes: * Algorithms from VLSI VL82C596/7 spec. * */ #include "local.h" #define NUM_VLSI_IRQ (sizeof(rgbIndexToIRQ)/sizeof(rgbIndexToIRQ[0])) #define INDEX_UNUSED ((ULONG)-1) #ifdef ALLOC_DATA_PRAGMA #pragma data_seg() #pragma const_seg() #endif const UCHAR rgbIndexToIRQ[] = { 3, 5, 9, 10, 11, 12, 14, 15 }; #ifdef ALLOC_PRAGMA #pragma alloc_text(INIT, VLSIValidateTable) #endif //ALLOC_PRAGMA /**************************************************************************** * * VLSISetIRQ - Set a VLSI PCI link to a specific IRQ * * Exported. * * ENTRY: bIRQNumber is the new IRQ to be used. * * bLink is the Link to be set. * * EXIT: Standard PCIMP return value. * ***************************************************************************/ PCIMPRET CDECL VLSISetIRQ(UCHAR bIRQNumber, UCHAR bLink) { ULONG ulNewIRQIndex; ULONG rgbIRQSteering[NUM_IRQ_PINS]; ULONG ulMask; ULONG ulUnusedIndex; ULONG ulVLSIRegister; ULONG ulIRQIndex; ULONG i; // // Make link number 0 based, and validate. // bLink--; if (bLink > 3) { return(PCIMP_INVALID_LINK); } // // Find the VLSI index of the new IRQ. // if (bIRQNumber) { // // Look through the list of valid indicies. // for (ulNewIRQIndex=0; ulNewIRQIndex> (i * 4); if ((ulVLSIRegister & (1 << (ulIRQIndex + 16))) != 0) { rgbIRQSteering[i] = ulIRQIndex; } else { rgbIRQSteering[i] = INDEX_UNUSED; } } // // Update the IRQ Mapping with the new IRQ. // rgbIRQSteering[bLink] = ulNewIRQIndex; // // Find an unused IRQ index. // for (ulUnusedIndex=0; ulUnusedIndex 3) { return(PCIMP_INVALID_LINK); } // // Read in the VLSI Interrupt Steering Register. // ulVLSIRegister=ReadConfigUchar(bBusPIC, bDevFuncPIC, 0x74); // // Find the link's IRQ value. // ulIndex = (ulVLSIRegister >> (bLink*4)) & 0x7; bIRQ = rgbIndexToIRQ[ulIndex]; // // Make sure the IRQ is marked as in use. // if ((ulVLSIRegister & (1 << (ulIndex + 16))) == 0) { bIRQ = 0; } // // Set the return buffer. // *pbIRQNumber = bIRQ; return(PCIMP_SUCCESS); } /**************************************************************************** * * VLSISetTrigger - Set the IRQ triggering values for the VLSI. * * Exported. * * ENTRY: ulTrigger has bits set for Level triggered IRQs. * * EXIT: Standard PCIMP return value. * ***************************************************************************/ PCIMPRET CDECL VLSISetTrigger(ULONG ulTrigger) { ULONG ulAssertionRegister; ULONG ulPMAssertionRegister; ULONG i; // // Read in the Interrupt Assertion Level register. // ulAssertionRegister = ReadConfigUlong(bBusPIC, bDevFuncPIC, 0x5C); // // Clear off the old edge/level settings. // ulAssertionRegister &= ~0xff; // // For each VLSI interrupt... // for (i=0; i0x04) { return(PCIMP_FAILURE); } return(PCIMP_SUCCESS); }