示例#1
0
SCI_STATUS scic_library_allocate_controller(
    SCI_LIBRARY_HANDLE_T    library,
    SCI_CONTROLLER_HANDLE_T *new_controller
)
{
    SCI_STATUS status;
    SCIC_SDS_LIBRARY_T *this_library;

    this_library = (SCIC_SDS_LIBRARY_T *)library;

    if (
        (  (this_library->pci_device >= 0x1D60)
           && (this_library->pci_device <= 0x1D62)
        )
        || (  (this_library->pci_device >= 0x1D64)
              && (this_library->pci_device <= 0x1D65)
           )
        || (  (this_library->pci_device >= 0x1D68)
              && (this_library->pci_device <= 0x1D6F)
           )
    )
    {
        SCI_BASE_LIBRARY_ALLOCATE_CONTROLLER(
            this_library, new_controller, &status);
    }
    else
        status = SCI_FAILURE_UNSUPPORTED_PCI_DEVICE_ID;

    return status;
}
示例#2
0
SCI_STATUS scif_library_allocate_controller(
   SCI_LIBRARY_HANDLE_T      library,
   SCI_CONTROLLER_HANDLE_T * new_controller
)
{
   SCI_STATUS  status;

   // Ensure the user supplied a valid library handle.
   if (library != SCI_INVALID_HANDLE)
   {
      SCIF_SAS_LIBRARY_T * fw_library = (SCIF_SAS_LIBRARY_T *) library;

      // Allocate the framework library.
      SCI_BASE_LIBRARY_ALLOCATE_CONTROLLER(fw_library, new_controller, &status);
      if (status == SCI_SUCCESS)
      {
         SCIF_SAS_CONTROLLER_T * fw_controller;

         // Allocate the core controller and save the handle in the framework
         // controller object.
         fw_controller = (SCIF_SAS_CONTROLLER_T*) *new_controller;

         // Just clear out the memory of the structure to be safe.
         memset(fw_controller, 0, sizeof(SCIF_SAS_CONTROLLER_T));

         status = scic_library_allocate_controller(
                     fw_library->core_object, &(fw_controller->core_object)
                  );

         // Free the framework controller if the core controller allocation
         // failed.
         if (status != SCI_SUCCESS)
            scif_library_free_controller(library, fw_controller);
      }

      if (status != SCI_SUCCESS)
      {
         SCIF_LOG_WARNING((
            sci_base_object_get_logger(fw_library),
            SCIF_LOG_OBJECT_LIBRARY,
            "Library:0x%x Status:0x%x controller allocation failed\n",
            fw_library, status
         ));
      }
   }
   else
      status = SCI_FAILURE_INVALID_PARAMETER_VALUE;

   return status;
}