1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 
  27 /*
  28  * Assembly language support for pci config space access on sun4v
  29  */
  30 
  31 #include <sys/asm_linkage.h>
  32 #include <sys/hypervisor_api.h>
  33 #include <sys/dditypes.h>
  34 #include <sys/pci_cfgacc.h>
  35 #include <io/px/px_ioapi.h>
  36 #include <io/px/px_lib4v.h>
  37 
  38 #if defined(lint) || defined(__lint)
  39 
  40 /*ARGSUSED*/
  41 uint64_t
  42 hvio_config_get(devhandle_t dev_hdl, pci_device_t bdf, pci_config_offset_t off, 
  43     pci_config_size_t size, pci_cfg_data_t *data_p)
  44 { return (0); }
  45 
  46 /*ARGSUSED*/
  47 uint64_t
  48 hvio_config_put(devhandle_t dev_hdl, pci_device_t bdf, pci_config_offset_t off, 
  49     pci_config_size_t size, pci_cfg_data_t data)
  50 { return (0); }
  51 
  52 #else   /* lint || __lint */
  53 
  54         /*
  55          * arg0 - devhandle
  56          * arg1 - pci_device
  57          * arg2 - pci_config_offset
  58          * arg3 - pci_config_size (1, 2 or 4 byte)
  59          *
  60          * ret0 - status
  61          * ret1 - error_flag
  62          * ret2 - pci_cfg_data
  63          */
  64         ENTRY(hvio_config_get)
  65         mov     HVIO_CONFIG_GET, %o5
  66         ta      FAST_TRAP
  67         sllx    %o1, 32, %o1
  68         or      %o0, %o1, %o0
  69         movrnz  %o1, -1, %o2
  70         stx     %o2, [%o4]
  71         retl
  72         nop
  73         SET_SIZE(hvio_config_get)
  74 
  75         /*
  76          * arg0 - devhandle
  77          * arg1 - pci_device
  78          * arg2 - pci_config_offset
  79          * arg3 - pci_config_size (1, 2 or 4 byte)
  80          * arg4 - pci_cfg_data
  81          *
  82          * ret0 - status
  83          * ret1 - error_flag
  84          */
  85         ENTRY(hvio_config_put)
  86         mov     HVIO_CONFIG_PUT, %o5
  87         ta      FAST_TRAP
  88         sllx    %o1, 32, %o1
  89         or      %o0, %o1, %o0
  90         retl
  91         nop
  92         SET_SIZE(hvio_config_put)
  93 #endif