From: Zach Brown <zab@zabbo.net>
To: linux-kernel@vger.kernel.org
Subject: [RFC] pci_dma_set_mask()
Date: Wed, 28 Feb 2001 10:37:27 -0500 [thread overview]
Message-ID: <20010228103727.I23735@tetsuo.zabbo.net> (raw)
This patch really has two parts. Most of it adds a helper function that
does the
if(pci_dma_supported()) { ->dma_mask = mask }
code path. I was using the api today and didn't realize that I had to
set the mask myself, I assumed the _supported call would do it. If
people prefer the struct setting api, thats fine with me :)
It also seems goofy that pci_dma_supported() unconditionally return true
on x86. If a device needs a mask smaller than GFP_DMA (admitedly probably
won't exist in the real world, one hopes), they're going to have troubles
because x86 just falls back to GFP_DMA when the mask isn't 0xffffffff..
all totally untested, of course..
--
zach
--- linux-2.4.2/include/linux/pci.h.dmasup Wed Feb 28 10:26:14 2001
+++ linux-2.4.2/include/linux/pci.h Wed Feb 28 10:30:12 2001
@@ -527,6 +527,7 @@
int pci_enable_device(struct pci_dev *dev);
void pci_set_master(struct pci_dev *dev);
+int pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask);
int pci_set_power_state(struct pci_dev *dev, int state);
int pci_assign_resource(struct pci_dev *dev, int i);
--- linux-2.4.2/include/asm-i386/pci.h.dmasup Wed Feb 28 10:19:01 2001
+++ linux-2.4.2/include/asm-i386/pci.h Wed Feb 28 10:25:40 2001
@@ -152,6 +152,14 @@
*/
extern inline int pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
{
+ /*
+ * we fall back to GFP_DMA when the mask isn't all 1s,
+ * so we can't guarantee allocations that must be
+ * within a tighter range than GFP_DMA..
+ */
+ if(mask < 0x00ffffff)
+ return 0;
+
return 1;
}
--- linux-2.4.2/drivers/pci/pci.c.dmasup Wed Feb 28 10:26:34 2001
+++ linux-2.4.2/drivers/pci/pci.c Wed Feb 28 10:27:34 2001
@@ -518,6 +518,18 @@
pcibios_set_master(dev);
}
+int
+pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask)
+{
+ if(! pci_dma_supported(dev, mask))
+ return 0;
+
+ dev->dma_mask = mask;
+
+ return 1;
+}
+
+
/*
* Translate the low bits of the PCI base
* to the resource type
@@ -1206,6 +1218,7 @@
EXPORT_SYMBOL(pci_find_slot);
EXPORT_SYMBOL(pci_find_subsys);
EXPORT_SYMBOL(pci_set_master);
+EXPORT_SYMBOL(pci_set_dma_mask);
EXPORT_SYMBOL(pci_set_power_state);
EXPORT_SYMBOL(pci_assign_resource);
EXPORT_SYMBOL(pci_register_driver);
next reply other threads:[~2001-02-28 15:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-28 15:37 Zach Brown [this message]
2001-02-28 16:26 ` Jeff Garzik
2001-02-28 21:14 ` Zach Brown
2001-02-28 23:23 ` David S. Miller
2001-02-28 23:37 ` Zach Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010228103727.I23735@tetsuo.zabbo.net \
--to=zab@zabbo.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®