svn commit: r230557 - in user/jimharris/isci/sys/dev/isci: . scil
Jim Harris
jimharris at FreeBSD.org
Wed Jan 25 22:39:23 UTC 2012
Author: jimharris
Date: Wed Jan 25 22:39:22 2012
New Revision: 230557
URL: http://svn.freebsd.org/changeset/base/230557
Log:
Add all isci driver source code to sys/dev/isci for the Intel C600
(Patsburg) integrated SAS controller.
sys/dev/isci contains all files specific to FreeBSD.
sys/dev/isci/scil contains OS-agnostic library maintained by Intel and
modified to best integrate into FreeBSD kernel build environment.
Sponsored by: Intel
Reviewed by: scottl
Added:
user/jimharris/isci/sys/dev/isci/environment.h
user/jimharris/isci/sys/dev/isci/isci.c
user/jimharris/isci/sys/dev/isci/isci.h
user/jimharris/isci/sys/dev/isci/isci_controller.c
user/jimharris/isci/sys/dev/isci/isci_domain.c
user/jimharris/isci/sys/dev/isci/isci_interrupt.c
user/jimharris/isci/sys/dev/isci/isci_io_request.c
user/jimharris/isci/sys/dev/isci/isci_logger.c
user/jimharris/isci/sys/dev/isci/isci_oem_parameters.c
user/jimharris/isci/sys/dev/isci/isci_remote_device.c
user/jimharris/isci/sys/dev/isci/isci_sysctl.c
user/jimharris/isci/sys/dev/isci/isci_task_request.c
user/jimharris/isci/sys/dev/isci/isci_timer.c
user/jimharris/isci/sys/dev/isci/sci_environment.h
user/jimharris/isci/sys/dev/isci/scil/
user/jimharris/isci/sys/dev/isci/scil/intel_ata.h
user/jimharris/isci/sys/dev/isci/scil/intel_pci.h
user/jimharris/isci/sys/dev/isci/scil/intel_sas.h
user/jimharris/isci/sys/dev/isci/scil/intel_sat.h
user/jimharris/isci/sys/dev/isci/scil/intel_sata.h
user/jimharris/isci/sys/dev/isci/scil/intel_scsi.h
user/jimharris/isci/sys/dev/isci/scil/sati.c
user/jimharris/isci/sys/dev/isci/scil/sati.h
user/jimharris/isci/sys/dev/isci/scil/sati_abort_task_set.c
user/jimharris/isci/sys/dev/isci/scil/sati_abort_task_set.h
user/jimharris/isci/sys/dev/isci/scil/sati_atapi.c
user/jimharris/isci/sys/dev/isci/scil/sati_atapi.h
user/jimharris/isci/sys/dev/isci/scil/sati_callbacks.h
user/jimharris/isci/sys/dev/isci/scil/sati_design.h
user/jimharris/isci/sys/dev/isci/scil/sati_device.c
user/jimharris/isci/sys/dev/isci/scil/sati_device.h
user/jimharris/isci/sys/dev/isci/scil/sati_inquiry.c
user/jimharris/isci/sys/dev/isci/scil/sati_inquiry.h
user/jimharris/isci/sys/dev/isci/scil/sati_log_sense.c
user/jimharris/isci/sys/dev/isci/scil/sati_log_sense.h
user/jimharris/isci/sys/dev/isci/scil/sati_lun_reset.c
user/jimharris/isci/sys/dev/isci/scil/sati_lun_reset.h
user/jimharris/isci/sys/dev/isci/scil/sati_mode_pages.c
user/jimharris/isci/sys/dev/isci/scil/sati_mode_pages.h
user/jimharris/isci/sys/dev/isci/scil/sati_mode_select.c
user/jimharris/isci/sys/dev/isci/scil/sati_mode_select.h
user/jimharris/isci/sys/dev/isci/scil/sati_mode_sense.c
user/jimharris/isci/sys/dev/isci/scil/sati_mode_sense.h
user/jimharris/isci/sys/dev/isci/scil/sati_mode_sense_10.c
user/jimharris/isci/sys/dev/isci/scil/sati_mode_sense_10.h
user/jimharris/isci/sys/dev/isci/scil/sati_mode_sense_6.c
user/jimharris/isci/sys/dev/isci/scil/sati_mode_sense_6.h
user/jimharris/isci/sys/dev/isci/scil/sati_move.c
user/jimharris/isci/sys/dev/isci/scil/sati_move.h
user/jimharris/isci/sys/dev/isci/scil/sati_passthrough.c
user/jimharris/isci/sys/dev/isci/scil/sati_passthrough.h
user/jimharris/isci/sys/dev/isci/scil/sati_read.c
user/jimharris/isci/sys/dev/isci/scil/sati_read.h
user/jimharris/isci/sys/dev/isci/scil/sati_read_buffer.c
user/jimharris/isci/sys/dev/isci/scil/sati_read_buffer.h
user/jimharris/isci/sys/dev/isci/scil/sati_read_capacity.c
user/jimharris/isci/sys/dev/isci/scil/sati_read_capacity.h
user/jimharris/isci/sys/dev/isci/scil/sati_reassign_blocks.c
user/jimharris/isci/sys/dev/isci/scil/sati_reassign_blocks.h
user/jimharris/isci/sys/dev/isci/scil/sati_report_luns.c
user/jimharris/isci/sys/dev/isci/scil/sati_report_luns.h
user/jimharris/isci/sys/dev/isci/scil/sati_request_sense.c
user/jimharris/isci/sys/dev/isci/scil/sati_request_sense.h
user/jimharris/isci/sys/dev/isci/scil/sati_start_stop_unit.c
user/jimharris/isci/sys/dev/isci/scil/sati_start_stop_unit.h
user/jimharris/isci/sys/dev/isci/scil/sati_synchronize_cache.c
user/jimharris/isci/sys/dev/isci/scil/sati_synchronize_cache.h
user/jimharris/isci/sys/dev/isci/scil/sati_test_unit_ready.c
user/jimharris/isci/sys/dev/isci/scil/sati_test_unit_ready.h
user/jimharris/isci/sys/dev/isci/scil/sati_translator_sequence.h
user/jimharris/isci/sys/dev/isci/scil/sati_types.h
user/jimharris/isci/sys/dev/isci/scil/sati_unmap.c
user/jimharris/isci/sys/dev/isci/scil/sati_unmap.h
user/jimharris/isci/sys/dev/isci/scil/sati_util.c
user/jimharris/isci/sys/dev/isci/scil/sati_util.h
user/jimharris/isci/sys/dev/isci/scil/sati_verify.c
user/jimharris/isci/sys/dev/isci/scil/sati_verify.h
user/jimharris/isci/sys/dev/isci/scil/sati_write.c
user/jimharris/isci/sys/dev/isci/scil/sati_write.h
user/jimharris/isci/sys/dev/isci/scil/sati_write_and_verify.c
user/jimharris/isci/sys/dev/isci/scil/sati_write_and_verify.h
user/jimharris/isci/sys/dev/isci/scil/sati_write_buffer.c
user/jimharris/isci/sys/dev/isci/scil/sati_write_buffer.h
user/jimharris/isci/sys/dev/isci/scil/sati_write_long.c
user/jimharris/isci/sys/dev/isci/scil/sati_write_long.h
user/jimharris/isci/sys/dev/isci/scil/sci_abstract_list.c
user/jimharris/isci/sys/dev/isci/scil/sci_abstract_list.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_controller.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_controller.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_domain.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_domain.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_iterator.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_iterator.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_library.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_library.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_logger.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_logger.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_memory_descriptor_list.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_memory_descriptor_list.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_memory_descriptor_list_decorator.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_object.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_object.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_observer.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_observer.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_phy.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_phy.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_port.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_port.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_request.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_request.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_state.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_state_machine.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_state_machine.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_state_machine_logger.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_state_machine_logger.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_state_machine_observer.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_state_machine_observer.h
user/jimharris/isci/sys/dev/isci/scil/sci_base_subject.c
user/jimharris/isci/sys/dev/isci/scil/sci_base_subject.h
user/jimharris/isci/sys/dev/isci/scil/sci_controller.h
user/jimharris/isci/sys/dev/isci/scil/sci_controller_constants.h
user/jimharris/isci/sys/dev/isci/scil/sci_fast_list.h
user/jimharris/isci/sys/dev/isci/scil/sci_iterator.h
user/jimharris/isci/sys/dev/isci/scil/sci_library.h
user/jimharris/isci/sys/dev/isci/scil/sci_logger.h
user/jimharris/isci/sys/dev/isci/scil/sci_memory_descriptor_list.h
user/jimharris/isci/sys/dev/isci/scil/sci_memory_descriptor_list_decorator.h
user/jimharris/isci/sys/dev/isci/scil/sci_object.h
user/jimharris/isci/sys/dev/isci/scil/sci_overview.h
user/jimharris/isci/sys/dev/isci/scil/sci_pool.h
user/jimharris/isci/sys/dev/isci/scil/sci_simple_list.h
user/jimharris/isci/sys/dev/isci/scil/sci_status.h
user/jimharris/isci/sys/dev/isci/scil/sci_types.h
user/jimharris/isci/sys/dev/isci/scil/sci_util.c
user/jimharris/isci/sys/dev/isci/scil/sci_util.h
user/jimharris/isci/sys/dev/isci/scil/scic_config_parameters.h
user/jimharris/isci/sys/dev/isci/scil/scic_controller.h
user/jimharris/isci/sys/dev/isci/scil/scic_io_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_library.h
user/jimharris/isci/sys/dev/isci/scil/scic_logger.h
user/jimharris/isci/sys/dev/isci/scil/scic_overview.h
user/jimharris/isci/sys/dev/isci/scil/scic_phy.h
user/jimharris/isci/sys/dev/isci/scil/scic_port.h
user/jimharris/isci/sys/dev/isci/scil/scic_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_controller.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_controller.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_controller_registers.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_library.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_library.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_logger.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_pci.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_pci.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_phy.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_phy.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_phy_registers.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_port.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_port.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_port_configuration_agent.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_port_configuration_agent.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_port_registers.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_remote_node_context.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_remote_node_context.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_remote_node_table.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_remote_node_table.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_request.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_sgpio.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_smp_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_smp_request.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_smp_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_ssp_request.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_stp_packet_request.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_stp_packet_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_stp_pio_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_stp_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_stp_request.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_stp_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c
user/jimharris/isci/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.h
user/jimharris/isci/sys/dev/isci/scil/scic_sgpio.h
user/jimharris/isci/sys/dev/isci/scil/scic_task_request.h
user/jimharris/isci/sys/dev/isci/scil/scic_user_callback.h
user/jimharris/isci/sys/dev/isci/scil/scif_config_parameters.h
user/jimharris/isci/sys/dev/isci/scil/scif_controller.h
user/jimharris/isci/sys/dev/isci/scil/scif_domain.h
user/jimharris/isci/sys/dev/isci/scil/scif_io_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_library.h
user/jimharris/isci/sys/dev/isci/scil/scif_logger.h
user/jimharris/isci/sys/dev/isci/scil/scif_overview.h
user/jimharris/isci/sys/dev/isci/scil/scif_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_constants.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_controller.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_controller.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_controller_state_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_controller_states.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_design.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_domain.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_domain.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_domain_state_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_domain_states.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_high_priority_request_queue.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_high_priority_request_queue.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_internal_io_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_internal_io_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_io_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_io_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_io_request_state_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_io_request_states.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_library.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_library.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_logger.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device_ready_substate_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device_starting_substate_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device_starting_substates.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_remote_device_states.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_sati_binding.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_activity_clear_affiliation.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_io_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_io_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_phy.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_phy.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_smp_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_stp_io_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_stp_io_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_stp_remote_device.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_stp_remote_device.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_stp_task_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_stp_task_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_task_request.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_task_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_sas_task_request_state_handlers.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_task_request_states.c
user/jimharris/isci/sys/dev/isci/scil/scif_sas_timer.c
user/jimharris/isci/sys/dev/isci/scil/scif_task_request.h
user/jimharris/isci/sys/dev/isci/scil/scif_user_callback.h
user/jimharris/isci/sys/dev/isci/scil/scu_bios_definitions.h
user/jimharris/isci/sys/dev/isci/scil/scu_completion_codes.h
user/jimharris/isci/sys/dev/isci/scil/scu_constants.h
user/jimharris/isci/sys/dev/isci/scil/scu_event_codes.h
user/jimharris/isci/sys/dev/isci/scil/scu_registers.h
user/jimharris/isci/sys/dev/isci/scil/scu_remote_node_context.h
user/jimharris/isci/sys/dev/isci/scil/scu_task_context.h
user/jimharris/isci/sys/dev/isci/scil/scu_unsolicited_frame.h
user/jimharris/isci/sys/dev/isci/scil/scu_viit_data.h
user/jimharris/isci/sys/dev/isci/types.h
Added: user/jimharris/isci/sys/dev/isci/environment.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/jimharris/isci/sys/dev/isci/environment.h Wed Jan 25 22:39:22 2012 (r230557)
@@ -0,0 +1,100 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef ENVIRONMENT_H_
+#define ENVIRONMENT_H_
+
+/**
+ * @file
+ *
+ * @brief Types and macros specific to the FreeBSD environment.
+ */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/libkern.h>
+#include <machine/bus.h>
+#include <opt_isci.h>
+
+typedef int8_t S8;
+typedef uint8_t U8;
+
+typedef int16_t S16;
+typedef uint16_t U16;
+
+typedef int32_t S32;
+typedef uint32_t U32;
+
+typedef int64_t S64;
+typedef uint64_t U64;
+
+/* Technically, this should be defined as bus_addr_t, but SCIL makes some
+ * incorrect assumptions in some of its physical address calculations which
+ * necessitate using uint64_t here to avoid compiler warnings. This is
+ * easier for now than modifying SCIL, and works just as well.
+ */
+typedef uint64_t SCI_PHYSICAL_ADDRESS;
+
+typedef U64 SATI_LBA;
+typedef void * FUNCPTR;
+
+#define sci_cb_physical_address_upper(address) ((uint32_t)((address)>>32))
+#define sci_cb_physical_address_lower(address) ((uint32_t)((address)&0xFFFFFFFF))
+#define sci_cb_make_physical_address(physical_address, address_upper, address_lower) \
+ ((physical_address) = ((U64)(address_upper))<<32 | (address_lower))
+
+#define INLINE __inline
+
+#define PLACEMENT_HINTS(...)
+
+#define SCIC_SDS_4_ENABLED 1
+#define PBG_BUILD 1
+#define PHY_MAX_LINK_SPEED_GENERATION 3
+
+/* SCIL defines logging as SCI_LOGGING, but the FreeBSD driver name is ISCI.
+ So we define ISCI_LOGGING as the option exported to the kernel, and
+ translate it here. */
+#ifdef ISCI_LOGGING
+#define SCI_LOGGING
+#endif
+
+#define __SCI_LIBRARY_MAJOR_VERSION__ 3
+#define __SCI_LIBRARY_MINOR_VERSION__ 1
+#define __SCI_LIBRARY_BUILD_VERSION__ 7142
+
+#define SATI_TRANSPORT_SUPPORTS_SATA
+#define SATI_TRANSPORT_SUPPORTS_SAS
+#define USE_ABSTRACT_LIST_FUNCTIONS
+
+#define ASSERT(cond)
+#define assert(cond)
+
+#endif /* ENVIRONMENT_H_ */
Added: user/jimharris/isci/sys/dev/isci/isci.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/jimharris/isci/sys/dev/isci/isci.c Wed Jan 25 22:39:22 2012 (r230557)
@@ -0,0 +1,650 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <dev/isci/isci.h>
+
+#include <sys/sysctl.h>
+#include <sys/malloc.h>
+
+#include <cam/cam_periph.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include <dev/isci/scil/scic_logger.h>
+#include <dev/isci/scil/scic_library.h>
+#include <dev/isci/scil/scic_user_callback.h>
+
+#include <dev/isci/scil/scif_controller.h>
+#include <dev/isci/scil/scif_library.h>
+#include <dev/isci/scil/scif_logger.h>
+#include <dev/isci/scil/scif_user_callback.h>
+
+MALLOC_DEFINE(M_ISCI, "isci", "isci driver memory allocations");
+
+struct isci_softc *g_isci;
+uint32_t g_isci_debug_level = 0;
+
+static int isci_probe(device_t);
+static int isci_attach(device_t);
+static int isci_detach(device_t);
+
+int isci_initialize(struct isci_softc *isci);
+
+void isci_allocate_dma_buffer_callback(void *arg, bus_dma_segment_t *seg,
+ int nseg, int error);
+
+static devclass_t isci_devclass;
+
+static device_method_t isci_pci_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, isci_probe),
+ DEVMETHOD(device_attach, isci_attach),
+ DEVMETHOD(device_detach, isci_detach),
+ { 0, 0 }
+};
+
+static driver_t isci_pci_driver = {
+ "isci",
+ isci_pci_methods,
+ sizeof(struct isci_softc),
+};
+
+DRIVER_MODULE(isci, pci, isci_pci_driver, isci_devclass, 0, 0);
+
+static struct _pcsid
+{
+ u_int32_t type;
+ const char *desc;
+} pci_ids[] = {
+ { 0x1d608086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d618086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" },
+ { 0x1d628086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d638086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d648086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d658086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d668086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d678086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d688086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d698086, "Intel(R) C600 Series Chipset SAS Controller" },
+ { 0x1d6a8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" },
+ { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" },
+ { 0x00000000, NULL }
+};
+
+static int
+isci_probe (device_t device)
+{
+ u_int32_t type = pci_get_devid(device);
+ struct _pcsid *ep = pci_ids;
+
+ while (ep->type && ep->type != type)
+ ++ep;
+
+ if (ep->desc)
+ {
+ device_set_desc(device, ep->desc);
+ return (0);
+ }
+ else
+ return (ENXIO);
+}
+
+static int
+isci_allocate_pci_memory(struct isci_softc *isci)
+{
+ int i;
+
+ for (i = 0; i < ISCI_NUM_PCI_BARS; i++)
+ {
+ struct ISCI_PCI_BAR *pci_bar = &isci->pci_bar[i];
+
+ pci_bar->resource_id = PCIR_BAR(i*2);
+ pci_bar->resource = bus_alloc_resource(isci->device,
+ SYS_RES_MEMORY, &pci_bar->resource_id, 0, ~0, 1,
+ RF_ACTIVE);
+
+ if(pci_bar->resource == NULL)
+ isci_log_message(0, "ISCI",
+ "unable to allocate pci resource\n");
+ else {
+ pci_bar->bus_tag = rman_get_bustag(pci_bar->resource);
+ pci_bar->bus_handle =
+ rman_get_bushandle(pci_bar->resource);
+ }
+ }
+
+ return (0);
+}
+
+static int
+isci_attach(device_t device)
+{
+ int error;
+ struct isci_softc *isci = DEVICE2SOFTC(device);
+
+ g_isci = isci;
+ isci->device = device;
+
+ isci_allocate_pci_memory(isci);
+
+ error = isci_initialize(isci);
+
+ if (error)
+ {
+ isci_detach(device);
+ return (error);
+ }
+
+ isci_interrupt_setup(isci);
+ isci_sysctl_initialize(isci);
+
+ return (0);
+}
+
+static int
+isci_detach(device_t device)
+{
+ struct isci_softc *isci = DEVICE2SOFTC(device);
+ int i;
+
+ for (i = 0; i < isci->controller_count; i++) {
+ struct ISCI_CONTROLLER *controller = &isci->controllers[i];
+ SCI_STATUS status;
+
+ if (controller->scif_controller_handle != NULL) {
+ scic_controller_disable_interrupts(
+ scif_controller_get_scic_handle(controller->scif_controller_handle));
+
+ mtx_lock(&controller->lock);
+ status = scif_controller_stop(controller->scif_controller_handle, 0);
+ mtx_unlock(&controller->lock);
+
+ while (controller->is_started == TRUE) {
+ /* Now poll for interrupts until the controller stop complete
+ * callback is received.
+ */
+ mtx_lock(&controller->lock);
+ isci_interrupt_poll_handler(controller);
+ mtx_unlock(&controller->lock);
+ pause("isci", 1);
+ }
+
+ if(controller->sim != NULL) {
+ mtx_lock(&controller->lock);
+ xpt_free_path(controller->path);
+ xpt_bus_deregister(cam_sim_path(controller->sim));
+ cam_sim_free(controller->sim, TRUE);
+ mtx_unlock(&controller->lock);
+ }
+ }
+
+ if (controller->timer_memory != NULL)
+ free(controller->timer_memory, M_ISCI);
+
+ if (controller->remote_device_memory != NULL)
+ free(controller->remote_device_memory, M_ISCI);
+ }
+
+ /* The SCIF controllers have been stopped, so we can now
+ * free the SCI library memory.
+ */
+ if (isci->sci_library_memory != NULL)
+ free(isci->sci_library_memory, M_ISCI);
+
+ for (i = 0; i < ISCI_NUM_PCI_BARS; i++)
+ {
+ struct ISCI_PCI_BAR *pci_bar = &isci->pci_bar[i];
+
+ if (pci_bar->resource != NULL)
+ bus_release_resource(device, SYS_RES_MEMORY,
+ pci_bar->resource_id, pci_bar->resource);
+ }
+
+ for (i = 0; i < isci->num_interrupts; i++)
+ {
+ struct ISCI_INTERRUPT_INFO *interrupt_info;
+
+ interrupt_info = &isci->interrupt_info[i];
+
+ if(interrupt_info->tag != NULL)
+ bus_teardown_intr(device, interrupt_info->res,
+ interrupt_info->tag);
+
+ if(interrupt_info->res != NULL)
+ bus_release_resource(device, SYS_RES_IRQ,
+ rman_get_rid(interrupt_info->res),
+ interrupt_info->res);
+
+ pci_release_msi(device);
+ }
+
+ return (0);
+}
+
+int
+isci_initialize(struct isci_softc *isci)
+{
+ int error;
+ uint32_t status = 0;
+ uint32_t library_object_size;
+ uint32_t verbosity_mask;
+ uint32_t scic_log_object_mask;
+ uint32_t scif_log_object_mask;
+ uint8_t *header_buffer;
+
+ library_object_size = scif_library_get_object_size(SCI_MAX_CONTROLLERS);
+
+ isci->sci_library_memory =
+ malloc(library_object_size, M_ISCI, M_NOWAIT | M_ZERO );
+
+ isci->sci_library_handle = scif_library_construct(
+ isci->sci_library_memory, SCI_MAX_CONTROLLERS);
+
+ sci_object_set_association( isci->sci_library_handle, (void *)isci);
+
+ verbosity_mask = (1<<SCI_LOG_VERBOSITY_ERROR) |
+ (1<<SCI_LOG_VERBOSITY_WARNING) | (1<<SCI_LOG_VERBOSITY_INFO) |
+ (1<<SCI_LOG_VERBOSITY_TRACE);
+
+ scic_log_object_mask = 0xFFFFFFFF;
+ scic_log_object_mask &= ~SCIC_LOG_OBJECT_COMPLETION_QUEUE;
+ scic_log_object_mask &= ~SCIC_LOG_OBJECT_SSP_IO_REQUEST;
+ scic_log_object_mask &= ~SCIC_LOG_OBJECT_STP_IO_REQUEST;
+ scic_log_object_mask &= ~SCIC_LOG_OBJECT_SMP_IO_REQUEST;
+ scic_log_object_mask &= ~SCIC_LOG_OBJECT_CONTROLLER;
+
+ scif_log_object_mask = 0xFFFFFFFF;
+ scif_log_object_mask &= ~SCIF_LOG_OBJECT_CONTROLLER;
+ scif_log_object_mask &= ~SCIF_LOG_OBJECT_IO_REQUEST;
+
+ TUNABLE_INT_FETCH("hw.isci.debug_level", &g_isci_debug_level);
+
+ sci_logger_enable(sci_object_get_logger(isci->sci_library_handle),
+ scif_log_object_mask, verbosity_mask);
+
+ sci_logger_enable(sci_object_get_logger(
+ scif_library_get_scic_handle(isci->sci_library_handle)),
+ scic_log_object_mask, verbosity_mask);
+
+ header_buffer = (uint8_t *)&isci->pci_common_header;
+ for (uint8_t i = 0; i < sizeof(isci->pci_common_header); i++)
+ header_buffer[i] = pci_read_config(isci->device, i, 1);
+
+ scic_library_set_pci_info(
+ scif_library_get_scic_handle(isci->sci_library_handle),
+ &isci->pci_common_header);
+
+ isci->oem_parameters_found = FALSE;
+
+ isci_get_oem_parameters(isci);
+
+ /* trigger interrupt if 32 completions occur before timeout expires */
+ isci->coalesce_number = 32;
+
+ /* trigger interrupt if 2 microseconds elapse after a completion occurs,
+ * regardless if "coalesce_number" completions have occurred
+ */
+ isci->coalesce_timeout = 2;
+
+ isci->controller_count = scic_library_get_pci_device_controller_count(
+ scif_library_get_scic_handle(isci->sci_library_handle));
+
+ for (int index = 0; index < isci->controller_count; index++) {
+ struct ISCI_CONTROLLER *controller = &isci->controllers[index];
+ SCI_CONTROLLER_HANDLE_T scif_controller_handle;
+
+ controller->index = index;
+ isci_controller_construct(controller, isci);
+
+ scif_controller_handle = controller->scif_controller_handle;
+
+ status = isci_controller_initialize(controller);
+
+ if(status != SCI_SUCCESS) {
+ isci_log_message(0, "ISCI",
+ "isci_controller_initialize FAILED: %x\n",
+ status);
+ return (status);
+ }
+
+ error = isci_controller_allocate_memory(controller);
+
+ if (error != 0)
+ return (error);
+
+ scif_controller_set_interrupt_coalescence(
+ scif_controller_handle, isci->coalesce_number,
+ isci->coalesce_timeout);
+ }
+
+ /* FreeBSD provides us a hook to ensure we get a chance to start
+ * our controllers and complete initial domain discovery before
+ * it searches for the boot device. Once we're done, we'll
+ * disestablish the hook, signaling the kernel that is can proceed
+ * with the boot process.
+ */
+ isci->config_hook.ich_func = &isci_controller_start;
+ isci->config_hook.ich_arg = &isci->controllers[0];
+
+ if (config_intrhook_establish(&isci->config_hook) != 0)
+ isci_log_message(0, "ISCI",
+ "config_intrhook_establish failed!\n");
+
+ return (status);
+}
+
+void
+isci_allocate_dma_buffer_callback(void *arg, bus_dma_segment_t *seg,
+ int nseg, int error)
+{
+ struct ISCI_MEMORY *memory = (struct ISCI_MEMORY *)arg;
+
+ memory->error = error;
+
+ if (nseg != 1 || error != 0)
+ isci_log_message(0, "ISCI",
+ "Failed to allocate physically contiguous memory!\n");
+ else
+ memory->physical_address = seg->ds_addr;
+}
+
+int
+isci_allocate_dma_buffer(device_t device, struct ISCI_MEMORY *memory)
+{
+ uint32_t status;
+
+ status = bus_dma_tag_create(bus_get_dma_tag(device),
+ 0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR,
+ BUS_SPACE_MAXADDR, NULL, NULL, memory->size,
+ 0x1 /* we want physically contiguous */,
+ memory->size, 0, NULL, NULL, &memory->dma_tag);
+
+ if(status == ENOMEM) {
+ isci_log_message(0, "ISCI", "bus_dma_tag_create failed\n");
+ return (status);
+ }
+
+ status = bus_dmamem_alloc(memory->dma_tag,
+ (void **)&memory->virtual_address, BUS_DMA_ZERO, &memory->dma_map);
+
+ if(status == ENOMEM)
+ {
+ isci_log_message(0, "ISCI", "bus_dmamem_alloc failed\n");
+ return (status);
+ }
+
+ status = bus_dmamap_load(memory->dma_tag, memory->dma_map,
+ (void *)memory->virtual_address, memory->size,
+ isci_allocate_dma_buffer_callback, memory, 0);
+
+ if(status == EINVAL)
+ {
+ isci_log_message(0, "ISCI", "bus_dmamap_load failed\n");
+ return (status);
+ }
+
+ return (0);
+}
+
+/**
+ * @brief This callback method asks the user to associate the supplied
+ * lock with an operating environment specific locking construct.
+ *
+ * @param[in] controller This parameter specifies the controller with
+ * which this lock is to be associated.
+ * @param[in] lock This parameter specifies the lock for which the
+ * user should associate an operating environment specific
+ * locking object.
+ *
+ * @see The SCI_LOCK_LEVEL enumeration for more information.
+ *
+ * @return none.
+ */
+void
+scif_cb_lock_associate(SCI_CONTROLLER_HANDLE_T controller,
+ SCI_LOCK_HANDLE_T lock)
+{
+
+}
+
+/**
+ * @brief This callback method asks the user to de-associate the supplied
+ * lock with an operating environment specific locking construct.
+ *
+ * @param[in] controller This parameter specifies the controller with
+ * which this lock is to be de-associated.
+ * @param[in] lock This parameter specifies the lock for which the
+ * user should de-associate an operating environment specific
+ * locking object.
+ *
+ * @see The SCI_LOCK_LEVEL enumeration for more information.
+ *
+ * @return none.
+ */
+void
+scif_cb_lock_disassociate(SCI_CONTROLLER_HANDLE_T controller,
+ SCI_LOCK_HANDLE_T lock)
+{
+
+}
+
+
+/**
+ * @brief This callback method asks the user to acquire/get the lock.
+ * This method should pend until the lock has been acquired.
+ *
+ * @param[in] controller This parameter specifies the controller with
+ * which this lock is associated.
+ * @param[in] lock This parameter specifies the lock to be acquired.
+ *
+ * @return none
+ */
+void
+scif_cb_lock_acquire(SCI_CONTROLLER_HANDLE_T controller,
+ SCI_LOCK_HANDLE_T lock)
+{
+
+}
+
+/**
+ * @brief This callback method asks the user to release a lock.
+ *
+ * @param[in] controller This parameter specifies the controller with
+ * which this lock is associated.
+ * @param[in] lock This parameter specifies the lock to be released.
+ *
+ * @return none
+ */
+void
+scif_cb_lock_release(SCI_CONTROLLER_HANDLE_T controller,
+ SCI_LOCK_HANDLE_T lock)
+{
+}
+
+/**
+ * @brief This callback method creates an OS specific deferred task
+ * for internal usage. The handler to deferred task is stored by OS
+ * driver.
+ *
+ * @param[in] controller This parameter specifies the controller object
+ * with which this callback is associated.
+ *
+ * @return none
+ */
+void
+scif_cb_start_internal_io_task_create(SCI_CONTROLLER_HANDLE_T controller)
+{
+
+}
+
+/**
+ * @brief This callback method schedules a OS specific deferred task.
+ *
+ * @param[in] controller This parameter specifies the controller
+ * object with which this callback is associated.
+ * @param[in] start_internal_io_task_routine This parameter specifies the
+ * sci start_internal_io routine.
+ * @param[in] context This parameter specifies a handle to a parameter
+ * that will be passed into the "start_internal_io_task_routine"
+ * when it is invoked.
+ *
+ * @return none
+ */
+void
+scif_cb_start_internal_io_task_schedule(SCI_CONTROLLER_HANDLE_T scif_controller,
+ FUNCPTR start_internal_io_task_routine, void *context)
+{
+ /** @todo Use FreeBSD tasklet to defer this routine to a later time,
+ * rather than calling the routine inline.
+ */
+ SCI_START_INTERNAL_IO_ROUTINE sci_start_internal_io_routine =
+ (SCI_START_INTERNAL_IO_ROUTINE)start_internal_io_task_routine;
+
+ sci_start_internal_io_routine(context);
+}
+
+/**
+ * @brief In this method the user must write to PCI memory via access.
+ * This method is used for access to memory space and IO space.
+ *
+ * @param[in] controller The controller for which to read a DWORD.
+ * @param[in] address This parameter depicts the address into
+ * which to write.
+ * @param[out] write_value This parameter depicts the value being written
+ * into the PCI memory location.
+ *
+ * @todo These PCI memory access calls likely needs to be optimized into macros?
+ */
+void
+scic_cb_pci_write_dword(SCI_CONTROLLER_HANDLE_T scic_controller,
+ void *address, uint32_t write_value)
+{
+ SCI_CONTROLLER_HANDLE_T scif_controller =
+ (SCI_CONTROLLER_HANDLE_T) sci_object_get_association(scic_controller);
+ struct ISCI_CONTROLLER *isci_controller =
+ (struct ISCI_CONTROLLER *) sci_object_get_association(scif_controller);
+ struct isci_softc *isci = isci_controller->isci;
+ uint32_t bar = (uint32_t)(((POINTER_UINT)address & 0xF0000000) >> 28);
+ bus_size_t offset = (bus_size_t)((POINTER_UINT)address & 0x0FFFFFFF);
+
+ bus_space_write_4(isci->pci_bar[bar].bus_tag,
+ isci->pci_bar[bar].bus_handle, offset, write_value);
+}
+
+/**
+ * @brief In this method the user must read from PCI memory via access.
+ * This method is used for access to memory space and IO space.
+ *
+ * @param[in] controller The controller for which to read a DWORD.
+ * @param[in] address This parameter depicts the address from
+ * which to read.
+ *
+ * @return The value being returned from the PCI memory location.
+ *
+ * @todo This PCI memory access calls likely need to be optimized into macro?
+ */
+uint32_t
+scic_cb_pci_read_dword(SCI_CONTROLLER_HANDLE_T scic_controller, void *address)
+{
+ SCI_CONTROLLER_HANDLE_T scif_controller =
+ (SCI_CONTROLLER_HANDLE_T)sci_object_get_association(scic_controller);
+ struct ISCI_CONTROLLER *isci_controller =
+ (struct ISCI_CONTROLLER *)sci_object_get_association(scif_controller);
+ struct isci_softc *isci = isci_controller->isci;
+ uint32_t bar = (uint32_t)(((POINTER_UINT)address & 0xF0000000) >> 28);
+ bus_size_t offset = (bus_size_t)((POINTER_UINT)address & 0x0FFFFFFF);
+
+ return (bus_space_read_4(isci->pci_bar[bar].bus_tag,
+ isci->pci_bar[bar].bus_handle, offset));
+}
+
+/**
+ * @brief This method is called when the core requires the OS driver
+ * to stall execution. This method is utilized during initialization
+ * or non-performance paths only.
+ *
+ * @param[in] microseconds This parameter specifies the number of
+ * microseconds for which to stall. The operating system driver
+ * is allowed to round this value up where necessary.
+ *
+ * @return none.
+ */
+void
+scic_cb_stall_execution(uint32_t microseconds)
+{
+
+ DELAY(microseconds);
+}
+
+/**
+ * @brief In this method the user must return the base address register (BAR)
+ * value for the supplied base address register number.
+ *
+ * @param[in] controller The controller for which to retrieve the bar number.
+ * @param[in] bar_number This parameter depicts the BAR index/number to be read.
+ *
+ * @return Return a pointer value indicating the contents of the BAR.
+ * @retval NULL indicates an invalid BAR index/number was specified.
+ * @retval All other values indicate a valid VIRTUAL address from the BAR.
+ */
+void *
+scic_cb_pci_get_bar(SCI_CONTROLLER_HANDLE_T controller,
+ uint16_t bar_number)
+{
+
+ return ((void *)(POINTER_UINT)((uint32_t)bar_number << 28));
+}
+
+/**
+ * @brief This method informs the SCI Core user that a phy/link became
+ * ready, but the phy is not allowed in the port. In some
+ * situations the underlying hardware only allows for certain phy
+ * to port mappings. If these mappings are violated, then this
+ * API is invoked.
+ *
+ * @param[in] controller This parameter represents the controller which
+ * contains the port.
+ * @param[in] port This parameter specifies the SCI port object for which
+ * the callback is being invoked.
+ * @param[in] phy This parameter specifies the phy that came ready, but the
+ * phy can't be a valid member of the port.
+ *
+ * @return none
+ */
+void
+scic_cb_port_invalid_link_up(SCI_CONTROLLER_HANDLE_T controller,
+ SCI_PORT_HANDLE_T port, SCI_PHY_HANDLE_T phy)
+{
+
+}
Added: user/jimharris/isci/sys/dev/isci/isci.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/jimharris/isci/sys/dev/isci/isci.h Wed Jan 25 22:39:22 2012 (r230557)
@@ -0,0 +1,302 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/types.h>
+#include <sys/malloc.h>
+#include <sys/rman.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <cam/cam.h>
+#include <cam/cam_ccb.h>
+#include <cam/cam_sim.h>
+#include <cam/cam_xpt_sim.h>
+
+#include <dev/isci/environment.h>
+#include <dev/isci/scil/intel_pci.h>
+
+#include <dev/isci/scil/sci_types.h>
+#include <dev/isci/scil/sci_object.h>
+#include <dev/isci/scil/sci_status.h>
+#include <dev/isci/scil/sci_pool.h>
+#include <dev/isci/scil/sci_fast_list.h>
+
+#include <dev/isci/scil/sci_controller_constants.h>
+
+#include <dev/isci/scil/scic_controller.h>
+#include <dev/isci/scil/scic_config_parameters.h>
+
+#define DEVICE2SOFTC(dev) ((struct isci_softc *) device_get_softc(dev))
+
+#define DEVICE_TIMEOUT 1000
+#define SCI_MAX_TIMERS 32
+
+#define ISCI_NUM_PCI_BARS 2
+#define ISCI_MAX_LUN 8
+
+MALLOC_DECLARE(M_ISCI);
+
+struct ISCI_TIMER {
+ struct callout callout;
+ SCI_TIMER_CALLBACK_T callback;
+ void *cookie;
+ BOOL is_started;
+};
+
+struct ISCI_REMOTE_DEVICE {
+ uint32_t index;
+ struct ISCI_DOMAIN *domain;
+ SCI_REMOTE_DEVICE_HANDLE_T sci_object;
+ BOOL is_resetting;
+ uint32_t frozen_lun_mask;
+ SCI_FAST_LIST_ELEMENT_T pending_device_reset_element;
+};
+
+struct ISCI_DOMAIN {
+ struct ISCI_CONTROLLER *controller;
+ SCI_DOMAIN_HANDLE_T sci_object;
+ uint8_t index;
+
+};
+
+struct ISCI_MEMORY
+{
+ bus_addr_t physical_address;
+ bus_dma_tag_t dma_tag;
+ bus_dmamap_t dma_map;
+ POINTER_UINT virtual_address;
+ uint32_t size;
+ int error;
+};
+
+struct ISCI_INTERRUPT_INFO
+{
+ SCIC_CONTROLLER_HANDLER_METHODS_T *handlers;
+ void *interrupt_target_handle;
+ struct resource *res;
+ int rid;
+ void *tag;
+
+};
+
+struct ISCI_CONTROLLER
+{
+ struct isci_softc *isci;
+ uint8_t index;
+ SCI_CONTROLLER_HANDLE_T scif_controller_handle;
+ struct ISCI_DOMAIN domain[SCI_MAX_DOMAINS];
+ BOOL is_started;
+ uint32_t initial_discovery_mask;
+ BOOL is_frozen;
+ uint8_t *remote_device_memory;
+ struct ISCI_MEMORY cached_controller_memory;
+ struct ISCI_MEMORY uncached_controller_memory;
+ struct ISCI_MEMORY request_memory;
+ bus_dma_tag_t buffer_dma_tag;
+ struct mtx lock;
+ struct cam_sim *sim;
+ struct cam_path *path;
+ struct ISCI_REMOTE_DEVICE *remote_device[SCI_MAX_REMOTE_DEVICES];
+ void *timer_memory;
+ SCIC_OEM_PARAMETERS_T oem_parameters;
+ uint32_t oem_parameters_version;
+ uint32_t queue_depth;
+ uint32_t sim_queue_depth;
+ SCI_FAST_LIST_T pending_device_reset_list;
+
+ SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl;
+
+ SCI_POOL_CREATE(remote_device_pool, struct ISCI_REMOTE_DEVICE *, SCI_MAX_REMOTE_DEVICES);
+ SCI_POOL_CREATE(request_pool, struct ISCI_REQUEST *, SCI_MAX_IO_REQUESTS);
+ SCI_POOL_CREATE(timer_pool, struct ISCI_TIMER *, SCI_MAX_TIMERS);
+};
+
+struct ISCI_REQUEST
+{
+ SCI_CONTROLLER_HANDLE_T controller_handle;
+ SCI_REMOTE_DEVICE_HANDLE_T remote_device_handle;
+ bus_dma_tag_t dma_tag;
+ bus_dmamap_t dma_map;
+ SCI_PHYSICAL_ADDRESS physical_address;
+ struct callout timer;
+};
+
+struct ISCI_IO_REQUEST
+{
+ struct ISCI_REQUEST parent;
+ SCI_STATUS status;
+ SCI_IO_REQUEST_HANDLE_T sci_object;
+ union ccb *ccb;
+ uint32_t num_segments;
+ uint32_t current_sge_index;
+ bus_dma_segment_t *sge;
+};
+
+struct ISCI_TASK_REQUEST
+{
+ struct ISCI_REQUEST parent;
+ struct scsi_sense_data sense_data;
+ SCI_TASK_REQUEST_HANDLE_T sci_object;
+ union ccb *ccb;
+
+};
+
+struct ISCI_PCI_BAR {
+
+ bus_space_tag_t bus_tag;
+ bus_space_handle_t bus_handle;
+ int resource_id;
+ struct resource *resource;
+
+};
+
+/*
+ * One of these per allocated PCI device.
+ */
+struct isci_softc {
+
+ struct ISCI_PCI_BAR pci_bar[ISCI_NUM_PCI_BARS];
+ struct ISCI_CONTROLLER controllers[SCI_MAX_CONTROLLERS];
+ SCI_LIBRARY_HANDLE_T sci_library_handle;
+ void * sci_library_memory;
+ SCIC_CONTROLLER_HANDLER_METHODS_T handlers[4];
+ struct ISCI_INTERRUPT_INFO interrupt_info[4];
+ uint32_t controller_count;
+ uint32_t num_interrupts;
+ uint32_t coalesce_number;
+ uint32_t coalesce_timeout;
+ device_t device;
+ SCI_PCI_COMMON_HEADER_T pci_common_header;
+ BOOL oem_parameters_found;
+ struct intr_config_hook config_hook;
+};
+
+int isci_allocate_resources(device_t device);
+
+int isci_allocate_dma_buffer(device_t device, struct ISCI_MEMORY *memory);
+
+void isci_remote_device_reset(struct ISCI_REMOTE_DEVICE *remote_device,
+ union ccb *ccb);
+
+/**
+ * Returns the negotiated link rate (in KB/s) for the associated
+ * remote device. Used to fill out bitrate field for GET_TRANS_SETTINGS.
+ * Will match the negotiated link rate for the lowest numbered local phy
+ * in the port/domain containing this remote device.
+ */
+uint32_t isci_remote_device_get_bitrate(
+ struct ISCI_REMOTE_DEVICE *remote_device);
+
+void isci_remote_device_freeze_lun_queue(
+ struct ISCI_REMOTE_DEVICE *remote_device, lun_id_t lun);
+
+void isci_remote_device_release_lun_queue(
+ struct ISCI_REMOTE_DEVICE *remote_device, lun_id_t lun);
+
+void isci_remote_device_release_device_queue(
+ struct ISCI_REMOTE_DEVICE * remote_device);
+
+void isci_request_construct(struct ISCI_REQUEST *request,
+ SCI_CONTROLLER_HANDLE_T scif_controller_handle,
+ bus_dma_tag_t io_buffer_dma_tag, bus_addr_t physical_address);
+
+#define isci_io_request_get_max_io_size() \
+ ((SCI_MAX_SCATTER_GATHER_ELEMENTS - 1) * PAGE_SIZE)
+
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list