Changeset 5882487 in mainline for uspace/srv
- Timestamp:
- 2012-08-16T09:43:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c8cbd39
- Parents:
- b52dd1de (diff), c8444d8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/srv
- Files:
-
- 4 added
- 13 edited
-
bd/ata_bd/ata_bd.c (modified) (46 diffs)
-
bd/ata_bd/ata_bd.h (modified) (1 diff)
-
bd/file_bd/file_bd.c (modified) (4 diffs)
-
bd/gxe_bd/gxe_bd.c (modified) (5 diffs)
-
bd/part/guid_part/guid_part.c (modified) (5 diffs)
-
bd/part/mbr_part/mbr_part.c (modified) (5 diffs)
-
bd/rd/rd.c (modified) (3 diffs)
-
bd/sata_bd/sata_bd.c (modified) (4 diffs)
-
bd/sata_bd/sata_bd.h (modified) (1 diff)
-
hid/console/console.c (modified) (2 diffs)
-
hid/input/generic/input.c (modified) (1 diff)
-
hid/input/include/mouse.h (modified) (1 diff)
-
hid/input/proto/mousedev.c (modified) (1 diff)
-
hid/isdv4_tablet/Makefile (added)
-
hid/isdv4_tablet/isdv4.c (added)
-
hid/isdv4_tablet/isdv4.h (added)
-
hid/isdv4_tablet/main.c (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
rb52dd1de r5882487 104 104 static void ata_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *); 105 105 106 static int ata_bd_open(bd_srv _t *);106 static int ata_bd_open(bd_srvs_t *, bd_srv_t *); 107 107 static int ata_bd_close(bd_srv_t *); 108 108 static int ata_bd_read_blocks(bd_srv_t *, uint64_t ba, size_t cnt, void *buf, … … 114 114 static int ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *); 115 115 116 static int ata_rcmd_read( int disk_id, uint64_t ba, size_t cnt,116 static int ata_rcmd_read(disk_t *disk, uint64_t ba, size_t cnt, 117 117 void *buf); 118 static int ata_rcmd_write( int disk_id, uint64_t ba, size_t cnt,118 static int ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt, 119 119 const void *buf); 120 120 static int disk_init(disk_t *d, int disk_id); 121 static int drive_identify( int drive_id, void *buf);122 static int identify_pkt_dev( int dev_idx, void *buf);123 static int ata_cmd_packet( int dev_idx, const void *cpkt, size_t cpkt_size,121 static int drive_identify(disk_t *disk, void *buf); 122 static int identify_pkt_dev(disk_t *disk, void *buf); 123 static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size, 124 124 void *obuf, size_t obuf_size); 125 static int ata_pcmd_inquiry( int dev_idx, void *obuf, size_t obuf_size);126 static int ata_pcmd_read_12( int dev_idx, uint64_t ba, size_t cnt,125 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size); 126 static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt, 127 127 void *obuf, size_t obuf_size); 128 static int ata_pcmd_read_toc( int dev_idx, uint8_t ses,128 static int ata_pcmd_read_toc(disk_t *disk, uint8_t ses, 129 129 void *obuf, size_t obuf_size); 130 130 static void disk_print_summary(disk_t *d); … … 146 146 static disk_t *bd_srv_disk(bd_srv_t *bd) 147 147 { 148 return (disk_t *)bd->arg; 148 return (disk_t *)bd->srvs->sarg; 149 } 150 151 static int disk_dev_idx(disk_t *disk) 152 { 153 return (disk->disk_id & 1); 149 154 } 150 155 … … 296 301 { 297 302 service_id_t dsid; 298 int disk_id, i; 303 int i; 304 disk_t *disk; 299 305 300 306 /* Get the device service ID. */ … … 302 308 303 309 /* Determine which disk device is the client connecting to. */ 304 disk _id = -1;310 disk = NULL; 305 311 for (i = 0; i < MAX_DISKS; i++) 306 312 if (ata_disk[i].service_id == dsid) 307 disk _id = i;308 309 if (disk _id < 0 || ata_disk[disk_id].present == false) {313 disk = &ata_disk[i]; 314 315 if (disk == NULL || disk->present == false) { 310 316 async_answer_0(iid, EINVAL); 311 317 return; 312 318 } 313 319 314 bd_conn(iid, icall, & ata_disk[disk_id].bd);320 bd_conn(iid, icall, &disk->bds); 315 321 } 316 322 … … 336 342 fibril_mutex_initialize(&d->lock); 337 343 338 bd_srv _init(&d->bd);339 d->bd .ops = &ata_bd_ops;340 d->bd .arg = d;344 bd_srvs_init(&d->bds); 345 d->bds.ops = &ata_bd_ops; 346 d->bds.sarg = d; 341 347 342 348 /* Try identify command. */ 343 rc = drive_identify(d isk_id, &idata);349 rc = drive_identify(d, &idata); 344 350 if (rc == EOK) { 345 351 /* Success. It's a register (non-packet) device. */ … … 361 367 362 368 if (bc == PDEV_SIGNATURE_BC) { 363 rc = identify_pkt_dev(d isk_id, &idata);369 rc = identify_pkt_dev(d, &idata); 364 370 if (rc == EOK) { 365 371 /* We have a packet device. */ … … 445 451 if (d->dev_type == ata_pkt_dev) { 446 452 /* Send inquiry. */ 447 rc = ata_pcmd_inquiry( 0, &inq_data, sizeof(inq_data));453 rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data)); 448 454 if (rc != EOK) { 449 455 printf("Device inquiry failed.\n"); … … 467 473 } 468 474 469 static int ata_bd_open(bd_srv _t *bd)475 static int ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 470 476 { 471 477 return EOK; … … 488 494 489 495 while (cnt > 0) { 490 if (disk->dev_type == ata_reg_dev) 491 rc = ata_rcmd_read(disk ->disk_id, ba, 1, buf);492 else493 rc = ata_pcmd_read_12(disk ->disk_id, ba, 1, buf,496 if (disk->dev_type == ata_reg_dev) { 497 rc = ata_rcmd_read(disk, ba, 1, buf); 498 } else { 499 rc = ata_pcmd_read_12(disk, ba, 1, buf, 494 500 disk->block_size); 501 } 495 502 496 503 if (rc != EOK) … … 510 517 disk_t *disk = bd_srv_disk(bd); 511 518 512 return ata_pcmd_read_toc(disk ->disk_id, session, buf, size);519 return ata_pcmd_read_toc(disk, session, buf, size); 513 520 } 514 521 … … 527 534 528 535 while (cnt > 0) { 529 rc = ata_rcmd_write(disk ->disk_id, ba, 1, buf);536 rc = ata_rcmd_write(disk, ba, 1, buf); 530 537 if (rc != EOK) 531 538 return rc; … … 562 569 * whether an ATA device is present and if so, to determine its parameters. 563 570 * 564 * @param disk _id Device ID, 0 or 1.571 * @param disk Disk 565 572 * @param buf Pointer to a 512-byte buffer. 566 573 * … … 568 575 * not present). EIO if device responds with error. 569 576 */ 570 static int drive_identify( int disk_id, void *buf)577 static int drive_identify(disk_t *disk, void *buf) 571 578 { 572 579 uint16_t data; … … 575 582 size_t i; 576 583 577 drv_head = ((disk_ id!= 0) ? DHR_DRV : 0);584 drv_head = ((disk_dev_idx(disk) != 0) ? DHR_DRV : 0); 578 585 579 586 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) … … 621 628 * whether an ATAPI device is present and if so, to determine its parameters. 622 629 * 623 * @param d ev_idx Device index, 0 or 1.630 * @param disk Disk 624 631 * @param buf Pointer to a 512-byte buffer. 625 632 */ 626 static int identify_pkt_dev( int dev_idx, void *buf)633 static int identify_pkt_dev(disk_t *disk, void *buf) 627 634 { 628 635 uint16_t data; … … 631 638 size_t i; 632 639 633 drv_head = ((d ev_idx!= 0) ? DHR_DRV : 0);640 drv_head = ((disk_dev_idx(disk) != 0) ? DHR_DRV : 0); 634 641 635 642 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) … … 666 673 * Only data-in commands are supported (e.g. inquiry, read). 667 674 * 668 * @param d ev_idx Device index (0 or 1)675 * @param disk Disk 669 676 * @param obuf Buffer for storing data read from device 670 677 * @param obuf_size Size of obuf in bytes … … 672 679 * @return EOK on success, EIO on error. 673 680 */ 674 static int ata_cmd_packet( int dev_idx, const void *cpkt, size_t cpkt_size,681 static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size, 675 682 void *obuf, size_t obuf_size) 676 683 { … … 678 685 uint8_t status; 679 686 uint8_t drv_head; 680 disk_t *d;681 687 size_t data_size; 682 688 uint16_t val; 683 689 684 d = &ata_disk[dev_idx]; 685 fibril_mutex_lock(&d->lock); 690 fibril_mutex_lock(&disk->lock); 686 691 687 692 /* New value for Drive/Head register */ 688 693 drv_head = 689 ((d ev_idx!= 0) ? DHR_DRV : 0);694 ((disk_dev_idx(disk) != 0) ? DHR_DRV : 0); 690 695 691 696 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) { 692 fibril_mutex_unlock(&d ->lock);697 fibril_mutex_unlock(&disk->lock); 693 698 return EIO; 694 699 } … … 697 702 698 703 if (wait_status(0, ~(SR_BSY|SR_DRQ), NULL, TIMEOUT_BSY) != EOK) { 699 fibril_mutex_unlock(&d ->lock);704 fibril_mutex_unlock(&disk->lock); 700 705 return EIO; 701 706 } … … 708 713 709 714 if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 710 fibril_mutex_unlock(&d ->lock);715 fibril_mutex_unlock(&disk->lock); 711 716 return EIO; 712 717 } … … 717 722 718 723 if (wait_status(0, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 719 fibril_mutex_unlock(&d ->lock);724 fibril_mutex_unlock(&disk->lock); 720 725 return EIO; 721 726 } 722 727 723 728 if ((status & SR_DRQ) == 0) { 724 fibril_mutex_unlock(&d ->lock);729 fibril_mutex_unlock(&disk->lock); 725 730 return EIO; 726 731 } … … 733 738 if (data_size > obuf_size) { 734 739 /* Output buffer is too small to store data. */ 735 fibril_mutex_unlock(&d ->lock);740 fibril_mutex_unlock(&disk->lock); 736 741 return EIO; 737 742 } … … 744 749 745 750 if (status & SR_ERR) { 746 fibril_mutex_unlock(&d ->lock);747 return EIO; 748 } 749 750 fibril_mutex_unlock(&d ->lock);751 fibril_mutex_unlock(&disk->lock); 752 return EIO; 753 } 754 755 fibril_mutex_unlock(&disk->lock); 751 756 752 757 return EOK; … … 755 760 /** Issue ATAPI Inquiry. 756 761 * 757 * @param d ev_idx Device index (0 or 1)762 * @param disk Disk 758 763 * @param obuf Buffer for storing inquiry data read from device 759 764 * @param obuf_size Size of obuf in bytes … … 761 766 * @return EOK on success, EIO on error. 762 767 */ 763 static int ata_pcmd_inquiry( int dev_idx, void *obuf, size_t obuf_size)768 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size) 764 769 { 765 770 ata_pcmd_inquiry_t cp; … … 771 776 cp.alloc_len = min(obuf_size, 0xff); /* Allocation length */ 772 777 773 rc = ata_cmd_packet( 0, &cp, sizeof(cp), obuf, obuf_size);778 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size); 774 779 if (rc != EOK) 775 780 return rc; … … 783 788 * function will fail. 784 789 * 785 * @param d ev_idx Device index (0 or 1)790 * @param disk Disk 786 791 * @param ba Starting block address 787 792 * @param cnt Number of blocks to read … … 791 796 * @return EOK on success, EIO on error. 792 797 */ 793 static int ata_pcmd_read_12( int dev_idx, uint64_t ba, size_t cnt,798 static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt, 794 799 void *obuf, size_t obuf_size) 795 800 { … … 806 811 cp.nblocks = host2uint32_t_be(cnt); 807 812 808 rc = ata_cmd_packet( 0, &cp, sizeof(cp), obuf, obuf_size);813 rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size); 809 814 if (rc != EOK) 810 815 return rc; … … 823 828 * function will fail. 824 829 * 825 * @param d ev_idx Device index (0 or 1)830 * @param disk Disk 826 831 * @param session Starting session 827 832 * @param obuf Buffer for storing inquiry data read from device … … 830 835 * @return EOK on success, EIO on error. 831 836 */ 832 static int ata_pcmd_read_toc( int dev_idx, uint8_t session, void *obuf,837 static int ata_pcmd_read_toc(disk_t *disk, uint8_t session, void *obuf, 833 838 size_t obuf_size) 834 839 { … … 854 859 /** Read a physical from the device. 855 860 * 856 * @param disk _id Device index (0 or 1)861 * @param disk Disk 857 862 * @param ba Address the first block. 858 863 * @param cnt Number of blocks to transfer. … … 861 866 * @return EOK on success, EIO on error. 862 867 */ 863 static int ata_rcmd_read( int disk_id, uint64_t ba, size_t blk_cnt,868 static int ata_rcmd_read(disk_t *disk, uint64_t ba, size_t blk_cnt, 864 869 void *buf) 865 870 { … … 868 873 uint8_t status; 869 874 uint8_t drv_head; 870 disk_t *d;871 875 block_coord_t bc; 872 876 873 d = &ata_disk[disk_id];874 875 877 /* Silence warning. */ 876 878 memset(&bc, 0, sizeof(bc)); 877 879 878 880 /* Compute block coordinates. */ 879 if (coord_calc(d , ba, &bc) != EOK)881 if (coord_calc(disk, ba, &bc) != EOK) 880 882 return EINVAL; 881 883 882 884 /* New value for Drive/Head register */ 883 885 drv_head = 884 ((disk_ id!= 0) ? DHR_DRV : 0) |885 ((d ->amode != am_chs) ? DHR_LBA : 0) |886 ((disk_dev_idx(disk) != 0) ? DHR_DRV : 0) | 887 ((disk->amode != am_chs) ? DHR_LBA : 0) | 886 888 (bc.h & 0x0f); 887 889 888 fibril_mutex_lock(&d ->lock);890 fibril_mutex_lock(&disk->lock); 889 891 890 892 /* Program a Read Sectors operation. */ 891 893 892 894 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) { 893 fibril_mutex_unlock(&d ->lock);895 fibril_mutex_unlock(&disk->lock); 894 896 return EIO; 895 897 } … … 898 900 899 901 if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) { 900 fibril_mutex_unlock(&d ->lock);902 fibril_mutex_unlock(&disk->lock); 901 903 return EIO; 902 904 } … … 905 907 coord_sc_program(&bc, 1); 906 908 907 pio_write_8(&cmd->command, d ->amode == am_lba48 ?909 pio_write_8(&cmd->command, disk->amode == am_lba48 ? 908 910 CMD_READ_SECTORS_EXT : CMD_READ_SECTORS); 909 911 910 912 if (wait_status(0, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 911 fibril_mutex_unlock(&d ->lock);913 fibril_mutex_unlock(&disk->lock); 912 914 return EIO; 913 915 } … … 916 918 /* Read data from the device buffer. */ 917 919 918 for (i = 0; i < ata_disk[disk_id].block_size / 2; i++) {920 for (i = 0; i < disk->block_size / 2; i++) { 919 921 data = pio_read_16(&cmd->data_port); 920 922 ((uint16_t *) buf)[i] = data; … … 925 927 return EIO; 926 928 927 fibril_mutex_unlock(&d ->lock);929 fibril_mutex_unlock(&disk->lock); 928 930 return EOK; 929 931 } … … 931 933 /** Write a physical block to the device. 932 934 * 933 * @param disk _id Device index (0 or 1)935 * @param disk Disk 934 936 * @param ba Address of the first block. 935 937 * @param cnt Number of blocks to transfer. … … 938 940 * @return EOK on success, EIO on error. 939 941 */ 940 static int ata_rcmd_write( int disk_id, uint64_t ba, size_t cnt,942 static int ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt, 941 943 const void *buf) 942 944 { … … 944 946 uint8_t status; 945 947 uint8_t drv_head; 946 disk_t *d;947 948 block_coord_t bc; 948 949 949 d = &ata_disk[disk_id];950 951 950 /* Silence warning. */ 952 951 memset(&bc, 0, sizeof(bc)); 953 952 954 953 /* Compute block coordinates. */ 955 if (coord_calc(d , ba, &bc) != EOK)954 if (coord_calc(disk, ba, &bc) != EOK) 956 955 return EINVAL; 957 956 958 957 /* New value for Drive/Head register */ 959 958 drv_head = 960 ((disk_ id!= 0) ? DHR_DRV : 0) |961 ((d ->amode != am_chs) ? DHR_LBA : 0) |959 ((disk_dev_idx(disk) != 0) ? DHR_DRV : 0) | 960 ((disk->amode != am_chs) ? DHR_LBA : 0) | 962 961 (bc.h & 0x0f); 963 962 964 fibril_mutex_lock(&d ->lock);963 fibril_mutex_lock(&disk->lock); 965 964 966 965 /* Program a Write Sectors operation. */ 967 966 968 967 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) { 969 fibril_mutex_unlock(&d ->lock);968 fibril_mutex_unlock(&disk->lock); 970 969 return EIO; 971 970 } … … 974 973 975 974 if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) { 976 fibril_mutex_unlock(&d ->lock);975 fibril_mutex_unlock(&disk->lock); 977 976 return EIO; 978 977 } … … 981 980 coord_sc_program(&bc, 1); 982 981 983 pio_write_8(&cmd->command, d ->amode == am_lba48 ?982 pio_write_8(&cmd->command, disk->amode == am_lba48 ? 984 983 CMD_WRITE_SECTORS_EXT : CMD_WRITE_SECTORS); 985 984 986 985 if (wait_status(0, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 987 fibril_mutex_unlock(&d ->lock);986 fibril_mutex_unlock(&disk->lock); 988 987 return EIO; 989 988 } … … 992 991 /* Write data to the device buffer. */ 993 992 994 for (i = 0; i < d ->block_size / 2; i++) {993 for (i = 0; i < disk->block_size / 2; i++) { 995 994 pio_write_16(&cmd->data_port, ((uint16_t *) buf)[i]); 996 995 } 997 996 } 998 997 999 fibril_mutex_unlock(&d ->lock);998 fibril_mutex_unlock(&disk->lock); 1000 999 1001 1000 if (status & SR_ERR) -
uspace/srv/bd/ata_bd/ata_bd.h
rb52dd1de r5882487 119 119 service_id_t service_id; 120 120 int disk_id; 121 bd_srv _t bd;121 bd_srvs_t bds; 122 122 } disk_t; 123 123 -
uspace/srv/bd/file_bd/file_bd.c
rb52dd1de r5882487 62 62 63 63 static service_id_t service_id; 64 static bd_srv _t bd_srv;64 static bd_srvs_t bd_srvs; 65 65 static fibril_mutex_t dev_lock; 66 66 … … 69 69 static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *); 70 70 71 static int file_bd_open(bd_srv _t *);71 static int file_bd_open(bd_srvs_t *, bd_srv_t *); 72 72 static int file_bd_close(bd_srv_t *); 73 73 static int file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 154 154 static int file_bd_init(const char *fname) 155 155 { 156 bd_srv _init(&bd_srv);157 bd_srv .ops = &file_bd_ops;156 bd_srvs_init(&bd_srvs); 157 bd_srvs.ops = &file_bd_ops; 158 158 159 159 async_set_client_connection(file_bd_connection); … … 188 188 static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 189 189 { 190 bd_conn(iid, icall, &bd_srv );190 bd_conn(iid, icall, &bd_srvs); 191 191 } 192 192 193 193 /** Open device. */ 194 static int file_bd_open(bd_srv _t *bd)194 static int file_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 195 195 { 196 196 return EOK; -
uspace/srv/bd/gxe_bd/gxe_bd.c
rb52dd1de r5882487 88 88 /** GXE block device soft state */ 89 89 typedef struct { 90 /** Block device serv erstructure */91 bd_srv _t bd;90 /** Block device service structure */ 91 bd_srvs_t bds; 92 92 int disk_id; 93 93 } gxe_bd_t; … … 109 109 static int gxe_bd_write_block(int disk_id, uint64_t ba, const void *buf); 110 110 111 static int gxe_bd_open(bd_srv _t *);111 static int gxe_bd_open(bd_srvs_t *, bd_srv_t *); 112 112 static int gxe_bd_close(bd_srv_t *); 113 113 static int gxe_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 127 127 static gxe_bd_t *bd_srv_gxe(bd_srv_t *bd) 128 128 { 129 return (gxe_bd_t *)bd-> arg;129 return (gxe_bd_t *)bd->srvs->sarg; 130 130 } 131 131 … … 166 166 char name[16]; 167 167 168 bd_srv _init(&gxe_bd[i].bd);169 gxe_bd[i].bd .ops = &gxe_bd_ops;170 gxe_bd[i].bd .arg = (void *)&gxe_bd[i];168 bd_srvs_init(&gxe_bd[i].bds); 169 gxe_bd[i].bds.ops = &gxe_bd_ops; 170 gxe_bd[i].bds.sarg = (void *)&gxe_bd[i]; 171 171 172 172 snprintf(name, 16, "%s/disk%u", NAMESPACE, i); … … 203 203 } 204 204 205 bd_conn(iid, icall, &gxe_bd[disk_id].bd );205 bd_conn(iid, icall, &gxe_bd[disk_id].bds); 206 206 } 207 207 208 208 /** Open device. */ 209 static int gxe_bd_open(bd_srv _t *bd)209 static int gxe_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 210 210 { 211 211 return EOK; -
uspace/srv/bd/part/guid_part/guid_part.c
rb52dd1de r5882487 83 83 /** Service representing the partition (outbound device) */ 84 84 service_id_t dsid; 85 /** Block device serv erstructure */86 bd_srv _t bd;85 /** Block device service structure */ 86 bd_srvs_t bds; 87 87 /** Points to next partition structure. */ 88 88 struct part *next; … … 104 104 static int gpt_bsa_translate(part_t *p, aoff64_t ba, size_t cnt, aoff64_t *gba); 105 105 106 static int gpt_bd_open(bd_srv _t *);106 static int gpt_bd_open(bd_srvs_t *, bd_srv_t *); 107 107 static int gpt_bd_close(bd_srv_t *); 108 108 static int gpt_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 122 122 static part_t *bd_srv_part(bd_srv_t *bd) 123 123 { 124 return (part_t *)bd-> arg;124 return (part_t *)bd->srvs->sarg; 125 125 } 126 126 … … 325 325 } 326 326 327 bd_srv _init(&part->bd);328 part->bd .ops = &gpt_bd_ops;329 part->bd .arg = part;327 bd_srvs_init(&part->bds); 328 part->bds.ops = &gpt_bd_ops; 329 part->bds.sarg = part; 330 330 331 331 part->dsid = 0; … … 357 357 assert(part->present == true); 358 358 359 bd_conn(iid, icall, &part->bd );359 bd_conn(iid, icall, &part->bds); 360 360 } 361 361 362 362 /** Open device. */ 363 static int gpt_bd_open(bd_srv _t *bd)363 static int gpt_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 364 364 { 365 365 return EOK; -
uspace/srv/bd/part/mbr_part/mbr_part.c
rb52dd1de r5882487 100 100 /** Device representing the partition (outbound device) */ 101 101 service_id_t dsid; 102 /** Block device serv er structure */103 bd_srv _t bd;102 /** Block device service sturcture */ 103 bd_srvs_t bds; 104 104 /** Points to next partition structure. */ 105 105 struct part *next; … … 154 154 static int mbr_bsa_translate(part_t *p, uint64_t ba, size_t cnt, uint64_t *gba); 155 155 156 static int mbr_bd_open(bd_srv _t *);156 static int mbr_bd_open(bd_srvs_t *, bd_srv_t *); 157 157 static int mbr_bd_close(bd_srv_t *); 158 158 static int mbr_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 172 172 static part_t *bd_srv_part(bd_srv_t *bd) 173 173 { 174 return (part_t *)bd-> arg;174 return (part_t *)bd->srvs->sarg; 175 175 } 176 176 … … 402 402 part->present = (pte->ptype != PT_UNUSED) ? true : false; 403 403 404 bd_srv _init(&part->bd);405 part->bd .ops = &mbr_bd_ops;406 part->bd .arg = part;404 bd_srvs_init(&part->bds); 405 part->bds.ops = &mbr_bd_ops; 406 part->bds.sarg = part; 407 407 408 408 part->dsid = 0; … … 433 433 434 434 assert(part->present == true); 435 bd_conn(iid, icall, &part->bd );435 bd_conn(iid, icall, &part->bds); 436 436 } 437 437 438 438 /** Open device. */ 439 static int mbr_bd_open(bd_srv _t *bd)439 static int mbr_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 440 440 { 441 441 return EOK; -
uspace/srv/bd/rd/rd.c
rb52dd1de r5882487 68 68 static const size_t block_size = 512; 69 69 70 static int rd_open(bd_srv _t *);70 static int rd_open(bd_srvs_t *, bd_srv_t *); 71 71 static int rd_close(bd_srv_t *); 72 72 static int rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 93 93 }; 94 94 95 static bd_srv _t bd_srv;95 static bd_srvs_t bd_srvs; 96 96 97 97 static void rd_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 98 98 { 99 bd_conn(iid, icall, &bd_srv );99 bd_conn(iid, icall, &bd_srvs); 100 100 } 101 101 102 102 /** Open device. */ 103 static int rd_open(bd_srv _t *bd)103 static int rd_open(bd_srvs_t *bds, bd_srv_t *bd) 104 104 { 105 105 return EOK; … … 175 175 (void *) addr_phys, size); 176 176 177 bd_srv _init(&bd_srv);178 bd_srv .ops = &rd_bd_ops;177 bd_srvs_init(&bd_srvs); 178 bd_srvs.ops = &rd_bd_ops; 179 179 180 180 async_set_client_connection(rd_client_conn); -
uspace/srv/bd/sata_bd/sata_bd.c
rb52dd1de r5882487 57 57 static int disk_count; 58 58 59 static int sata_bd_open(bd_srv _t *);59 static int sata_bd_open(bd_srvs_t *, bd_srv_t *); 60 60 static int sata_bd_close(bd_srv_t *); 61 61 static int sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 75 75 static sata_bd_dev_t *bd_srv_sata(bd_srv_t *bd) 76 76 { 77 return (sata_bd_dev_t *)bd-> arg;77 return (sata_bd_dev_t *)bd->srvs->sarg; 78 78 } 79 79 … … 104 104 ahci_get_num_blocks(disk[disk_count].sess, &disk[disk_count].blocks); 105 105 106 bd_srv _init(&disk[disk_count].bd);107 disk[disk_count].bd .ops = &sata_bd_ops;108 disk[disk_count].bd .arg = &disk[disk_count];106 bd_srvs_init(&disk[disk_count].bds); 107 disk[disk_count].bds.ops = &sata_bd_ops; 108 disk[disk_count].bds.sarg = &disk[disk_count]; 109 109 110 110 printf("Device %s - %s , blocks: %lu, block_size: %lu\n", … … 183 183 } 184 184 185 bd_conn(iid, icall, &disk[disk_id].bd );185 bd_conn(iid, icall, &disk[disk_id].bds); 186 186 } 187 187 188 188 /** Open device. */ 189 static int sata_bd_open(bd_srv _t *bd)189 static int sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 190 190 { 191 191 return EOK; -
uspace/srv/bd/sata_bd/sata_bd.h
rb52dd1de r5882487 58 58 size_t block_size; 59 59 /** Block device server structure */ 60 bd_srv _t bd;60 bd_srvs_t bds; 61 61 } sata_bd_dev_t; 62 62 -
uspace/srv/hid/console/console.c
rb52dd1de r5882487 383 383 384 384 fb_pointer_update(fb_sess, mouse.x, mouse.y, true); 385 } 386 387 static void cons_mouse_abs_move(sysarg_t x, sysarg_t y, 388 sysarg_t max_x, sysarg_t max_y) 389 { 390 if (max_x && max_y) { 391 mouse.x = limit(x * xres / max_x, 0, xres); 392 mouse.y = limit(y * yres / max_y, 0, yres); 393 394 fb_pointer_update(fb_sess, mouse.x, mouse.y, true); 395 } 385 396 } 386 397 … … 503 514 async_answer_0(callid, EOK); 504 515 break; 516 case INPUT_EVENT_ABS_MOVE: 517 cons_mouse_abs_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call), 518 IPC_GET_ARG3(call), IPC_GET_ARG4(call)); 519 async_answer_0(callid, EOK); 520 break; 505 521 case INPUT_EVENT_BUTTON: 506 522 /* Got pointer button press/release event */ -
uspace/srv/hid/input/generic/input.c
rb52dd1de r5882487 189 189 } 190 190 async_exchange_end(exch); 191 } 192 193 /** Mouse pointer has moved in absolute mode. */ 194 void mouse_push_event_abs_move(mouse_dev_t *mdev, unsigned int x, unsigned int y, 195 unsigned int max_x, unsigned int max_y) 196 { 197 if (max_x && max_y) { 198 async_exch_t *exch = async_exchange_begin(client_sess); 199 async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y); 200 async_exchange_end(exch); 201 } 191 202 } 192 203 -
uspace/srv/hid/input/include/mouse.h
rb52dd1de r5882487 63 63 extern void mouse_push_data(mouse_dev_t *, sysarg_t); 64 64 extern void mouse_push_event_move(mouse_dev_t *, int, int, int); 65 extern void mouse_push_event_abs_move(mouse_dev_t *, unsigned int, unsigned int, 66 unsigned int, unsigned int); 65 67 extern void mouse_push_event_button(mouse_dev_t *, int, int); 66 68 -
uspace/srv/hid/input/proto/mousedev.c
rb52dd1de r5882487 96 96 retval = EOK; 97 97 break; 98 case MOUSEEV_ABS_MOVE_EVENT: 99 mouse_push_event_abs_move(mousedev->mouse_dev, 100 IPC_GET_ARG1(call), IPC_GET_ARG2(call), 101 IPC_GET_ARG3(call), IPC_GET_ARG4(call)); 102 retval = EOK; 103 break; 98 104 case MOUSEEV_BUTTON_EVENT: 99 105 mouse_push_event_button(mousedev->mouse_dev,
Note:
See TracChangeset
for help on using the changeset viewer.
