diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/acpi.h | 22 | ||||
-rw-r--r-- | include/linux/pci.h | 9 | ||||
-rw-r--r-- | include/linux/resource_ext.h | 77 |
3 files changed, 94 insertions, 14 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d459cd17b477..24c7aa8b1d20 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/ioport.h> /* for struct resource */ | 29 | #include <linux/ioport.h> /* for struct resource */ |
30 | #include <linux/resource_ext.h> | ||
30 | #include <linux/device.h> | 31 | #include <linux/device.h> |
31 | #include <linux/property.h> | 32 | #include <linux/property.h> |
32 | 33 | ||
@@ -151,6 +152,10 @@ int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu); | |||
151 | int acpi_unmap_cpu(int cpu); | 152 | int acpi_unmap_cpu(int cpu); |
152 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ | 153 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
153 | 154 | ||
155 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC | ||
156 | int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr); | ||
157 | #endif | ||
158 | |||
154 | int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); | 159 | int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); |
155 | int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); | 160 | int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); |
156 | int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base); | 161 | int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base); |
@@ -288,22 +293,25 @@ extern int pnpacpi_disabled; | |||
288 | bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res); | 293 | bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res); |
289 | bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res); | 294 | bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res); |
290 | bool acpi_dev_resource_address_space(struct acpi_resource *ares, | 295 | bool acpi_dev_resource_address_space(struct acpi_resource *ares, |
291 | struct resource *res); | 296 | struct resource_win *win); |
292 | bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, | 297 | bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, |
293 | struct resource *res); | 298 | struct resource_win *win); |
294 | unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); | 299 | unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); |
295 | bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | 300 | bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, |
296 | struct resource *res); | 301 | struct resource *res); |
297 | 302 | ||
298 | struct resource_list_entry { | ||
299 | struct list_head node; | ||
300 | struct resource res; | ||
301 | }; | ||
302 | |||
303 | void acpi_dev_free_resource_list(struct list_head *list); | 303 | void acpi_dev_free_resource_list(struct list_head *list); |
304 | int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, | 304 | int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, |
305 | int (*preproc)(struct acpi_resource *, void *), | 305 | int (*preproc)(struct acpi_resource *, void *), |
306 | void *preproc_data); | 306 | void *preproc_data); |
307 | int acpi_dev_filter_resource_type(struct acpi_resource *ares, | ||
308 | unsigned long types); | ||
309 | |||
310 | static inline int acpi_dev_filter_resource_type_cb(struct acpi_resource *ares, | ||
311 | void *arg) | ||
312 | { | ||
313 | return acpi_dev_filter_resource_type(ares, (unsigned long)arg); | ||
314 | } | ||
307 | 315 | ||
308 | int acpi_check_resource_conflict(const struct resource *res); | 316 | int acpi_check_resource_conflict(const struct resource *res); |
309 | 317 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 9603094ed59b..faa60fa26314 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/atomic.h> | 29 | #include <linux/atomic.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/resource_ext.h> | ||
32 | #include <uapi/linux/pci.h> | 33 | #include <uapi/linux/pci.h> |
33 | 34 | ||
34 | #include <linux/pci_ids.h> | 35 | #include <linux/pci_ids.h> |
@@ -397,16 +398,10 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
397 | return (pdev->error_state != pci_channel_io_normal); | 398 | return (pdev->error_state != pci_channel_io_normal); |
398 | } | 399 | } |
399 | 400 | ||
400 | struct pci_host_bridge_window { | ||
401 | struct list_head list; | ||
402 | struct resource *res; /* host bridge aperture (CPU address) */ | ||
403 | resource_size_t offset; /* bus address + offset = CPU address */ | ||
404 | }; | ||
405 | |||
406 | struct pci_host_bridge { | 401 | struct pci_host_bridge { |
407 | struct device dev; | 402 | struct device dev; |
408 | struct pci_bus *bus; /* root bus */ | 403 | struct pci_bus *bus; /* root bus */ |
409 | struct list_head windows; /* pci_host_bridge_windows */ | 404 | struct list_head windows; /* resource_entry */ |
410 | void (*release_fn)(struct pci_host_bridge *); | 405 | void (*release_fn)(struct pci_host_bridge *); |
411 | void *release_data; | 406 | void *release_data; |
412 | }; | 407 | }; |
diff --git a/include/linux/resource_ext.h b/include/linux/resource_ext.h new file mode 100644 index 000000000000..e2bf63d881d4 --- /dev/null +++ b/include/linux/resource_ext.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015, Intel Corporation | ||
3 | * Author: Jiang Liu <jiang.liu@linux.intel.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | #ifndef _LINUX_RESOURCE_EXT_H | ||
15 | #define _LINUX_RESOURCE_EXT_H | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/ioport.h> | ||
19 | #include <linux/slab.h> | ||
20 | |||
21 | /* Represent resource window for bridge devices */ | ||
22 | struct resource_win { | ||
23 | struct resource res; /* In master (CPU) address space */ | ||
24 | resource_size_t offset; /* Translation offset for bridge */ | ||
25 | }; | ||
26 | |||
27 | /* | ||
28 | * Common resource list management data structure and interfaces to support | ||
29 | * ACPI, PNP and PCI host bridge etc. | ||
30 | */ | ||
31 | struct resource_entry { | ||
32 | struct list_head node; | ||
33 | struct resource *res; /* In master (CPU) address space */ | ||
34 | resource_size_t offset; /* Translation offset for bridge */ | ||
35 | struct resource __res; /* Default storage for res */ | ||
36 | }; | ||
37 | |||
38 | extern struct resource_entry * | ||
39 | resource_list_create_entry(struct resource *res, size_t extra_size); | ||
40 | extern void resource_list_free(struct list_head *head); | ||
41 | |||
42 | static inline void resource_list_add(struct resource_entry *entry, | ||
43 | struct list_head *head) | ||
44 | { | ||
45 | list_add(&entry->node, head); | ||
46 | } | ||
47 | |||
48 | static inline void resource_list_add_tail(struct resource_entry *entry, | ||
49 | struct list_head *head) | ||
50 | { | ||
51 | list_add_tail(&entry->node, head); | ||
52 | } | ||
53 | |||
54 | static inline void resource_list_del(struct resource_entry *entry) | ||
55 | { | ||
56 | list_del(&entry->node); | ||
57 | } | ||
58 | |||
59 | static inline void resource_list_free_entry(struct resource_entry *entry) | ||
60 | { | ||
61 | kfree(entry); | ||
62 | } | ||
63 | |||
64 | static inline void | ||
65 | resource_list_destroy_entry(struct resource_entry *entry) | ||
66 | { | ||
67 | resource_list_del(entry); | ||
68 | resource_list_free_entry(entry); | ||
69 | } | ||
70 | |||
71 | #define resource_list_for_each_entry(entry, list) \ | ||
72 | list_for_each_entry((entry), (list), node) | ||
73 | |||
74 | #define resource_list_for_each_entry_safe(entry, tmp, list) \ | ||
75 | list_for_each_entry_safe((entry), (tmp), (list), node) | ||
76 | |||
77 | #endif /* _LINUX_RESOURCE_EXT_H */ | ||