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

TOMOYO Linux Cross Reference
Linux/arch/sh/drivers/pci/ops-dreamcast.c

Version: ~ [ linux-5.6 ] ~ [ linux-5.5.13 ] ~ [ linux-5.4.28 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.113 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.174 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.217 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.217 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.82 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * PCI operations for the Sega Dreamcast
  3  *
  4  * Copyright (C) 2001, 2002  M. R. Brown
  5  * Copyright (C) 2002, 2003  Paul Mundt
  6  *
  7  * This file is subject to the terms and conditions of the GNU General Public
  8  * License.  See the file "COPYING" in the main directory of this archive
  9  * for more details.
 10  */
 11 
 12 #include <linux/sched.h>
 13 #include <linux/kernel.h>
 14 #include <linux/param.h>
 15 #include <linux/interrupt.h>
 16 #include <linux/init.h>
 17 #include <linux/irq.h>
 18 #include <linux/pci.h>
 19 #include <linux/module.h>
 20 #include <linux/io.h>
 21 #include <mach/pci.h>
 22 
 23 /*
 24  * The !gapspci_config_access case really shouldn't happen, ever, unless
 25  * someone implicitly messes around with the last devfn value.. otherwise we
 26  * only support a single device anyways, and if we didn't have a BBA, we
 27  * wouldn't make it terribly far through the PCI setup anyways.
 28  *
 29  * Also, we could very easily support both Type 0 and Type 1 configurations
 30  * here, but since it doesn't seem that there is any such implementation in
 31  * existence, we don't bother.
 32  *
 33  * I suppose if someone actually gets around to ripping the chip out of
 34  * the BBA and hanging some more devices off of it, then this might be
 35  * something to take into consideration. However, due to the cost of the BBA,
 36  * and the general lack of activity by DC hardware hackers, this doesn't seem
 37  * likely to happen anytime soon.
 38  */
 39 static int gapspci_config_access(unsigned char bus, unsigned int devfn)
 40 {
 41         return (bus == 0) && (devfn == 0);
 42 }
 43 
 44 /*
 45  * We can also actually read and write in b/w/l sizes! Thankfully this part
 46  * was at least done right, and we don't have to do the stupid masking and
 47  * shifting that we do on the 7751! Small wonders never cease to amaze.
 48  */
 49 static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
 50 {
 51         *val = 0xffffffff;
 52 
 53         if (!gapspci_config_access(bus->number, devfn))
 54                 return PCIBIOS_DEVICE_NOT_FOUND;
 55 
 56         switch (size) {
 57         case 1: *val = inb(GAPSPCI_BBA_CONFIG+where); break;
 58         case 2: *val = inw(GAPSPCI_BBA_CONFIG+where); break;
 59         case 4: *val = inl(GAPSPCI_BBA_CONFIG+where); break;
 60         }
 61 
 62         return PCIBIOS_SUCCESSFUL;
 63 }
 64 
 65 static int gapspci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
 66 {
 67         if (!gapspci_config_access(bus->number, devfn))
 68                 return PCIBIOS_DEVICE_NOT_FOUND;
 69 
 70         switch (size) {
 71         case 1: outb(( u8)val, GAPSPCI_BBA_CONFIG+where); break;
 72         case 2: outw((u16)val, GAPSPCI_BBA_CONFIG+where); break;
 73         case 4: outl((u32)val, GAPSPCI_BBA_CONFIG+where); break;
 74         }
 75 
 76         return PCIBIOS_SUCCESSFUL;
 77 }
 78 
 79 struct pci_ops gapspci_pci_ops = {
 80         .read   = gapspci_read,
 81         .write  = gapspci_write,
 82 };
 83 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp