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

TOMOYO Linux Cross Reference
Linux/arch/mips/loongson2ef/common/cs5536/cs5536_pci.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * read/write operation to the PCI config space of CS5536
  4  *
  5  * Copyright (C) 2007 Lemote, Inc.
  6  * Author : jlliu, liujl@lemote.com
  7  *
  8  * Copyright (C) 2009 Lemote, Inc.
  9  * Author: Wu Zhangjin, wuzhangjin@gmail.com
 10  *
 11  *      the Virtual Support Module(VSM) for virtulizing the PCI
 12  *      configure space are defined in cs5536_modulename.c respectively,
 13  *
 14  *      after this virtulizing, user can access the PCI configure space
 15  *      directly as a normal multi-function PCI device which follows
 16  *      the PCI-2.2 spec.
 17  */
 18 
 19 #include <linux/types.h>
 20 #include <cs5536/cs5536_pci.h>
 21 #include <cs5536/cs5536_vsm.h>
 22 
 23 enum {
 24         CS5536_FUNC_START = -1,
 25         CS5536_ISA_FUNC,
 26         reserved_func,
 27         CS5536_IDE_FUNC,
 28         CS5536_ACC_FUNC,
 29         CS5536_OHCI_FUNC,
 30         CS5536_EHCI_FUNC,
 31         CS5536_FUNC_END,
 32 };
 33 
 34 static const cs5536_pci_vsm_write vsm_conf_write[] = {
 35         [CS5536_ISA_FUNC]       = pci_isa_write_reg,
 36         [reserved_func]         = NULL,
 37         [CS5536_IDE_FUNC]       = pci_ide_write_reg,
 38         [CS5536_ACC_FUNC]       = pci_acc_write_reg,
 39         [CS5536_OHCI_FUNC]      = pci_ohci_write_reg,
 40         [CS5536_EHCI_FUNC]      = pci_ehci_write_reg,
 41 };
 42 
 43 static const cs5536_pci_vsm_read vsm_conf_read[] = {
 44         [CS5536_ISA_FUNC]       = pci_isa_read_reg,
 45         [reserved_func]         = NULL,
 46         [CS5536_IDE_FUNC]       = pci_ide_read_reg,
 47         [CS5536_ACC_FUNC]       = pci_acc_read_reg,
 48         [CS5536_OHCI_FUNC]      = pci_ohci_read_reg,
 49         [CS5536_EHCI_FUNC]      = pci_ehci_read_reg,
 50 };
 51 
 52 /*
 53  * write to PCI config space and transfer it to MSR write.
 54  */
 55 void cs5536_pci_conf_write4(int function, int reg, u32 value)
 56 {
 57         if ((function <= CS5536_FUNC_START) || (function >= CS5536_FUNC_END))
 58                 return;
 59         if ((reg < 0) || (reg > 0x100) || ((reg & 0x03) != 0))
 60                 return;
 61 
 62         if (vsm_conf_write[function] != NULL)
 63                 vsm_conf_write[function](reg, value);
 64 }
 65 
 66 /*
 67  * read PCI config space and transfer it to MSR access.
 68  */
 69 u32 cs5536_pci_conf_read4(int function, int reg)
 70 {
 71         u32 data = 0;
 72 
 73         if ((function <= CS5536_FUNC_START) || (function >= CS5536_FUNC_END))
 74                 return 0;
 75         if ((reg < 0) || ((reg & 0x03) != 0))
 76                 return 0;
 77         if (reg > 0x100)
 78                 return 0xffffffff;
 79 
 80         if (vsm_conf_read[function] != NULL)
 81                 data = vsm_conf_read[function](reg);
 82 
 83         return data;
 84 }
 85 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php