From b1776b04ae7a0623c5fa8611770593011fe3a01f Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 22 Mar 2004 14:15:58 -0500 Subject: [PATCH] Create PCI_DMA_{64,32]BIT constants, for use in passing to pci_set_{consistent_}dma_mask(). Use them in e1000 and ixgb. --- Documentation/DMA-mapping.txt | 16 ++++++++-------- drivers/net/e1000/e1000.h | 2 -- drivers/net/ixgb/ixgb.h | 2 -- include/linux/pci.h | 3 +++ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt index a77c940893c65..5f3675cf096d4 100644 --- a/Documentation/DMA-mapping.txt +++ b/Documentation/DMA-mapping.txt @@ -132,7 +132,7 @@ exactly why. The standard 32-bit addressing PCI device would do something like this: - if (pci_set_dma_mask(pdev, 0xffffffff)) { + if (pci_set_dma_mask(pdev, PCI_DMA_32BIT)) { printk(KERN_WARNING "mydev: No suitable DMA available.\n"); goto ignore_this_device; @@ -151,9 +151,9 @@ all 64-bits when accessing streaming DMA: int using_dac; - if (!pci_set_dma_mask(pdev, 0xffffffffffffffff)) { + if (!pci_set_dma_mask(pdev, PCI_DMA_64BIT)) { using_dac = 1; - } else if (!pci_set_dma_mask(pdev, 0xffffffff)) { + } else if (!pci_set_dma_mask(pdev, PCI_DMA_32BIT)) { using_dac = 0; } else { printk(KERN_WARNING @@ -166,14 +166,14 @@ the case would look like this: int using_dac, consistent_using_dac; - if (!pci_set_dma_mask(pdev, 0xffffffffffffffff)) { + if (!pci_set_dma_mask(pdev, PCI_DMA_64BIT)) { using_dac = 1; consistent_using_dac = 1; - pci_set_consistent_dma_mask(pdev, 0xffffffffffffffff) - } else if (!pci_set_dma_mask(pdev, 0xffffffff)) { + pci_set_consistent_dma_mask(pdev, PCI_DMA_64BIT); + } else if (!pci_set_dma_mask(pdev, PCI_DMA_32BIT)) { using_dac = 0; consistent_using_dac = 0; - pci_set_consistent_dma_mask(pdev, 0xffffffff) + pci_set_consistent_dma_mask(pdev, PCI_DMA_32BIT); } else { printk(KERN_WARNING "mydev: No suitable DMA available.\n"); @@ -215,7 +215,7 @@ most specific mask. Here is pseudo-code showing how this might be done: - #define PLAYBACK_ADDRESS_BITS 0xffffffff + #define PLAYBACK_ADDRESS_BITS PCI_DMA_32BIT #define RECORD_ADDRESS_BITS 0x00ffffff struct my_sound_card *card; diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 019267bdedf30..3d4d9181b58ae 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -74,8 +74,6 @@ #define BAR_0 0 #define BAR_1 1 #define BAR_5 5 -#define PCI_DMA_64BIT 0xffffffffffffffffULL -#define PCI_DMA_32BIT 0x00000000ffffffffULL struct e1000_adapter; diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h index 3e84fbec0981c..d9c70c42dbd48 100644 --- a/drivers/net/ixgb/ixgb.h +++ b/drivers/net/ixgb/ixgb.h @@ -65,8 +65,6 @@ struct ixgb_adapter; #define BAR_0 0 #define BAR_1 1 #define BAR_5 5 -#define PCI_DMA_64BIT 0xffffffffffffffffULL -#define PCI_DMA_32BIT 0x00000000ffffffffULL #include "ixgb_hw.h" #include "ixgb_ee.h" diff --git a/include/linux/pci.h b/include/linux/pci.h index 3f2b4949a65ee..f16a5bbb2ba3e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -362,6 +362,9 @@ enum pci_mmap_state { #define PCI_DMA_FROMDEVICE 2 #define PCI_DMA_NONE 3 +#define PCI_DMA_64BIT 0xffffffffffffffffULL +#define PCI_DMA_32BIT 0x00000000ffffffffULL + #define DEVICE_COUNT_COMPATIBLE 4 #define DEVICE_COUNT_RESOURCE 12 -- 2.53.0