ia64/xen-unstable

changeset 17778:fe60bf79d96f

rombios: S3 resume fixes.

On AMD cpus, HVM S3 resume was hanging in the bios when trying
to load the x_firmware_waking_vector from absolute
address 0xEA01C (that is, a segment offset greater than 64kB).

This change also now uses 20-bits (instead of 16) from the FACS
standard firmware_waking_vector.

Signed-off-by: Juergen Keil <jk@tools.de>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 02 16:05:07 2008 +0100 (2008-06-02)
parents 7155d82576a4
children 5c38568d90df
files tools/firmware/rombios/rombios.c
line diff
     1.1 --- a/tools/firmware/rombios/rombios.c	Mon Jun 02 16:00:45 2008 +0100
     1.2 +++ b/tools/firmware/rombios/rombios.c	Mon Jun 02 16:05:07 2008 +0100
     1.3 @@ -2311,10 +2311,31 @@ debugger_off()
     1.4  #define ACPI_FACS_OFFSET 0x10
     1.5  /* S3 resume status in CMOS 0Fh shutdown status byte*/
     1.6  
     1.7 +Bit32u facs_get32(offs)
     1.8 +Bit16u offs;
     1.9 +{
    1.10 +ASM_START
    1.11 +  push bp
    1.12 +  mov  bp, sp
    1.13 +
    1.14 +    push ds
    1.15 +    mov ax, #(ACPI_FACS_ADDRESS >> 4)
    1.16 +    mov ds, ax
    1.17 +
    1.18 +    mov bx, 4[bp]
    1.19 +    mov ax, [bx]
    1.20 +    mov dx, 2[bx]
    1.21 +    pop ds
    1.22 +
    1.23 +  pop  bp
    1.24 +ASM_END
    1.25 +}
    1.26 +
    1.27 +
    1.28  void 
    1.29  s3_resume()
    1.30  {
    1.31 -    Bit16u s3_wakeup_vector;
    1.32 +    Bit32u s3_wakeup_vector;
    1.33      extern Bit16u s3_wakeup_ip;
    1.34      extern Bit16u s3_wakeup_cs;
    1.35      extern Bit8u s3_resume_flag;
    1.36 @@ -2330,19 +2351,14 @@ ASM_END
    1.37      }
    1.38      s3_resume_flag = 0;
    1.39  
    1.40 -ASM_START
    1.41 -    mov ax, #0x0
    1.42 -    mov ds, ax
    1.43 -ASM_END
    1.44 -
    1.45      /* get x_firmware_waking_vector */
    1.46 -    s3_wakeup_vector = *((Bit16u*)(ACPI_FACS_ADDRESS+ACPI_FACS_OFFSET+24));
    1.47 -    if (s3_wakeup_vector == 0){
    1.48 +    s3_wakeup_vector = facs_get32(ACPI_FACS_OFFSET+24);
    1.49 +    if (!s3_wakeup_vector) {
    1.50          /* get firmware_waking_vector */
    1.51 -        s3_wakeup_vector = *((Bit16u*)(ACPI_FACS_ADDRESS+ACPI_FACS_OFFSET+12));
    1.52 -        if (s3_wakeup_vector == 0){
    1.53 +	s3_wakeup_vector = facs_get32(ACPI_FACS_OFFSET+12);
    1.54 +    	if (!s3_wakeup_vector) {
    1.55              goto s3_out;
    1.56 -        }
    1.57 +	}
    1.58      }
    1.59  
    1.60      /* setup wakeup vector */
    1.61 @@ -2350,13 +2366,6 @@ ASM_END
    1.62      s3_wakeup_cs = s3_wakeup_vector >> 4;
    1.63  
    1.64  ASM_START
    1.65 -    mov bx, [_s3_wakeup_cs]
    1.66 -    mov dx, [_s3_wakeup_ip]
    1.67 -
    1.68 -    mov ax, #0xF000
    1.69 -    mov ds, ax
    1.70 -    mov [_s3_wakeup_cs], bx
    1.71 -    mov [_s3_wakeup_ip], dx
    1.72      jmpf [_s3_wakeup_ip]
    1.73  
    1.74  ; S3 data