device/resource: Modify some resource allocation instances
These changes made my crude pattern matching work with coccinelle simpler. Change-Id: I83f3ef38b8663640594b4d726838f7a6f96a58a2 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64698 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
parent
2a167ffbbf
commit
4e4edf7d60
|
@ -161,9 +161,9 @@ static void wilco_ec_resource(struct device *dev, int index,
|
|||
size_t base, size_t size)
|
||||
{
|
||||
struct resource *res = new_resource(dev, index);
|
||||
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||
res->base = base;
|
||||
res->size = size;
|
||||
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||
}
|
||||
|
||||
static void wilco_ec_read_resources(struct device *dev)
|
||||
|
|
|
@ -106,11 +106,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
|
|||
continue;
|
||||
|
||||
resource = new_resource(dev, mc_fixed_resources[i].index);
|
||||
resource->base = base;
|
||||
resource->size = size;
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
|
||||
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
|
||||
|
||||
resource->base = base;
|
||||
resource->size = size;
|
||||
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
|
||||
__func__, mc_fixed_resources[i].description, index,
|
||||
(unsigned long)base, (unsigned long)(base + size - 1));
|
||||
|
@ -298,7 +298,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
|
|||
/* TSEG - DPR -> BGSM */
|
||||
resource = new_resource(dev, index++);
|
||||
resource->base = mc_values[TSEG_REG] - dpr.size * MiB;
|
||||
resource->size = mc_values[BGSM_REG] - resource->base;
|
||||
resource->size = mc_values[BGSM_REG] - (mc_values[TSEG_REG] - dpr.size * MiB);
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
|
||||
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
|
||||
|
||||
|
@ -306,7 +306,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
|
|||
if (mc_values[BGSM_REG] != mc_values[TOLUD_REG]) {
|
||||
resource = new_resource(dev, index++);
|
||||
resource->base = mc_values[BGSM_REG];
|
||||
resource->size = mc_values[TOLUD_REG] - resource->base;
|
||||
resource->size = mc_values[TOLUD_REG] - mc_values[BGSM_REG];
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
|
||||
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ static void mch_domain_read_resources(struct device *dev)
|
|||
|
||||
/* cbmem_top can be shifted downwards due to alignment.
|
||||
Mark the region between cbmem_top and tomk as unusable */
|
||||
delta_cbmem = tomk - ((uint32_t)(uintptr_t)cbmem_top() >> 10);
|
||||
delta_cbmem = tomk - ((uintptr_t)cbmem_top() >> 10);
|
||||
tomk -= delta_cbmem;
|
||||
uma_sizek += delta_cbmem;
|
||||
|
||||
|
|
|
@ -129,11 +129,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
|
|||
continue;
|
||||
|
||||
resource = new_resource(dev, mc_fixed_resources[i].index);
|
||||
resource->base = base;
|
||||
resource->size = size;
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||
IORESOURCE_STORED | IORESOURCE_RESERVE |
|
||||
IORESOURCE_ASSIGNED;
|
||||
resource->base = base;
|
||||
resource->size = size;
|
||||
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
|
||||
__func__, mc_fixed_resources[i].description, index,
|
||||
(unsigned long)base, (unsigned long)(base + size - 1));
|
||||
|
@ -328,7 +328,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
|
|||
/* TSEG - DPR -> BGSM */
|
||||
resource = new_resource(dev, index++);
|
||||
resource->base = mc_values[TSEG_REG] - dpr_size;
|
||||
resource->size = mc_values[BGSM_REG] - resource->base;
|
||||
resource->size = mc_values[BGSM_REG] - (mc_values[TSEG_REG] - dpr_size);
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||
IORESOURCE_STORED | IORESOURCE_RESERVE |
|
||||
IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
|
||||
|
@ -336,7 +336,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
|
|||
/* BGSM -> TOLUD */
|
||||
resource = new_resource(dev, index++);
|
||||
resource->base = mc_values[BGSM_REG];
|
||||
resource->size = mc_values[TOLUD_REG] - resource->base;
|
||||
resource->size = mc_values[TOLUD_REG] - mc_values[BGSM_REG];
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||
IORESOURCE_STORED | IORESOURCE_RESERVE |
|
||||
IORESOURCE_ASSIGNED;
|
||||
|
|
|
@ -405,10 +405,6 @@ static void pci_p2sb_read_resources(struct device *dev)
|
|||
res->size = 16 * 1024 * 1024; /* 16MB PCR config space */
|
||||
res->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
|
||||
IORESOURCE_ASSIGNED;
|
||||
printk(BIOS_DEBUG,
|
||||
"Adding P2SB PCR config space BAR 0x%08lx-0x%08lx.\n",
|
||||
(unsigned long)(res->base),
|
||||
(unsigned long)(res->base + res->size));
|
||||
|
||||
/* Add MMIO resource
|
||||
* Use 0xdb as an unused index for IOAPIC.
|
||||
|
|
|
@ -104,11 +104,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
|
|||
continue;
|
||||
|
||||
resource = new_resource(dev, mc_fixed_resources[i].index);
|
||||
resource->base = base;
|
||||
resource->size = size;
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||
IORESOURCE_STORED | IORESOURCE_RESERVE |
|
||||
IORESOURCE_ASSIGNED;
|
||||
resource->base = base;
|
||||
resource->size = size;
|
||||
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
|
||||
__func__, mc_fixed_resources[i].description, index,
|
||||
(unsigned long)base, (unsigned long)(base + size - 1));
|
||||
|
@ -248,7 +248,7 @@ static void mc_add_dram_resources(struct device *dev)
|
|||
/* top_of_ram -> TSEG */
|
||||
resource = new_resource(dev, index++);
|
||||
resource->base = top_of_ram;
|
||||
resource->size = mc_values[TSEG_REG] - resource->base;
|
||||
resource->size = mc_values[TSEG_REG] - top_of_ram;
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||
IORESOURCE_STORED | IORESOURCE_RESERVE |
|
||||
IORESOURCE_ASSIGNED;
|
||||
|
@ -256,13 +256,10 @@ static void mc_add_dram_resources(struct device *dev)
|
|||
/* TSEG -> TOLUD */
|
||||
resource = new_resource(dev, index++);
|
||||
resource->base = mc_values[TSEG_REG];
|
||||
resource->size = mc_values[TOLUD_REG] - resource->base;
|
||||
resource->size = mc_values[TOLUD_REG] - mc_values[TSEG_REG];
|
||||
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||
IORESOURCE_STORED | IORESOURCE_RESERVE |
|
||||
IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
|
||||
printk(BIOS_DEBUG,
|
||||
"SMM memory location: 0x%llx SMM memory size: 0x%llx\n",
|
||||
resource->base, resource->size);
|
||||
|
||||
/* 4GiB -> TOUUD */
|
||||
base_k = 4096 * 1024; /* 4GiB */
|
||||
|
|
Loading…
Reference in New Issue