diff options
author | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-07-19 17:49:39 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-07-19 17:49:39 -0400 |
commit | 39299d9d15c41cbdd7c7009967cd35afaf34d8fa (patch) | |
tree | 42a0c0408fcf76024eb6885a27d4f1ed0228abcf /arch/ia64/sn/pci/pci_dma.c | |
parent | ce625a801664d8ed7344117bbb57510e4e0e872c (diff) | |
parent | f60f700876cd51de9de69f3a3c865d95e287a24d (diff) |
Merge with /shiny/git/linux-2.6/.git
Diffstat (limited to 'arch/ia64/sn/pci/pci_dma.c')
-rw-r--r-- | arch/ia64/sn/pci/pci_dma.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c index a2f7a88aefbb..0e4b9ad9ef02 100644 --- a/arch/ia64/sn/pci/pci_dma.c +++ b/arch/ia64/sn/pci/pci_dma.c | |||
@@ -79,6 +79,7 @@ void *sn_dma_alloc_coherent(struct device *dev, size_t size, | |||
79 | { | 79 | { |
80 | void *cpuaddr; | 80 | void *cpuaddr; |
81 | unsigned long phys_addr; | 81 | unsigned long phys_addr; |
82 | int node; | ||
82 | struct pci_dev *pdev = to_pci_dev(dev); | 83 | struct pci_dev *pdev = to_pci_dev(dev); |
83 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); | 84 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); |
84 | 85 | ||
@@ -86,10 +87,19 @@ void *sn_dma_alloc_coherent(struct device *dev, size_t size, | |||
86 | 87 | ||
87 | /* | 88 | /* |
88 | * Allocate the memory. | 89 | * Allocate the memory. |
89 | * FIXME: We should be doing alloc_pages_node for the node closest | ||
90 | * to the PCI device. | ||
91 | */ | 90 | */ |
92 | if (!(cpuaddr = (void *)__get_free_pages(GFP_ATOMIC, get_order(size)))) | 91 | node = pcibus_to_node(pdev->bus); |
92 | if (likely(node >=0)) { | ||
93 | struct page *p = alloc_pages_node(node, GFP_ATOMIC, get_order(size)); | ||
94 | |||
95 | if (likely(p)) | ||
96 | cpuaddr = page_address(p); | ||
97 | else | ||
98 | return NULL; | ||
99 | } else | ||
100 | cpuaddr = (void *)__get_free_pages(GFP_ATOMIC, get_order(size)); | ||
101 | |||
102 | if (unlikely(!cpuaddr)) | ||
93 | return NULL; | 103 | return NULL; |
94 | 104 | ||
95 | memset(cpuaddr, 0x0, size); | 105 | memset(cpuaddr, 0x0, size); |