www.pudn.com > hpbios.rar > 686_FDC.ASX


//---------------------------------------------------------------------------- 
//Rev    Date     Name   Description 
//---------------------------------------------------------------------------- 
//R03	03/01/00  GAR	Fixed unreport I/O of FDC 
//R02	05/11/99  ADS	For HCT 8.1 Convert PnP/APM to ACPI fail 
//R01	03/30/99  RIC	Fixed that Win98 Device Node report error in disabling 
//			VIA 686 Superio in BIOS Setup. 
//R00	12/02/98  ADS	 Start of Definitions for VT686 super I/O device 
 
//*************************************************************************// 
//*   FDC DEVICE							  *// 
//*************************************************************************// 
Device(FDC0)	{ 			// Floppy Disk controller 
        Name(_HID, EISAID("PNP0700")) 	// PnP Device ID 
        Method(_STA,0)	{ 		// Status of the Floppy disk controller 
//R02                If(LNot(\_SB.PCI0.PIB.EP3C)) { 
//R02                        Return(0x00)	// Not present 
//R02                }  // end if 
//R02 start 
		Store(0x8000[VT686_DEV_FUN0]84, PIND) 
		Store(PDAT, Local0) 
		And(Local0, 0x00000100, Local0)		// VT686 Function 0 Rx85 bit 0 
		If(LNot(Local0)) { 
			Return(0x00) 
		}  //end if 
//R02 end 
 
                Else { 
			ENFG() 			// Enter Config Mode 
			Store(CRC2, Local0)		//Read FSR register 
			And(Local0, 0x10, Local0)	//Read bit4 FDC enable 
			If(LNotEqual(Local0, 0x00)){ 
                                EXFG() 
				Return(0x0F)		//present, enable, UI, functioning 
			}  // end if 
			Else { 
                		//Store(CRC3, Local1)     // Read FAR register 
                		//If (LNotEqual(Local1, 0x00)) { 
                                //	EXFG() 
                                //	Return(0x0D)		//present, disable 
				//}  // end if 
                		Store(CRC3, Local1)     // Read FAR register //R01 - starts 
                		If (LNotEqual(Local1, 0x00)) { 
                                	EXFG() 
                                	Return(0x0D)		//present, disable 
				}  // end if				      
				else {					     //R01 - ends 
					EXFG() 
        	                        Return(0x00)		//disable 
				} 
                        }  // end else 
                }  // end else 
        }  // end of _STA method 
 
        Method(_DIS,0)	{ 
			ENFG() 				// Enter Config Mode 
			Store(CRC2, Local0)		//Read FSR register 
			And(Local0, 0xEF, Local0)	//Read bit4 FDC enable 
			Store(Local0, CRC2)  		//Disable 
			EXFG() 
 
        }  //end _DIS method 
 
        Method(_CRS,0)	{ 			//Current FDC Resource 
		Name(BUFF, ResourceTemplate(){ 
//R03			IO( 
//R03				Decode16,	// FIO1._DEC 
//R03				0x03F2,		// Min base I/O addr, FIO1._MIN 
//R03				0x03F2,		// Max base I/O addr, FIO1._MAX 
//R03				0x02,		// Base alignment, FIO1._ALN  
//R03				0x04,		// Number of contig I/O ports, FIO1._LEN 
//R03                                FIO1		// Name 
//R03				) 
//R03 - start 
			IO( 
				Decode16,	// FIO2._DEC 
				0x03F0,		// Min base I/O addr, FIO2._MIN 
				0x03F0,		// Max base I/O addr, FIO2._MAX 
				0x08,		// Base alignment, FIO2._ALN  
				0x06,		// Number of contig I/O ports, FIO2._LEN 
                                FIO1		// Name 
				) 
//R03 - end 
			IO( 
				Decode16,	// FIO2._DEC 
				0x03F7,		// Min base I/O addr, FIO2._MIN 
				0x03F7,		// Max base I/O addr, FIO2._MAX 
				0x01,		// Base alignment, FIO2._ALN  
				0x01,		// Number of contig I/O ports, FIO2._LEN 
                                FIO2		// Name 
				) 
                        IRQNoFlags( 
                                FIRQ 
				) 
				{0x06}      	// IRQ 6, FIRQ._INT 
			DMA( 
				Compatibility,	// Channel Speed, FDMA._TYP 
				BusMaster,	// Bus Master, FDMA._BM 
				Transfer8,	// Transfer Size, FDMA._SIZ 
                                FDMA		// Name 
				) 
				{0x02}		// DMA channel 2, FDMA._DMA   
			} // end Resource Template 
		) // end buffer BUFF 
 
		Return(BUFF) 			// Return BUFF 
        }  // end _CRS method 
 
	Name(_PRS, ResourceTemplate(){ 
//R03		IO( 
//R03			Decode16,	// FIO1._DEC 
//R03			0x03F2,		// Min base I/O addr, FIO1._MIN 
//R03			0x03F2,		// Max base I/O addr, FIO1._MAX 
//R03			0x02,		// Base alignment, FIO1._ALN  
//R03			0x04,		// Number of contig I/O ports, FIO1._LEN 
//R03                        FIO1		// Name 
//R03		) 
//R03 - start 
		IO( 
			Decode16,	// FIO1._DEC 
			0x03F0,		// Min base I/O addr, FIO1._MIN 
			0x03F0,		// Max base I/O addr, FIO1._MAX 
			0x08,		// Base alignment, FIO1._ALN  
			0x06,		// Number of contig I/O ports, FIO1._LEN 
                        FIO1		// Name 
		) 
//R03 - end 
		IO( 
			Decode16,	// FIO2._DEC 
			0x03F7,		// Min base I/O addr, FIO2._MIN 
			0x03F7,		// Max base I/O addr, FIO2._MAX 
			0x01,		// Base alignment, FIO2._ALN  
			0x01,		// Number of contig I/O ports, FIO2._LEN 
                        FIO2		// Name 
		) 
                IRQNoFlags( 
                	FIRQ 
		) 
			{0x06}      	// IRQ 6, FIRQ._INT 
		DMA( 
			Compatibility,	// Channel Speed, FDMA._TYP 
			BusMaster,	// Bus Master, FDMA._BM 
			Transfer8,	// Transfer Size, FDMA._SIZ 
                        FDMA		// Name 
		) 
			{0x02}		// DMA channel 2, FDMA._DMA   
		} // end Resource Template 
	) // end of _PRS 
 
        Method(_SRS,1)	{			//Set Resource 
                CreateByteField (Arg0, 0x02, IOLO)      //IO Port Low Byte (F2) 
                CreateByteField (Arg0, 0x03, IOHI)      //IO Port High Byte (03) 
                CreateWordField (Arg0, 0x11, IRQ0)      //IRQ  
                CreateByteField (Arg0, 0x14, DMA0) 	//DMA 
 
                ENFG()                  // Enter Config Mode 
 
                Store(CRC2,Local0)      // Disable FDC 
                And(Local0,0xEF,Local1) 
                Store(Local1,CRC2) 
 
		Store(IOLO, Local0)			//Set IO 
		ShiftRight(Local0, 0x02, Local0)	//FDC IO: CRC3 
		And(Local0, 0xFC, Local0)		//Bit7-2 = ADR9-4 
		Store(IOHI, Local1)			//Bit1-0 = 00 
		ShiftLeft(Local1, 0x06, Local1) 
		Or(Local0, Local1, Local0) 
                Store(Local0, CRC3)         
 
                FindSetRightBit(IRQ0, Local0)		//Set IRQ 
		If(LGreater(Local0, 0x00)) { 
			Decrement(Local0) 
		} 
		Store(Local0, \_SB.PCI0.PIB.FLIR)      // Set IRQ: 6 
 
		FindSetRightBit(DMA0, Local0)		//Set DMA 
		If(LGreater(Local0, 0x00)) { 
			Decrement(Local0) 
		} 
                Store(Local0, \_SB.PCI0.PIB.FLDA)      // Set DMA: channel 2 
 
                Store(CRC2,Local0)      // Enable FDC 
                Or(Local0,0x10,Local1) 
                Store(Local1,CRC2) 
 
                EXFG()                  // Exit Config Mode 
 
        }  // end of _SRS method 
 
}    // end of FDC0 device