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

TOMOYO Linux Cross Reference
Linux/arch/x86/pci/numachip.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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/pci/numachip.c (Version linux-6.12-rc7) and /arch/i386/pci/numachip.c (Version linux-5.4.281)


** Warning: Cannot open xref database.

  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * Numascale NumaConnect-specific PCI code        
  4  *                                                
  5  * Copyright (C) 2012 Numascale AS. All rights    
  6  *                                                
  7  * Send feedback to <support@numascale.com>       
  8  *                                                
  9  * PCI accessor functions derived from mmconfi    
 10  *                                                
 11  */                                               
 12                                                   
 13 #include <linux/pci.h>                            
 14 #include <asm/pci_x86.h>                          
 15 #include <asm/numachip/numachip.h>                
 16                                                   
 17 static u8 limit __read_mostly;                    
 18                                                   
 19 static inline char __iomem *pci_dev_base(unsig    
 20 {                                                 
 21         struct pci_mmcfg_region *cfg = pci_mmc    
 22                                                   
 23         if (cfg && cfg->virt)                     
 24                 return cfg->virt + (PCI_MMCFG_    
 25         return NULL;                              
 26 }                                                 
 27                                                   
 28 static int pci_mmcfg_read_numachip(unsigned in    
 29                           unsigned int devfn,     
 30 {                                                 
 31         char __iomem *addr;                       
 32                                                   
 33         /* Why do we have this when nobody che    
 34         if (unlikely((bus > 255) || (devfn > 2    
 35 err:            *value = -1;                      
 36                 return -EINVAL;                   
 37         }                                         
 38                                                   
 39         /* Ensure AMD Northbridges don't decod    
 40         if (unlikely(bus == 0 && devfn >= limi    
 41                 *value = -1;                      
 42                 return 0;                         
 43         }                                         
 44                                                   
 45         rcu_read_lock();                          
 46         addr = pci_dev_base(seg, bus, devfn);     
 47         if (!addr) {                              
 48                 rcu_read_unlock();                
 49                 goto err;                         
 50         }                                         
 51                                                   
 52         switch (len) {                            
 53         case 1:                                   
 54                 *value = mmio_config_readb(add    
 55                 break;                            
 56         case 2:                                   
 57                 *value = mmio_config_readw(add    
 58                 break;                            
 59         case 4:                                   
 60                 *value = mmio_config_readl(add    
 61                 break;                            
 62         }                                         
 63         rcu_read_unlock();                        
 64                                                   
 65         return 0;                                 
 66 }                                                 
 67                                                   
 68 static int pci_mmcfg_write_numachip(unsigned i    
 69                            unsigned int devfn,    
 70 {                                                 
 71         char __iomem *addr;                       
 72                                                   
 73         /* Why do we have this when nobody che    
 74         if (unlikely((bus > 255) || (devfn > 2    
 75                 return -EINVAL;                   
 76                                                   
 77         /* Ensure AMD Northbridges don't decod    
 78         if (unlikely(bus == 0 && devfn >= limi    
 79                 return 0;                         
 80                                                   
 81         rcu_read_lock();                          
 82         addr = pci_dev_base(seg, bus, devfn);     
 83         if (!addr) {                              
 84                 rcu_read_unlock();                
 85                 return -EINVAL;                   
 86         }                                         
 87                                                   
 88         switch (len) {                            
 89         case 1:                                   
 90                 mmio_config_writeb(addr + reg,    
 91                 break;                            
 92         case 2:                                   
 93                 mmio_config_writew(addr + reg,    
 94                 break;                            
 95         case 4:                                   
 96                 mmio_config_writel(addr + reg,    
 97                 break;                            
 98         }                                         
 99         rcu_read_unlock();                        
100                                                   
101         return 0;                                 
102 }                                                 
103                                                   
104 static const struct pci_raw_ops pci_mmcfg_numa    
105         .read = pci_mmcfg_read_numachip,          
106         .write = pci_mmcfg_write_numachip,        
107 };                                                
108                                                   
109 int __init pci_numachip_init(void)                
110 {                                                 
111         int ret = 0;                              
112         u32 val;                                  
113                                                   
114         /* For remote I/O, restrict bus 0 acce    
115            Northbridges, which starts at devic    
116         ret = raw_pci_read(0, 0, PCI_DEVFN(0x1    
117         if (ret)                                  
118                 goto out;                         
119                                                   
120         /* HyperTransport fabric size in bits     
121         limit = PCI_DEVFN(0x18 + ((val >> 4) &    
122                                                   
123         /* Use NumaChip PCI accessors for non-    
124         raw_pci_ops = raw_pci_ext_ops = &pci_m    
125 out:                                              
126         return ret;                               
127 }                                                 
128                                                   

~ [ 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