diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-12-10 05:41:25 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-12-10 05:41:25 +0100 |
commit | 293e981e7452511a876431aa076c0eb256623124 (patch) | |
tree | c15e999a2f1c69cb193c5f1a1015bbc095dcd33d /include | |
parent | 056196ba04574d4f8cf11d92df09eb664a3e62dd (diff) | |
parent | 5451508c4ff5d8f1d0c115963508b2ca7120141a (diff) | |
download | barebox-293e981e7452511a876431aa076c0eb256623124.tar.gz barebox-293e981e7452511a876431aa076c0eb256623124.tar.xz |
Merge branch 'for-next/pci'
Diffstat (limited to 'include')
-rw-r--r-- | include/driver.h | 4 | ||||
-rw-r--r-- | include/efi.h | 42 | ||||
-rw-r--r-- | include/efi/efi-device.h | 12 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 1 | ||||
-rw-r--r-- | include/linux/pci.h | 34 |
5 files changed, 72 insertions, 21 deletions
diff --git a/include/driver.h b/include/driver.h index 300603fa32..ad59ce90c3 100644 --- a/include/driver.h +++ b/include/driver.h @@ -155,12 +155,12 @@ int unregister_device(struct device_d *); /* Iterate over a devices children */ #define device_for_each_child(dev, child) \ - list_for_each_entry(child, &dev->children, sibling) + list_for_each_entry(child, &(dev)->children, sibling) /* Iterate over a devices children - Safe against removal version */ #define device_for_each_child_safe(dev, tmpdev, child) \ - list_for_each_entry_safe(child, tmpdev, &dev->children, sibling) + list_for_each_entry_safe(child, tmpdev, &(dev)->children, sibling) /* Iterate through the devices of a given type. if last is NULL, the * first device of this type is returned. Put this pointer in as diff --git a/include/efi.h b/include/efi.h index 166803a58f..43c0593951 100644 --- a/include/efi.h +++ b/include/efi.h @@ -91,21 +91,23 @@ typedef struct { */ /* Memory types: */ -#define EFI_RESERVED_TYPE 0 -#define EFI_LOADER_CODE 1 -#define EFI_LOADER_DATA 2 -#define EFI_BOOT_SERVICES_CODE 3 -#define EFI_BOOT_SERVICES_DATA 4 -#define EFI_RUNTIME_SERVICES_CODE 5 -#define EFI_RUNTIME_SERVICES_DATA 6 -#define EFI_CONVENTIONAL_MEMORY 7 -#define EFI_UNUSABLE_MEMORY 8 -#define EFI_ACPI_RECLAIM_MEMORY 9 -#define EFI_ACPI_MEMORY_NVS 10 -#define EFI_MEMORY_MAPPED_IO 11 -#define EFI_MEMORY_MAPPED_IO_PORT_SPACE 12 -#define EFI_PAL_CODE 13 -#define EFI_MAX_MEMORY_TYPE 14 +enum efi_memory_type { + EFI_RESERVED_TYPE, + EFI_LOADER_CODE, + EFI_LOADER_DATA, + EFI_BOOT_SERVICES_CODE, + EFI_BOOT_SERVICES_DATA, + EFI_RUNTIME_SERVICES_CODE, + EFI_RUNTIME_SERVICES_DATA, + EFI_CONVENTIONAL_MEMORY, + EFI_UNUSABLE_MEMORY, + EFI_ACPI_RECLAIM_MEMORY, + EFI_ACPI_MEMORY_NVS, + EFI_MEMORY_MAPPED_IO, + EFI_MEMORY_MAPPED_IO_PORT_SPACE, + EFI_PAL_CODE, + EFI_MAX_MEMORY_TYPE +}; /* Attribute values: */ #define EFI_MEMORY_UC ((u64)0x0000000000000001ULL) /* uncached */ @@ -124,10 +126,12 @@ typedef struct { /* * Allocation types for calls to boottime->allocate_pages. */ -#define EFI_ALLOCATE_ANY_PAGES 0 -#define EFI_ALLOCATE_MAX_ADDRESS 1 -#define EFI_ALLOCATE_ADDRESS 2 -#define EFI_MAX_ALLOCATE_TYPE 3 +enum efi_allocate_type { + EFI_ALLOCATE_ANY_PAGES, + EFI_ALLOCATE_MAX_ADDRESS, + EFI_ALLOCATE_ADDRESS, + EFI_MAX_ALLOCATE_TYPE +}; typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); diff --git a/include/efi/efi-device.h b/include/efi/efi-device.h index 5eaf1f260d..5ec59a8a2d 100644 --- a/include/efi/efi-device.h +++ b/include/efi/efi-device.h @@ -45,4 +45,16 @@ int efi_connect_all(void); void efi_register_devices(void); struct efi_device *efi_get_bootsource(void); +static inline bool efi_device_has_guid(struct efi_device *efidev, efi_guid_t guid) +{ + int i; + + for (i = 0; i < efidev->num_guids; i++) { + if (!efi_guidcmp(efidev->guids[i], guid)) + return true; + } + + return false; +} + #endif /* __EFI_EFI_DEVICE_H */ diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index d8125214a0..1fbb3dc5c1 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -15,6 +15,7 @@ struct pci_device_id { __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ __u32 class, class_mask; /* (class,subclass,prog-if) triplet */ + unsigned long driver_data; /* Data private to the driver */ }; #define SPI_NAME_SIZE 32 diff --git a/include/linux/pci.h b/include/linux/pci.h index d92d70b6bd..c742570e36 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -115,6 +115,17 @@ struct pci_dev { }; #define to_pci_dev(d) container_of(d, struct pci_dev, dev) +#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) +#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) +#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) +#define pci_resource_len(dev,bar) \ + ((pci_resource_start((dev), (bar)) == 0 && \ + pci_resource_end((dev), (bar)) == \ + pci_resource_start((dev), (bar))) ? 0 : \ + \ + (pci_resource_end((dev), (bar)) - \ + pci_resource_start((dev), (bar)) + 1)) + enum { PCI_BUS_RESOURCE_IO = 0, PCI_BUS_RESOURCE_MEM = 1, @@ -211,6 +222,20 @@ struct pci_driver { .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID /** + * PCI_DEVICE_SUB - macro used to describe a specific PCI device with subsystem + * @vend: the 16 bit PCI Vendor ID + * @dev: the 16 bit PCI Device ID + * @subvend: the 16 bit PCI Subvendor ID + * @subdev: the 16 bit PCI Subdevice ID + * + * This macro is used to create a struct pci_device_id that matches a + * specific device with subsystem information. + */ +#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \ + .vendor = (vend), .device = (dev), \ + .subvendor = (subvend), .subdevice = (subdev) + +/** * PCI_DEVICE_CLASS - macro used to describe a specific pci device class * @dev_class: the class, subclass, prog-if triple for this device * @dev_class_mask: the class mask for this device @@ -350,4 +375,13 @@ enum pci_fixup_pass { void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); +#ifdef CONFIG_PCI +const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, + struct pci_dev *dev); +#else +static inline const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, + struct pci_dev *dev) +{ return NULL; } +#endif + #endif /* LINUX_PCI_H */ |