~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/pci/ops-msc.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/mips/pci/ops-msc.c (Version linux-6.12-rc7) and /arch/sparc64/pci/ops-msc.c (Version linux-5.18.19)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Copyright (C) 1999, 2000, 2004, 2005  MIPS     
  4  *    All rights reserved.                        
  5  *    Authors: Carsten Langgaard <carstenl@mip    
  6  *             Maciej W. Rozycki <macro@mips.c    
  7  * Copyright (C) 2005 Ralf Baechle (ralf@linux    
  8  *                                                
  9  * MIPS boards specific PCI support.              
 10  */                                               
 11 #include <linux/types.h>                          
 12 #include <linux/pci.h>                            
 13 #include <linux/kernel.h>                         
 14                                                   
 15 #include <asm/mips-boards/msc01_pci.h>            
 16                                                   
 17 #define PCI_ACCESS_READ  0                        
 18 #define PCI_ACCESS_WRITE 1                        
 19                                                   
 20 /*                                                
 21  *  PCI configuration cycle AD bus definition     
 22  */                                               
 23 /* Type 0 */                                      
 24 #define PCI_CFG_TYPE0_REG_SHF           0         
 25 #define PCI_CFG_TYPE0_FUNC_SHF          8         
 26                                                   
 27 /* Type 1 */                                      
 28 #define PCI_CFG_TYPE1_REG_SHF           0         
 29 #define PCI_CFG_TYPE1_FUNC_SHF          8         
 30 #define PCI_CFG_TYPE1_DEV_SHF           11        
 31 #define PCI_CFG_TYPE1_BUS_SHF           16        
 32                                                   
 33 static int msc_pcibios_config_access(unsigned     
 34         struct pci_bus *bus, unsigned int devf    
 35 {                                                 
 36         unsigned char busnum = bus->number;       
 37         u32 intr;                                 
 38                                                   
 39         /* Clear status register bits. */         
 40         MSC_WRITE(MSC01_PCI_INTSTAT,              
 41                   (MSC01_PCI_INTCFG_MA_BIT | M    
 42                                                   
 43         MSC_WRITE(MSC01_PCI_CFGADDR,              
 44                   ((busnum << MSC01_PCI_CFGADD    
 45                    (PCI_SLOT(devfn) << MSC01_P    
 46                    (PCI_FUNC(devfn) << MSC01_P    
 47                    ((where / 4) << MSC01_PCI_C    
 48                                                   
 49         /* Perform access */                      
 50         if (access_type == PCI_ACCESS_WRITE)      
 51                 MSC_WRITE(MSC01_PCI_CFGDATA, *    
 52         else                                      
 53                 MSC_READ(MSC01_PCI_CFGDATA, *d    
 54                                                   
 55         /* Detect Master/Target abort */          
 56         MSC_READ(MSC01_PCI_INTSTAT, intr);        
 57         if (intr & (MSC01_PCI_INTCFG_MA_BIT |     
 58                 /* Error occurred */              
 59                                                   
 60                 /* Clear bits */                  
 61                 MSC_WRITE(MSC01_PCI_INTSTAT,      
 62                           (MSC01_PCI_INTCFG_MA    
 63                                                   
 64                 return -1;                        
 65         }                                         
 66                                                   
 67         return 0;                                 
 68 }                                                 
 69                                                   
 70                                                   
 71 /*                                                
 72  * We can't address 8 and 16 bit words directl    
 73  * read/write a 32bit word and mask/modify the    
 74  */                                               
 75 static int msc_pcibios_read(struct pci_bus *bu    
 76                              int where, int si    
 77 {                                                 
 78         u32 data = 0;                             
 79                                                   
 80         if ((size == 2) && (where & 1))           
 81                 return PCIBIOS_BAD_REGISTER_NU    
 82         else if ((size == 4) && (where & 3))      
 83                 return PCIBIOS_BAD_REGISTER_NU    
 84                                                   
 85         if (msc_pcibios_config_access(PCI_ACCE    
 86                                       &data))     
 87                 return -1;                        
 88                                                   
 89         if (size == 1)                            
 90                 *val = (data >> ((where & 3) <    
 91         else if (size == 2)                       
 92                 *val = (data >> ((where & 3) <    
 93         else                                      
 94                 *val = data;                      
 95                                                   
 96         return PCIBIOS_SUCCESSFUL;                
 97 }                                                 
 98                                                   
 99 static int msc_pcibios_write(struct pci_bus *b    
100                               int where, int s    
101 {                                                 
102         u32 data = 0;                             
103                                                   
104         if ((size == 2) && (where & 1))           
105                 return PCIBIOS_BAD_REGISTER_NU    
106         else if ((size == 4) && (where & 3))      
107                 return PCIBIOS_BAD_REGISTER_NU    
108                                                   
109         if (size == 4)                            
110                 data = val;                       
111         else {                                    
112                 if (msc_pcibios_config_access(    
113                                                   
114                         return -1;                
115                                                   
116                 if (size == 1)                    
117                         data = (data & ~(0xff     
118                                 (val << ((wher    
119                 else if (size == 2)               
120                         data = (data & ~(0xfff    
121                                 (val << ((wher    
122         }                                         
123                                                   
124         if (msc_pcibios_config_access(PCI_ACCE    
125                                        &data))    
126                 return -1;                        
127                                                   
128         return PCIBIOS_SUCCESSFUL;                
129 }                                                 
130                                                   
131 struct pci_ops msc_pci_ops = {                    
132         .read = msc_pcibios_read,                 
133         .write = msc_pcibios_write                
134 };                                                
135                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php