From owner-p4-projects@FreeBSD.ORG Tue Nov 10 20:35:27 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AED17106568B; Tue, 10 Nov 2009 20:35:27 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 732D5106566B for ; Tue, 10 Nov 2009 20:35:27 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 609958FC1C for ; Tue, 10 Nov 2009 20:35:27 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id nAAKZRIU028868 for ; Tue, 10 Nov 2009 20:35:27 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nAAKZRcH028866 for perforce@freebsd.org; Tue, 10 Nov 2009 20:35:27 GMT (envelope-from mav@freebsd.org) Date: Tue, 10 Nov 2009 20:35:27 GMT Message-Id: <200911102035.nAAKZRcH028866@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 170444 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 20:35:27 -0000 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) ====