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

TOMOYO Linux Cross Reference
Linux/arch/alpha/kernel/pci-noop.c

Version: ~ [ linux-5.5-rc7 ] ~ [ linux-5.4.13 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.97 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.166 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.210 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.210 ] ~ [ 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.81 ] ~ [ 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  *      linux/arch/alpha/kernel/pci-noop.c
  3  *
  4  * Stub PCI interfaces for Jensen-specific kernels.
  5  */
  6 
  7 #include <linux/pci.h>
  8 #include <linux/init.h>
  9 #include <linux/bootmem.h>
 10 #include <linux/gfp.h>
 11 #include <linux/capability.h>
 12 #include <linux/mm.h>
 13 #include <linux/errno.h>
 14 #include <linux/sched.h>
 15 #include <linux/dma-mapping.h>
 16 #include <linux/scatterlist.h>
 17 
 18 #include "proto.h"
 19 
 20 
 21 /*
 22  * The PCI controller list.
 23  */
 24 
 25 struct pci_controller *hose_head, **hose_tail = &hose_head;
 26 struct pci_controller *pci_isa_hose;
 27 
 28 
 29 struct pci_controller * __init
 30 alloc_pci_controller(void)
 31 {
 32         struct pci_controller *hose;
 33 
 34         hose = alloc_bootmem(sizeof(*hose));
 35 
 36         *hose_tail = hose;
 37         hose_tail = &hose->next;
 38 
 39         return hose;
 40 }
 41 
 42 struct resource * __init
 43 alloc_resource(void)
 44 {
 45         struct resource *res;
 46 
 47         res = alloc_bootmem(sizeof(*res));
 48 
 49         return res;
 50 }
 51 
 52 asmlinkage long
 53 sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
 54 {
 55         struct pci_controller *hose;
 56 
 57         /* from hose or from bus.devfn */
 58         if (which & IOBASE_FROM_HOSE) {
 59                 for (hose = hose_head; hose; hose = hose->next) 
 60                         if (hose->index == bus)
 61                                 break;
 62                 if (!hose)
 63                         return -ENODEV;
 64         } else {
 65                 /* Special hook for ISA access.  */
 66                 if (bus == 0 && dfn == 0)
 67                         hose = pci_isa_hose;
 68                 else
 69                         return -ENODEV;
 70         }
 71 
 72         switch (which & ~IOBASE_FROM_HOSE) {
 73         case IOBASE_HOSE:
 74                 return hose->index;
 75         case IOBASE_SPARSE_MEM:
 76                 return hose->sparse_mem_base;
 77         case IOBASE_DENSE_MEM:
 78                 return hose->dense_mem_base;
 79         case IOBASE_SPARSE_IO:
 80                 return hose->sparse_io_base;
 81         case IOBASE_DENSE_IO:
 82                 return hose->dense_io_base;
 83         case IOBASE_ROOT_BUS:
 84                 return hose->bus->number;
 85         }
 86 
 87         return -EOPNOTSUPP;
 88 }
 89 
 90 asmlinkage long
 91 sys_pciconfig_read(unsigned long bus, unsigned long dfn,
 92                    unsigned long off, unsigned long len, void *buf)
 93 {
 94         if (!capable(CAP_SYS_ADMIN))
 95                 return -EPERM;
 96         else
 97                 return -ENODEV;
 98 }
 99 
100 asmlinkage long
101 sys_pciconfig_write(unsigned long bus, unsigned long dfn,
102                     unsigned long off, unsigned long len, void *buf)
103 {
104         if (!capable(CAP_SYS_ADMIN))
105                 return -EPERM;
106         else
107                 return -ENODEV;
108 }
109 
110 static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
111                                        dma_addr_t *dma_handle, gfp_t gfp,
112                                        unsigned long attrs)
113 {
114         void *ret;
115 
116         if (!dev || *dev->dma_mask >= 0xffffffffUL)
117                 gfp &= ~GFP_DMA;
118         ret = (void *)__get_free_pages(gfp, get_order(size));
119         if (ret) {
120                 memset(ret, 0, size);
121                 *dma_handle = virt_to_phys(ret);
122         }
123         return ret;
124 }
125 
126 static int alpha_noop_supported(struct device *dev, u64 mask)
127 {
128         return mask < 0x00ffffffUL ? 0 : 1;
129 }
130 
131 struct dma_map_ops alpha_noop_ops = {
132         .alloc                  = alpha_noop_alloc_coherent,
133         .free                   = dma_noop_free_coherent,
134         .map_page               = dma_noop_map_page,
135         .map_sg                 = dma_noop_map_sg,
136         .mapping_error          = dma_noop_mapping_error,
137         .dma_supported          = alpha_noop_supported,
138 };
139 
140 struct dma_map_ops *dma_ops = &alpha_noop_ops;
141 EXPORT_SYMBOL(dma_ops);
142 

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