Index: /trunk/src/VBox/Devices/Builtins.cpp
===================================================================
--- /trunk/src/VBox/Devices/Builtins.cpp	(revision 29325)
+++ /trunk/src/VBox/Devices/Builtins.cpp	(revision 29326)
@@ -178,4 +178,7 @@
     if (RT_FAILURE(rc))
         return rc;
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
+    if (RT_FAILURE(rc))
+        return rc;
 #endif
 
Index: /trunk/src/VBox/Devices/Builtins.h
===================================================================
--- /trunk/src/VBox/Devices/Builtins.h	(revision 29325)
+++ /trunk/src/VBox/Devices/Builtins.h	(revision 29326)
@@ -78,4 +78,5 @@
 #ifdef VBOX_WITH_LSILOGIC
 extern const PDMDEVREG g_DeviceLsiLogicSCSI;
+extern const PDMDEVREG g_DeviceLsiLogicSAS;
 #endif
 #ifdef VBOX_WITH_SMC
Index: /trunk/src/VBox/Devices/PC/BIOS/scsi.c
===================================================================
--- /trunk/src/VBox/Devices/PC/BIOS/scsi.c	(revision 29325)
+++ /trunk/src/VBox/Devices/PC/BIOS/scsi.c	(revision 29326)
@@ -20,4 +20,6 @@
 /* The I/O port of the LsiLogic SCSI adapter. */
 #define LSILOGIC_ISA_IO_PORT 0x340
+/* The I/O port of the LsiLogic SAS adapter. */
+#define LSILOGIC_SAS_ISA_IO_PORT 0x350
 
 #define VBOXSCSI_REGISTER_STATUS   0
@@ -284,6 +286,4 @@
 
     ebda_seg = read_word(0x0040, 0x000E);
-
-    write_byte(ebda_seg, &EbdaData->scsi.hdcount, 0);
 
     /* Go through target devices. */
@@ -366,5 +366,5 @@
                     cylinders = (uint32_t)(sectors / (heads * sectors_per_track));
                 }
-                else if (io_base == LSILOGIC_ISA_IO_PORT)
+                else if (io_base == LSILOGIC_ISA_IO_PORT || io_base == LSILOGIC_SAS_ISA_IO_PORT)
                 {
                     /* This is from the BusLogic driver in the Linux kernel. */
@@ -442,4 +442,9 @@
 {
     Bit8u identifier;
+    Bit16u ebda_seg;
+
+
+    ebda_seg = read_word(0x0040, 0x000E);
+    write_byte(ebda_seg, &EbdaData->scsi.hdcount, 0);
 
     identifier = 0;
@@ -476,4 +481,20 @@
         VBOXSCSI_DEBUG("scsi_init: LsiLogic SCSI adapter not detected\n");
     }
+
+    /* Detect LsiLogic SAS adapter. */
+    outb(LSILOGIC_SAS_ISA_IO_PORT+VBOXSCSI_REGISTER_IDENTIFY, 0x55);
+    identifier = inb(LSILOGIC_SAS_ISA_IO_PORT+VBOXSCSI_REGISTER_IDENTIFY);
+
+    if (identifier == 0x55)
+    {
+        /* Detected - Enumerate attached devices. */
+        VBOXSCSI_DEBUG("scsi_init: LsiLogic SAS adapter detected\n");
+        outb(LSILOGIC_SAS_ISA_IO_PORT+VBOXSCSI_REGISTER_RESET, 0);
+        scsi_enumerate_attached_devices(LSILOGIC_SAS_ISA_IO_PORT);
+    }
+    else
+    {
+        VBOXSCSI_DEBUG("scsi_init: LsiLogic SAS adapter not detected\n");
+    }
 }
 
Index: /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 29325)
+++ /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 29326)
@@ -3502,12 +3502,15 @@
 {
     int rc;
-    PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
 
     Assert(cb == 1);
 
-    rc = vboxscsiReadRegister(&pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT), pu32);
+    uint8_t iRegister =   pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                        ? Port - LSILOGIC_ISA_IO_PORT
+                        : Port - LSILOGIC_SAS_ISA_IO_PORT;
+    rc = vboxscsiReadRegister(&pThis->VBoxSCSI, iRegister, pu32);
 
     Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n",
-          __FUNCTION__, pu32, 1, pu32, (Port - LSILOGIC_ISA_IO_PORT), rc));
+          __FUNCTION__, pu32, 1, pu32, iRegister, rc));
 
     return rc;
@@ -3585,5 +3588,5 @@
 {
     int rc;
-    PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
 
     Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x Port=%#x\n",
@@ -3592,8 +3595,11 @@
     Assert(cb == 1);
 
-    rc = vboxscsiWriteRegister(&pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT), (uint8_t)u32);
+    uint8_t iRegister =   pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                        ? Port - LSILOGIC_ISA_IO_PORT
+                        : Port - LSILOGIC_SAS_ISA_IO_PORT;
+    rc = vboxscsiWriteRegister(&pThis->VBoxSCSI, iRegister, (uint8_t)u32);
     if (rc == VERR_MORE_DATA)
     {
-        rc = lsilogicPrepareBIOSSCSIRequest(pLsiLogic);
+        rc = lsilogicPrepareBIOSSCSIRequest(pThis);
         AssertRC(rc);
     }
@@ -3610,5 +3616,5 @@
 static DECLCALLBACK(int) lsilogicIsaIOPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb)
 {
-    PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
     int rc;
 
@@ -3616,9 +3622,12 @@
           pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port));
 
-    rc = vboxscsiWriteString(pDevIns, &pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT),
+    uint8_t iRegister =   pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                        ? Port - LSILOGIC_ISA_IO_PORT
+                        : Port - LSILOGIC_SAS_ISA_IO_PORT;
+    rc = vboxscsiWriteString(pDevIns, &pThis->VBoxSCSI, iRegister,
                              pGCPtrSrc, pcTransfer, cb);
     if (rc == VERR_MORE_DATA)
     {
-        rc = lsilogicPrepareBIOSSCSIRequest(pLsiLogic);
+        rc = lsilogicPrepareBIOSSCSIRequest(pThis);
         AssertRC(rc);
     }
@@ -3635,10 +3644,13 @@
 static DECLCALLBACK(int) lsilogicIsaIOPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb)
 {
-    PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
 
     LogFlowFunc(("#%d %s: pvUser=%#p cb=%d Port=%#x\n",
                  pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port));
 
-    return vboxscsiReadString(pDevIns, &pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT),
+    uint8_t iRegister =   pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                        ? Port - LSILOGIC_ISA_IO_PORT
+                        : Port - LSILOGIC_SAS_ISA_IO_PORT;
+    return vboxscsiReadString(pDevIns, &pThis->VBoxSCSI, iRegister,
                               pGCPtrDst, pcTransfer, cb);
 }
@@ -3651,4 +3663,10 @@
     PLSILOGICSCSI  pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
     int   rc = VINF_SUCCESS;
+    const char *pcszCtrl = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                           ? "LsiLogic"
+                           : "LsiLogicSas";
+    const char *pcszDiag = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                           ? "LsiLogicDiag"
+                           : "LsiLogicSasDiag";
 
     Log2(("%s: registering area at GCPhysAddr=%RGp cb=%u\n", __FUNCTION__, GCPhysAddress, cb));
@@ -3662,5 +3680,5 @@
         /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */
         rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL,
-                                   lsilogicMMIOWrite, lsilogicMMIORead, NULL, "LsiLogic");
+                                   lsilogicMMIOWrite, lsilogicMMIORead, NULL, pcszCtrl);
         if (RT_FAILURE(rc))
             return rc;
@@ -3688,5 +3706,5 @@
         /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */
         rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL,
-                                   lsilogicDiagnosticWrite, lsilogicDiagnosticRead, NULL, "LsiLogicDiag");
+                                   lsilogicDiagnosticWrite, lsilogicDiagnosticRead, NULL, pcszDiag);
         if (RT_FAILURE(rc))
             return rc;
@@ -3711,5 +3729,5 @@
     {
         rc = PDMDevHlpIOPortRegister(pDevIns, (RTIOPORT)GCPhysAddress, LSILOGIC_PCI_SPACE_IO_SIZE,
-                                     NULL, lsilogicIOPortWrite, lsilogicIOPortRead, NULL, NULL, "LsiLogic");
+                                     NULL, lsilogicIOPortWrite, lsilogicIOPortRead, NULL, NULL, pcszCtrl);
         if (RT_FAILURE(rc))
             return rc;
@@ -3718,5 +3736,5 @@
         {
             rc = PDMDevHlpIOPortRegisterR0(pDevIns, (RTIOPORT)GCPhysAddress, LSILOGIC_PCI_SPACE_IO_SIZE,
-                                           0, "lsilogicIOPortWrite", "lsilogicIOPortRead", NULL, NULL, "LsiLogic");
+                                           0, "lsilogicIOPortWrite", "lsilogicIOPortRead", NULL, NULL, pcszCtrl);
             if (RT_FAILURE(rc))
                 return rc;
@@ -3726,5 +3744,5 @@
         {
             rc = PDMDevHlpIOPortRegisterRC(pDevIns, (RTIOPORT)GCPhysAddress, LSILOGIC_PCI_SPACE_IO_SIZE,
-                                           0, "lsilogicIOPortWrite", "lsilogicIOPortRead", NULL, NULL, "LsiLogic");
+                                           0, "lsilogicIOPortWrite", "lsilogicIOPortRead", NULL, NULL, pcszCtrl);
             if (RT_FAILURE(rc))
                 return rc;
@@ -4512,5 +4530,9 @@
     /* Intialize task queue. */
     rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 2, 0,
-                              lsilogicNotifyQueueConsumer, true, "LsiLogic-Task", &pThis->pNotificationQueueR3);
+                              lsilogicNotifyQueueConsumer, true,
+                              pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                              ? "LsiLogic-Task"
+                              : "LsiLogicSAS-Task",
+                              &pThis->pNotificationQueueR3);
     if (RT_FAILURE(rc))
         return rc;
@@ -4549,10 +4571,16 @@
      * Create critical sections protecting the reply post and free queues.
      */
-    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyFreeQueueCritSect, RT_SRC_POS, "LsiLogicRFQ");
+    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyFreeQueueCritSect, RT_SRC_POS,
+                               pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                               ? "LsiLogicRFQ"
+                               : "LsiLogicSasRFQ");
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("LsiLogic: cannot create critical section for reply free queue"));
 
-    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyPostQueueCritSect, RT_SRC_POS, "LsiLogicRPQ");
+    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyPostQueueCritSect, RT_SRC_POS,
+                               pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
+                               ? "LsiLogicRPQ"
+                               : "LsiLogicSasRPQ");
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
@@ -4637,8 +4665,17 @@
 
     /* Register I/O port space in ISA region for BIOS access. */
-    rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_ISA_IO_PORT, 3, NULL,
-                                 lsilogicIsaIOPortWrite, lsilogicIsaIOPortRead,
-                                 lsilogicIsaIOPortWriteStr, lsilogicIsaIOPortReadStr,
-                                 "LsiLogic BIOS");
+    if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)
+        rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_ISA_IO_PORT, 3, NULL,
+                                     lsilogicIsaIOPortWrite, lsilogicIsaIOPortRead,
+                                     lsilogicIsaIOPortWriteStr, lsilogicIsaIOPortReadStr,
+                                     "LsiLogic BIOS");
+    else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)
+        rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_SAS_ISA_IO_PORT, 3, NULL,
+                                     lsilogicIsaIOPortWrite, lsilogicIsaIOPortRead,
+                                     lsilogicIsaIOPortWriteStr, lsilogicIsaIOPortReadStr,
+                                     "LsiLogic SAS BIOS");
+    else
+        AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType));
+
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot register legacy I/O handlers"));
@@ -4660,5 +4697,5 @@
 
 /**
- * The device registration structure.
+ * The device registration structure - SPI SCSI controller.
  */
 const PDMDEVREG g_DeviceLsiLogicSCSI =
@@ -4714,4 +4751,59 @@
 };
 
+/**
+ * The device registration structure - SAS controller.
+ */
+const PDMDEVREG g_DeviceLsiLogicSAS =
+{
+    /* u32Version */
+    PDM_DEVREG_VERSION,
+    /* szName */
+    "lsilogicsas",
+    /* szRCMod */
+    "VBoxDDGC.gc",
+    /* szR0Mod */
+    "VBoxDDR0.r0",
+    /* pszDescription */
+    "LSI Logic SAS1068 controller.\n",
+    /* fFlags */
+    PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
+    /* fClass */
+    PDM_DEVREG_CLASS_STORAGE,
+    /* cMaxInstances */
+    ~0,
+    /* cbInstance */
+    sizeof(LSILOGICSCSI),
+    /* pfnConstruct */
+    lsilogicConstruct,
+    /* pfnDestruct */
+    lsilogicDestruct,
+    /* pfnRelocate */
+    lsilogicRelocate,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    lsilogicReset,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    lsilogicAttach,
+    /* pfnDetach */
+    lsilogicDetach,
+    /* pfnQueryInterface. */
+    NULL,
+    /* pfnInitComplete */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32VersionEnd */
+    PDM_DEVREG_VERSION
+};
+
 #endif /* IN_RING3 */
 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
Index: /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.h
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.h	(revision 29325)
+++ /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.h	(revision 29326)
@@ -25,4 +25,5 @@
  */
 #define LSILOGIC_ISA_IO_PORT 0x340
+#define LSILOGIC_SAS_ISA_IO_PORT 0x350
 
 #define LSILOGICSCSI_REQUEST_QUEUE_DEPTH_DEFAULT 1024
Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 29325)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 29326)
@@ -3106,8 +3106,9 @@
     {
         case StorageControllerType_LsiLogic:
-        case StorageControllerType_LsiLogicSas:
             return "lsilogicscsi";
         case StorageControllerType_BusLogic:
             return "buslogic";
+        case StorageControllerType_LsiLogicSas:
+            return "lsilogicsas";
         case StorageControllerType_IntelAhci:
             return "ahci";
