Changeset 35b8bfe in mainline for uspace/drv/block/ata_bd/ata_bd.c
- Timestamp:
- 2014-08-16T13:05:28Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3abf70c7
- Parents:
- 8820544
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/ata_bd/ata_bd.c
r8820544 r35b8bfe 54 54 #include <bd_srv.h> 55 55 #include <fibril_synch.h> 56 #include <scsi/mmc.h> 56 57 #include <scsi/sbc.h> 58 #include <scsi/spc.h> 57 59 #include <stdint.h> 58 60 #include <str.h> … … 343 345 identify_data_t idata; 344 346 uint8_t model[40]; 345 ata_inquiry_data_t inq_data;347 scsi_std_inquiry_data_t inq_data; 346 348 size_t isize; 347 349 uint16_t w; … … 472 474 473 475 /* Check device type. */ 474 if (INQUIRY_PDEV_TYPE(inq_data.p dev_type) != PDEV_TYPE_CDROM)476 if (INQUIRY_PDEV_TYPE(inq_data.pqual_devtype) != SCSI_DEV_CD_DVD) 475 477 ddf_msg(LVL_WARN, "Peripheral device type is not CD-ROM."); 476 478 … … 831 833 size_t *rcvd_size) 832 834 { 833 ata_pcmd_inquiry_t cp; 835 uint8_t cpb[12]; 836 scsi_cdb_inquiry_t *cp = (scsi_cdb_inquiry_t *)cpb; 834 837 int rc; 835 838 836 memset(&cp, 0, sizeof(cp)); 837 838 cp.opcode = PCMD_INQUIRY; 839 cp.alloc_len = min(obuf_size, 0xff); /* Allocation length */ 840 841 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size, rcvd_size); 839 memset(cpb, 0, sizeof(cpb)); 840 841 /* 842 * For SFF 8020 compliance the inquiry must be padded to 12 bytes 843 * and allocation length must fit in one byte. 844 */ 845 cp->op_code = SCSI_CMD_INQUIRY; 846 847 /* Allocation length */ 848 cp->alloc_len = host2uint16_t_be(min(obuf_size, 0xff)); 849 850 rc = ata_cmd_packet(disk, cpb, sizeof(cpb), obuf, obuf_size, rcvd_size); 842 851 if (rc != EOK) 843 852 return rc; … … 894 903 void *obuf, size_t obuf_size) 895 904 { 896 ata_pcmd_read_12_t cp;905 scsi_cdb_read_12_t cp; 897 906 int rc; 898 907 … … 902 911 memset(&cp, 0, sizeof(cp)); 903 912 904 cp.op code = PCMD_READ_12;905 cp. ba = host2uint32_t_be(ba);906 cp. nblocks= host2uint32_t_be(cnt);913 cp.op_code = SCSI_CMD_READ_12; 914 cp.lba = host2uint32_t_be(ba); 915 cp.xfer_len = host2uint32_t_be(cnt); 907 916 908 917 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size, NULL); … … 933 942 size_t obuf_size) 934 943 { 935 ata_pcmd_read_toc_t cp; 944 uint8_t cpb[12]; 945 scsi_cdb_read_toc_t *cp = (scsi_cdb_read_toc_t *)cpb; 936 946 int rc; 937 947 938 memset( &cp, 0, sizeof(cp));939 940 cp .opcode = PCMD_READ_TOC;941 cp .msf = 0;942 cp .format = 0x01; /* 0x01 = multi-session mode */943 cp .start= session;944 cp .size= host2uint16_t_be(obuf_size);945 cp .oldformat= 0x40; /* 0x01 = multi-session mode (shifted to MSB) */946 947 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size, NULL);948 memset(cpb, 0, sizeof(cpb)); 949 950 cp->op_code = SCSI_CMD_READ_TOC; 951 cp->msf = 0; 952 cp->format = 0x01; /* 0x01 = multi-session mode */ 953 cp->track_sess_no = session; 954 cp->alloc_len = host2uint16_t_be(obuf_size); 955 cp->control = 0x40; /* 0x01 = multi-session mode (shifted to MSB) */ 956 957 rc = ata_cmd_packet(disk, cpb, sizeof(cpb), obuf, obuf_size, NULL); 948 958 if (rc != EOK) 949 959 return rc; 950 960 951 961 return EOK; 952 962 }
Note:
See TracChangeset
for help on using the changeset viewer.