diff options
-rw-r--r-- | arch/i386/kernel/acpi/boot.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index a574cd2c8b61..b87cedeaf59b 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -618,6 +618,8 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table) | |||
618 | #ifdef CONFIG_HPET_TIMER | 618 | #ifdef CONFIG_HPET_TIMER |
619 | #include <asm/hpet.h> | 619 | #include <asm/hpet.h> |
620 | 620 | ||
621 | static struct __initdata resource *hpet_res; | ||
622 | |||
621 | static int __init acpi_parse_hpet(struct acpi_table_header *table) | 623 | static int __init acpi_parse_hpet(struct acpi_table_header *table) |
622 | { | 624 | { |
623 | struct acpi_table_hpet *hpet_tbl; | 625 | struct acpi_table_hpet *hpet_tbl; |
@@ -638,8 +640,42 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table) | |||
638 | printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", | 640 | printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", |
639 | hpet_tbl->id, hpet_address); | 641 | hpet_tbl->id, hpet_address); |
640 | 642 | ||
643 | /* | ||
644 | * Allocate and initialize the HPET firmware resource for adding into | ||
645 | * the resource tree during the lateinit timeframe. | ||
646 | */ | ||
647 | #define HPET_RESOURCE_NAME_SIZE 9 | ||
648 | hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE); | ||
649 | |||
650 | if (!hpet_res) | ||
651 | return 0; | ||
652 | |||
653 | memset(hpet_res, 0, sizeof(*hpet_res)); | ||
654 | hpet_res->name = (void *)&hpet_res[1]; | ||
655 | hpet_res->flags = IORESOURCE_MEM; | ||
656 | snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, "HPET %u", | ||
657 | hpet_tbl->sequence); | ||
658 | |||
659 | hpet_res->start = hpet_address; | ||
660 | hpet_res->end = hpet_address + (1 * 1024) - 1; | ||
661 | |||
641 | return 0; | 662 | return 0; |
642 | } | 663 | } |
664 | |||
665 | /* | ||
666 | * hpet_insert_resource inserts the HPET resources used into the resource | ||
667 | * tree. | ||
668 | */ | ||
669 | static __init int hpet_insert_resource(void) | ||
670 | { | ||
671 | if (!hpet_res) | ||
672 | return 1; | ||
673 | |||
674 | return insert_resource(&iomem_resource, hpet_res); | ||
675 | } | ||
676 | |||
677 | late_initcall(hpet_insert_resource); | ||
678 | |||
643 | #else | 679 | #else |
644 | #define acpi_parse_hpet NULL | 680 | #define acpi_parse_hpet NULL |
645 | #endif | 681 | #endif |