Changes in / [f480d7e:5b68e0c] in mainline


Ignore:
Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/block/libblock.c

    rf480d7e r5b68e0c  
    9393static int get_block_size(async_sess_t *, size_t *);
    9494static int get_num_blocks(async_sess_t *, aoff64_t *);
    95 static int read_toc(async_sess_t *, uint8_t);
    9695static aoff64_t ba_ltop(devcon_t *, aoff64_t);
    9796
     
    892891}
    893892
    894 /** Get TOC from device.
    895  *
    896  * @param service_id Service ID of the block device.
    897  * @param session    Starting session.
    898  * @param data       Buffer to read TOC into.
    899  *
    900  * @return EOK on success.
    901  * @return Error code on failure.
    902  *
    903  */
    904 int block_get_toc(service_id_t service_id, uint8_t session, void *data)
    905 {
    906         devcon_t *devcon = devcon_search(service_id);
    907         assert(devcon);
    908        
    909         fibril_mutex_lock(&devcon->comm_area_lock);
    910        
    911         int rc = read_toc(devcon->sess, session);
    912         if (rc == EOK)
    913                 memcpy(data, devcon->comm_area, devcon->pblock_size);
    914        
    915         fibril_mutex_unlock(&devcon->comm_area_lock);
    916        
    917         return rc;
    918 }
    919 
    920893/** Read blocks from block device.
    921894 *
     
    1008981}
    1009982
    1010 /** Get TOC from block device. */
    1011 static int read_toc(async_sess_t *sess, uint8_t session)
    1012 {
    1013         async_exch_t *exch = async_exchange_begin(sess);
    1014         int rc = async_req_1_0(exch, BD_READ_TOC, session);
    1015         async_exchange_end(exch);
    1016 
    1017         return rc;
    1018 }
    1019 
    1020983/** Convert logical block address to physical block address. */
    1021984static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba)
  • uspace/lib/block/libblock.h

    rf480d7e r5b68e0c  
    114114extern int block_get_bsize(service_id_t, size_t *);
    115115extern int block_get_nblocks(service_id_t, aoff64_t *);
    116 extern int block_get_toc(service_id_t, uint8_t, void *);
    117116extern int block_read_direct(service_id_t, aoff64_t, size_t, void *);
    118117extern int block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
  • uspace/lib/c/generic/str.c

    rf480d7e r5b68e0c  
    551551 *
    552552 * Common legacy text encoding in hardware is 7-bit ASCII fitted into
    553  * a fixed-width byte buffer (bit 7 always zero), right-padded with spaces
     553 * a fixed-with byte buffer (bit 7 always zero), right-padded with spaces
    554554 * (ASCII 0x20). Convert space-padded ascii to string representation.
    555555 *
  • uspace/lib/c/include/ipc/bd.h

    rf480d7e r5b68e0c  
    4242        BD_GET_NUM_BLOCKS,
    4343        BD_READ_BLOCKS,
    44         BD_WRITE_BLOCKS,
    45         BD_READ_TOC
     44        BD_WRITE_BLOCKS
    4645} bd_request_t;
    4746
  • uspace/srv/bd/ata_bd/ata_bd.c

    rf480d7e r5b68e0c  
    118118static int ata_pcmd_inquiry(int dev_idx, void *obuf, size_t obuf_size);
    119119static int ata_pcmd_read_12(int dev_idx, uint64_t ba, size_t cnt,
    120     void *obuf, size_t obuf_size);
    121 static int ata_pcmd_read_toc(int dev_idx, uint8_t ses,
    122120    void *obuf, size_t obuf_size);
    123121static void disk_print_summary(disk_t *d);
     
    355353                            UPPER32(disk[disk_id].blocks));
    356354                        continue;
    357                 case BD_READ_TOC:
    358                         cnt = IPC_GET_ARG1(call);
    359                         if (disk[disk_id].dev_type == ata_pkt_dev)
    360                                 retval = ata_pcmd_read_toc(disk_id, cnt, fs_va,
    361                                     disk[disk_id].block_size);
    362                         else
    363                                 retval = EINVAL;
    364                         break;
    365355                default:
    366356                        retval = EINVAL;
     
    820810}
    821811
    822 /** Issue ATAPI read TOC command.
    823  *
    824  * Read TOC in 'multi-session' format (first and last session number
    825  * with last session LBA).
    826  *
    827  * http://suif.stanford.edu/~csapuntz/specs/INF-8020.PDF page 171
    828  *
    829  * Output buffer must be large enough to hold the data, otherwise the
    830  * function will fail.
    831  *
    832  * @param dev_idx       Device index (0 or 1)
    833  * @param session       Starting session
    834  * @param obuf          Buffer for storing inquiry data read from device
    835  * @param obuf_size     Size of obuf in bytes
    836  *
    837  * @return EOK on success, EIO on error.
    838  */
    839 static int ata_pcmd_read_toc(int dev_idx, uint8_t session, void *obuf,
    840     size_t obuf_size)
    841 {
    842         ata_pcmd_read_toc_t cp;
    843         int rc;
    844 
    845         memset(&cp, 0, sizeof(cp));
    846 
    847         cp.opcode = PCMD_READ_TOC;
    848         cp.msf = 0;
    849         cp.format = 0x01; /* 0x01 = multi-session mode */
    850         cp.start = session;
    851         cp.size = host2uint16_t_be(obuf_size);
    852         cp.oldformat = 0x40; /* 0x01 = multi-session mode (shifted to MSB) */
    853        
    854         rc = ata_cmd_packet(0, &cp, sizeof(cp), obuf, obuf_size);
    855         if (rc != EOK)
    856                 return rc;
    857        
    858         return EOK;
    859 }
    860 
    861812/** Read a physical from the device.
    862813 *
  • uspace/srv/bd/ata_bd/ata_hw.h

    rf480d7e r5b68e0c  
    244244enum ata_pkt_command {
    245245        PCMD_INQUIRY            = 0x12,
    246         PCMD_READ_12            = 0xa8,
    247         PCMD_READ_TOC           = 0x43
     246        PCMD_READ_12            = 0xa8
    248247};
    249248
     
    270269        uint8_t _res2;
    271270} __attribute__ ((packed)) ata_pcmd_read_12_t;
    272 
    273 /** ATAPI Read TOC command */
    274 typedef struct {
    275         uint8_t opcode;         /**< Operation code (PCMD_READ_TOC) */
    276         uint8_t msf;            /**< 0x2 = MSF bit set */
    277         uint8_t format;         /**< low 3 bits */
    278         uint8_t _res0;
    279         uint8_t _res1;
    280         uint8_t _res2;
    281         uint8_t start;          /**< starting track/session number */
    282         uint16_t size;          /**< Allocation length */
    283         uint8_t oldformat;         /**< high 2 bits */
    284         uint8_t _res3;
    285         uint8_t _res4;
    286 } __attribute__ ((packed)) ata_pcmd_read_toc_t;
    287271
    288272/** Data returned from Inquiry command (mandatory part) */
Note: See TracChangeset for help on using the changeset viewer.