Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4794
b: refs/heads/master
c: 7c2a6c6
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter authored and Tony Luck committed Jul 12, 2005
1 parent 6679070 commit 5299107
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08357f82d4decc48bbfd39ae30d5fe0754f7f576
refs/heads/master: 7c2a6c62c013a4ea57243536fc7f3987e4ba04bc
20 changes: 18 additions & 2 deletions trunk/arch/ia64/sn/kernel/io_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ sn_default_pci_unmap(struct pci_dev *pdev, dma_addr_t addr, int direction)
}

static void *
sn_default_pci_bus_fixup(struct pcibus_bussoft *soft)
sn_default_pci_bus_fixup(struct pcibus_bussoft *soft, struct pci_controller *controller)
{
return NULL;
}
Expand Down Expand Up @@ -362,7 +362,7 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)

provider_soft = NULL;
if (provider->bus_fixup)
provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr);
provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller);

if (provider_soft == NULL)
return; /* fixup failed or not applicable */
Expand All @@ -380,6 +380,22 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
SN_PCIBUS_BUSSOFT(bus)->bs_xwidget_info =
&(hubdev_info->hdi_xwidget_info[SN_PCIBUS_BUSSOFT(bus)->bs_xid]);

/*
* If the node information we obtained during the fixup phase is invalid
* then set controller->node to -1 (undetermined)
*/
if (controller->node >= num_online_nodes()) {
struct pcibus_bussoft *b = SN_PCIBUS_BUSSOFT(bus);

printk(KERN_WARNING "Device ASIC=%u XID=%u PBUSNUM=%lu"
"L_IO=%lx L_MEM=%lx BASE=%lx\n",
b->bs_asic_type, b->bs_xid, b->bs_persist_busnum,
b->bs_legacy_io, b->bs_legacy_mem, b->bs_base);
printk(KERN_WARNING "on node %d but only %d nodes online."
"Association set to undetermined.\n",
controller->node, num_online_nodes());
controller->node = -1;
}
return;

error_return:
Expand Down
16 changes: 13 additions & 3 deletions trunk/arch/ia64/sn/pci/pci_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,27 @@ void *sn_dma_alloc_coherent(struct device *dev, size_t size,
{
void *cpuaddr;
unsigned long phys_addr;
int node;
struct pci_dev *pdev = to_pci_dev(dev);
struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);

BUG_ON(dev->bus != &pci_bus_type);

/*
* Allocate the memory.
* FIXME: We should be doing alloc_pages_node for the node closest
* to the PCI device.
*/
if (!(cpuaddr = (void *)__get_free_pages(GFP_ATOMIC, get_order(size))))
node = pcibus_to_node(pdev->bus);
if (likely(node >=0)) {
struct page *p = alloc_pages_node(node, GFP_ATOMIC, get_order(size));

if (likely(p))
cpuaddr = page_address(p);
else
return NULL;
} else
cpuaddr = (void *)__get_free_pages(GFP_ATOMIC, get_order(size));

if (unlikely(!cpuaddr))
return NULL;

memset(cpuaddr, 0x0, size);
Expand Down
10 changes: 9 additions & 1 deletion trunk/arch/ia64/sn/pci/pcibr/pcibr_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pcibr_error_intr_handler(int irq, void *arg, struct pt_regs *regs)
}

void *
pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft)
pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *controller)
{
int nasid, cnode, j;
struct hubdev_info *hubdev_info;
Expand Down Expand Up @@ -158,6 +158,14 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft)
memset(soft->pbi_int_ate_resource.ate, 0,
(soft->pbi_int_ate_size * sizeof(uint64_t)));

if (prom_bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP)
/*
* TIO PCI Bridge with no closest node information.
* FIXME: Find another way to determine the closest node
*/
controller->node = -1;
else
controller->node = cnode;
return soft;
}

Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/ia64/sn/pci/tioca_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ tioca_error_intr_handler(int irq, void *arg, struct pt_regs *pt)
* the caller.
*/
static void *
tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft)
tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *controller)
{
struct tioca_common *tioca_common;
struct tioca_kernel *tioca_kern;
Expand Down Expand Up @@ -646,6 +646,8 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft)
__FUNCTION__, SGI_TIOCA_ERROR,
(int)tioca_common->ca_common.bs_persist_busnum);

/* Setup locality information */
controller->node = tioca_kern->ca_closest_node;
return tioca_common;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-ia64/sn/pcibr_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pcibr_lock(struct pcibus_info *pcibus_info)
#define pcibr_unlock(pcibus_info, flag) spin_unlock_irqrestore(&pcibus_info->pbi_lock, flag)

extern int pcibr_init_provider(void);
extern void *pcibr_bus_fixup(struct pcibus_bussoft *);
extern void *pcibr_bus_fixup(struct pcibus_bussoft *, struct pci_controller *);
extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t);
extern dma_addr_t pcibr_dma_map_consistent(struct pci_dev *, unsigned long, size_t);
extern void pcibr_dma_unmap(struct pci_dev *, dma_addr_t, int);
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/asm-ia64/sn/pcibus_provider_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct pcibus_bussoft {
struct xwidget_info *bs_xwidget_info;
};

struct pci_controller;
/*
* SN pci bus indirection
*/
Expand All @@ -45,7 +46,7 @@ struct sn_pcibus_provider {
dma_addr_t (*dma_map)(struct pci_dev *, unsigned long, size_t);
dma_addr_t (*dma_map_consistent)(struct pci_dev *, unsigned long, size_t);
void (*dma_unmap)(struct pci_dev *, dma_addr_t, int);
void * (*bus_fixup)(struct pcibus_bussoft *);
void * (*bus_fixup)(struct pcibus_bussoft *, struct pci_controller *);
};

extern struct sn_pcibus_provider *sn_pci_provider[];
Expand Down

0 comments on commit 5299107

Please sign in to comment.