aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-10-10 10:01:21 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:36:57 -0500
commitedb2d97eb57b7a21c9256260562de6a65dda86cc (patch)
treec07b98d0e14256e6a91709c39e55074d5ffcc05e
parentebf5a24829def5d066922ceebde61dd57fdc6b1e (diff)
PCI: Replace HAVE_ARCH_PCI_MWI with PCI_DISABLE_MWI
pSeries is the only architecture left using HAVE_ARCH_PCI_MWI and it's really inappropriate for its needs. It really wants to disable MWI altogether. So here are a pair of stub implementations for pci_set_mwi and pci_clear_mwi. Also rename pci_generic_prep_mwi to pci_set_cacheline_size since that better reflects what it does. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Cc: Paul Mackerras <paulus@samba.org> Acked-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/pci.c31
-rw-r--r--include/asm-powerpc/pci.h20
2 files changed, 25 insertions, 26 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bc88c30a418b..427991741cf3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -875,7 +875,17 @@ pci_set_master(struct pci_dev *dev)
875 pcibios_set_master(dev); 875 pcibios_set_master(dev);
876} 876}
877 877
878#ifndef HAVE_ARCH_PCI_MWI 878#ifdef PCI_DISABLE_MWI
879int pci_set_mwi(struct pci_dev *dev)
880{
881 return 0;
882}
883
884void pci_clear_mwi(struct pci_dev *dev)
885{
886}
887
888#else
879 889
880#ifndef PCI_CACHE_LINE_BYTES 890#ifndef PCI_CACHE_LINE_BYTES
881#define PCI_CACHE_LINE_BYTES L1_CACHE_BYTES 891#define PCI_CACHE_LINE_BYTES L1_CACHE_BYTES
@@ -886,17 +896,17 @@ pci_set_master(struct pci_dev *dev)
886u8 pci_cache_line_size = PCI_CACHE_LINE_BYTES / 4; 896u8 pci_cache_line_size = PCI_CACHE_LINE_BYTES / 4;
887 897
888/** 898/**
889 * pci_generic_prep_mwi - helper function for pci_set_mwi 899 * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed
890 * @dev: the PCI device for which MWI is enabled 900 * @dev: the PCI device for which MWI is to be enabled
891 * 901 *
892 * Helper function for generic implementation of pcibios_prep_mwi 902 * Helper function for pci_set_mwi.
893 * function. Originally copied from drivers/net/acenic.c. 903 * Originally copied from drivers/net/acenic.c.
894 * Copyright 1998-2001 by Jes Sorensen, <jes@trained-monkey.org>. 904 * Copyright 1998-2001 by Jes Sorensen, <jes@trained-monkey.org>.
895 * 905 *
896 * RETURNS: An appropriate -ERRNO error value on error, or zero for success. 906 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
897 */ 907 */
898static int 908static int
899pci_generic_prep_mwi(struct pci_dev *dev) 909pci_set_cacheline_size(struct pci_dev *dev)
900{ 910{
901 u8 cacheline_size; 911 u8 cacheline_size;
902 912
@@ -922,7 +932,6 @@ pci_generic_prep_mwi(struct pci_dev *dev)
922 932
923 return -EINVAL; 933 return -EINVAL;
924} 934}
925#endif /* !HAVE_ARCH_PCI_MWI */
926 935
927/** 936/**
928 * pci_set_mwi - enables memory-write-invalidate PCI transaction 937 * pci_set_mwi - enables memory-write-invalidate PCI transaction
@@ -940,12 +949,7 @@ pci_set_mwi(struct pci_dev *dev)
940 int rc; 949 int rc;
941 u16 cmd; 950 u16 cmd;
942 951
943#ifdef HAVE_ARCH_PCI_MWI 952 rc = pci_set_cacheline_size(dev);
944 rc = pcibios_prep_mwi(dev);
945#else
946 rc = pci_generic_prep_mwi(dev);
947#endif
948
949 if (rc) 953 if (rc)
950 return rc; 954 return rc;
951 955
@@ -976,6 +980,7 @@ pci_clear_mwi(struct pci_dev *dev)
976 pci_write_config_word(dev, PCI_COMMAND, cmd); 980 pci_write_config_word(dev, PCI_COMMAND, cmd);
977 } 981 }
978} 982}
983#endif /* ! PCI_DISABLE_MWI */
979 984
980/** 985/**
981 * pci_intx - enables/disables PCI INTx for device dev 986 * pci_intx - enables/disables PCI INTx for device dev
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 46afd29b904e..721c97f09b20 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -62,19 +62,13 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
62} 62}
63 63
64#ifdef CONFIG_PPC64 64#ifdef CONFIG_PPC64
65#define HAVE_ARCH_PCI_MWI 1 65
66static inline int pcibios_prep_mwi(struct pci_dev *dev) 66/*
67{ 67 * We want to avoid touching the cacheline size or MWI bit.
68 /* 68 * pSeries firmware sets the cacheline size (which is not the cpu cacheline
69 * We would like to avoid touching the cacheline size or MWI bit 69 * size in all cases) and hardware treats MWI the same as memory write.
70 * but we cant do that with the current pcibios_prep_mwi 70 */
71 * interface. pSeries firmware sets the cacheline size (which is not 71#define PCI_DISABLE_MWI
72 * the cpu cacheline size in all cases) and hardware treats MWI
73 * the same as memory write. So we dont touch the cacheline size
74 * here and allow the generic code to set the MWI bit.
75 */
76 return 0;
77}
78 72
79extern struct dma_mapping_ops pci_dma_ops; 73extern struct dma_mapping_ops pci_dma_ops;
80 74