device/pci_device: Extract pci_domain_set_resources from SOC

pci_domain_set_resources is duplicated in all the SOCs. This change
promotes the duplicated function.

Picasso was adding it again in the northbridge patch. I decided to
promote the function instead of duplicating it.

BUG=b:147042464
TEST=Build and boot trembyle.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Iba9661ac2c3a1803783d5aa32404143c9144aea5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41041
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Raul E Rangel
2020-05-04 16:41:22 -06:00
committed by Patrick Georgi
parent 194695fd95
commit 5cb34e2ea0
18 changed files with 9 additions and 74 deletions

View File

@@ -439,6 +439,11 @@ void pci_domain_read_resources(struct device *dev)
IORESOURCE_ASSIGNED; IORESOURCE_ASSIGNED;
} }
void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static void pci_set_resource(struct device *dev, struct resource *resource) static void pci_set_resource(struct device *dev, struct resource *resource)
{ {
resource_t base, end; resource_t base, end;

View File

@@ -256,6 +256,7 @@ void show_all_devs_resources(int debug_level, const char *msg);
extern struct device_operations default_dev_ops_root; 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_set_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, void fixed_io_resource(struct device *dev, unsigned long index,

View File

@@ -52,11 +52,6 @@ static int get_pcie_bar(struct device *dev, unsigned int index, u32 *base, u32 *
return 0; return 0;
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static const char *northbridge_acpi_name(const struct device *dev) static const char *northbridge_acpi_name(const struct device *dev)
{ {
if (dev->path.type == DEVICE_PATH_DOMAIN) if (dev->path.type == DEVICE_PATH_DOMAIN)

View File

@@ -67,11 +67,6 @@ static void add_fixed_resources(struct device *dev, int index)
#endif #endif
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
static const char *northbridge_acpi_name(const struct device *dev) static const char *northbridge_acpi_name(const struct device *dev)
{ {

View File

@@ -99,7 +99,7 @@ static void add_fixed_resources(struct device *dev, int index)
} }
} }
static void pci_domain_set_resources(struct device *dev) static void pci_domain_set_resources_sandybridge(struct device *dev)
{ {
uint64_t tom, me_base, touud; uint64_t tom, me_base, touud;
uint32_t tseg_base, uma_size, tolud; uint32_t tseg_base, uma_size, tolud;
@@ -243,7 +243,7 @@ static const char *northbridge_acpi_name(const struct device *dev)
*/ */
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = pci_domain_read_resources,
.set_resources = pci_domain_set_resources, .set_resources = pci_domain_set_resources_sandybridge,
.scan_bus = pci_domain_scan_bus, .scan_bus = pci_domain_scan_bus,
.write_acpi_tables = northbridge_write_acpi_tables, .write_acpi_tables = northbridge_write_acpi_tables,
.acpi_name = northbridge_acpi_name, .acpi_name = northbridge_acpi_name,

View File

@@ -78,7 +78,7 @@ const char *soc_acpi_name(const struct device *dev)
struct device_operations pci_domain_ops = { struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = pci_domain_read_resources,
.set_resources = domain_set_resources, .set_resources = pci_domain_set_resources,
.scan_bus = pci_domain_scan_bus, .scan_bus = pci_domain_scan_bus,
.acpi_name = soc_acpi_name, .acpi_name = soc_acpi_name,
}; };

View File

@@ -197,11 +197,6 @@ const char *soc_acpi_name(const struct device *dev)
return NULL; return NULL;
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = pci_domain_read_resources,
.set_resources = pci_domain_set_resources, .set_resources = pci_domain_set_resources,

View File

@@ -8,11 +8,6 @@
#include <soc/ramstage.h> #include <soc/ramstage.h>
#include "chip.h" #include "chip.h"
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = pci_domain_read_resources,
.set_resources = pci_domain_set_resources, .set_resources = pci_domain_set_resources,

View File

@@ -10,12 +10,6 @@
#include "chip.h" #include "chip.h"
static void pci_domain_set_resources(struct device *dev)
{
printk(BIOS_SPEW, "%s/%s (%s)\n", __FILE__, __func__, dev_name(dev));
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = pci_domain_read_resources,
.set_resources = pci_domain_set_resources, .set_resources = pci_domain_set_resources,

View File

@@ -7,11 +7,6 @@
#include <soc/ramstage.h> #include <soc/ramstage.h>
#include <soc/intel/broadwell/chip.h> #include <soc/intel/broadwell/chip.h>
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -168,11 +168,6 @@ void soc_init_pre_device(void *chip_info)
soc_gpio_pm_configuration(); soc_gpio_pm_configuration();
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -17,11 +17,6 @@
#include <spi-generic.h> #include <spi-generic.h>
#include <soc/hob_mem.h> #include <soc/hob_mem.h>
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -124,11 +124,6 @@ void soc_init_pre_device(void *chip_info)
soc_fill_gpio_pm_configuration(); soc_fill_gpio_pm_configuration();
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -133,11 +133,6 @@ void soc_init_pre_device(void *chip_info)
soc_fill_gpio_pm_configuration(); soc_fill_gpio_pm_configuration();
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -106,11 +106,6 @@ static void chip_init(void *chip_info)
fsp_silicon_init(romstage_handoff_is_resume()); fsp_silicon_init(romstage_handoff_is_resume());
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = pci_domain_read_resources,
.set_resources = pci_domain_set_resources, .set_resources = pci_domain_set_resources,

View File

@@ -78,11 +78,6 @@ void soc_fsp_load(void)
fsps_load(romstage_handoff_is_resume()); fsps_load(romstage_handoff_is_resume());
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -132,11 +132,6 @@ void soc_init_pre_device(void *chip_info)
soc_fill_gpio_pm_configuration(); soc_fill_gpio_pm_configuration();
} }
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,

View File

@@ -14,11 +14,6 @@
/* C620 IOAPIC has 120 redirection entries */ /* C620 IOAPIC has 120 redirection entries */
#define C620_IOAPIC_REDIR_ENTRIES 120 #define C620_IOAPIC_REDIR_ENTRIES 120
static void pci_domain_set_resources(struct device *dev)
{
assign_resources(dev->link_list);
}
void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd) void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd)
{ {
/* not implemented yet */ /* not implemented yet */