flat assembler
Message board for the users of flat assembler.

Index > DOS > Enter/exit to ACPI S3 ( suspend to ram ) mode

Author
Thread Post new topic Reply to topic
rednight



Joined: 19 Nov 2008
Posts: 3
rednight 23 Jun 2009, 03:33
Dear all,
I have a Dell E4300 notebook.
And I'd like to enter/exit ACPI S3 mode in the pure DOS.
( My source codes as below. )
I ran the program, the power button was twinkling.
But after 5 secs, the screen was dark and display nothing.
More than 10 secs, the notebook was rebooted itself.

Could somebody can help me please ?
Thank you in advance.


Code:
Main Proc;
  
  S3_state:
  ;--------------------------

   S3_state_01:
    ; set RTC timer
     ; OUT 70h, Address   (link)
      ; IN AL, 71h   (read)  
      ; OUT 71h, AL   (write)
    
    ;write   seconds   
    mov  al, 00h; 00: Seconds (BCD)
    out  70h, al;
    
     mov  al, 0h; 
     out   71h, al;
     
      mov    al, 01h; 01: Seconds Alarm
      out    70h, al; 
    
       mov    al, 05h; Countdown 5 sec...
       out    71h, al;  
    
    ;write   minutes   
    mov    al, 02h;   02: Minutes 
    out   70h, al;  
    
     mov  al, 0h;
     out  71h, al;
      mov    al, 03h;    02: Minutes Alarm
      out    70h, al; 
    
       mov    al, 0h;   
       out    71h, al;   
    
    ;write   hours   
    mov    al, 04h;   04: Hours
    out    70h, al;   
    
     mov  al, 0h;
     out  71h, al;
     
      mov    al, 05h;   05: Hours Alarm
      out    70h, al;  
    
       mov    al, 0h;   
       out    71h, al;       
        
   ;--------------------------

   S3_state_02: 
    ; set Alarm Interrupt Enable 
                mov al, 0bh;    RTC_REGB  Register B (General Configuration)(LPC I/F  D31:F0)
                out 70h, al;  
    
                 in  al,71h; 
                 or al, 26h;     
     out 71h, al;       
     
   ;---------------------------------------

   S3_state_03:
    ; set RTC event enable
    mov eax, 8000f840h;   PMBASE - ACPI Base Address Register (D:31 F:0 OFF:40-43h)
     mov dx, 0cf8h;
     out dx, eax;
      mov dx, 0cfch;
      in eax, dx;
    
    and ax, 0ff80h;    Get the PMBase[15:7]
     add ax, 02h;   PMBASE + 02h = PM1_EN ( Power management 1 Enable Register )
      mov edx, eax;
    
    in ax, dx;
    or ax, 0500h;  
     out dx, ax;  
  
   
   ;-------------------------------------

   Main_Exit:
     
    ; enter S3 mode
                mov eax, 8000f840h;  
     mov dx, 0cf8h;
     out dx, eax;
      mov dx, 0cfch;
      in eax, dx;
       
    and ax, 0ff80h;     Get the PMBase[15:7]
     add ax, 04h;   PMBASE + 04h = PM1_CNT ( Power management 1 control )
      mov edx, eax;
        
  
    mov eax, 00003c00h  ;  Enable S3 mode
     out dx, eax;
    
   Exit_PGM:
    mov ah, 4ch;
    int 21h;
Main Endp;
    
Post 23 Jun 2009, 03:33
View user's profile Send private message Reply with quote
louislu



Joined: 05 Mar 2009
Posts: 4
louislu 21 Aug 2009, 02:22
When you S3 resume, BIOS will far jmp OS wackup vector of FACS table in ACPI spec. I think you can't inform DOS like that!
Post 21 Aug 2009, 02:22
View user's profile Send private message Reply with quote
louislu



Joined: 05 Mar 2009
Posts: 4
louislu 21 Aug 2009, 02:25
the main issue is how to let DOS can wait or jmp to next step when you resume from S3. Maybe you could do DOS TSR to do that!
Post 21 Aug 2009, 02:25
View user's profile Send private message Reply with quote
fonolite



Joined: 14 Dec 2005
Posts: 32
fonolite 01 Jun 2010, 02:51
to louislu,
Another question about this.

I wrote physical address of Exit_PGM into waking vector of FACS.
(Big Real Mode)
(Initial value of waking vector of FACS = 00000000h)

But, the screen is blank, too and no wakeup.

I also wrote any garbage value into waking vector of FACS,
and nothing happens, either.


Q1) When the system enters s3 sleep mode,
in where cpu registers like cr0 is saved?

Q2) What bios code will do for restoring procedure from sleeping states?

Q3) What should I prepare for this wakeup?



Too many questions about ACPI? Very Happy
Post 01 Jun 2010, 02:51
View user's profile Send private message Reply with quote
louislu



Joined: 05 Mar 2009
Posts: 4
louislu 05 Jul 2010, 05:31
1. All of CPU registers will be save and restore
2. bios will do devices (chipset, I/O, CPU MTRR, devices) register restoring.
3. bios may not recall VGA ROM again, because VGA driver will do that.
maybe the bios setup has a S3 VGA ROM item can select.
I am bios engineer, I can do DOS STR, but I modify bios better that modify DOS STR application.
Post 05 Jul 2010, 05:31
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 05 Jul 2010, 05:43
louislu wrote:

I am bios engineer[...]

Really?! Dude, that's cool.
Post 05 Jul 2010, 05:43
View user's profile Send private message Reply with quote
louislu



Joined: 05 Mar 2009
Posts: 4
louislu 05 Jul 2010, 05:46
OK explain about BIOS how to jump to this vector
Example
waking vector of FACS = 0000f3345h
bios will jump to f334h:0005h address.
so you need to know your "Enable S3 mode" address and transfer it. be careful the key point about the address must add 8.
and you code has to add a lot of NOP behind "Enable S3 mode". don't use loop, just nop...
Post 05 Jul 2010, 05:46
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.