PERFORCE change 170444 for review

View: New views
1 Messages — Rating Filter:   Alert me  

PERFORCE change 170444 for review

by Alexander Motin-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://p4web.freebsd.org/chv.cgi?CH=170444

Change 170444 by mav@mav_mavbook on 2009/11/10 20:34:42

        Implement quirk matching for ATA.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_all.c#21 edit
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_all.h#21 edit
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#41 edit
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#54 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam.c#12 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_all.c#21 (text+ko) ====

@@ -519,3 +519,38 @@
     return (mode);
 }
 
+int
+ata_identify_match(caddr_t identbuffer, caddr_t table_entry)
+{
+ struct scsi_inquiry_pattern *entry;
+ struct ata_params *ident;
+
+ entry = (struct scsi_inquiry_pattern *)table_entry;
+ ident = (struct ata_params *)identbuffer;
+
+ if ((cam_strmatch(ident->model, entry->product,
+  sizeof(ident->model)) == 0)
+ && (cam_strmatch(ident->revision, entry->revision,
+  sizeof(ident->revision)) == 0)) {
+ return (0);
+ }
+        return (-1);
+}
+
+int
+ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry)
+{
+ struct scsi_static_inquiry_pattern *entry;
+ struct ata_params *ident;
+
+ entry = (struct scsi_static_inquiry_pattern *)table_entry;
+ ident = (struct ata_params *)identbuffer;
+
+ if ((cam_strmatch(ident->model, entry->product,
+  sizeof(ident->model)) == 0)
+ && (cam_strmatch(ident->revision, entry->revision,
+  sizeof(ident->revision)) == 0)) {
+ return (0);
+ }
+        return (-1);
+}

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_all.h#21 (text+ko) ====

@@ -115,4 +115,7 @@
 int ata_max_umode(struct ata_params *ap);
 int ata_max_mode(struct ata_params *ap, int mode, int maxmode);
 
+int ata_identify_match(caddr_t identbuffer, caddr_t table_entry);
+int ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry);
+
 #endif

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#41 (text+ko) ====

@@ -122,9 +122,17 @@
  ada_quirks quirks;
 };
 
-//static struct ada_quirk_entry ada_quirk_table[] =
-//{
-//};
+static struct ada_quirk_entry ada_quirk_table[] =
+{
+ {
+ /* Default */
+ {
+  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
+  /*vendor*/"*", /*product*/"*", /*revision*/"*"
+ },
+ /*quirks*/0
+ },
+};
 
 static disk_strategy_t adastrategy;
 static dumper_t adadump;
@@ -627,12 +635,10 @@
  /*
  * See if this device has any quirks.
  */
-// match = cam_quirkmatch((caddr_t)&cgd->inq_data,
-//       (caddr_t)ada_quirk_table,
-//       sizeof(ada_quirk_table)/sizeof(*ada_quirk_table),
-//       sizeof(*ada_quirk_table), scsi_inquiry_match);
- match = NULL;
-
+ match = cam_quirkmatch((caddr_t)&cgd->ident_data,
+       (caddr_t)ada_quirk_table,
+       sizeof(ada_quirk_table)/sizeof(*ada_quirk_table),
+       sizeof(*ada_quirk_table), ata_identify_match);
  if (match != NULL)
  softc->quirks = ((struct ada_quirk_entry *)match)->quirks;
  else

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#54 (text+ko) ====

@@ -69,11 +69,7 @@
 struct ata_quirk_entry {
  struct scsi_inquiry_pattern inq_pat;
  u_int8_t quirks;
-#define CAM_QUIRK_NOLUNS 0x01
-#define CAM_QUIRK_NOSERIAL 0x02
-#define CAM_QUIRK_HILUNS 0x04
-#define CAM_QUIRK_NOHILUNS 0x08
- u_int mintags;
+#define CAM_QUIRK_MAXTAGS 0x01
  u_int maxtags;
 };
 
@@ -145,7 +141,7 @@
   T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
   /*vendor*/"*", /*product*/"*", /*revision*/"*"
  },
- /*quirks*/0, /*mintags*/2, /*maxtags*/32
+ /*quirks*/0, /*maxtags*/0
  },
 };
 
@@ -863,18 +859,18 @@
  struct ata_quirk_entry *quirk;
  caddr_t match;
 
- match = cam_quirkmatch((caddr_t)&device->inq_data,
+ match = cam_quirkmatch((caddr_t)&device->ident_data,
        (caddr_t)ata_quirk_table,
        ata_quirk_table_size,
-       sizeof(*ata_quirk_table), scsi_inquiry_match);
+       sizeof(*ata_quirk_table), ata_identify_match);
 
  if (match == NULL)
  panic("xpt_find_quirk: device didn't match wildcard entry!!");
 
  quirk = (struct ata_quirk_entry *)match;
  device->quirk = quirk;
-// device->mintags = quirk->mintags;
-// device->maxtags = quirk->maxtags;
+ if (quirk->quirks & CAM_QUIRK_MAXTAGS)
+ device->mintags = device->maxtags = quirk->maxtags;
 }
 
 typedef struct {

==== //depot/projects/scottl-camlock/src/sys/cam/cam.c#12 (text+ko) ====

_______________________________________________
p4-projects@... mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "p4-projects-unsubscribe@..."