1
/* Copyright 2013-2015 IBM Corp.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
28
/* Debugging option */
29
#define APOLLO_PCI_DBG(fmt, a...) \
30
prlog(PR_DEBUG, "APOLLO-PCI: " fmt, ##a)
31
#define APOLLO_PCI_INFO(fmt, a...) \
32
prlog(PR_INFO, "APOLLO-PCI: " fmt, ##a)
33
#define APOLLO_PCI_ERR(fmt, a...) \
34
prlog(PR_ERR, "APOLLO-PCI: " fmt, ##a)
36
void apollo_pci_setup_phb(struct phb *phb, unsigned int index)
38
struct dt_node *ioc_node;
40
/* Grab the device-tree node of the IOC */
41
ioc_node = phb->dt_node->parent;
43
APOLLO_PCI_DBG("No IOC devnode for PHB%04x\n",
49
* Process the pcie slot entries from the lx vpd lid
51
* FIXME: We currently assume chip 1 always, this will have to be
52
* fixed once we understand the right way to get the BRxy/BRxy "x"
53
* "x" value. It's not working well. I found 2 different root ports
54
* on Firebird-L has been assigned to same slot label.
56
lxvpd_process_slot_entries(phb, ioc_node, 1,
57
index, sizeof(struct lxvpd_pci_slot));
60
void apollo_pci_get_slot_info(struct phb *phb, struct pci_device *pd)
62
struct pci_slot *slot;
63
struct lxvpd_pci_slot *s = NULL;
65
if (pd->dev_type != PCIE_TYPE_ROOT_PORT &&
66
pd->dev_type != PCIE_TYPE_SWITCH_UPPORT &&
67
pd->dev_type != PCIE_TYPE_SWITCH_DNPORT &&
68
pd->dev_type != PCIE_TYPE_PCIE_TO_PCIX)
71
/* Create PCIe slot */
72
slot = pcie_slot_create(phb, pd);
76
/* Root complex inherits methods from PHB slot */
77
if (!pd->parent && phb->slot)
78
memcpy(&slot->ops, &phb->slot->ops, sizeof(struct pci_slot_ops));
81
s = lxvpd_get_slot(slot);
83
lxvpd_extract_info(slot, s);
84
slot->ops.add_properties = lxvpd_add_slot_properties;