resources: introduce io_resource()
This patch creates new resource function to perform allocation of IO resource, similar to mmio_resource() function does for MMIO. Change-Id: I3fdcabb14302537d6074bfd6a362690c06b66bb5 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31911 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Lijian Zhao <lijian.zhao@intel.com>
This commit is contained in:
parent
41483c9dff
commit
217ca36377
|
@ -801,6 +801,20 @@ void fixed_mem_resource(struct device *dev, unsigned long index,
|
||||||
resource->flags |= type;
|
resource->flags |= type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fixed_io_resource(struct device *dev, unsigned long index,
|
||||||
|
unsigned long base, unsigned long size)
|
||||||
|
{
|
||||||
|
struct resource *resource;
|
||||||
|
|
||||||
|
resource = new_resource(dev, index);
|
||||||
|
resource->base = (resource_t)base;
|
||||||
|
resource->size = (resource_t)size;
|
||||||
|
resource->limit = resource->base + resource->size - 1;
|
||||||
|
resource->flags = IORESOURCE_IO | IORESOURCE_FIXED |
|
||||||
|
IORESOURCE_STORED | IORESOURCE_ASSIGNED |
|
||||||
|
IORESOURCE_RESERVE;
|
||||||
|
}
|
||||||
|
|
||||||
void mmconf_resource_init(struct resource *resource, resource_t base,
|
void mmconf_resource_init(struct resource *resource, resource_t base,
|
||||||
int buses)
|
int buses)
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,6 +234,9 @@ extern struct device_operations default_dev_ops_root;
|
||||||
void pci_domain_read_resources(struct device *dev);
|
void pci_domain_read_resources(struct device *dev);
|
||||||
void pci_domain_scan_bus(struct device *dev);
|
void pci_domain_scan_bus(struct device *dev);
|
||||||
|
|
||||||
|
void fixed_io_resource(struct device *dev, unsigned long index,
|
||||||
|
unsigned long base, unsigned long size);
|
||||||
|
|
||||||
void fixed_mem_resource(struct device *dev, unsigned long index,
|
void fixed_mem_resource(struct device *dev, unsigned long index,
|
||||||
unsigned long basek, unsigned long sizek, unsigned long type);
|
unsigned long basek, unsigned long sizek, unsigned long type);
|
||||||
|
|
||||||
|
@ -259,6 +262,9 @@ void mmconf_resource(struct device *dev, unsigned long index);
|
||||||
#define mmio_resource(dev, idx, basek, sizek) \
|
#define mmio_resource(dev, idx, basek, sizek) \
|
||||||
fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE)
|
fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE)
|
||||||
|
|
||||||
|
#define io_resource(dev, idx, base, size) \
|
||||||
|
fixed_io_resource(dev, idx, base, size)
|
||||||
|
|
||||||
void tolm_test(void *gp, struct device *dev, struct resource *new);
|
void tolm_test(void *gp, struct device *dev, struct resource *new);
|
||||||
u32 find_pci_tolm(struct bus *bus);
|
u32 find_pci_tolm(struct bus *bus);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue