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

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

Version: ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ 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.85 ] ~ [ 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-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  * arch/sh/drivers/pci/fixups-dreamcast.c
  3  *
  4  * PCI fixups for the Sega Dreamcast
  5  *
  6  * Copyright (C) 2001, 2002  M. R. Brown
  7  * Copyright (C) 2002, 2003, 2006  Paul Mundt
  8  *
  9  * This file originally bore the message (with enclosed-$):
 10  *      Id: pci.c,v 1.3 2003/05/04 19:29:46 lethal Exp
 11  *      Dreamcast PCI: Supports SEGA Broadband Adaptor only.
 12  *
 13  * This file is subject to the terms and conditions of the GNU General Public
 14  * License.  See the file "COPYING" in the main directory of this archive
 15  * for more details.
 16  */
 17 
 18 #include <linux/sched.h>
 19 #include <linux/kernel.h>
 20 #include <linux/param.h>
 21 #include <linux/interrupt.h>
 22 #include <linux/init.h>
 23 #include <linux/irq.h>
 24 #include <linux/pci.h>
 25 #include <linux/dma-mapping.h>
 26 
 27 #include <asm/io.h>
 28 #include <asm/irq.h>
 29 #include <mach/pci.h>
 30 
 31 static void gapspci_fixup_resources(struct pci_dev *dev)
 32 {
 33         struct pci_channel *p = dev->sysdata;
 34         struct resource res;
 35         struct pci_bus_region region;
 36 
 37         printk(KERN_NOTICE "PCI: Fixing up device %s\n", pci_name(dev));
 38 
 39         switch (dev->device) {
 40         case PCI_DEVICE_ID_SEGA_BBA:
 41                 /*
 42                  * We also assume that dev->devfn == 0
 43                  */
 44                 dev->resource[1].start  = p->resources[0].start  + 0x100;
 45                 dev->resource[1].end    = dev->resource[1].start + 0x200 - 1;
 46 
 47                 /*
 48                  * This is not a normal BAR, prevent any attempts to move
 49                  * the BAR, as this will result in a bus lock.
 50                  */
 51                 dev->resource[1].flags |= IORESOURCE_PCI_FIXED;
 52 
 53                 /*
 54                  * Redirect dma memory allocations to special memory window.
 55                  *
 56                  * If this GAPSPCI region were mapped by a BAR, the CPU
 57                  * phys_addr_t would be pci_resource_start(), and the bus
 58                  * address would be pci_bus_address(pci_resource_start()).
 59                  * But apparently there's no BAR mapping it, so we just
 60                  * "know" its CPU address is GAPSPCI_DMA_BASE.
 61                  */
 62                 res.start = GAPSPCI_DMA_BASE;
 63                 res.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1;
 64                 res.flags = IORESOURCE_MEM;
 65                 pcibios_resource_to_bus(dev->bus, &region, &res);
 66                 BUG_ON(!dma_declare_coherent_memory(&dev->dev,
 67                                                 res.start,
 68                                                 region.start,
 69                                                 resource_size(&res),
 70                                                 DMA_MEMORY_MAP |
 71                                                 DMA_MEMORY_EXCLUSIVE));
 72                 break;
 73         default:
 74                 printk("PCI: Failed resource fixup\n");
 75         }
 76 }
 77 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources);
 78 
 79 int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 80 {
 81         /*
 82          * The interrupt routing semantics here are quite trivial.
 83          *
 84          * We basically only support one interrupt, so we only bother
 85          * updating a device's interrupt line with this single shared
 86          * interrupt. Keeps routing quite simple, doesn't it?
 87          */
 88         return GAPSPCI_IRQ;
 89 }
 90 

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