ia64/xen-unstable

changeset 17388:b2a63fc4fac9

x86: Adjust ACPI PM1a/b event/control information retrieval

Restore the fallback to v1 fields which got removed as a side effect
of c/s 17249. Additionally, use the correct width from the tables
rather than hardcoded values. Also make the copying code more compact
by using a macro, and print the results earlier to have better
indication whether subsequent failures lead to the information
retrieved getting invalidated.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Apr 04 13:03:57 2008 +0100 (2008-04-04)
parents 585e3d56aded
children 7d617282f18e
files xen/arch/x86/acpi/boot.c
line diff
     1.1 --- a/xen/arch/x86/acpi/boot.c	Fri Apr 04 13:00:26 2008 +0100
     1.2 +++ b/xen/arch/x86/acpi/boot.c	Fri Apr 04 13:03:57 2008 +0100
     1.3 @@ -374,6 +374,18 @@ extern u32 pmtmr_ioport;
     1.4  #endif
     1.5  
     1.6  #ifdef CONFIG_ACPI_SLEEP
     1.7 +#define acpi_fadt_copy_address(dst, src, len) do {			\
     1.8 +	if (fadt->header.revision >= FADT2_REVISION_ID)			\
     1.9 +		acpi_sinfo.dst##_blk = fadt->x##src##_block;		\
    1.10 +	if (!acpi_sinfo.dst##_blk.address) {				\
    1.11 +		acpi_sinfo.dst##_blk.address      = fadt->src##_block;	\
    1.12 +		acpi_sinfo.dst##_blk.space_id     = ACPI_ADR_SPACE_SYSTEM_IO; \
    1.13 +		acpi_sinfo.dst##_blk.bit_width    = fadt->len##_length << 3; \
    1.14 +		acpi_sinfo.dst##_blk.bit_offset   = 0;			\
    1.15 +		acpi_sinfo.dst##_blk.access_width = 0;			\
    1.16 +	} \
    1.17 +} while (0)
    1.18 +
    1.19  /* Get pm1x_cnt and pm1x_evt information for ACPI sleep */
    1.20  static void __init
    1.21  acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
    1.22 @@ -388,37 +400,18 @@ acpi_fadt_parse_sleep_info(struct acpi_t
    1.23  		goto bad;
    1.24  	rsdp = __va(rsdp_phys);
    1.25  
    1.26 -	if (fadt->header.revision >= FADT2_REVISION_ID) {
    1.27 -		memcpy(&acpi_sinfo.pm1a_cnt_blk, &fadt->xpm1a_control_block,
    1.28 -			sizeof(struct acpi_generic_address));
    1.29 -		memcpy(&acpi_sinfo.pm1b_cnt_blk, &fadt->xpm1b_control_block,
    1.30 -			sizeof(struct acpi_generic_address));
    1.31 -		memcpy(&acpi_sinfo.pm1a_evt_blk, &fadt->xpm1a_event_block,
    1.32 -			sizeof(struct acpi_generic_address));
    1.33 -		memcpy(&acpi_sinfo.pm1b_evt_blk, &fadt->xpm1b_event_block,
    1.34 -			sizeof(struct acpi_generic_address));
    1.35 -	} else {
    1.36 -		acpi_sinfo.pm1a_cnt_blk.address = fadt->pm1a_control_block;
    1.37 -		acpi_sinfo.pm1b_cnt_blk.address = fadt->pm1b_control_block;
    1.38 -		acpi_sinfo.pm1a_evt_blk.address = fadt->pm1a_event_block;
    1.39 -		acpi_sinfo.pm1b_evt_blk.address = fadt->pm1b_event_block;
    1.40 -		acpi_sinfo.pm1a_cnt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
    1.41 -		acpi_sinfo.pm1b_cnt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
    1.42 -		acpi_sinfo.pm1a_evt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
    1.43 -		acpi_sinfo.pm1b_evt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
    1.44 -		acpi_sinfo.pm1a_cnt_blk.bit_width = 16;
    1.45 -		acpi_sinfo.pm1b_cnt_blk.bit_width = 16;
    1.46 -		acpi_sinfo.pm1a_evt_blk.bit_width = 16;
    1.47 -		acpi_sinfo.pm1b_evt_blk.bit_width = 16;
    1.48 -		acpi_sinfo.pm1a_cnt_blk.bit_offset = 0;
    1.49 -		acpi_sinfo.pm1b_cnt_blk.bit_offset = 0;
    1.50 -		acpi_sinfo.pm1a_evt_blk.bit_offset = 0;
    1.51 -		acpi_sinfo.pm1b_evt_blk.bit_offset = 0;
    1.52 -		acpi_sinfo.pm1a_cnt_blk.access_width = 0;
    1.53 -		acpi_sinfo.pm1b_cnt_blk.access_width = 0;
    1.54 -		acpi_sinfo.pm1a_evt_blk.access_width = 0;
    1.55 -		acpi_sinfo.pm1b_evt_blk.access_width = 0;
    1.56 -	}
    1.57 +	acpi_fadt_copy_address(pm1a_cnt, pm1a_control, pm1_control);
    1.58 +	acpi_fadt_copy_address(pm1b_cnt, pm1b_control, pm1_control);
    1.59 +	acpi_fadt_copy_address(pm1a_evt, pm1a_event, pm1_event);
    1.60 +	acpi_fadt_copy_address(pm1b_evt, pm1b_event, pm1_event);
    1.61 +
    1.62 +	printk(KERN_INFO PREFIX
    1.63 +	       "ACPI SLEEP INFO: pm1x_cnt[%"PRIx64",%"PRIx64"], "
    1.64 +	       "pm1x_evt[%"PRIx64",%"PRIx64"]\n",
    1.65 +	       acpi_sinfo.pm1a_cnt_blk.address,
    1.66 +	       acpi_sinfo.pm1b_cnt_blk.address,
    1.67 +	       acpi_sinfo.pm1a_evt_blk.address,
    1.68 +	       acpi_sinfo.pm1b_evt_blk.address);
    1.69  
    1.70  	/* Now FACS... */
    1.71  	if (fadt->header.revision >= FADT2_REVISION_ID)
    1.72 @@ -461,13 +454,6 @@ acpi_fadt_parse_sleep_info(struct acpi_t
    1.73  	}
    1.74  
    1.75  	printk(KERN_INFO PREFIX
    1.76 -	       "ACPI SLEEP INFO: pm1x_cnt[%"PRIx64",%"PRIx64"], "
    1.77 -	       "pm1x_evt[%"PRIx64",%"PRIx64"]\n",
    1.78 -	       acpi_sinfo.pm1a_cnt_blk.address,
    1.79 -	       acpi_sinfo.pm1b_cnt_blk.address,
    1.80 -	       acpi_sinfo.pm1a_evt_blk.address,
    1.81 -	       acpi_sinfo.pm1b_evt_blk.address);
    1.82 -	printk(KERN_INFO PREFIX
    1.83  	       "                 wakeup_vec[%"PRIx64"], vec_size[%x]\n",
    1.84  	       acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
    1.85  	return;