pmcs_proto.h revision 145e0143b4896d03ce53b1af6787afa1a7e73959
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file provides prototype function definitions.
*/
#ifndef _PMCS_PROTO_H
#define _PMCS_PROTO_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
PMCS_PRT_DEBUG = 0,
(lvl > PMCS_PRT_DEBUG_DEVEL)) { \
} \
}
/*PRINTFLIKE5*/
void
const char *, ...) __KPRINTFLIKE(5);
void pmcs_handle_dead_phys(pmcs_hw_t *);
void pmcs_release_scratch(pmcs_hw_t *);
/* get a work structure */
/* put a work structure */
/* given a tag, find a work structure */
/*
* Abort function
*/
/*
* SSP Task Management Function
*/
uint32_t *);
/*
* Abort NCQ function
*/
/*
* Interrupt Functions
*/
void pmcs_general_intr(pmcs_hw_t *);
void pmcs_iodone_intr(pmcs_hw_t *);
void pmcs_event_intr(pmcs_hw_t *);
/*
* Abort handler
*/
int pmcs_abort_handler(pmcs_hw_t *);
/*
* Deregister all expander connected devices
*/
/*
* endian transform a data structure
*/
/* get the connection rate string */
const char *pmcs_get_rate(unsigned int);
/* get the device type string */
/* get the SAS Task Management function name */
const char *pmcs_tmf2str(int);
/* get the PMC status string */
const char *pmcs_status_str(uint32_t);
/*
* WWN to Byte Array and vice versa conversion
*/
/*
* Print f/w version
*/
void pmcs_report_fwversion(pmcs_hw_t *);
/*
* Build a device name.
*/
/*
* Find a PHY by device_id
*/
/*
* Find a PHY by wwn
*/
/*
* Find a PHY by sas_address
*/
pmcs_phy_t *, char *);
/*
* Print out a FIS
*/
/*
* Print an IOMB
*/
void pmcs_print_entry(pmcs_hw_t *, int, char *, void *);
/*
* Handler for events - can be called from interrupt level or from worker thread
*/
void pmcs_ack_events(pmcs_hw_t *);
/*
* This function does some initial setup and hardware validation
*/
int pmcs_setup(pmcs_hw_t *);
/*
* These functions start and stop the MPI (message passing interface)
*/
int pmcs_start_mpi(pmcs_hw_t *);
int pmcs_stop_mpi(pmcs_hw_t *);
/*
* This function checks firmware revisions against required revisions
* and attempts to flash new firmware (if possible).
*/
int pmcs_firmware_update(pmcs_hw_t *);
/*
* This function runs ECHO commands to test both interrupts and queues
*/
int pmcs_echo_test(pmcs_hw_t *);
/*
* These functions start, reset, and stop the physical chip PHYs
*/
int pmcs_start_phy(pmcs_hw_t *, int, int, int);
int pmcs_start_phys(pmcs_hw_t *);
void pmcs_stop_phy(pmcs_hw_t *, int);
void pmcs_stop_phys(pmcs_hw_t *);
/*
*/
int pmcs_iport_tgtmap_create(pmcs_iport_t *);
/*
* Utility and wrapper functions for SAS_DIAG_EXECUTE
*/
/*
* Get current firmware timestamp
*/
/*
* Register Dump (including "internal" registers)
*/
void pmcs_register_dump(pmcs_hw_t *);
void pmcs_register_dump_int(pmcs_hw_t *);
/*
* This function perform a soft reset.
* Hard reset is platform specific.
*/
/*
* Some more reset functions
*/
/*
* These functions do topology configuration changes
*/
void pmcs_discover(pmcs_hw_t *);
/*
* Firmware flash function
*/
/*
* Set a new value for the interrupt coalescing timer. If it's being set
* to zero (disabling), then re-enable auto clear if necessary. If it's
* being changed from zero, turn off auto clear if it was on.
*/
typedef enum {
DECREASE_TIMER = 0,
void pmcs_check_intr_coal(void *arg);
/*
* Misc supporting routines
*/
void pmcs_sata_work(pmcs_hw_t *);
void pmcs_free_dma_chunklist(pmcs_hw_t *);
pmcs_xscsi_t *);
void pmcs_ssp_event_recovery(pmcs_hw_t *);
void pmcs_lock_phy(pmcs_phy_t *);
void pmcs_unlock_phy(pmcs_phy_t *);
void pmcs_destroy_target(pmcs_xscsi_t *);
void pmcs_phymap_activate(void *, char *, void **);
void pmcs_phymap_deactivate(void *, char *, void *);
int pmcs_phy_constructor(void *, void *, int);
void pmcs_phy_destructor(void *, void *);
void pmcs_inc_phy_ref_count(pmcs_phy_t *);
void pmcs_dec_phy_ref_count(pmcs_phy_t *);
/* Worker thread */
void pmcs_worker(void *);
void pmcs_fatal_handler(pmcs_hw_t *);
/*
* Schedule device state recovery for this device immediately
*/
#ifdef __cplusplus
}
#endif
#endif /* _PMCS_PROTO_H */