#ifndef _SYS_PCI_PBM_H
#define _SYS_PCI_PBM_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/dditypes.h>
#include <sys/ontrap.h>
#include <sys/callb.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct config_header config_header_t;
struct config_header {
volatile uint16_t ch_vendor_id;
volatile uint16_t ch_device_id;
volatile uint16_t ch_command_reg;
volatile uint16_t ch_status_reg;
volatile uint8_t ch_revision_id_reg;
volatile uint8_t ch_programming_if_code_reg;
volatile uint8_t ch_sub_class_reg;
volatile uint8_t ch_base_class_reg;
volatile uint8_t ch_cache_line_size_reg;
volatile uint8_t ch_latency_timer_reg;
volatile uint8_t ch_header_type_reg;
};
typedef enum { PBM_SPEED_33MHZ, PBM_SPEED_66MHZ } pbm_speed_t;
#define PCI_STATUS_BITS "\020\
\11signaled-parity-error\
\14signaled-target-abort\
\15received-target-abort\
\16received-master-abort\
\17signaled-system-error\
\20detected-parity-error"
struct pbm {
pci_t *pbm_pci_p;
pbm_speed_t pbm_speed;
volatile uint64_t *pbm_ctrl_reg;
volatile uint64_t *pbm_async_flt_status_reg;
volatile uint64_t *pbm_async_flt_addr_reg;
volatile uint64_t *pbm_diag_reg;
volatile uint64_t *pbm_estar_reg;
volatile uint64_t *pbm_pcix_err_stat_reg;
volatile uint64_t *pbm_pci_ped_ctrl;
volatile uint64_t *pbm_upper_retry_counter_reg;
config_header_t *pbm_config_header;
iopfn_t pbm_base_pfn;
iopfn_t pbm_last_pfn;
uint64_t pbm_imr_save;
uint64_t pbm_cdma_imr_save;
ddi_iblock_cookie_t pbm_iblock_cookie;
uint64_t pbm_sync_reg_pa;
ib_ino_t pbm_sync_ino;
volatile uint32_t pbm_cdma_flag;
kmutex_t pbm_sync_mutex;
on_trap_data_t *pbm_ontrap_data;
kmutex_t pbm_pokefault_mutex;
ddi_acc_handle_t pbm_excl_handle;
uint64_t pbm_saved_ctrl_reg;
uint_t pbm_quiesce_count;
callb_id_t pbm_panic_cb_id;
callb_id_t pbm_debug_cb_id;
uint64_t pbm_anychild_cfgpa;
uint32_t pbm_pio_limit;
volatile uint32_t pbm_pio_counter;
#define PBM_NAMESTR_BUFLEN 64
char pbm_nameinst_str[PBM_NAMESTR_BUFLEN];
char *pbm_nameaddr_str;
};
extern void pbm_create(pci_t *pci_p);
extern void pbm_destroy(pci_t *pci_p);
extern void pbm_configure(pbm_t *pbm_p);
extern void pbm_clear_error(pbm_t *pbm_p);
extern void pbm_enable_intr(pbm_t *pbm_p);
extern void pbm_suspend(pbm_t *pbm_p);
extern void pbm_resume(pbm_t *pbm_p);
extern void pbm_intr_dist(void *arg);
extern int pbm_register_intr(pbm_t *pbm_p);
extern int pbm_afsr_report(dev_info_t *dip, uint64_t fme_ena,
pbm_errstate_t *pbm_err_p);
#ifdef __cplusplus
}
#endif
#endif