8 #include <soc/soc_util.h>
59 assert(stack->PciResourceIoBase <= stack->PciResourceIoLimit);
60 return stack->PciResourceIoBase;
63 assert(stack->PciResourceMem32Base <= stack->PciResourceMem32Limit);
64 return stack->PciResourceMem32Base;
66 assert(stack->PciResourceMem64Base <= stack->PciResourceMem64Limit);
67 return stack->PciResourceMem64Base;
73 assert(
base <= (stack->PciResourceIoLimit + 1));
74 stack->PciResourceIoBase =
base;
76 assert(
base <= (stack->PciResourceMem32Limit + 1));
77 stack->PciResourceMem32Base =
base;
79 assert(
base <= (stack->PciResourceMem64Limit + 1));
80 stack->PciResourceMem64Base =
base;
94 while (link !=
NULL) {
109 void (*dev_iterator)(
struct device *,
void *),
131 dev_iterator(curdev, data);
135 res_iterator(curdev, res, data);
162 for (
int i = 0; i <
info->no_of_stacks; ++i) {
164 return &
info->res[i];
189 die(
"assign_resource_to_stack(): out of memory.\n");
213 die(
"%s: out of memory.\n", __func__);
264 res_root = res_root->
next;
298 res_root = res_root->
next;
373 for (
int rt = 0; rt < no_res_types; ++rt) {
379 __func__, __LINE__,
dev_path(curdev));
387 if (res->
size == 0 ||
410 return hob->PlatformData.Pci64BitResourceAllocation;
442 STACK_RES *
res = &stack_info.
res[
s];
444 res->PciResourceMem32Base + 1)/2;
445 res->PciResourceMem64Limit =
res->PciResourceMem32Limit;
446 res->PciResourceMem32Limit = (
res->PciResourceMem32Base +
length - 1);
447 res->PciResourceMem64Base =
res->PciResourceMem32Limit + 1;
478 while (link !=
NULL) {
491 struct bus *iiostack_bus;
500 if (stack_info.
res[
s].BusBase == 0)
503 iiostack_bus =
malloc(
sizeof(
struct bus));
504 if (iiostack_bus ==
NULL)
505 die(
"%s: out of memory.\n", __func__);
506 memset(iiostack_bus, 0,
sizeof(*iiostack_bus));
507 memcpy(iiostack_bus, dev->
bus,
sizeof(*iiostack_bus));
515 dummy.
bus = iiostack_bus;
519 if (
id == 0xffffffff)
529 nlink->
next = iiostack_bus;
void * memcpy(void *dest, const void *src, size_t n)
void * memset(void *dstpp, int c, size_t len)
#define assert(statement)
static void xeonsp_pci_domain_read_resources(struct device *dev)
void xeonsp_pci_domain_scan_bus(struct device *dev)
static void assign_bridge_resources(struct iiostack_resource *stack_list, struct device *dev, struct resource *bridge)
static bool need_assignment(uint64_t flags)
void xeonsp_pci_domain_set_resources(struct device *dev)
static void set_resource_base(STACK_RES *stack, RES_TYPE res_type, uint64_t base)
static void xeonsp_pci_dev_dummy_func(struct device *dev)
static void xeonsp_pci_dev_iterator(struct bus *bus, void(*dev_iterator)(struct device *, void *), void(*res_iterator)(struct device *, struct resource *, void *), void *data)
static void reclaim_resource_mem(struct stack_dev_resource *res_root)
static void reserve_dev_resources(STACK_RES *stack, RES_TYPE res_type, struct stack_dev_resource *res_root, struct resource *bridge)
static uint64_t get_resource_base(STACK_RES *stack, RES_TYPE res_type)
static STACK_RES * find_stack_for_bus(struct iiostack_resource *info, uint8_t bus)
static void reset_resource_to_unassigned(struct device *dev, struct resource *res, void *data)
static uint8_t is_pci64bit_alloc(void)
static void xeonsp_pci_dev_read_resources(struct device *dev, void *data)
static void xeonsp_reset_pci_op(struct device *dev, void *data)
static RES_TYPE get_res_type(uint64_t flags)
static void add_res_to_stack(struct stack_dev_resource **root, struct device *dev, struct resource *res)
static void assign_stack_resources(struct iiostack_resource *stack_list, struct device *dev, struct resource *bridge)
void attach_iio_stacks(struct device *dev)
#define printk(level,...)
void __noreturn die(const char *fmt,...)
void scan_bridges(struct bus *bus)
void assign_resources(struct bus *bus)
Assign the computed resources to the devices on the bus.
void print_resource_tree(const struct device *root, int debug_level, const char *msg)
const char * dev_path(const struct device *dev)
static struct smmstore_params_info info
#define DEV_FUNC_EXIT(dev)
#define DEV_FUNC_ENTER(dev)
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
void * malloc(size_t size)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
static const PCI_SUBCLASS bridge[]
#define PCI_DEVFN(slot, func)
struct device * pci_probe_dev(struct device *dev, struct bus *bus, unsigned int devfn)
Scan a PCI bus.
void pci_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn)
Scan a PCI bus.
void pci_domain_read_resources(struct device *dev)
static void post_log_path(const struct device *dev)
#define IORESOURCE_RESERVE
#define IORESOURCE_STORED
#define IORESOURCE_ASSIGNED
#define IORESOURCE_PREFETCH
#define IORESOURCE_BRIDGE
void get_iiostack_info(struct iiostack_resource *info)
const IIO_UDS * get_iio_uds(void)
unsigned long long uint64_t
DEVTREE_CONST struct bus * next
DEVTREE_CONST struct device * children
DEVTREE_CONST struct device * dev
void(* read_resources)(struct device *dev)
enum device_path_type type
DEVTREE_CONST struct device * sibling
struct device_operations * ops
DEVTREE_CONST struct bus * bus
DEVTREE_CONST struct bus * link_list
DEVTREE_CONST struct resource * resource_list
STACK_RES res[CONFIG_MAX_SOCKET *MAX_IIO_STACK]
struct pci_resource * next
DEVTREE_CONST struct resource * next
struct stack_dev_resource * next
struct pci_resource * children
#define s(param, src_bits, pmcreg, dst_bits)