I don’t see how this could really be the issue in and of themselves, but
your problem made me think of these, which I read a while ago:
http://support.microsoft.com/kb/283649
http://www.microsoft.com/whdc/archive/BIOSAML.mspx
Basically, what they say is that access to 0x70 & 0x71 from ACPI AML
code are blocked on XP and forward, and an attempt to access these ports
from AML would result in an entry in the system event log, along the
lines of:
“Source: ACPI Category: None Type: Error Event ID: 5 User: N/A Computer:
Machine_Name Description: AMLI: ACPI BIOS is attempting to write to an
illegal IO port address (0xnnnn), which lies in the 0xXXXX - 0xYYYY
protected address range. This could lead to system instability. Please
contact your system vendor for technical assistance.”
As you’re not using AML, this isn’t your problem, but given that it is
possible for a chipset to cause I/O to a port to result in an SMI, I
thought I would mention this, mostly to see if anyone has any thoughts
on the subject. At least for the Intel chipsets with which I am
reasonably familiar, buried somewhere in the usually 800 or so pages
that document whatever ICH a platform happens to use, there’s a way to
redirect most anything to an SMI. Perhaps there’s something ACPI
related going on here. I’m not suggesting that there is; I really have
no idea. As there is really not much to the code involved, I am kind of
wondering what’s going on here. Historically, the RTC has been a source
of instability and exploit, and SMM has been used by firmware vendors
for things like power management, error correction, hardware emulation,
and in the implementation of other really, really nasty hacks, so,
barring any better ideas, which I think probably are, I don’t think it
unreasonable to wonder if there’s something like this going on. That
being said, I would definitely explore this as a possibility only if no
better ideas surface, because I don’t see it as particularly likely, but
also because, reasonably speaking, there’s no way to investigate this
one without a JTAG emulator or some other expensive form of hardware
assisted debugging.
Good luck,
mm
Mark S. Edwards wrote:
Too many years since I did anything like this to quickly spot anything
wrong, but why aren’t you using the native functions which are portable ?
READ_PORT_UCHAR()
WRITE_PORT_UCHAR()
etc
Using the above will get rid of any assembler mistakes you might have made.
Mark.
At 07:29 AM 3/7/2008, xxxxx@yahoo.com wrote:
> Thanks Tim and Jake!!!
> Sorry for late reply.
>
> This is a piece of code with which i am trying to write to cmos memory.
>
> unsigned char index = 16;
> unsigned char buff=0,PrevBuff=0;
> KeAcquireSpinLock(pspin_lock,&cIrq);
>
> //Read
> _asm {
> xor ax,ax /* Clear Accumulator*/
> cli /* Clear interrupts*/
> mov al,index /* move index address*/
> out 0x70,al /* copy address to CMOS register*/
> nop
> nop
> nop /* Wait a bit for response*/
> in al,0x7 1 /* Fetch 1 byte to al*/
> sti /* Enable interrupts*/
> mov buff,al
> }
> PrevBuff = buff;
> buff=0x3F;
>
> //Write
> _asm {
> xor ax,ax /* zero register*/
> cli
> mov al,index /* move index address*/
> mov ah,buff /* copy value to ah*/
> out 0x70,al /* copy address to CMOS register*/
> nop
> nop
> nop
> mov al,ah /* move value to al*/
> out 0x71,al /* write 1 byte to CMOS*/
> sti /* Enable interrupts*/
> }
> KeReleaseSpinLock(pspin_lock,cIrq);
>
> When i write to cmos memory at offset 16 and again when i read back
> from same offset i am not getting new value.
> I have added sufficient delay and lock for the same.
>
> I have also try to add delay upto 3 seconds using
> KeDelayExecutionThread ,but it won’t work.
> Let me know if i am missing anything.
>
> Thanks in anticipation!!!
>
> —