Changes in / [f2f4c00:1f1fa64] in mainline
- Location:
- uspace
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nic/nic.c
rf2f4c00 r1f1fa64 226 226 } 227 227 228 printf("% zu: %s\n", i, svc_name);228 printf("%d: %s\n", i, svc_name); 229 229 printf("\tMAC address: %s\n", addr_str); 230 230 printf("\tVendor name: %s\n", -
uspace/drv/block/ata_bd/Makefile
rf2f4c00 r1f1fa64 28 28 29 29 USPACE_PREFIX = ../../.. 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBSCSI_PREFIX)/libscsi.a31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBSCSI_PREFIX)/include30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 32 BINARY = ata_bd 33 33 -
uspace/drv/block/ata_bd/ata_bd.c
rf2f4c00 r1f1fa64 54 54 #include <bd_srv.h> 55 55 #include <fibril_synch.h> 56 #include <scsi/sbc.h>57 56 #include <stdint.h> 58 57 #include <str.h> … … 104 103 static int ata_identify_pkt_dev(disk_t *disk, void *buf); 105 104 static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size, 106 void *obuf, size_t obuf_size, size_t *rcvd_size); 107 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size, 108 size_t *rcvd_size); 105 void *obuf, size_t obuf_size); 106 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size); 109 107 static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt, 110 108 void *obuf, size_t obuf_size); 111 static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,112 size_t *block_size);113 109 static int ata_pcmd_read_toc(disk_t *disk, uint8_t ses, 114 110 void *obuf, size_t obuf_size); … … 344 340 uint8_t model[40]; 345 341 ata_inquiry_data_t inq_data; 346 size_t isize;347 342 uint16_t w; 348 343 uint8_t c; 349 344 uint16_t bc; 350 uint64_t nblocks;351 size_t block_size;352 345 size_t pos, len; 353 346 int rc; … … 464 457 if (d->dev_type == ata_pkt_dev) { 465 458 /* Send inquiry. */ 466 rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data) , &isize);467 if (rc != EOK || isize < sizeof(inq_data)) {459 rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data)); 460 if (rc != EOK) { 468 461 ddf_msg(LVL_ERROR, "Device inquiry failed."); 469 462 d->present = false; … … 475 468 ddf_msg(LVL_WARN, "Peripheral device type is not CD-ROM."); 476 469 477 rc = ata_pcmd_read_capacity(d, &nblocks, &block_size); 478 if (rc != EOK) { 479 ddf_msg(LVL_ERROR, "Read capacity command failed."); 480 d->present = false; 481 return EIO; 482 } 483 484 d->blocks = nblocks; 485 d->block_size = block_size; 470 /* Assume 2k block size for now. */ 471 d->block_size = 2048; 486 472 } else { 487 473 /* Assume register Read always uses 512-byte blocks. */ … … 736 722 * @param obuf Buffer for storing data read from device 737 723 * @param obuf_size Size of obuf in bytes 738 * @param rcvd_size Place to store number of bytes read or @c NULL739 724 * 740 725 * @return EOK on success, EIO on error. 741 726 */ 742 727 static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size, 743 void *obuf, size_t obuf_size , size_t *rcvd_size)728 void *obuf, size_t obuf_size) 744 729 { 745 730 ata_ctrl_t *ctrl = disk->ctrl; … … 815 800 return EIO; 816 801 817 if (rcvd_size != NULL)818 *rcvd_size = data_size;819 802 return EOK; 820 803 } … … 828 811 * @return EOK on success, EIO on error. 829 812 */ 830 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size, 831 size_t *rcvd_size) 813 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size) 832 814 { 833 815 ata_pcmd_inquiry_t cp; … … 839 821 cp.alloc_len = min(obuf_size, 0xff); /* Allocation length */ 840 822 841 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size , rcvd_size);823 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size); 842 824 if (rc != EOK) 843 825 return rc; 844 845 return EOK;846 }847 848 /** Issue ATAPI read capacity(10) command.849 *850 * @param disk Disk851 * @param nblocks Place to store number of blocks852 * @param block_size Place to store block size853 *854 * @return EOK on success, EIO on error.855 */856 static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,857 size_t *block_size)858 {859 scsi_cdb_read_capacity_10_t cdb;860 scsi_read_capacity_10_data_t data;861 size_t rsize;862 int rc;863 864 memset(&cdb, 0, sizeof(cdb));865 cdb.op_code = SCSI_CMD_READ_CAPACITY_10;866 867 rc = ata_cmd_packet(disk, &cdb, sizeof(cdb), &data, sizeof(data), &rsize);868 if (rc != EOK)869 return rc;870 871 if (rsize != sizeof(data))872 return EIO;873 874 *nblocks = uint32_t_be2host(data.last_lba) + 1;875 *block_size = uint32_t_be2host(data.block_size);876 826 877 827 return EOK; … … 906 856 cp.nblocks = host2uint32_t_be(cnt); 907 857 908 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size , NULL);858 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size); 909 859 if (rc != EOK) 910 860 return rc; … … 945 895 cp.oldformat = 0x40; /* 0x01 = multi-session mode (shifted to MSB) */ 946 896 947 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size , NULL);897 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size); 948 898 if (rc != EOK) 949 899 return rc; -
uspace/drv/bus/isa/isa.dev
rf2f4c00 r1f1fa64 14 14 irq 12 15 15 io_range 060 5 16 17 ne2k:18 match 100 isa/ne2k19 irq 520 io_range 300 2021 22 sb16:23 match 100 isa/sb1624 io_range 220 2025 io_range 330 226 irq 527 dma 128 dma 529 16 30 17 cmos-rtc: -
uspace/lib/block/block.c
rf2f4c00 r1f1fa64 55 55 #include "block.h" 56 56 57 #define MAX_WRITE_RETRIES 1058 59 57 /** Lock protecting the device connection list */ 60 58 static FIBRIL_MUTEX_INITIALIZE(dcl_lock); … … 81 79 void *bb_buf; 82 80 aoff64_t bb_addr; 83 aoff64_t pblocks; /**< Number of physical blocks */84 81 size_t pblock_size; /**< Physical block size. */ 85 82 cache_t *cache; … … 106 103 107 104 static int devcon_add(service_id_t service_id, async_sess_t *sess, 108 size_t bsize, aoff64_t dev_size,bd_t *bd)105 size_t bsize, bd_t *bd) 109 106 { 110 107 devcon_t *devcon; … … 121 118 devcon->bb_addr = 0; 122 119 devcon->pblock_size = bsize; 123 devcon->pblocks = dev_size;124 120 devcon->cache = NULL; 125 121 … … 168 164 return rc; 169 165 } 170 171 aoff64_t dev_size; 172 rc = bd_get_num_blocks(bd, &dev_size); 173 if (rc != EOK) { 174 bd_close(bd); 175 async_hangup(sess); 176 return rc; 177 } 178 179 rc = devcon_add(service_id, sess, bsize, dev_size, bd); 166 167 rc = devcon_add(service_id, sess, bsize, bd); 180 168 if (rc != EOK) { 181 169 bd_close(bd); … … 361 349 fibril_mutex_initialize(&b->lock); 362 350 b->refcnt = 1; 363 b->write_failures = 0;364 351 b->dirty = false; 365 352 b->toxic = false; … … 386 373 block_t *b; 387 374 link_t *link; 388 aoff64_t p_ba; 375 389 376 int rc; 390 377 … … 395 382 396 383 cache = devcon->cache; 397 398 /* Check whether the logical block (or part of it) is beyond399 * the end of the device or not.400 */401 p_ba = ba_ltop(devcon, ba);402 p_ba += cache->blocks_cluster;403 if (p_ba >= devcon->pblocks) {404 /* This request cannot be satisfied */405 return EIO;406 }407 408 384 409 385 retry: … … 482 458 * another block next time. 483 459 */ 484 if (b->write_failures < MAX_WRITE_RETRIES) { 485 b->write_failures++; 486 fibril_mutex_unlock(&b->lock); 487 goto retry; 488 } else { 489 printf("Too many errors writing block %" 490 PRIuOFF64 "from device handle %" PRIun "\n" 491 "SEVERE DATA LOSS POSSIBLE\n", 492 b->lba, devcon->service_id); 493 } 494 } else 495 b->write_failures = 0; 496 460 fibril_mutex_unlock(&b->lock); 461 goto retry; 462 } 497 463 b->dirty = false; 498 464 if (!fibril_mutex_trylock(&cache->lock)) { … … 611 577 rc = write_blocks(devcon, block->pba, cache->blocks_cluster, 612 578 block->data, block->size); 613 if (rc == EOK)614 block->write_failures = 0;615 579 block->dirty = false; 616 580 } … … 638 602 */ 639 603 block->refcnt++; 640 641 if (block->write_failures < MAX_WRITE_RETRIES) { 642 block->write_failures++; 643 fibril_mutex_unlock(&block->lock); 644 fibril_mutex_unlock(&cache->lock); 645 goto retry; 646 } else { 647 printf("Too many errors writing block %" 648 PRIuOFF64 "from device handle %" PRIun "\n" 649 "SEVERE DATA LOSS POSSIBLE\n", 650 block->lba, devcon->service_id); 651 } 604 fibril_mutex_unlock(&block->lock); 605 fibril_mutex_unlock(&cache->lock); 606 goto retry; 652 607 } 653 608 /* … … 815 770 devcon_t *devcon = devcon_search(service_id); 816 771 assert(devcon); 817 772 818 773 return bd_get_num_blocks(devcon->bd, nblocks); 819 774 } -
uspace/lib/block/block.h
rf2f4c00 r1f1fa64 81 81 /** Size of the block. */ 82 82 size_t size; 83 /** Number of write failures. */84 int write_failures;85 83 /** Link for placing the block into the free block list. */ 86 84 link_t free_link; -
uspace/lib/c/generic/adt/hash_table.c
rf2f4c00 r1f1fa64 370 370 */ 371 371 if (!f(cur_link, arg)) 372 goto out;373 } 374 } 375 out: 372 return; 373 } 374 } 375 376 376 h->apply_ongoing = false; 377 377 -
uspace/lib/mbr/libmbr.c
rf2f4c00 r1f1fa64 90 90 mbr_t *mbr_alloc_mbr(void) 91 91 { 92 return (mbr_t *)alloc_br();92 return malloc(sizeof(mbr_t)); 93 93 } 94 94 -
uspace/lib/mbr/libmbr.h
rf2f4c00 r1f1fa64 37 37 #define LIBMBR_LIBMBR_H_ 38 38 39 #include <adt/list.h>40 #include <loc.h>41 39 #include <sys/types.h> 42 40 #include "mbr.h" -
uspace/srv/fs/cdfs/cdfs_ops.c
rf2f4c00 r1f1fa64 249 249 cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link); 250 250 251 if (node->type == CDFS_DIRECTORY) {252 link_t *link;253 while ((link = list_first(&node->cs_list)) != NULL) {254 cdfs_dentry_t *dentry = list_get_instance(link, cdfs_dentry_t, link);255 list_remove(&dentry->link);256 free(dentry);257 }251 assert(node->type == CDFS_DIRECTORY); 252 253 link_t *link; 254 while ((link = list_first(&node->cs_list)) != NULL) { 255 cdfs_dentry_t *dentry = list_get_instance(link, cdfs_dentry_t, link); 256 list_remove(&dentry->link); 257 free(dentry); 258 258 } 259 259 -
uspace/srv/net/ethip/ethip_nic.c
rf2f4c00 r1f1fa64 309 309 break; 310 310 default: 311 log_msg(LOG_DEFAULT, LVL_DEBUG, "unknown IPC method: %d", (int)IPC_GET_IMETHOD(call));311 log_msg(LOG_DEFAULT, LVL_DEBUG, "unknown IPC method: %d", IPC_GET_IMETHOD(call)); 312 312 async_answer_0(callid, ENOTSUP); 313 313 }
Note:
See TracChangeset
for help on using the changeset viewer.