Exemplo n.º 1
0
struct acpi_rsdp *apci_get_RSDP()
{
	/* The root structure may in the first KB of EBDA or from 0xE0000 to 0xFFFFF */
	addr_t ebda_bottom = *(uint16_t *)(0x40e) << 4;
	addr_t tmp = ebda_bottom;
	addr_t end = 0xFFFFF;
	struct acpi_rsdp *rsdp;
	if(0xA0000 < ebda_bottom || ((0xA0000 - ebda_bottom) > (128 * 1024))) {
		printk(0, "[acpi]: got invalid lower ebda address (%x)\n", ebda_bottom);
		return 0;
	}
	/* scan the EBDA and other region */
	while(tmp < end)
	{
		rsdp = (struct acpi_rsdp *)tmp;
		if(!memcmp(rsdp->sig, "RSD PTR ", 8) && rsdp_validate_checksum(rsdp))
			return rsdp;
		tmp += 16;
		if(tmp >= 0xA0000 && tmp <0xE0000) tmp = 0xE0000;
	}
	return 0;
}
Exemplo n.º 2
0
static struct acpi_rsdp *apci_get_RSDP (void)
{
	// The root structure may in the first KB of EBDA or from 0xE0000 to 0xFFFFF.
	addr_t ebda_bottom = *(uint16_t *)(0x40e + PHYS_PAGE_MAP) << 4;
	addr_t tmp = ebda_bottom;
	addr_t end = 0xFFFFF;
	struct acpi_rsdp *rsdp;
	if((0xA0000) < ebda_bottom || ((0xA0000 - ebda_bottom) > (128 * 1024))) {
		printk(0, "[ACPI]: got invalid lower ebda address (%x)\n", ebda_bottom);
		tmp = 0xE0000;
		//return 0;
	}
	// Scan the EBDA and other region.
	while(tmp < end)
	{
		rsdp = (struct acpi_rsdp *)(tmp + PHYS_PAGE_MAP);
		if(!memcmp(rsdp->sig, "RSD PTR ", 8) && rsdp_validate_checksum(rsdp))
			return rsdp;
		tmp += 16;
		if(tmp >= 0xA0000 && tmp <0xE0000) 
			tmp = 0xE0000;
	}
	return 0;
}