ia64/xen-unstable

changeset 18146:e9f24be7a515

rombios: S3 resume data must be in EBDA.

Rombios itself is read-only.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jul 24 13:44:08 2008 +0100 (2008-07-24)
parents 9d56e562a570
children 6604234057f6
files tools/firmware/rombios/rombios.c
line diff
     1.1 --- a/tools/firmware/rombios/rombios.c	Thu Jul 24 11:19:13 2008 +0100
     1.2 +++ b/tools/firmware/rombios/rombios.c	Thu Jul 24 13:44:08 2008 +0100
     1.3 @@ -738,7 +738,9 @@ typedef struct {
     1.4    // EBDA must be at most 768 bytes; it lives at 0x9fc00, and the boot 
     1.5    // device tables are at 0x9ff00 -- 0x9ffff
     1.6    typedef struct {
     1.7 -    unsigned char filler1[0x3D];
     1.8 +    unsigned char ebda_size;
     1.9 +    unsigned char s3_resume_flag;
    1.10 +    unsigned char filler1[0x3B];
    1.11  
    1.12      // FDPT - Can be splitted in data members if needed
    1.13      unsigned char fdpt0[0x10];
    1.14 @@ -757,6 +759,7 @@ typedef struct {
    1.15      upcall_t upcall;
    1.16      } ebda_data_t;
    1.17    
    1.18 +  #define EBDA_S3_RESUME_FLAG_OFFSET 1
    1.19    #define EbdaData ((ebda_data_t *) 0)
    1.20  
    1.21    // for access to the int13ext structure
    1.22 @@ -2356,47 +2359,40 @@ void
    1.23  s3_resume()
    1.24  {
    1.25      Bit32u s3_wakeup_vector;
    1.26 -    extern Bit16u s3_wakeup_ip;
    1.27 -    extern Bit16u s3_wakeup_cs;
    1.28 -    extern Bit8u s3_resume_flag;
    1.29 +    Bit16u s3_wakeup_ip, s3_wakeup_cs;
    1.30 +    Bit8u s3_resume_flag;
    1.31  
    1.32  ASM_START
    1.33      push ds
    1.34 -    mov ax, #0xF000
    1.35 +    push ax
    1.36 +    mov ax, #EBDA_SEG
    1.37      mov ds, ax
    1.38 +    mov al, [EBDA_S3_RESUME_FLAG_OFFSET]
    1.39 +    mov .s3_resume.s3_resume_flag[bp], al
    1.40 +    mov byte ptr [EBDA_S3_RESUME_FLAG_OFFSET], #0
    1.41 +    pop ax
    1.42 +    pop ds
    1.43  ASM_END
    1.44  
    1.45 -    if (s3_resume_flag!=CMOS_SHUTDOWN_S3){
    1.46 -        goto s3_out;
    1.47 -    }
    1.48 -    s3_resume_flag = 0;
    1.49 +    if (s3_resume_flag != CMOS_SHUTDOWN_S3)
    1.50 +        return;
    1.51  
    1.52      /* get x_firmware_waking_vector */
    1.53      s3_wakeup_vector = facs_get32(ACPI_FACS_OFFSET+24);
    1.54      if (!s3_wakeup_vector) {
    1.55          /* get firmware_waking_vector */
    1.56  	s3_wakeup_vector = facs_get32(ACPI_FACS_OFFSET+12);
    1.57 -    	if (!s3_wakeup_vector) {
    1.58 -            goto s3_out;
    1.59 -	}
    1.60 +    	if (!s3_wakeup_vector)
    1.61 +            return;
    1.62      }
    1.63  
    1.64 -    /* setup wakeup vector */
    1.65      s3_wakeup_ip = s3_wakeup_vector & 0xF;
    1.66      s3_wakeup_cs = s3_wakeup_vector >> 4;
    1.67  
    1.68  ASM_START
    1.69 -    jmpf [_s3_wakeup_ip]
    1.70 -
    1.71 -; S3 data
    1.72 -_s3_wakeup_ip:    dw 0x0a      
    1.73 -_s3_wakeup_cs:    dw 0x0      
    1.74 -_s3_resume_flag:  db 0   ; set at POST time by CMOS[0xF] shutdown status
    1.75 -ASM_END
    1.76 -
    1.77 -s3_out:
    1.78 -ASM_START
    1.79 -   pop ds 
    1.80 +    push .s3_resume.s3_wakeup_cs[bp]
    1.81 +    push .s3_resume.s3_wakeup_ip[bp]
    1.82 +    retf
    1.83  ASM_END
    1.84  }
    1.85  
    1.86 @@ -9871,9 +9867,9 @@ post:
    1.87    jnz not_s3_resume
    1.88  
    1.89    ;; set S3 resume flag
    1.90 -  mov dx, #0xF000
    1.91 +  mov dx, #EBDA_SEG
    1.92    mov ds, dx
    1.93 -  mov [_s3_resume_flag], AL
    1.94 +  mov [EBDA_S3_RESUME_FLAG_OFFSET], AL
    1.95    jmp normal_post
    1.96  
    1.97  not_s3_resume: