25 #include <linux/module.h>
34 static bool force_register;
38 #define AML_NFW_SPACE 0xA1
59 if (address & (1
UL << 63))
70 virt_entry.ip = virt_map(c->
ip);
71 virt_entry.gp = virt_map(c->
gp);
84 *value = *(
u8 *)offset;
87 *value = *(
u16 *)offset;
90 *value = *(
u32 *)offset;
93 *value = *(
u64 *)offset;
98 static void aml_nfw_write_arg(
u8 *offset,
u32 bit_width,
u64 *value)
102 *(
u8 *) offset = *value;
105 *(
u16 *) offset = *value;
108 *(
u32 *) offset = *value;
111 *(
u64 *) offset = *value;
117 u32 bit_width,
u64 *value,
void *handler_context,
118 void *region_context)
121 u8 *offset = (
u8 *) context + address;
123 if (bit_width != 8 && bit_width != 16 &&
124 bit_width != 32 && bit_width != 64)
133 aml_nfw_execute(context);
134 aml_nfw_read_arg(offset, bit_width, value);
137 aml_nfw_write_arg(offset, bit_width, value);
145 static int global_handler_registered;
147 static int aml_nfw_add_global_handler(
void)
151 if (global_handler_registered)
159 global_handler_registered = 1;
165 static int aml_nfw_remove_global_handler(
void)
169 if (!global_handler_registered)
177 global_handler_registered = 0;
183 static int aml_nfw_add(
struct acpi_device *
device)
191 return aml_nfw_add_global_handler();
194 static int aml_nfw_remove(
struct acpi_device *
device,
int type)
196 return aml_nfw_remove_global_handler();
204 static struct acpi_driver acpi_aml_nfw_driver = {
205 .name =
"native firmware",
209 .remove = aml_nfw_remove,
213 static int __init aml_nfw_init(
void)
218 aml_nfw_add_global_handler();
222 aml_nfw_remove_global_handler();
229 static void __exit aml_nfw_exit(
void)
232 aml_nfw_remove_global_handler();