Skip to contentSkip to conversation

megasas: LSI Megaraid SAS emulation

PATCH Superseded Hannes Reinecke 2 participants 2 messages Nov 22, 2010 – Nov 23, 2010 Kbuild

v1 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megasas: LSI Megaraid SAS emulation

This patch adds an emulation for the LSI Megaraid SAS HBA.

---
 Makefile.objs |    2 +-
 hw/megasas.c  | 1826 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/mfi.h      | 1197 +++++++++++++++++++++++++++++++++++++
 hw/pci_ids.h  |    2 +
 hw/scsi.h     |    1 +
 5 files changed, 3027 insertions(+), 1 deletions(-)
 create mode 100644 hw/megasas.c
 create mode 100644 hw/mfi.h
Makefile.objs +1 -1
index 23b17ce..89c8661 100644
@@ -231,7 +231,7 @@ hw-obj-$(CONFIG_IDE_MACIO) += ide/macio.o
 hw-obj-$(CONFIG_IDE_VIA) += ide/via.o
 
 # SCSI layer
-hw-obj-y += lsi53c895a.o
+hw-obj-y += lsi53c895a.o megasas.o
 hw-obj-$(CONFIG_ESP) += esp.o
 
 hw-obj-y += dma-helpers.o sysbus.o isa-bus.o
hw/megasas.c new file +1826 -0

1,826 lines not on this page · raw message

hw/mfi.h new file +1197 -0

1,166 lines not on this page · raw message

hw/pci_ids.h +2 -0
index 82cba7e..6b9b54e 100644

Lines of this file are not shown. View the raw message.

hw/scsi.h +1 -0
index 538ae54..b0a477b 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.0.2

Part of the diff is not shown here. View the raw message.

#1 lore raw

On Mon, Nov 22, 2010 at 10:15 AM, Hannes Reinecke <[email protected]> wrote:
Not a full review but two small things I noticed:

hw/megasas.c line 148

Quoted 11 lines
hw/megasas.c new file +11 -0
+#define megasas_frame_set_cmd_status(f,v)              \
+    stb_phys((f) + offsetof(struct mfi_frame_header, cmd_status), v);
+
+#define megasas_frame_set_scsi_status(f,v)             \
+    stb_phys((f) + offsetof(struct mfi_frame_header, scsi_status), v);
+
+#define megasas_frame_get_cmd(f)                       \
+    ldub_phys((f) + offsetof(struct mfi_frame_header, frame_cmd))
+
+#define megasas_frame_get_context(f)                   \
+    ldl_phys(frame_addr + offsetof(struct mfi_frame_header, context));

These macros include a semicolon. They should be wrapped in:
do { ... } while (0)

hw/megasas.c line 1729

Quoted 5 lines
hw/megasas.c new file +5 -0
+static int megasas_scsi_uninit(PCIDevice *d)
+{
+    MPTState *s = DO_UPCAST(MPTState, dev, d);
+
+    cpu_unregister_io_memory(s->mmio_io_addr);

Missing cpu_unregister_io_memory(s->io_addr) and
cpu_unregister_io_memory(s->queue_addr)?

Stefan