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

TOMOYO Linux Cross Reference
Linux/arch/cris/arch-v32/drivers/pci/bios.c

Version: ~ [ linux-5.19-rc3 ] ~ [ linux-5.18.5 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.48 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.123 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.199 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.248 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.284 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.319 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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 #include <linux/pci.h>
  2 #include <linux/kernel.h>
  3 #include <arch/hwregs/intr_vect.h>
  4 
  5 void pcibios_fixup_bus(struct pci_bus *b)
  6 {
  7 }
  8 
  9 void pcibios_set_master(struct pci_dev *dev)
 10 {
 11         u8 lat;
 12         pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
 13         printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat);
 14         pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
 15 }
 16 
 17 int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 18                         enum pci_mmap_state mmap_state, int write_combine)
 19 {
 20         unsigned long prot;
 21 
 22         /* Leave vm_pgoff as-is, the PCI space address is the physical
 23          * address on this platform.
 24          */
 25         prot = pgprot_val(vma->vm_page_prot);
 26         vma->vm_page_prot = __pgprot(prot);
 27 
 28         /* Write-combine setting is ignored, it is changed via the mtrr
 29          * interfaces on this platform.
 30          */
 31         if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
 32                              vma->vm_end - vma->vm_start,
 33                              vma->vm_page_prot))
 34                 return -EAGAIN;
 35 
 36         return 0;
 37 }
 38 
 39 resource_size_t
 40 pcibios_align_resource(void *data, const struct resource *res,
 41                        resource_size_t size, resource_size_t align)
 42 {
 43         resource_size_t start = res->start;
 44 
 45         if ((res->flags & IORESOURCE_IO) && (start & 0x300))
 46                 start = (start + 0x3ff) & ~0x3ff;
 47 
 48         return start;
 49 }
 50 
 51 int pcibios_enable_resources(struct pci_dev *dev, int mask)
 52 {
 53         u16 cmd, old_cmd;
 54         int idx;
 55         struct resource *r;
 56 
 57         pci_read_config_word(dev, PCI_COMMAND, &cmd);
 58         old_cmd = cmd;
 59         for(idx=0; idx<6; idx++) {
 60                 /* Only set up the requested stuff */
 61                 if (!(mask & (1<<idx)))
 62                         continue;
 63 
 64                 r = &dev->resource[idx];
 65                 if (!r->start && r->end) {
 66                         printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
 67                         return -EINVAL;
 68                 }
 69                 if (r->flags & IORESOURCE_IO)
 70                         cmd |= PCI_COMMAND_IO;
 71                 if (r->flags & IORESOURCE_MEM)
 72                         cmd |= PCI_COMMAND_MEMORY;
 73         }
 74         if (dev->resource[PCI_ROM_RESOURCE].start)
 75                 cmd |= PCI_COMMAND_MEMORY;
 76         if (cmd != old_cmd) {
 77                 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
 78                 pci_write_config_word(dev, PCI_COMMAND, cmd);
 79         }
 80         return 0;
 81 }
 82 
 83 int pcibios_enable_irq(struct pci_dev *dev)
 84 {
 85         dev->irq = EXT_INTR_VECT;
 86         return 0;
 87 }
 88 
 89 int pcibios_enable_device(struct pci_dev *dev, int mask)
 90 {
 91         int err;
 92 
 93         if ((err = pcibios_enable_resources(dev, mask)) < 0)
 94                 return err;
 95 
 96         if (!dev->msi_enabled)
 97                 pcibios_enable_irq(dev);
 98         return 0;
 99 }
100 

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