Okay, on the MADT, I'm having a bit of trouble, LinuxBIOS is hanging
while creating the checksum. I've attached my acpi_tables.c (and Rudolf,
I'm sorry for not looking through yours more, I simply overlooked the
entire MADT portion of them and when they didn't build for me discarded
them). To be specific, it's these lines of acpi_create_madt() (in
arch/i386/boot/acpi.c) that are hanging:

    /* recalculate length */
    header->length= current - (unsigned long)madt;
    print_debug("calculating checksum\n"); <-last line I see
    header->checksum = acpi_checksum((void *)madt, header->length);
    print_debug("leaving acpi_create_madt\n");

A couple differences in my acpi tables, first off I couldn't find a gsi
base. Reading through the standard, it's optional, so I'm assuming it
should just be discarded if not present? Also, I couldn't find anything
about a northbridge apic in the stock bios MADT dump, is that maybe only
on k8?

Thanks,
Corey
/*
 * LinuxBIOS ACPI Table support
 * written by Stefan Reinauer <[EMAIL PROTECTED]>
 * ACPI FADT, FACS, and DSDT table support added by 
 * Nick Barker <[EMAIL PROTECTED]>, and those portions
 * (C) Copyright 2004 Nick Barker
 * (C) Copyright 2005 Stefan Reinauer
 */

#include <console/console.h>
#include <string.h>
#include <arch/acpi.h>

extern unsigned char AmlCode[];

unsigned long acpi_fill_madt(unsigned long current)
{
	printk_debug("                * entering apci_fill_madt()\n");
	
	/* create all subtables for processors */
	current = acpi_create_madt_lapic(current, 0, 0);

	current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, 
			0x02, 0xfec00000UL, 0);

	current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) 
						current, 0, 0, 2, 0);
	current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) 
						current, 0, 9, 9, 0xf);
	

	/* create all subtables for processors */
	current = acpi_create_madt_lapic_nmi(current, 0, 5, 1);
	printk_debug("                * leaving acpi_fill_madt()\n");
	return current;
}

unsigned long acpi_fill_srat(unsigned long current)
{
	/* No NUMA, no srat, dem's de rules */
	return current;
}

unsigned long write_acpi_tables(unsigned long start)
{
	unsigned long current;
	acpi_rsdp_t *rsdp;
	acpi_rsdt_t *rsdt;
	acpi_hpet_t *hpet;
	acpi_madt_t *madt;
	acpi_fadt_t *fadt;
	acpi_facs_t *facs;
	acpi_header_t *dsdt;
	
	/* Align ACPI tables to 16byte */
	start   = ( start + 0x0f ) & -0x10;
	current = start;
	
	printk_info("ACPI: Writing ACPI tables at %lx...\n", start);

	/* We need at least an RSDP and an RSDT Table */
	rsdp = (acpi_rsdp_t *) current;
	current += sizeof(acpi_rsdp_t);
	rsdt = (acpi_rsdt_t *) current;
	current += sizeof(acpi_rsdt_t);

	/* clear all table memory */
	memset((void *)start, 0, current - start);
	
	acpi_write_rsdp(rsdp, rsdt);
	acpi_write_rsdt(rsdt);
	
	printk_debug("ACPI:     * FACS\n");
	facs = (acpi_facs_t *) current;
	current += sizeof(acpi_facs_t);
	acpi_create_facs(facs);

	dsdt = (acpi_header_t *) current;
	current += ((acpi_header_t *)AmlCode)->length;
	memcpy((void *)dsdt,(void *)AmlCode, ((acpi_header_t *)AmlCode)->length);
	dsdt->checksum = 0; // don't trust intel iasl compiler to get this right
	dsdt->checksum = acpi_checksum(dsdt, dsdt->length);
	printk_debug("ACPI:     * DSDT @ %08x Length %x\n", dsdt, dsdt->length);
	printk_debug("ACPI:     * FADT\n");

	fadt = (acpi_fadt_t *) current;
	current += sizeof(acpi_fadt_t);

	acpi_create_fadt(fadt,facs,dsdt);
	acpi_add_table(rsdt,fadt);
	
	/*
	 * We explicitly add these tables later on:
	 */
	printk_debug("ACPI:    * HPET\n");
	hpet = (acpi_hpet_t *) current;
	current += sizeof(acpi_hpet_t);
	acpi_create_hpet(hpet);
	acpi_add_table(rsdt, hpet);
		
	/* If we want to use HPET Timers Linux wants an MADT */
	printk_debug("ACPI:    * MADT\n");
	madt = (acpi_madt_t *) current;
	printk_debug("            * creating madt\n");
	acpi_create_madt(madt);
	printk_debug("            * done creation\n");
	current += madt->header.length;
	printk_debug("            * adding madt to rsdt\n");
	acpi_add_table(rsdt, madt);

	printk_info("ACPI: done.\n");
	return current;
}

-- 
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to