return adev ? adev->handle : NULL;
}
- #define ACPI_COMPANION(dev) to_acpi_node((dev)->fwnode)
+ #define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode)
#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
acpi_fwnode_handle(adev) : NULL)
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
static inline bool has_acpi_companion(struct device *dev)
{
- return is_acpi_node(dev->fwnode);
+ return is_acpi_device_node(dev->fwnode);
}
static inline void acpi_preset_companion(struct device *dev,
(!entry) || (unsigned long)entry + sizeof(*entry) > end || \
((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
+ +struct acpi_subtable_proc {
+ + int id;
+ + acpi_tbl_entry_handler handler;
+ + int count;
+ +};
+ +
char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
void __acpi_unmap_table(char *map, unsigned long size);
int early_acpi_boot_init(void);
struct acpi_table_header *table_header,
int entry_id, unsigned int max_entries);
int __init acpi_table_parse_entries(char *id, unsigned long table_size,
- - int entry_id,
- - acpi_tbl_entry_handler handler,
- - unsigned int max_entries);
+ + int entry_id,
+ + acpi_tbl_entry_handler handler,
+ + unsigned int max_entries);
+ +int __init acpi_table_parse_entries(char *id, unsigned long table_size,
+ + int entry_id,
+ + acpi_tbl_entry_handler handler,
+ + unsigned int max_entries);
+ +int __init acpi_table_parse_entries_array(char *id, unsigned long table_size,
+ + struct acpi_subtable_proc *proc, int proc_num,
+ + unsigned int max_entries);
int acpi_table_parse_madt(enum acpi_madt_type id,
acpi_tbl_entry_handler handler,
unsigned int max_entries);
void acpi_irq_stats_init(void);
extern u32 acpi_irq_handled;
extern u32 acpi_irq_not_handled;
+ +extern unsigned int acpi_sci_irq;
+ +#define INVALID_ACPI_IRQ ((unsigned)-1)
+ +static inline bool acpi_sci_irq_valid(void)
+ +{
+ + return acpi_sci_irq != INVALID_ACPI_IRQ;
+ +}
extern int sbf_port;
extern unsigned long acpi_realmode_flags;
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
+ +void acpi_set_irq_model(enum acpi_irq_model_id model,
+ + struct fwnode_handle *fwnode);
+ +
#ifdef CONFIG_X86_IO_APIC
extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
#else
int acpi_pci_irq_enable (struct pci_dev *dev);
void acpi_penalize_isa_irq(int irq, int active);
+bool acpi_isa_irq_available(int irq);
void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
void acpi_pci_irq_disable (struct pci_dev *dev);
return false;
}
- static inline struct acpi_device *to_acpi_node(struct fwnode_handle *fwnode)
+ static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)
+ {
+ return false;
+ }
+
+ static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
+ {
+ return NULL;
+ }
+
+ static inline bool is_acpi_data_node(struct fwnode_handle *fwnode)
+ {
+ return false;
+ }
+
+ static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode)
{
return NULL;
}
return false;
}
+ +static inline void acpi_preset_companion(struct device *dev,
+ + struct acpi_device *parent, u64 addr)
+ +{
+ +}
+ +
static inline const char *acpi_dev_name(struct acpi_device *adev)
{
return NULL;
return -ENODEV;
}
- -static inline bool acpi_check_dma(struct acpi_device *adev, bool *coherent)
+ +static inline bool acpi_dma_supported(struct acpi_device *adev)
{
return false;
}
+ +static inline enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
+ +{
+ + return DEV_DMA_NOT_SUPPORTED;
+ +}
+ +
#define ACPI_PTR(_ptr) (NULL)
#endif /* !CONFIG_ACPI */
#ifdef CONFIG_ACPI
int acpi_dev_get_property(struct acpi_device *adev, const char *name,
acpi_object_type type, const union acpi_object **obj);
- int acpi_dev_get_property_array(struct acpi_device *adev, const char *name,
- acpi_object_type type,
- const union acpi_object **obj);
- int acpi_dev_get_property_reference(struct acpi_device *adev,
- const char *name, size_t index,
- struct acpi_reference_args *args);
-
- int acpi_dev_prop_get(struct acpi_device *adev, const char *propname,
- void **valptr);
+ int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
+ const char *name, size_t index,
+ struct acpi_reference_args *args);
+
+ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
+ void **valptr);
int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val);
+ int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname,
+ enum dev_prop_type proptype, void *val, size_t nval);
int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val, size_t nval);
- struct acpi_device *acpi_get_next_child(struct device *dev,
- struct acpi_device *child);
+ struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
+ struct fwnode_handle *subnode);
+ +
+ +struct acpi_probe_entry;
+ +typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
+ + struct acpi_probe_entry *);
+ +
+ +#define ACPI_TABLE_ID_LEN 5
+ +
+ +/**
+ + * struct acpi_probe_entry - boot-time probing entry
+ + * @id: ACPI table name
+ + * @type: Optional subtable type to match
+ + * (if @id contains subtables)
+ + * @subtable_valid: Optional callback to check the validity of
+ + * the subtable
+ + * @probe_table: Callback to the driver being probed when table
+ + * match is successful
+ + * @probe_subtbl: Callback to the driver being probed when table and
+ + * subtable match (and optional callback is successful)
+ + * @driver_data: Sideband data provided back to the driver
+ + */
+ +struct acpi_probe_entry {
+ + __u8 id[ACPI_TABLE_ID_LEN];
+ + __u8 type;
+ + acpi_probe_entry_validate_subtbl subtable_valid;
+ + union {
+ + acpi_tbl_table_handler probe_table;
+ + acpi_tbl_entry_handler probe_subtbl;
+ + };
+ + kernel_ulong_t driver_data;
+ +};
+ +
+ +#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
+ + static const struct acpi_probe_entry __acpi_probe_##name \
+ + __used __section(__##table##_acpi_probe_table) \
+ + = { \
+ + .id = table_id, \
+ + .type = subtable, \
+ + .subtable_valid = valid, \
+ + .probe_table = (acpi_tbl_table_handler)fn, \
+ + .driver_data = data, \
+ + }
+ +
+ +#define ACPI_PROBE_TABLE(name) __##name##_acpi_probe_table
+ +#define ACPI_PROBE_TABLE_END(name) __##name##_acpi_probe_table_end
+ +
+ +int __acpi_probe_device_table(struct acpi_probe_entry *start, int nr);
+ +
+ +#define acpi_probe_device_table(t) \
+ + ({ \
+ + extern struct acpi_probe_entry ACPI_PROBE_TABLE(t), \
+ + ACPI_PROBE_TABLE_END(t); \
+ + __acpi_probe_device_table(&ACPI_PROBE_TABLE(t), \
+ + (&ACPI_PROBE_TABLE_END(t) - \
+ + &ACPI_PROBE_TABLE(t))); \
+ + })
#else
static inline int acpi_dev_get_property(struct acpi_device *adev,
const char *name, acpi_object_type type,
{
return -ENXIO;
}
- static inline int acpi_dev_get_property_array(struct acpi_device *adev,
- const char *name,
- acpi_object_type type,
- const union acpi_object **obj)
+
+ static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
- - const char *name, const char *cells_name,
- - size_t index, struct acpi_reference_args *args)
+++ const char *name, size_t index,
+++ struct acpi_reference_args *args)
{
return -ENXIO;
}
- static inline int acpi_dev_get_property_reference(struct acpi_device *adev,
- const char *name, const char *cells_name,
- size_t index, struct acpi_reference_args *args)
+
+ static inline int acpi_node_prop_get(struct fwnode_handle *fwnode,
+ const char *propname,
+ void **valptr)
{
return -ENXIO;
}
return -ENXIO;
}
+ static inline int acpi_node_prop_read(struct fwnode_handle *fwnode,
+ const char *propname,
+ enum dev_prop_type proptype,
+ void *val, size_t nval)
+ {
+ return -ENXIO;
+ }
+
static inline int acpi_dev_prop_read(struct acpi_device *adev,
const char *propname,
enum dev_prop_type proptype,
return -ENXIO;
}
- static inline struct acpi_device *acpi_get_next_child(struct device *dev,
- struct acpi_device *child)
+ static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
+ struct fwnode_handle *subnode)
{
return NULL;
}
+
+ +#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, validate, data, fn) \
+ + static const void * __acpi_table_##name[] \
+ + __attribute__((unused)) \
+ + = { (void *) table_id, \
+ + (void *) subtable, \
+ + (void *) valid, \
+ + (void *) fn, \
+ + (void *) data }
+ +
+ +#define acpi_probe_device_table(t) ({ int __r = 0; __r;})
#endif
#endif /*_LINUX_ACPI_H*/