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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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 ] ~

  1 /*
  2  * This file is subject to the terms and conditions of the GNU General Public
  3  * License.  See the file "COPYING" in the main directory of this archive
  4  * for more details.
  5  *
  6  * Copyright (C) 2000, 2001 Keith M Wesolowski
  7  */
  8 #include <linux/kernel.h>
  9 #include <linux/pci.h>
 10 #include <linux/types.h>
 11 #include <asm/ip32/mace.h>
 12 
 13 #if 0
 14 # define DPRINTK(args...) printk(args);
 15 #else
 16 # define DPRINTK(args...)
 17 #endif
 18 
 19 /*
 20  * O2 has up to 5 PCI devices connected into the MACE bridge.  The device
 21  * map looks like this:
 22  *
 23  * 0  aic7xxx 0
 24  * 1  aic7xxx 1
 25  * 2  expansion slot
 26  * 3  N/C
 27  * 4  N/C
 28  */
 29 
 30 static inline int mkaddr(struct pci_bus *bus, unsigned int devfn,
 31         unsigned int reg)
 32 {
 33         return ((bus->number & 0xff) << 16) |
 34                 ((devfn & 0xff) << 8) |
 35                 (reg & 0xfc);
 36 }
 37 
 38 
 39 static int
 40 mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 41                      int reg, int size, u32 *val)
 42 {
 43         u32 control = mace->pci.control;
 44 
 45         /* disable master aborts interrupts during config read */
 46         mace->pci.control = control & ~MACEPCI_CONTROL_MAR_INT;
 47         mace->pci.config_addr = mkaddr(bus, devfn, reg);
 48         switch (size) {
 49         case 1:
 50                 *val = mace->pci.config_data.b[(reg & 3) ^ 3];
 51                 break;
 52         case 2:
 53                 *val = mace->pci.config_data.w[((reg >> 1) & 1) ^ 1];
 54                 break;
 55         case 4:
 56                 *val = mace->pci.config_data.l;
 57                 break;
 58         }
 59         /* ack possible master abort */
 60         mace->pci.error &= ~MACEPCI_ERROR_MASTER_ABORT;
 61         mace->pci.control = control;
 62         /*
 63          * someone forgot to set the ultra bit for the onboard
 64          * scsi chips; we fake it here
 65          */
 66         if (bus->number == 0 && reg == 0x40 && size == 4 &&
 67             (devfn == (1 << 3) || devfn == (2 << 3)))
 68                 *val |= 0x1000;
 69 
 70         DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val);
 71 
 72         return PCIBIOS_SUCCESSFUL;
 73 }
 74 
 75 static int
 76 mace_pci_write_config(struct pci_bus *bus, unsigned int devfn,
 77                       int reg, int size, u32 val)
 78 {
 79         mace->pci.config_addr = mkaddr(bus, devfn, reg);
 80         switch (size) {
 81         case 1:
 82                 mace->pci.config_data.b[(reg & 3) ^ 3] = val;
 83                 break;
 84         case 2:
 85                 mace->pci.config_data.w[((reg >> 1) & 1) ^ 1] = val;
 86                 break;
 87         case 4:
 88                 mace->pci.config_data.l = val;
 89                 break;
 90         }
 91 
 92         DPRINTK("write%d: reg=%08x,val=%02x\n", size * 8, reg, val);
 93 
 94         return PCIBIOS_SUCCESSFUL;
 95 }
 96 
 97 struct pci_ops mace_pci_ops = {
 98         .read = mace_pci_read_config,
 99         .write = mace_pci_write_config,
100 };
101 

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