dmraid/dmraid-1.0.0.rc14-fixup_lsi1068e.patch

60 lines
1.8 KiB
Diff

Index: 1.0.0.rc14/lib/format/ddf/ddf1.c
===================================================================
--- 1.0.0.rc14.orig/lib/format/ddf/ddf1.c
+++ 1.0.0.rc14/lib/format/ddf/ddf1.c
@@ -28,6 +28,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) {
struct states states[] = {
@@ -358,6 +361,13 @@ static int read_extended(struct lib_cont
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 =
@@ -667,10 +677,14 @@ static char *name(struct lib_context *lc
} 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.rc14/lib/format/ddf/ddf1.h
===================================================================
--- 1.0.0.rc14.orig/lib/format/ddf/ddf1.h
+++ 1.0.0.rc14/lib/format/ddf/ddf1.h
@@ -264,6 +264,7 @@ struct ddf1 {
int disk_format;
int in_cpu_format;
int adaptec_mode;
+ int lsi_mode;
};
#endif /* FORMAT_HANDLER */