From: Juergen Keil Subject: Re: [PATCH 3/4] rombios interface for HVM S3 Date: Mon, 2 Jun 2008 16:50:22 +0200 (CEST) Message-ID: <20080602145022.D946D4BDF4@imap.tools.intra> Reply-To: Juergen Keil Mime-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY=Troop_of_Antelope_791_000 Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: keir.fraser@eu.citrix.com Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Troop_of_Antelope_791_000 Content-Type: TEXT/plain; charset=us-ascii Content-MD5: +pgWRLSNKxbsvulBCDpM9A== Keir Fraser wrote: > On 2/6/08 14:45, "Juergen Keil" wrote: > > > For unknown reasons, HVM S3 resume hangs in the bios when trying to load > > the x_firmware_waking_vector from absolute address 0xEA01C (it hangs for > > access to address 0x10000, but doesn't hang for 0xfffe). > > It works on Intel because there we emulate the rombios, and our emulator > does not bother with segment limit checks in real mode. This is actually > more lenient than real hardware, hence an AMD CPU (which is directly > executing the rombios code) will fault on the access because it is at a > segment offset greater than 64kB. > > Your patch is good. Please re-submit with a fixed changeset comment and a > signed-off-by line. I'll then check it in. Ok, comment is updated, see the attachment. --Troop_of_Antelope_791_000 Content-Type: TEXT/plain; name="hvm-s3.patch"; charset=us-ascii; x-unix-mode=0755 Content-Description: hvm-s3.patch Content-MD5: 3Pl4uZXBboUgtzQdZJv2tA== HVM S3 resume hangs in bios on AMD cpus; support 20-bit firmware_waking_vector 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 now uses 20-bits (instead of 16) from the FACS standard firmware_waking_vector. Signed-off-by: Juergen keil diff --git a/tools/firmware/rombios/rombios.c b/tools/firmware/rombios/rombios.c --- a/tools/firmware/rombios/rombios.c +++ b/tools/firmware/rombios/rombios.c @@ -2311,10 +2311,31 @@ #define ACPI_FACS_OFFSET 0x10 /* S3 resume status in CMOS 0Fh shutdown status byte*/ +Bit32u facs_get32(offs) +Bit16u offs; +{ +ASM_START + push bp + mov bp, sp + + push ds + mov ax, #(ACPI_FACS_ADDRESS >> 4) + mov ds, ax + + mov bx, 4[bp] + mov ax, [bx] + mov dx, 2[bx] + pop ds + + pop bp +ASM_END +} + + void s3_resume() { - Bit16u s3_wakeup_vector; + Bit32u s3_wakeup_vector; extern Bit16u s3_wakeup_ip; extern Bit16u s3_wakeup_cs; extern Bit8u s3_resume_flag; @@ -2330,19 +2351,14 @@ } s3_resume_flag = 0; -ASM_START - mov ax, #0x0 - mov ds, ax -ASM_END - /* get x_firmware_waking_vector */ - s3_wakeup_vector = *((Bit16u*)(ACPI_FACS_ADDRESS+ACPI_FACS_OFFSET+24)); - if (s3_wakeup_vector == 0){ + s3_wakeup_vector = facs_get32(ACPI_FACS_OFFSET+24); + if (!s3_wakeup_vector) { /* get firmware_waking_vector */ - s3_wakeup_vector = *((Bit16u*)(ACPI_FACS_ADDRESS+ACPI_FACS_OFFSET+12)); - if (s3_wakeup_vector == 0){ + s3_wakeup_vector = facs_get32(ACPI_FACS_OFFSET+12); + if (!s3_wakeup_vector) { goto s3_out; - } + } } /* setup wakeup vector */ @@ -2350,13 +2366,6 @@ s3_wakeup_cs = s3_wakeup_vector >> 4; ASM_START - mov bx, [_s3_wakeup_cs] - mov dx, [_s3_wakeup_ip] - - mov ax, #0xF000 - mov ds, ax - mov [_s3_wakeup_cs], bx - mov [_s3_wakeup_ip], dx jmpf [_s3_wakeup_ip] ; S3 data --Troop_of_Antelope_791_000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Troop_of_Antelope_791_000--