2 * arch/ia64/kernel/acpi-ext.c
4 * Copyright (C) 2003 Hewlett-Packard
5 * Copyright (C) Alex Williamson
6 * Copyright (C) Bjorn Helgaas
8 * Vendor specific extensions to ACPI.
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/acpi.h>
15 #include <linux/efi.h>
17 #include <asm/acpi-ext.h>
19 struct acpi_vendor_descriptor
{
24 struct acpi_vendor_info
{
25 struct acpi_vendor_descriptor
*descriptor
;
31 acpi_vendor_resource_match(struct acpi_resource
*resource
, void *context
)
33 struct acpi_vendor_info
*info
= (struct acpi_vendor_info
*) context
;
34 struct acpi_resource_vendor
*vendor
;
35 struct acpi_vendor_descriptor
*descriptor
;
38 if (resource
->id
!= ACPI_RSTYPE_VENDOR
)
41 vendor
= (struct acpi_resource_vendor
*) &resource
->data
;
42 descriptor
= (struct acpi_vendor_descriptor
*) vendor
->reserved
;
43 if (vendor
->length
<= sizeof(*info
->descriptor
) ||
44 descriptor
->guid_id
!= info
->descriptor
->guid_id
||
45 efi_guidcmp(descriptor
->guid
, info
->descriptor
->guid
))
48 length
= vendor
->length
- sizeof(struct acpi_vendor_descriptor
);
49 info
->data
= acpi_os_allocate(length
);
53 memcpy(info
->data
, vendor
->reserved
+ sizeof(struct acpi_vendor_descriptor
), length
);
54 info
->length
= length
;
55 return AE_CTRL_TERMINATE
;
59 acpi_find_vendor_resource(acpi_handle obj
, struct acpi_vendor_descriptor
*id
,
60 u8
**data
, u32
*length
)
62 struct acpi_vendor_info info
;
67 acpi_walk_resources(obj
, METHOD_NAME__CRS
, acpi_vendor_resource_match
, &info
);
72 *length
= info
.length
;
76 struct acpi_vendor_descriptor hp_ccsr_descriptor
= {
78 .guid
= EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad)
82 hp_acpi_csr_space(acpi_handle obj
, u64
*csr_base
, u64
*csr_length
)
88 status
= acpi_find_vendor_resource(obj
, &hp_ccsr_descriptor
, &data
, &length
);
90 if (ACPI_FAILURE(status
) || length
!= 16)
93 memcpy(csr_base
, data
, sizeof(*csr_base
));
94 memcpy(csr_length
, data
+ 8, sizeof(*csr_length
));
100 EXPORT_SYMBOL(hp_acpi_csr_space
);