sbp.c (110579) | sbp.c (110798) |
---|---|
1/* 2 * Copyright (c) 1998,1999,2000,2001 Katsushi Kobayashi and Hidetosh Shimokawa 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1998,1999,2000,2001 Katsushi Kobayashi and Hidetosh Shimokawa 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/dev/firewire/sbp.c 110579 2003-02-09 07:40:27Z simokawa $ | 33 * $FreeBSD: head/sys/dev/firewire/sbp.c 110798 2003-02-13 13:35:57Z simokawa $ |
34 * 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/module.h> 40#include <sys/bus.h> 41#include <sys/mbuf.h> --- 474 unchanged lines hidden (view full) --- 516 int i, clen, found=0; 517 struct csrhdr *chdr; 518 struct csrreg *creg; 519 u_int32_t *src, *dst; 520 521 chdr = (struct csrhdr *)&fwdev->csrrom[0]; 522 creg = (struct csrreg *)chdr; 523 creg += chdr->info_len; | 34 * 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/module.h> 40#include <sys/bus.h> 41#include <sys/mbuf.h> --- 474 unchanged lines hidden (view full) --- 516 int i, clen, found=0; 517 struct csrhdr *chdr; 518 struct csrreg *creg; 519 u_int32_t *src, *dst; 520 521 chdr = (struct csrhdr *)&fwdev->csrrom[0]; 522 creg = (struct csrreg *)chdr; 523 creg += chdr->info_len; |
524 for( i = chdr->info_len + 4; i <= fwdev->rommax; i+=4){ | 524 for( i = chdr->info_len + 4; i <= fwdev->rommax - 4; i+=4){ |
525 if((creg++)->key == key){ 526 found = 1; 527 break; 528 } 529 } | 525 if((creg++)->key == key){ 526 found = 1; 527 break; 528 } 529 } |
530 if (!found) { | 530 if (!found || creg->key != CROM_TEXTLEAF) { |
531 strncpy(buf, nullstr, len); 532 return; 533 } 534 src = (u_int32_t *) creg + creg->val; 535 clen = ((*src >> 16) - 2) * 4; 536 src += 3; 537 dst = (u_int32_t *) buf; 538 if (len < clen) --- 236 unchanged lines hidden (view full) --- 775END_DEBUG 776 sdev->status = SBP_DEV_ATTACHED; 777 free(ccb, M_SBP); 778} 779 780static void 781sbp_cam_scan_lun(struct sbp_dev *sdev) 782{ | 531 strncpy(buf, nullstr, len); 532 return; 533 } 534 src = (u_int32_t *) creg + creg->val; 535 clen = ((*src >> 16) - 2) * 4; 536 src += 3; 537 dst = (u_int32_t *) buf; 538 if (len < clen) --- 236 unchanged lines hidden (view full) --- 775END_DEBUG 776 sdev->status = SBP_DEV_ATTACHED; 777 free(ccb, M_SBP); 778} 779 780static void 781sbp_cam_scan_lun(struct sbp_dev *sdev) 782{ |
783 union ccb *ccb = malloc(sizeof(union ccb), M_SBP, M_ZERO); | 783 union ccb *ccb; |
784 | 784 |
785 ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO); 786 if (ccb == NULL) { 787 printf("sbp_cam_scan_lun: malloc failed\n"); 788 return; 789 } 790 |
|
785SBP_DEBUG(0) 786 sbp_show_sdev_info(sdev, 2); 787 printf("sbp_cam_scan_lun\n"); 788END_DEBUG 789 xpt_setup_ccb(&ccb->ccb_h, sdev->path, 5/*priority (low)*/); 790 ccb->ccb_h.func_code = XPT_SCAN_LUN; 791 ccb->ccb_h.cbfcnp = sbp_cam_callback; 792 ccb->crcn.flags = CAM_FLAG_NONE; --- 42 unchanged lines hidden (view full) --- 835 * e.g. Maxtor 3000XT, Yano A-dish. 836 */ 837static void 838sbp_ping_unit(struct sbp_dev *sdev) 839{ 840 union ccb *ccb; 841 struct scsi_inquiry_data *inq_buf; 842 | 791SBP_DEBUG(0) 792 sbp_show_sdev_info(sdev, 2); 793 printf("sbp_cam_scan_lun\n"); 794END_DEBUG 795 xpt_setup_ccb(&ccb->ccb_h, sdev->path, 5/*priority (low)*/); 796 ccb->ccb_h.func_code = XPT_SCAN_LUN; 797 ccb->ccb_h.cbfcnp = sbp_cam_callback; 798 ccb->crcn.flags = CAM_FLAG_NONE; --- 42 unchanged lines hidden (view full) --- 841 * e.g. Maxtor 3000XT, Yano A-dish. 842 */ 843static void 844sbp_ping_unit(struct sbp_dev *sdev) 845{ 846 union ccb *ccb; 847 struct scsi_inquiry_data *inq_buf; 848 |
843 ccb = malloc(sizeof(union ccb), M_SBP, M_ZERO); | 849 850 ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO); 851 if (ccb == NULL) { 852 printf("sbp_ping_unit: malloc failed\n"); 853 return; 854 } 855 |
844 inq_buf = (struct scsi_inquiry_data *) | 856 inq_buf = (struct scsi_inquiry_data *) |
845 malloc(sizeof(*inq_buf), M_SBP, 0); | 857 malloc(sizeof(*inq_buf), M_SBP, M_NOWAIT); 858 if (inq_buf == NULL) { 859 free(ccb, M_SBP); 860 printf("sbp_ping_unit: malloc failed\n"); 861 return; 862 } |
846 847SBP_DEBUG(0) 848 sbp_show_sdev_info(sdev, 2); 849 printf("sbp_ping_unit\n"); 850END_DEBUG 851 852 /* 853 * We need to execute this command before any other queued command. --- 1539 unchanged lines hidden --- | 863 864SBP_DEBUG(0) 865 sbp_show_sdev_info(sdev, 2); 866 printf("sbp_ping_unit\n"); 867END_DEBUG 868 869 /* 870 * We need to execute this command before any other queued command. --- 1539 unchanged lines hidden --- |