dmraid/dmraid-1.0.0.rc14-fixup_lsi1068e.patch

60 lines
1.9 KiB
Diff

Index: 1.0.0.rc15/lib/format/ddf/ddf1.c
===================================================================
--- 1.0.0.rc15.orig/lib/format/ddf/ddf1.c 2008-06-20 18:04:10.000000000 +0200
+++ 1.0.0.rc15/lib/format/ddf/ddf1.c 2008-09-24 16:10:34.000000000 +0200
@@ -40,6 +40,9 @@ static const char *handler = HANDLER;
// #define PCI_VENDOR_ID_ADAPTEC 0x9004
#define PCI_VENDOR_ID_ADAPTEC2 0x9005
+/* PCI IDs for LSI */
+#define PCI_VENDOR_ID_LSI 0x1000
+
/* Map DDF1 disk status to dmraid status */
static enum status
disk_status(struct ddf1_phys_drive *disk)
@@ -378,6 +381,13 @@ read_extended(struct lib_context *lc, st
ddf1->adaptec_mode = 1;
}
+ if (ddf1->adapter &&
+ ddf1->adapter->pci_vendor == PCI_VENDOR_ID_LSI) {
+ log_notice(lc, "%s: LSI mode discovered on %s",
+ handler, di->path);
+ ddf1->lsi_mode = 1;
+ }
+
/* Read physical drive characteristic data */
where = to_bytes(pri->primary_table_lba + pri->disk_data_offset);
if (!(ddata = ddf1->disk_data =
@@ -692,10 +702,14 @@ name(struct lib_context *lc, struct ddf1
} else {
char *b;
- for (b = buf + prefix, i = 0; i < 24; b += 8, i += 4)
- sprintf(b, "%02x%02x%02x%02x",
- vd->guid[i], vd->guid[i + 1],
- vd->guid[i + 2], vd->guid[i + 3]);
+ for (b = buf + prefix, i = 0; i < 24; b += 8, i += 4) {
+ if (i == 16 && ddf1->lsi_mode)
+ sprintf(b, "00000000");
+ else
+ sprintf(b, "%02x%02x%02x%02x",
+ vd->guid[i], vd->guid[i+1],
+ vd->guid[i+2], vd->guid[i+3]);
+ }
}
out:
Index: 1.0.0.rc15/lib/format/ddf/ddf1.h
===================================================================
--- 1.0.0.rc15.orig/lib/format/ddf/ddf1.h 2008-06-12 12:54:32.000000000 +0200
+++ 1.0.0.rc15/lib/format/ddf/ddf1.h 2008-09-24 16:03:52.000000000 +0200
@@ -264,6 +264,7 @@ struct ddf1 {
int disk_format;
int in_cpu_format;
int adaptec_mode;
+ int lsi_mode;
};
#endif /* FORMAT_HANDLER */