ia64/xen-unstable

changeset 10018:8df6a7308178

[IA64] Correctly set aml code of domU dsdt.

Previously it was corrupted (bad length).

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Wed May 17 15:53:00 2006 -0600 (2006-05-17)
parents 2de2952715d9
children 41e7549d7df9
files xen/arch/ia64/xen/dom_fw.c
line diff
     1.1 --- a/xen/arch/ia64/xen/dom_fw.c	Wed May 17 15:52:55 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Wed May 17 15:53:00 2006 -0600
     1.3 @@ -541,7 +541,7 @@ struct fake_acpi_tables {
     1.4  	struct fadt_descriptor_rev2 fadt;
     1.5  	struct facs_descriptor_rev2 facs;
     1.6  	struct acpi_table_header dsdt;
     1.7 -	u8 aml[16];
     1.8 +	u8 aml[8 + 11 * MAX_VIRT_CPUS];
     1.9  	struct acpi_table_madt madt;
    1.10  	struct acpi_table_lsapic lsapic[MAX_VIRT_CPUS];
    1.11  	u8 pm1a_evt_blk[4];
    1.12 @@ -561,6 +561,7 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.13  	struct acpi_table_madt *madt = &tables->madt;
    1.14  	struct acpi_table_lsapic *lsapic = tables->lsapic;
    1.15  	int i;
    1.16 +	int aml_len;
    1.17  
    1.18  	memset(tables, 0, sizeof(struct fake_acpi_tables));
    1.19  
    1.20 @@ -629,7 +630,6 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.21  	/* setup DSDT with trivial namespace. */ 
    1.22  	strncpy(dsdt->signature, DSDT_SIG, 4);
    1.23  	dsdt->revision = 1;
    1.24 -	dsdt->length = sizeof(struct acpi_table_header) + sizeof(tables->aml);
    1.25  	strcpy(dsdt->oem_id, "XEN");
    1.26  	strcpy(dsdt->oem_table_id, "Xen/ia64");
    1.27  	strcpy(dsdt->asl_compiler_id, "XEN");
    1.28 @@ -637,15 +637,33 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.29  
    1.30  	/* Trivial namespace, avoids ACPI CA complaints */
    1.31  	tables->aml[0] = 0x10; /* Scope */
    1.32 -	tables->aml[1] = 0x12; /* length/offset to next object */
    1.33 -	strncpy((char *)&tables->aml[2], "_SB_", 4);
    1.34 +	tables->aml[1] = 0x40; /* length/offset to next object (patched) */
    1.35 +	tables->aml[2] = 0x00;
    1.36 +	strncpy((char *)&tables->aml[3], "_SB_", 4);
    1.37  
    1.38  	/* The processor object isn't absolutely necessary, revist for SMP */
    1.39 -	tables->aml[6] = 0x5b; /* processor object */
    1.40 -	tables->aml[7] = 0x83;
    1.41 -	tables->aml[8] = 0x0b; /* next */
    1.42 -	strncpy((char *)&tables->aml[9], "CPU0", 4);
    1.43 -
    1.44 +	aml_len = 7;
    1.45 +	for (i = 0; i < 3; i++) {
    1.46 +		unsigned char *p = tables->aml + aml_len;
    1.47 +		p[0] = 0x5b; /* processor object */
    1.48 +		p[1] = 0x83;
    1.49 +		p[2] = 0x0b; /* next */
    1.50 +		p[3] = 'C';
    1.51 +		p[4] = 'P';
    1.52 +		snprintf ((char *)p + 5, 3, "%02x", i);
    1.53 +		if (i < 16)
    1.54 +			p[5] = 'U';
    1.55 +		p[7] = i;	/* acpi_id */
    1.56 +		p[8] = 0;	/* pblk_addr */
    1.57 +		p[9] = 0;
    1.58 +		p[10] = 0;
    1.59 +		p[11] = 0;
    1.60 +		p[12] = 0;	/* pblk_len */
    1.61 +		aml_len += 13;
    1.62 +	}
    1.63 +	tables->aml[1] = 0x40 + ((aml_len - 1) & 0x0f);
    1.64 +	tables->aml[2] = (aml_len - 1) >> 4;
    1.65 +	dsdt->length = sizeof(struct acpi_table_header) + aml_len;
    1.66  	dsdt->checksum = generate_acpi_checksum(dsdt, dsdt->length);
    1.67  
    1.68  	/* setup MADT */
    1.69 @@ -662,6 +680,7 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.70  	for (i = 0; i < MAX_VIRT_CPUS; i++) {
    1.71  		lsapic[i].header.type = ACPI_MADT_LSAPIC;
    1.72  		lsapic[i].header.length = sizeof(struct acpi_table_lsapic);
    1.73 +		lsapic[i].acpi_id = i;
    1.74  		lsapic[i].id = i;
    1.75  		lsapic[i].eid = 0;
    1.76  		lsapic[i].flags.enabled = (d->vcpu[i] != NULL);