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

TOMOYO Linux Cross Reference
Linux/arch/tile/gxio/kiorpc.c

Version: ~ [ linux-5.1-rc1 ] ~ [ linux-5.0.3 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.30 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.107 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.164 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.176 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.136 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.63 ] ~ [ 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.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ 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  * Copyright 2012 Tilera Corporation. All Rights Reserved.
  3  *
  4  *   This program is free software; you can redistribute it and/or
  5  *   modify it under the terms of the GNU General Public License
  6  *   as published by the Free Software Foundation, version 2.
  7  *
  8  *   This program is distributed in the hope that it will be useful, but
  9  *   WITHOUT ANY WARRANTY; without even the implied warranty of
 10  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 11  *   NON INFRINGEMENT.  See the GNU General Public License for
 12  *   more details.
 13  *
 14  * TILE-Gx IORPC support for kernel I/O drivers.
 15  */
 16 
 17 #include <linux/mmzone.h>
 18 #include <linux/module.h>
 19 #include <linux/io.h>
 20 #include <gxio/iorpc_globals.h>
 21 #include <gxio/kiorpc.h>
 22 
 23 #ifdef DEBUG_IORPC
 24 #define TRACE(FMT, ...) pr_info(SIMPLE_MSG_LINE FMT, ## __VA_ARGS__)
 25 #else
 26 #define TRACE(...)
 27 #endif
 28 
 29 /* Create kernel-VA-space MMIO mapping for an on-chip IO device. */
 30 void __iomem *iorpc_ioremap(int hv_fd, resource_size_t offset,
 31                             unsigned long size)
 32 {
 33         pgprot_t mmio_base, prot = { 0 };
 34         unsigned long pfn;
 35         int err;
 36 
 37         /* Look up the shim's lotar and base PA. */
 38         err = __iorpc_get_mmio_base(hv_fd, &mmio_base);
 39         if (err) {
 40                 TRACE("get_mmio_base() failure: %d\n", err);
 41                 return NULL;
 42         }
 43 
 44         /* Make sure the HV driver approves of our offset and size. */
 45         err = __iorpc_check_mmio_offset(hv_fd, offset, size);
 46         if (err) {
 47                 TRACE("check_mmio_offset() failure: %d\n", err);
 48                 return NULL;
 49         }
 50 
 51         /*
 52          * mmio_base contains a base pfn and homing coordinates.  Turn
 53          * it into an MMIO pgprot and offset pfn.
 54          */
 55         prot = hv_pte_set_lotar(prot, hv_pte_get_lotar(mmio_base));
 56         pfn = pte_pfn(mmio_base) + PFN_DOWN(offset);
 57 
 58         return ioremap_prot(PFN_PHYS(pfn), size, prot);
 59 }
 60 
 61 EXPORT_SYMBOL(iorpc_ioremap);
 62 

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