📄 halsci.c
字号:
mov edx, dwIOBase
add edx, 028h
out dx, ax
jmp short $+2
;; General Purpose Status (Offset 30-33)
mov edx, dwIOBase
add edx, 030h
out dx, eax
jmp short $+2
mov eax, 0h
;; Processor & PCI Bus Control (Offset 11-10)
mov edx, dwIOBase
add edx, 010h
out dx, ax
jmp short $+2
;;enable SMI
mov edx, dwIOBase
add edx, 24h
in ax, dx
or ax, dwGPIOSTS
;or ax, 0ffffh
out dx, ax
}
if ( ChipSetID == 0x30401106 )
{
// VT82C586
_asm
{
mov edx, dwIOBase
add edx, 05h
mov al, 20h
out dx, al
}
}
else
{
// Suspend to Disk, set to 28h
if(dwSusTo == 0)
{
_asm
{
mov edx, dwIOBase
;; Power Management Control (Offset 5)
add edx, 05h
mov al, 28h
out dx, al
}
//RETAILMSG(1, (TEXT("SCIPWM:Set suspend to disk.\n")));
}
else // Suspend to Ram, set to 24h
{
_asm
{
mov edx, dwIOBase
;; Power Management Control (Offset 5)
add edx, 05h
mov al, 24h
out dx, al
}
//RETAILMSG(1, (TEXT("SCIPWM:Set suspend to ram.\n")));
}
}
SC_Sleep(200);
}
}
BOOL GetIOBaseIRQ(DWORD dwGetIOBase, DWORD dwGetIRQ)
{
ULONG portBase, ACPI_Irq;
BOOL bFoundIt;
DWORD configid, deviceid;
WORD GenPurEV_Sts;
bFoundIt = FALSE;
for ( configid = 0x80000000; configid < 0x80010800; configid += 0x100 )
{
_asm
{
mov eax, configid
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
mov deviceid, eax
}
if (deviceid == 0x06861106) {
SB686A_configid=configid;
F0CFGID = configid;
CHIP = VT686;
}
else if(deviceid == 0x82311106)
{
F0CFGID = configid;
CHIP = VT8231;
}
if ( (deviceid == 0x30741106) || (deviceid == 0x31471106) || (deviceid == 0x31771106)|| (deviceid == 0x32271106) )
{
ChipSetID = deviceid;
// Enable ACPI IO Address, and Get ACPI IO Base, and ACPI Irq
if(deviceid == 0x31471106)
{
F0CFGID = F4CFGID = configid;
CHIP = VT8233;
}
if(deviceid == 0x31771106)
{
F0CFGID = F4CFGID = configid;
CHIP = VT8235;
}
else if(deviceid == 0x32271106)
{
F0CFGID = F4CFGID = configid;
CHIP = VT8237;
}
_asm
{
mov eax, configid
add ax, 080h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
mov ACPI_Irq, eax ; ACPI_IRQ's value : Offset80-83 bits
or eax, 00008000h
out dx, eax
mov eax, configid
add eax, 088h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
and eax, 0fffffffeh
mov portBase, eax
}
if (!AutoConfig)
{
WORD wtemp = 1 << IrqSetting;
ACPI_Irq = IrqSetting << 16;
_asm
{
mov eax, configid
add ax, 080h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
and eax, 0fff0ffffh
or eax, ACPI_Irq
out dx, eax
mov dx, 04d0h
in ax, dx
or ax, wtemp
out dx, ax
}
RETAILMSG(1, (TEXT("SCIPWM:Assign SCI IRQ:0x%x\r\n"), IrqSetting));
}
ACPI_Irq = ACPI_Irq >> 16;
ACPI_Irq = ACPI_Irq & 0x0000000f;
if (ACPI_Irq == 0)
{
DEBUGMSG(ZONE_ERROR, (TEXT("SCIPWM: Please Assign Irq for ACPI\r\n")));
return FALSE;
}
// Install IRQ sharing, dwSysIntr : return the sharing system IRQ
//bResult=InstallIRQShare((DWORD)ACPI_Irq, (PVOID)portBase, configid, &dwSysIntr);
//ACPI_Irq = (ULONG)dwSysIntr; // Assigned as sharing IRQ
bFoundIt = TRUE;
PWM_Config = configid;
dwGetIOBase=portBase;
dwGetIRQ=ACPI_Irq;
DEBUGMSG(ZONE_INIT, (TEXT("SCIPWM: Irq 0x%X, IOBase 0x%X\r\n"), ACPI_Irq, portBase));
break;
}
if ( (deviceid == 0x30571106) || (deviceid == 0x30501106) || (deviceid == 0x30401106)
|| (deviceid == 0x82351106 ) )
{
if(deviceid == 0x30571106)
{
F4CFGID = configid;
}
else if(deviceid == 0x82351106)
{
F4CFGID = configid;
}
ChipSetID = deviceid;
// Enable ACPI IO Address, and Get ACPI IO Base, and ACPI Irq
if(dwSLPBTN == 1)
{
_asm
{
mov eax, configid
add ax, 040h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
mov ACPI_Irq, eax
;or eax, 00008000h
or eax, 00008040h ;Enable sleep button
out dx, eax
}
}
else
{
_asm
{
mov eax, configid
add ax, 040h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
mov ACPI_Irq, eax
or eax, 00008000h
out dx, eax
}
}
_asm{
mov eax, configid
add eax, 048h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
and eax, 0fffffffeh
mov portBase, eax
}
// For VT82C586B Rev. 3040E
if ( (deviceid == 0x30401106) && ( (portBase == 0) || (portBase == 0xfffffffe) ) )
{
_asm{
mov eax, configid
add eax, 048h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
and eax, 0fffffffeh
mov portBase, eax
}
}
if (!AutoConfig)
{
WORD wtemp = 1 << IrqSetting;
ACPI_Irq = IrqSetting << 16;
_asm
{
mov eax, configid
add ax, 040h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
and eax, 0fff0ffffh
or eax, ACPI_Irq
out dx, eax
mov dx, 04d0h
in ax, dx
or ax, wtemp
out dx, ax
}
RETAILMSG(1, (TEXT("SCIPWM:Assign SCI IRQ:0x%x\r\n"), IrqSetting));
}
ACPI_Irq = ACPI_Irq >> 16;
ACPI_Irq = ACPI_Irq & 0x0000000f;
if (ACPI_Irq == 0)
{
DEBUGMSG(ZONE_ERROR, (TEXT("SCIPWM: Please Assign Irq for ACPI\r\n")));
return FALSE;
}
// Install IRQ sharing, dwSysIntr : return the sharing system IRQ
// bResult=InstallIRQShare((DWORD)ACPI_Irq, (PVOID)portBase, configid, &dwSysIntr);
// ACPI_Irq = (ULONG)dwSysIntr; // Assigned as sharing IRQ
bFoundIt = TRUE;
PWM_Config = configid;
dwGetIOBase=portBase;
dwGetIRQ=ACPI_Irq;
DEBUGMSG(ZONE_INIT, (TEXT("SCIPWM: Irq 0x%X, IOBase 0x%X\r\n"), ACPI_Irq, portBase));
break;
}
}
dwIOBase=portBase;
dwIrqId=ACPI_Irq;
dwConfigId=configid;
// ACPowerLoss(dwALAR);
// Enable SCI
_asm
{
mov edx, dwIOBase
add edx, 04h
in al, dx
or al, 01h ; Enable SCI
out dx, al
mov edx, dwIOBase
add edx, 24h
in ax, dx
;and ax, 0fffeh
and ax, 0ff00h
out dx, al ; Disable ALL GPIO to generate SMI
mov edx, dwIOBase ;clear current status offset 0h-1h & 20h-21h
mov ax,0xffff ;
out dx,ax
add dx,20h
out dx,ax
}
//Check current general purpose status
do {
_asm
{
mov edx, dwIOBase
add edx, 20h
in ax, dx
mov GenPurEV_Sts, ax ;GenPurEV_Sts : Offset21-20 bits
out dx, ax
}
DEBUGMSG(ZONE_IO, (TEXT("SCIPWM: General Purpose status:%04XH\r\n"),GenPurEV_Sts));
} while(GenPurEV_Sts);
if(dwSLPBTN == 1)
{
_asm {
mov edx, dwIOBase ;enable pwr button
add dx,3h
mov al,0x3
out dx,al
}
}
else
{
_asm {
mov edx, dwIOBase ;enable pwr button
add dx,3h
mov al,0x1
out dx,al
}
}
_asm {
mov edx, dwIOBase
add edx, 22h
in ax, dx
or ax, 0401h ;THERM|EXT_SMI
out dx, ax
}
return bFoundIt;
}
//
// Request SysIntr from OAL given an IRQ.
//
void DllPowerUp(DWORD dwIOBase)
{
WORD GenPurEV_Sts;
_asm
{
mov edx, dwIOBase
add edx, 04h
in al, dx
or al, 01h ; Enable SCI
out dx, al
mov edx, dwIOBase
add edx, 24h
in ax, dx
;and ax, 0fffeh
and ax, 0ff00h
out dx, al ; Disable ALL GPIO to generate SMI
mov edx, dwIOBase ;clear current status offset 0h-1h & 20h-21h
mov ax,0xffff ;
out dx,ax
add dx,20h
out dx,ax
}
//Check current general purpose status
do {
_asm
{
mov edx, dwIOBase
add edx, 20h
in ax, dx
mov GenPurEV_Sts, ax
out dx, ax
}
DEBUGMSG(ZONE_IO, (TEXT("SCIPWM: General Purpose status:%04XH\r\n"),GenPurEV_Sts));
} while(GenPurEV_Sts);
_asm {
mov edx, dwIOBase ;enable pwr button
add dx,3h
mov al,0x1
out dx,al
}
_asm {
mov edx, dwIOBase
add edx, 22h
in ax, dx
or ax, 0401h ;THERM|EXT_SMI ????
out dx, ax
}
if ( ChipSetID == 0x30401106 && dwGPIOACK == 1 )
{
// Ack GPO 3
// Set GPIO3 Dir
_asm
{
mov edx, dwIOBase
add edx, 40h
mov al, 08h
out dx, al
}
}
if (ChipSetID == 0x30571106 && dwGPIOACK == 2)
{
//Initialize GPO10
_asm
{
;Set GPO10 : rx74[4]=1, rx76[2]=0
mov eax, SB686A_configid
mov al,74h
mov edx, 0cf8h
out dx, eax
mov edx, 0cfch
in eax, dx
or ax, 0010h ; rx74[4]=1
and eax, 0fffbffffh ; rx76[2]=0
out dx,eax
}
}
}
void DllGPIO(DWORD dwGPIOACK)
{
// For Mr. Wu's Case, GPO 3 ACK, GPI 4 REQ (MVP3+586B)
if ( ChipSetID == 0x30401106 && dwGPIOACK == 1 )
{
RETAILMSG(1, (TEXT("SCIPWM: Trigger ACK signal (GPO 3)")));
// Ack GPO 3
// Set GPIO3 Dir
_asm
{
mov edx, dwIOBase
add edx, 40h
mov al, 08h
out dx, al
}
// Set GPO3 Low
_asm
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -