hptnr_osm_bsd.c (275980) | hptnr_osm_bsd.c (281957) |
---|---|
1/* $Id: osm_bsd.c,v 1.36 2010/05/11 03:12:11 lcn Exp $ */ 2/*- 3 * HighPoint RAID Driver for FreeBSD 4 * Copyright (C) 2005-2011 HighPoint Technologies, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/* $Id: osm_bsd.c,v 1.36 2010/05/11 03:12:11 lcn Exp $ */ 2/*- 3 * HighPoint RAID Driver for FreeBSD 4 * Copyright (C) 2005-2011 HighPoint Technologies, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: stable/10/sys/dev/hptnr/hptnr_osm_bsd.c 275980 2014-12-21 02:57:03Z smh $ | 28 * $FreeBSD: stable/10/sys/dev/hptnr/hptnr_osm_bsd.c 281957 2015-04-25 00:32:47Z delphij $ |
29 */ 30#include <dev/hptnr/hptnr_config.h> 31#include <dev/hptnr/os_bsd.h> 32#include <dev/hptnr/hptintf.h> | 29 */ 30#include <dev/hptnr/hptnr_config.h> 31#include <dev/hptnr/os_bsd.h> 32#include <dev/hptnr/hptintf.h> |
33 | 33int msi = 0; 34int debug_flag = 0; |
34static HIM *hpt_match(device_t dev) 35{ 36 PCI_ID pci_id; 37 HIM *him; 38 int i; 39 40 for (him = him_list; him; him = him->next) { 41 for (i=0; him->get_supported_device_id(i, &pci_id); i++) { --- 384 unchanged lines hidden (view full) --- 426 427 ldm_reset_vbus((PVBUS)ext->vbus_ext->vbus); 428} 429 430static void os_cmddone(PCOMMAND pCmd) 431{ 432 POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv; 433 union ccb *ccb = ext->ccb; | 35static HIM *hpt_match(device_t dev) 36{ 37 PCI_ID pci_id; 38 HIM *him; 39 int i; 40 41 for (him = him_list; him; him = him->next) { 42 for (i=0; him->get_supported_device_id(i, &pci_id); i++) { --- 384 unchanged lines hidden (view full) --- 427 428 ldm_reset_vbus((PVBUS)ext->vbus_ext->vbus); 429} 430 431static void os_cmddone(PCOMMAND pCmd) 432{ 433 POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv; 434 union ccb *ccb = ext->ccb; |
435 HPT_U8 *cdb; 436 437 if (ccb->ccb_h.flags & CAM_CDB_POINTER) 438 cdb = ccb->csio.cdb_io.cdb_ptr; 439 else 440 cdb = ccb->csio.cdb_io.cdb_bytes; |
|
434 435 KdPrint(("os_cmddone(%p, %d)", pCmd, pCmd->Result)); 436 437 callout_stop(&ext->timeout); | 441 442 KdPrint(("os_cmddone(%p, %d)", pCmd, pCmd->Result)); 443 444 callout_stop(&ext->timeout); |
445 switch(cdb[0]) { 446 case 0x85: /*ATA_16*/ 447 case 0xA1: /*ATA_12*/ 448 { 449 PassthroughCmd *passthru = &pCmd->uCmd.Passthrough; 450 HPT_U8 *sense_buffer = (HPT_U8 *)&ccb->csio.sense_data; 451 memset(&ccb->csio.sense_data, 0,sizeof(ccb->csio.sense_data)); |
|
438 | 452 |
453 sense_buffer[0] = 0x72; /* Response Code */ 454 sense_buffer[7] = 14; /* Additional Sense Length */ 455 456 sense_buffer[8] = 0x9; /* ATA Return Descriptor */ 457 sense_buffer[9] = 0xc; /* Additional Descriptor Length */ 458 sense_buffer[11] = (HPT_U8)passthru->bFeaturesReg; /* Error */ 459 sense_buffer[13] = (HPT_U8)passthru->bSectorCountReg; /* Sector Count (7:0) */ 460 sense_buffer[15] = (HPT_U8)passthru->bLbaLowReg; /* LBA Low (7:0) */ 461 sense_buffer[17] = (HPT_U8)passthru->bLbaMidReg; /* LBA Mid (7:0) */ 462 sense_buffer[19] = (HPT_U8)passthru->bLbaHighReg; /* LBA High (7:0) */ 463 464 if ((cdb[0] == 0x85) && (cdb[1] & 0x1)) 465 { 466 sense_buffer[10] = 1; 467 sense_buffer[12] = (HPT_U8)(passthru->bSectorCountReg >> 8); /* Sector Count (15:8) */ 468 sense_buffer[14] = (HPT_U8)(passthru->bLbaLowReg >> 8); /* LBA Low (15:8) */ 469 sense_buffer[16] = (HPT_U8)(passthru->bLbaMidReg >> 8); /* LBA Mid (15:8) */ 470 sense_buffer[18] = (HPT_U8)(passthru->bLbaHighReg >> 8); /* LBA High (15:8) */ 471 } 472 473 sense_buffer[20] = (HPT_U8)passthru->bDriveHeadReg; /* Device */ 474 sense_buffer[21] = (HPT_U8)passthru->bCommandReg; /* Status */ 475 KdPrint(("sts 0x%x err 0x%x low 0x%x mid 0x%x hig 0x%x dh 0x%x sc 0x%x", 476 passthru->bCommandReg, 477 passthru->bFeaturesReg, 478 passthru->bLbaLowReg, 479 passthru->bLbaMidReg, 480 passthru->bLbaHighReg, 481 passthru->bDriveHeadReg, 482 passthru->bSectorCountReg)); 483 KdPrint(("result:0x%x,bFeaturesReg:0x%04x,bSectorCountReg:0x%04x,LBA:0x%04x%04x%04x ", 484 pCmd->Result,passthru->bFeaturesReg,passthru->bSectorCountReg, 485 passthru->bLbaHighReg,passthru->bLbaMidReg,passthru->bLbaLowReg)); 486 } 487 default: 488 break; 489 } 490 |
|
439 switch(pCmd->Result) { 440 case RETURN_SUCCESS: 441 ccb->ccb_h.status = CAM_REQ_CMP; 442 break; 443 case RETURN_BAD_DEVICE: 444 ccb->ccb_h.status = CAM_DEV_NOT_THERE; 445 break; 446 case RETURN_DEVICE_BUSY: --- 109 unchanged lines hidden (view full) --- 556 557 switch (cdb[0]) { 558 case TEST_UNIT_READY: 559 case START_STOP_UNIT: 560 case SYNCHRONIZE_CACHE: 561 ccb->ccb_h.status = CAM_REQ_CMP; 562 break; 563 | 491 switch(pCmd->Result) { 492 case RETURN_SUCCESS: 493 ccb->ccb_h.status = CAM_REQ_CMP; 494 break; 495 case RETURN_BAD_DEVICE: 496 ccb->ccb_h.status = CAM_DEV_NOT_THERE; 497 break; 498 case RETURN_DEVICE_BUSY: --- 109 unchanged lines hidden (view full) --- 608 609 switch (cdb[0]) { 610 case TEST_UNIT_READY: 611 case START_STOP_UNIT: 612 case SYNCHRONIZE_CACHE: 613 ccb->ccb_h.status = CAM_REQ_CMP; 614 break; 615 |
564 case INQUIRY: | 616 case 0x85: /*ATA_16*/ 617 case 0xA1: /*ATA_12*/ 618 { 619 int error; 620 HPT_U8 prot; 621 PassthroughCmd *passthru; 622 623 if (mIsArray(vd->type)) { 624 ccb->ccb_h.status = CAM_PATH_INVALID; 625 break; 626 } 627 628 HPT_ASSERT(vd->type == VD_RAW && vd->u.raw.legacy_disk); 629 630 prot = (cdb[1] & 0x1e) >> 1; 631 632 633 if (prot < 3 || prot > 5) |
565 { | 634 { |
566 PINQUIRYDATA inquiryData; 567 memset(ccb->csio.data_ptr, 0, ccb->csio.dxfer_len); 568 inquiryData = (PINQUIRYDATA)ccb->csio.data_ptr; | 635 ccb->ccb_h.status = CAM_REQ_INVALID; 636 break; 637 } |
569 | 638 |
570 inquiryData->AdditionalLength = 31; 571 inquiryData->CommandQueue = 1; 572 memcpy(&inquiryData->VendorId, "HPT ", 8); 573 memcpy(&inquiryData->ProductId, "DISK 0_0 ", 16); 574 575 if (vd->target_id / 10) { 576 inquiryData->ProductId[7] = (vd->target_id % 100) / 10 + '0'; 577 inquiryData->ProductId[8] = (vd->target_id % 100) % 10 + '0'; | 639 pCmd = ldm_alloc_cmds(vbus, vd->cmds_per_request); 640 if (!pCmd) { 641 HPT_ASSERT(0); 642 ccb->ccb_h.status = CAM_BUSY; 643 break; 644 } 645 646 passthru = &pCmd->uCmd.Passthrough; 647 if (cdb[0] == 0x85/*ATA_16*/) { 648 if (cdb[1] & 0x1) { 649 passthru->bFeaturesReg = 650 ((HPT_U16)cdb[3] << 8) 651 | cdb[4]; 652 passthru->bSectorCountReg = 653 ((HPT_U16)cdb[5] << 8) | 654 cdb[6]; 655 passthru->bLbaLowReg = 656 ((HPT_U16)cdb[7] << 8) | 657 cdb[8]; 658 passthru->bLbaMidReg = 659 ((HPT_U16)cdb[9] << 8) | 660 cdb[10]; 661 passthru->bLbaHighReg = 662 ((HPT_U16)cdb[11] << 8) | 663 cdb[12]; 664 } else { 665 passthru->bFeaturesReg = cdb[4]; 666 passthru->bSectorCountReg = cdb[6]; 667 passthru->bLbaLowReg = cdb[8]; 668 passthru->bLbaMidReg = cdb[10]; 669 passthru->bLbaHighReg = cdb[12]; |
578 } | 670 } |
579 else 580 inquiryData->ProductId[7] = (vd->target_id % 100) % 10 + '0'; 581 582 memcpy(&inquiryData->ProductRevisionLevel, "4.00", 4); 583 584 ccb->ccb_h.status = CAM_REQ_CMP; | 671 passthru->bDriveHeadReg = cdb[13]; 672 passthru->bCommandReg = cdb[14]; 673 674 } else { /*ATA_12*/ 675 676 passthru->bFeaturesReg = cdb[3]; 677 passthru->bSectorCountReg = cdb[4]; 678 passthru->bLbaLowReg = cdb[5]; 679 passthru->bLbaMidReg = cdb[6]; 680 passthru->bLbaHighReg = cdb[7]; 681 passthru->bDriveHeadReg = cdb[8]; 682 passthru->bCommandReg = cdb[9]; |
585 } | 683 } |
684 685 if (cdb[1] & 0xe0) { 686 687 688 if (!(passthru->bCommandReg == ATA_CMD_READ_MULTI || 689 passthru->bCommandReg == ATA_CMD_READ_MULTI_EXT || 690 passthru->bCommandReg == ATA_CMD_WRITE_MULTI || 691 passthru->bCommandReg == ATA_CMD_WRITE_MULTI_EXT || 692 passthru->bCommandReg == ATA_CMD_WRITE_MULTI_FUA_EXT) 693 ) { 694 goto error; 695 } 696 } 697 698 699 if (passthru->bFeaturesReg == ATA_SET_FEATURES_XFER && 700 passthru->bCommandReg == ATA_CMD_SET_FEATURES) { 701 goto error; 702 } 703 704 705 passthru->nSectors = ccb->csio.dxfer_len/ATA_SECTOR_SIZE; 706 switch (prot) { 707 default: /*None data*/ 708 break; 709 case 4: /*PIO data in, T_DIR=1 match check*/ 710 if ((cdb[2] & 3) && 711 (cdb[2] & 0x8) == 0) 712 { 713 OsPrint(("PIO data in, T_DIR=1 match check")); 714 goto error; 715 } 716 pCmd->flags.data_in = 1; 717 break; 718 case 5: /*PIO data out, T_DIR=0 match check*/ 719 if ((cdb[2] & 3) && 720 (cdb[2] & 0x8)) 721 { 722 OsPrint(("PIO data out, T_DIR=0 match check")); 723 goto error; 724 } 725 726 pCmd->flags.data_out = 1; 727 break; 728 } 729 pCmd->type = CMD_TYPE_PASSTHROUGH; 730 pCmd->priv = ext = cmdext_get(vbus_ext); 731 HPT_ASSERT(ext); 732 ext->ccb = ccb; 733 pCmd->target = vd; 734 pCmd->done = os_cmddone; 735 pCmd->buildsgl = os_buildsgl; 736 pCmd->psg = ext->psg; 737 738 if(!ccb->csio.dxfer_len) 739 { 740 ldm_queue_cmd(pCmd); 741 return; 742 } 743 pCmd->flags.physical_sg = 1; 744 error = bus_dmamap_load_ccb(vbus_ext->io_dmat, 745 ext->dma_map, ccb, 746 hpt_io_dmamap_callback, pCmd, 747 BUS_DMA_WAITOK 748 ); 749 KdPrint(("bus_dmamap_load return %d", error)); 750 if (error && error!=EINPROGRESS) { 751 os_printk("bus_dmamap_load error %d", error); 752 cmdext_put(ext); 753 ldm_free_cmds(pCmd); 754 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 755 xpt_done(ccb); 756 } 757 return; 758error: 759 ldm_free_cmds(pCmd); 760 ccb->ccb_h.status = CAM_PATH_INVALID; |
|
586 break; | 761 break; |
762 } |
|
587 | 763 |
764 case INQUIRY: 765 { 766 PINQUIRYDATA inquiryData; 767 HIM_DEVICE_CONFIG devconf; 768 HPT_U8 *rbuf; 769 770 memset(ccb->csio.data_ptr, 0, ccb->csio.dxfer_len); 771 inquiryData = (PINQUIRYDATA)ccb->csio.data_ptr; 772 773 if (cdb[1] & 1) { 774 rbuf = (HPT_U8 *)inquiryData; 775 switch(cdb[2]) { 776 case 0: 777 rbuf[0] = 0; 778 rbuf[1] = 0; 779 rbuf[2] = 0; 780 rbuf[3] = 3; 781 rbuf[4] = 0; 782 rbuf[5] = 0x80; 783 rbuf[6] = 0x83; 784 ccb->ccb_h.status = CAM_REQ_CMP; 785 break; 786 case 0x80: { 787 rbuf[0] = 0; 788 rbuf[1] = 0x80; 789 rbuf[2] = 0; 790 if (vd->type == VD_RAW) { 791 rbuf[3] = 20; 792 vd->u.raw.him->get_device_config(vd->u.raw.phy_dev,&devconf); 793 memcpy(&rbuf[4], devconf.pIdentifyData->SerialNumber, 20); 794 ldm_ide_fixstring(&rbuf[4], 20); 795 } else { 796 rbuf[3] = 1; 797 rbuf[4] = 0x20; 798 } 799 ccb->ccb_h.status = CAM_REQ_CMP; 800 break; 801 } 802 case 0x83: 803 rbuf[0] = 0; 804 rbuf[1] = 0x83; 805 rbuf[2] = 0; 806 rbuf[3] = 12; 807 rbuf[4] = 1; 808 rbuf[5] = 2; 809 rbuf[6] = 0; 810 rbuf[7] = 8; 811 rbuf[8] = 0; 812 rbuf[9] = 0x19; 813 rbuf[10] = 0x3C; 814 rbuf[11] = 0; 815 rbuf[12] = 0; 816 rbuf[13] = 0; 817 rbuf[14] = 0; 818 rbuf[15] = 0; 819 ccb->ccb_h.status = CAM_REQ_CMP; 820 break; 821 default: 822 ccb->ccb_h.status = CAM_REQ_INVALID; 823 break; 824 } 825 826 break; 827 } 828 else if (cdb[2]) { 829 ccb->ccb_h.status = CAM_REQ_INVALID; 830 break; 831 } 832 833 inquiryData->DeviceType = 0; /*DIRECT_ACCESS_DEVICE*/ 834 inquiryData->Versions = 5; /*SPC-3*/ 835 inquiryData->ResponseDataFormat = 2; 836 inquiryData->AdditionalLength = 0x5b; 837 inquiryData->CommandQueue = 1; 838 839 if (ccb->csio.dxfer_len > 63) { 840 rbuf = (HPT_U8 *)inquiryData; 841 rbuf[58] = 0x60; 842 rbuf[59] = 0x3; 843 844 rbuf[64] = 0x3; 845 rbuf[66] = 0x3; 846 rbuf[67] = 0x20; 847 848 } 849 850 if (vd->type == VD_RAW) { 851 vd->u.raw.him->get_device_config(vd->u.raw.phy_dev,&devconf); 852 853 if ((devconf.pIdentifyData->GeneralConfiguration & 0x80)) 854 inquiryData->RemovableMedia = 1; 855 856 857 memcpy(&inquiryData->VendorId, "ATA ", 8); 858 memcpy(&inquiryData->ProductId, devconf.pIdentifyData->ModelNumber, 16); 859 ldm_ide_fixstring((HPT_U8 *)&inquiryData->ProductId, 16); 860 memcpy(&inquiryData->ProductRevisionLevel, devconf.pIdentifyData->FirmwareRevision, 4); 861 ldm_ide_fixstring((HPT_U8 *)&inquiryData->ProductRevisionLevel, 4); 862 if (inquiryData->ProductRevisionLevel[0] == 0 || inquiryData->ProductRevisionLevel[0] == ' ') 863 memcpy(&inquiryData->ProductRevisionLevel, "n/a ", 4); 864 } else { 865 memcpy(&inquiryData->VendorId, "HPT ", 8); 866 snprintf((char *)&inquiryData->ProductId, 16, "DISK_%d_%d ", 867 os_get_vbus_seq(vbus_ext), vd->target_id); 868 inquiryData->ProductId[15] = ' '; 869 memcpy(&inquiryData->ProductRevisionLevel, "4.00", 4); 870 } 871 872 ccb->ccb_h.status = CAM_REQ_CMP; 873 break; 874 } |
|
588 case READ_CAPACITY: 589 { 590 HPT_U8 *rbuf = ccb->csio.data_ptr; 591 HPT_U32 cap; | 875 case READ_CAPACITY: 876 { 877 HPT_U8 *rbuf = ccb->csio.data_ptr; 878 HPT_U32 cap; |
879 HPT_U8 sector_size_shift = 0; 880 HPT_U64 new_cap; 881 HPT_U32 sector_size = 0; 882 883 if (mIsArray(vd->type)) 884 sector_size_shift = vd->u.array.sector_size_shift; 885 else{ 886 if(vd->type == VD_RAW){ 887 sector_size = vd->u.raw.logical_sector_size; 888 } |
|
592 | 889 |
593 if (vd->capacity>0xfffffffful) 594 cap = 0xfffffffful; | 890 switch (sector_size) { 891 case 0x1000: 892 KdPrint(("set 4k setctor size in READ_CAPACITY")); 893 sector_size_shift = 3; 894 break; 895 default: 896 break; 897 } 898 } 899 new_cap = vd->capacity >> sector_size_shift; 900 901 if (new_cap > 0xfffffffful) 902 cap = 0xffffffff; |
595 else | 903 else |
596 cap = vd->capacity - 1; 597 | 904 cap = new_cap - 1; 905 |
598 rbuf[0] = (HPT_U8)(cap>>24); 599 rbuf[1] = (HPT_U8)(cap>>16); 600 rbuf[2] = (HPT_U8)(cap>>8); 601 rbuf[3] = (HPT_U8)cap; 602 rbuf[4] = 0; 603 rbuf[5] = 0; | 906 rbuf[0] = (HPT_U8)(cap>>24); 907 rbuf[1] = (HPT_U8)(cap>>16); 908 rbuf[2] = (HPT_U8)(cap>>8); 909 rbuf[3] = (HPT_U8)cap; 910 rbuf[4] = 0; 911 rbuf[5] = 0; |
604 rbuf[6] = 2; | 912 rbuf[6] = 2 << sector_size_shift; |
605 rbuf[7] = 0; 606 607 ccb->ccb_h.status = CAM_REQ_CMP; 608 break; 609 } 610 611 case SERVICE_ACTION_IN: 612 { 613 HPT_U8 *rbuf = ccb->csio.data_ptr; | 913 rbuf[7] = 0; 914 915 ccb->ccb_h.status = CAM_REQ_CMP; 916 break; 917 } 918 919 case SERVICE_ACTION_IN: 920 { 921 HPT_U8 *rbuf = ccb->csio.data_ptr; |
614 HPT_U64 cap = vd->capacity - 1; | 922 HPT_U64 cap = 0; 923 HPT_U8 sector_size_shift = 0; 924 HPT_U32 sector_size = 0; 925 926 if(mIsArray(vd->type)) 927 sector_size_shift = vd->u.array.sector_size_shift; 928 else{ 929 if(vd->type == VD_RAW){ 930 sector_size = vd->u.raw.logical_sector_size; 931 } |
615 | 932 |
933 switch (sector_size) { 934 case 0x1000: 935 KdPrint(("set 4k setctor size in SERVICE_ACTION_IN")); 936 sector_size_shift = 3; 937 break; 938 default: 939 break; 940 } 941 } 942 cap = (vd->capacity >> sector_size_shift) - 1; 943 |
|
616 rbuf[0] = (HPT_U8)(cap>>56); 617 rbuf[1] = (HPT_U8)(cap>>48); 618 rbuf[2] = (HPT_U8)(cap>>40); 619 rbuf[3] = (HPT_U8)(cap>>32); 620 rbuf[4] = (HPT_U8)(cap>>24); 621 rbuf[5] = (HPT_U8)(cap>>16); 622 rbuf[6] = (HPT_U8)(cap>>8); 623 rbuf[7] = (HPT_U8)cap; 624 rbuf[8] = 0; 625 rbuf[9] = 0; | 944 rbuf[0] = (HPT_U8)(cap>>56); 945 rbuf[1] = (HPT_U8)(cap>>48); 946 rbuf[2] = (HPT_U8)(cap>>40); 947 rbuf[3] = (HPT_U8)(cap>>32); 948 rbuf[4] = (HPT_U8)(cap>>24); 949 rbuf[5] = (HPT_U8)(cap>>16); 950 rbuf[6] = (HPT_U8)(cap>>8); 951 rbuf[7] = (HPT_U8)cap; 952 rbuf[8] = 0; 953 rbuf[9] = 0; |
626 rbuf[10] = 2; | 954 rbuf[10] = 2 << sector_size_shift; |
627 rbuf[11] = 0; 628 629 ccb->ccb_h.status = CAM_REQ_CMP; 630 break; 631 } 632 633 case READ_6: 634 case READ_10: 635 case READ_16: 636 case WRITE_6: 637 case WRITE_10: 638 case WRITE_16: 639 case 0x13: 640 case 0x2f: 641 case 0x8f: /* VERIFY_16 */ 642 { 643 int error; | 955 rbuf[11] = 0; 956 957 ccb->ccb_h.status = CAM_REQ_CMP; 958 break; 959 } 960 961 case READ_6: 962 case READ_10: 963 case READ_16: 964 case WRITE_6: 965 case WRITE_10: 966 case WRITE_16: 967 case 0x13: 968 case 0x2f: 969 case 0x8f: /* VERIFY_16 */ 970 { 971 int error; |
972 HPT_U8 sector_size_shift = 0; 973 HPT_U32 sector_size = 0; |
|
644 pCmd = ldm_alloc_cmds(vbus, vd->cmds_per_request); 645 if(!pCmd){ 646 KdPrint(("Failed to allocate command!")); 647 ccb->ccb_h.status = CAM_BUSY; 648 break; 649 } 650 651 switch (cdb[0]) { --- 21 unchanged lines hidden (view full) --- 673 break; 674 } 675 676 default: 677 pCmd->uCmd.Ide.Lba = (HPT_U32)cdb[5] | ((HPT_U32)cdb[4] << 8) | ((HPT_U32)cdb[3] << 16) | ((HPT_U32)cdb[2] << 24); 678 pCmd->uCmd.Ide.nSectors = (HPT_U16) cdb[8] | ((HPT_U16)cdb[7]<<8); 679 break; 680 } | 974 pCmd = ldm_alloc_cmds(vbus, vd->cmds_per_request); 975 if(!pCmd){ 976 KdPrint(("Failed to allocate command!")); 977 ccb->ccb_h.status = CAM_BUSY; 978 break; 979 } 980 981 switch (cdb[0]) { --- 21 unchanged lines hidden (view full) --- 1003 break; 1004 } 1005 1006 default: 1007 pCmd->uCmd.Ide.Lba = (HPT_U32)cdb[5] | ((HPT_U32)cdb[4] << 8) | ((HPT_U32)cdb[3] << 16) | ((HPT_U32)cdb[2] << 24); 1008 pCmd->uCmd.Ide.nSectors = (HPT_U16) cdb[8] | ((HPT_U16)cdb[7]<<8); 1009 break; 1010 } |
1011 1012 if(mIsArray(vd->type)) { 1013 sector_size_shift = vd->u.array.sector_size_shift; 1014 } 1015 else{ 1016 if(vd->type == VD_RAW){ 1017 sector_size = vd->u.raw.logical_sector_size; 1018 } 1019 1020 switch (sector_size) { 1021 case 0x1000: 1022 KdPrint(("<8>resize sector size from 4k to 512")); 1023 sector_size_shift = 3; 1024 break; 1025 default: 1026 break; 1027 } 1028 } 1029 pCmd->uCmd.Ide.Lba <<= sector_size_shift; 1030 pCmd->uCmd.Ide.nSectors <<= sector_size_shift; 1031 |
|
681 682 switch (cdb[0]) { 683 case READ_6: 684 case READ_10: 685 case READ_16: 686 pCmd->flags.data_in = 1; 687 break; 688 case WRITE_6: --- 22 unchanged lines hidden (view full) --- 711 ldm_free_cmds(pCmd); 712 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 713 xpt_done(ccb); 714 } 715 return; 716 } 717 718 default: | 1032 1033 switch (cdb[0]) { 1034 case READ_6: 1035 case READ_10: 1036 case READ_16: 1037 pCmd->flags.data_in = 1; 1038 break; 1039 case WRITE_6: --- 22 unchanged lines hidden (view full) --- 1062 ldm_free_cmds(pCmd); 1063 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 1064 xpt_done(ccb); 1065 } 1066 return; 1067 } 1068 1069 default: |
719 ccb->ccb_h.status = CAM_REQ_INVALID; | 1070 ccb->ccb_h.status = CAM_SEL_TIMEOUT; |
720 break; 721 } 722 723 xpt_done(ccb); 724 return; 725} 726 727static void hpt_action(struct cam_sim *sim, union ccb *ccb) --- 586 unchanged lines hidden --- | 1071 break; 1072 } 1073 1074 xpt_done(ccb); 1075 return; 1076} 1077 1078static void hpt_action(struct cam_sim *sim, union ccb *ccb) --- 586 unchanged lines hidden --- |