mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-18 16:08:10 -04:00
Merge branch 'pci/resource'
- Rename find_resource() to find_resource_space() to make it more descriptive for exporting outside resource.c (Ilpo Järvinen) - Document find_resource_space() and the resource_constraint struct it uses (Ilpo Järvinen) - Add typedef resource_alignf to make it simpler to declare allocation constraint alignf callbacks (Ilpo Järvinen) - Open-code the no-constraint simple alignment case to make the simple_align_resource() default callback unnecessary (Ilpo Järvinen) - Export find_resource_space() because PCI bridge window allocation needs to learn whether there's space for a window (Ilpo Järvinen) - Fix a double-counting problem in PCI calculate_memsize() that led to allocating larger windows each time a bus was removed and rescanned (Ilpo Järvinen) - When we don't have space to allocate larger bridge windows, allocate windows only large enough for the downstream devices to prevent cases where a device worked originally, but not after being removed and re-added (Ilpo Järvinen) * pci/resource: PCI: Relax bridge window tail sizing rules PCI: Make minimum bridge window alignment reference more obvious PCI: Fix resource double counting on remove & rescan resource: Export find_resource_space() resource: Handle simple alignment inside __find_resource_space() resource: Use typedef for alignf callback resource: Document find_resource_space() and resource_constraint resource: Rename find_resource() to find_resource_space()
This commit is contained in:
@@ -188,6 +188,42 @@ enum {
|
||||
#define DEFINE_RES_DMA(_dma) \
|
||||
DEFINE_RES_DMA_NAMED((_dma), NULL)
|
||||
|
||||
/**
|
||||
* typedef resource_alignf - Resource alignment callback
|
||||
* @data: Private data used by the callback
|
||||
* @res: Resource candidate range (an empty resource space)
|
||||
* @size: The minimum size of the empty space
|
||||
* @align: Alignment from the constraints
|
||||
*
|
||||
* Callback allows calculating resource placement and alignment beyond min,
|
||||
* max, and align fields in the struct resource_constraint.
|
||||
*
|
||||
* Return: Start address for the resource.
|
||||
*/
|
||||
typedef resource_size_t (*resource_alignf)(void *data,
|
||||
const struct resource *res,
|
||||
resource_size_t size,
|
||||
resource_size_t align);
|
||||
|
||||
/**
|
||||
* struct resource_constraint - constraints to be met while searching empty
|
||||
* resource space
|
||||
* @min: The minimum address for the memory range
|
||||
* @max: The maximum address for the memory range
|
||||
* @align: Alignment for the start address of the empty space
|
||||
* @alignf: Additional alignment constraints callback
|
||||
* @alignf_data: Data provided for @alignf callback
|
||||
*
|
||||
* Contains the range and alignment constraints that have to be met during
|
||||
* find_resource_space(). @alignf can be NULL indicating no alignment beyond
|
||||
* @align is necessary.
|
||||
*/
|
||||
struct resource_constraint {
|
||||
resource_size_t min, max, align;
|
||||
resource_alignf alignf;
|
||||
void *alignf_data;
|
||||
};
|
||||
|
||||
/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
|
||||
extern struct resource ioport_resource;
|
||||
extern struct resource iomem_resource;
|
||||
@@ -207,10 +243,7 @@ extern void arch_remove_reservations(struct resource *avail);
|
||||
extern int allocate_resource(struct resource *root, struct resource *new,
|
||||
resource_size_t size, resource_size_t min,
|
||||
resource_size_t max, resource_size_t align,
|
||||
resource_size_t (*alignf)(void *,
|
||||
const struct resource *,
|
||||
resource_size_t,
|
||||
resource_size_t),
|
||||
resource_alignf alignf,
|
||||
void *alignf_data);
|
||||
struct resource *lookup_resource(struct resource *root, resource_size_t start);
|
||||
int adjust_resource(struct resource *res, resource_size_t start,
|
||||
@@ -264,6 +297,9 @@ static inline bool resource_union(const struct resource *r1, const struct resour
|
||||
return true;
|
||||
}
|
||||
|
||||
int find_resource_space(struct resource *root, struct resource *new,
|
||||
resource_size_t size, struct resource_constraint *constraint);
|
||||
|
||||
/* Convenience shorthand with allocation */
|
||||
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
|
||||
#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
|
||||
|
||||
@@ -1552,10 +1552,7 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
|
||||
struct resource *res, resource_size_t size,
|
||||
resource_size_t align, resource_size_t min,
|
||||
unsigned long type_mask,
|
||||
resource_size_t (*alignf)(void *,
|
||||
const struct resource *,
|
||||
resource_size_t,
|
||||
resource_size_t),
|
||||
resource_alignf alignf,
|
||||
void *alignf_data);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user