Changes in uspace/drv/block/ahci/ahci.c [267f235:7de1988c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/ahci/ahci.c
r267f235 r7de1988c 119 119 static int ahci_identify_device(sata_dev_t *); 120 120 static int ahci_set_highest_ultra_dma_mode(sata_dev_t *); 121 static int ahci_rb_fpdma(sata_dev_t *, void *, uint64_t);122 static int ahci_wb_fpdma(sata_dev_t *, void *, uint64_t);121 static int ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t); 122 static int ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t); 123 123 124 124 static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *); … … 233 233 sata_dev_t *sata = fun_sata_dev(fun); 234 234 235 void *phys;235 uintptr_t phys; 236 236 void *ibuf; 237 int rc = dmamem_map_anonymous(sata->block_size, AS_AREA_READ | AS_AREA_WRITE,238 0, &phys, (void **)&ibuf);237 int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB, 238 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf); 239 239 if (rc != EOK) { 240 240 ddf_msg(LVL_ERROR, "Cannot allocate read buffer."); … … 242 242 } 243 243 244 bzero(buf, sata->block_size);244 memset(buf, 0, sata->block_size); 245 245 246 246 fibril_mutex_lock(&sata->lock); … … 276 276 sata_dev_t *sata = fun_sata_dev(fun); 277 277 278 void *phys;278 uintptr_t phys; 279 279 void *ibuf; 280 int rc = dmamem_map_anonymous(sata->block_size, AS_AREA_READ | AS_AREA_WRITE,281 0, &phys, (void **)&ibuf);280 int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB, 281 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf); 282 282 if (rc != EOK) { 283 283 ddf_msg(LVL_ERROR, "Cannot allocate write buffer."); … … 336 336 * 337 337 */ 338 static void ahci_identify_device_cmd(sata_dev_t *sata, void *phys)338 static void ahci_identify_device_cmd(sata_dev_t *sata, uintptr_t phys) 339 339 { 340 340 volatile sata_std_command_frame_t *cmd = … … 381 381 * 382 382 */ 383 static void ahci_identify_packet_device_cmd(sata_dev_t *sata, void *phys)383 static void ahci_identify_packet_device_cmd(sata_dev_t *sata, uintptr_t phys) 384 384 { 385 385 volatile sata_std_command_frame_t *cmd = … … 435 435 } 436 436 437 void *phys;437 uintptr_t phys; 438 438 sata_identify_data_t *idata; 439 439 int rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH, 440 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, (void **) &idata); 440 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys, 441 (void **) &idata); 441 442 if (rc != EOK) { 442 443 ddf_msg(LVL_ERROR, "Cannot allocate buffer to identify device."); … … 444 445 } 445 446 446 bzero(idata, SATA_IDENTIFY_DEVICE_BUFFER_LENGTH);447 memset(idata, 0, SATA_IDENTIFY_DEVICE_BUFFER_LENGTH); 447 448 448 449 fibril_mutex_lock(&sata->lock); … … 561 562 * 562 563 */ 563 static void ahci_set_mode_cmd(sata_dev_t *sata, void*phys, uint8_t mode)564 static void ahci_set_mode_cmd(sata_dev_t *sata, uintptr_t phys, uint8_t mode) 564 565 { 565 566 volatile sata_std_command_frame_t *cmd = … … 567 568 568 569 cmd->fis_type = SATA_CMD_FIS_TYPE; 569 cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR; 570 cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR; 570 571 cmd->command = 0xef; 571 572 cmd->features = 0x03; … … 628 629 } 629 630 630 void *phys;631 uintptr_t phys; 631 632 sata_identify_data_t *idata; 632 633 int rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH, 633 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, (void **) &idata); 634 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys, 635 (void **) &idata); 634 636 if (rc != EOK) { 635 637 ddf_msg(LVL_ERROR, "Cannot allocate buffer for device set mode."); … … 637 639 } 638 640 639 bzero(idata, SATA_SET_FEATURE_BUFFER_LENGTH);641 memset(idata, 0, SATA_SET_FEATURE_BUFFER_LENGTH); 640 642 641 643 fibril_mutex_lock(&sata->lock); … … 677 679 * 678 680 */ 679 static void ahci_rb_fpdma_cmd(sata_dev_t *sata, void *phys, uint64_t blocknum) 681 static void ahci_rb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys, 682 uint64_t blocknum) 680 683 { 681 684 volatile sata_ncq_command_frame_t *cmd = … … 734 737 * 735 738 */ 736 static int ahci_rb_fpdma(sata_dev_t *sata, void *phys, uint64_t blocknum)739 static int ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum) 737 740 { 738 741 if (sata->is_invalid_device) { … … 763 766 * 764 767 */ 765 static void ahci_wb_fpdma_cmd(sata_dev_t *sata, void *phys, uint64_t blocknum) 768 static void ahci_wb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys, 769 uint64_t blocknum) 766 770 { 767 771 volatile sata_ncq_command_frame_t *cmd = … … 821 825 * 822 826 */ 823 static int ahci_wb_fpdma(sata_dev_t *sata, void *phys, uint64_t blocknum)827 static int ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum) 824 828 { 825 829 if (sata->is_invalid_device) { … … 933 937 { 934 938 size_t size = 4096; 935 void *phys = NULL;939 uintptr_t phys = 0; 936 940 void *virt_fb = NULL; 937 941 void *virt_cmd = NULL; … … 949 953 950 954 /* Allocate and init retfis structure. */ 951 int rc = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE, 0,952 &phys, &virt_fb);955 int rc = dmamem_map_anonymous(size, DMAMEM_4GiB, 956 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_fb); 953 957 if (rc != EOK) 954 958 goto error_retfis; 955 959 956 bzero(virt_fb, size);960 memset(virt_fb, 0, size); 957 961 sata->port->pxfbu = HI(phys); 958 962 sata->port->pxfb = LO(phys); 959 963 960 964 /* Allocate and init command header structure. */ 961 rc = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE, 0,962 &phys, &virt_cmd);965 rc = dmamem_map_anonymous(size, DMAMEM_4GiB, 966 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_cmd); 963 967 if (rc != EOK) 964 968 goto error_cmd; 965 969 966 bzero(virt_cmd, size);970 memset(virt_cmd, 0, size); 967 971 sata->port->pxclbu = HI(phys); 968 972 sata->port->pxclb = LO(phys); … … 970 974 971 975 /* Allocate and init command table structure. */ 972 rc = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE, 0,973 &phys, &virt_table);976 rc = dmamem_map_anonymous(size, DMAMEM_4GiB, 977 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_table); 974 978 if (rc != EOK) 975 979 goto error_table; 976 980 977 bzero(virt_table, size);981 memset(virt_table, 0, size); 978 982 sata->cmd_header->cmdtableu = HI(phys); 979 983 sata->cmd_header->cmdtable = LO(phys); … … 1153 1157 ahci->memregs = NULL; 1154 1158 1155 physmem_map( (void *) (size_t) (hw_res_parsed.mem_ranges.ranges[0].address),1159 physmem_map(RNGABS(hw_res_parsed.mem_ranges.ranges[0]), 1156 1160 AHCI_MEMREGS_PAGES_COUNT, AS_AREA_READ | AS_AREA_WRITE, 1157 1161 (void **) &ahci->memregs); … … 1160 1164 1161 1165 /* Register interrupt handler */ 1162 ahci_ranges[0].base = (size_t) hw_res_parsed.mem_ranges.ranges[0].address;1166 ahci_ranges[0].base = RNGABS(hw_res_parsed.mem_ranges.ranges[0]); 1163 1167 ahci_ranges[0].size = sizeof(ahci_memregs_t); 1164 1168 … … 1167 1171 1168 1172 ahci_cmds[base].addr = 1169 ((uint32_t *) (size_t) hw_res_parsed.mem_ranges.ranges[0].address) +1173 ((uint32_t *) RNGABSPTR(hw_res_parsed.mem_ranges.ranges[0])) + 1170 1174 AHCI_PORTS_REGISTERS_OFFSET + port * AHCI_PORT_REGISTERS_SIZE + 1171 1175 AHCI_PORT_IS_REGISTER_OFFSET; … … 1173 1177 1174 1178 ahci_cmds[base + 3].addr = 1175 ((uint32_t *) (size_t) hw_res_parsed.mem_ranges.ranges[0].address) +1179 ((uint32_t *) RNGABSPTR(hw_res_parsed.mem_ranges.ranges[0])) + 1176 1180 AHCI_GHC_IS_REGISTER_OFFSET; 1177 1181 ahci_cmds[base + 4].addr = ahci_cmds[base + 3].addr; … … 1287 1291 { 1288 1292 uint8_t model[40]; 1289 bzero(model, 40);1293 memset(model, 0, 40); 1290 1294 1291 1295 for (unsigned int i = 0; i < 20; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.