5a529c03bf60903f5304980aaff13e4fb9edf5f1
* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: pcie_device.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
#pragma ident "@(#)pcie_device.h 1.4 06/10/05 SMI"
* This file contains function prototypes and data structures
* for PCIE device generic support
* Structure used to implement PCIE interface unit model
* (it's named as PIU for Niagara 2)
typedef struct PCIE_MODEL pcie_model_t
;
* Macros, structs used in PCIE device
#define PCIE_REQ_ID(bus,dev,fun) ((bus<<8)|((MASK64(4,0)&dev)<<3)|(MASK64(2,0)&fun))
#define PCIE_BUS_NO(req_id) ((req_id & MASK64(15,8))>>8)
#define PCIE_DEV_NO(req_id) ((req_id & MASK64(7,3))>>3)
#define PCIE_FUN_NO(req_id) ((req_id & MASK64(2,0)))
* PCIE interface for down bound transaction
typedef struct pcie_dwbound
{
bool_t (*mem_access
)(void *hdl
, uint64_t addr
, uint64_t *datap
, uint32_t count
, dev_access_t type
,
int (*bar_test
)(void *hdl
, uint64_t addr
, pcie_space_t space_id
);
* PCIE access interface for upbound transaction
typedef struct pcie_upbound
{
bool_t (*dma_access
)(pcie_model_t
*pcie_model
, tvaddr_t va
, uint8_t *datap
, int count
,
uint16_t req_id
, dev_access_t type
, dev_mode_t mode
);
bool_t (*assert_intx
)(pcie_model_t
*pcie_model
, uint8_t pin_no
, uint8_t dev_no
);
bool_t (*deassert_intx
)(pcie_model_t
*pcie_model
, uint8_t pin_no
, uint8_t dev_no
);
* PCIE device instance (an instance of a pcie device type)
typedef struct pcie_dev_inst
{
uint16_t req_id
; /* 16 bit request ID (8 bit bus_no, 5 bit dev_no, 3 bit fun_no */
struct pcie_dev_inst
*next
;
* PCIE device type (derived from DEV_TYPE)
typedef struct pcie_dev_type
{
void (*dev_init
)(struct pcie_dev_inst
*);
void (*dev_parse
)(void *);
void (*dev_dump
)(void *);
typedef struct PCIE_MONDO
{
#endif /* _PCIE_DEVICE_H */