Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/ahci/ahci.c

    racdb5bac r7de1988c  
    119119static int ahci_identify_device(sata_dev_t *);
    120120static 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);
     121static int ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
     122static int ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
    123123
    124124static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *);
     
    233233        sata_dev_t *sata = fun_sata_dev(fun);
    234234       
    235         void *phys;
     235        uintptr_t phys;
    236236        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);
    239239        if (rc != EOK) {
    240240                ddf_msg(LVL_ERROR, "Cannot allocate read buffer.");
     
    276276        sata_dev_t *sata = fun_sata_dev(fun);
    277277       
    278         void *phys;
     278        uintptr_t phys;
    279279        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);
    282282        if (rc != EOK) {
    283283                ddf_msg(LVL_ERROR, "Cannot allocate write buffer.");
     
    336336 *
    337337 */
    338 static void ahci_identify_device_cmd(sata_dev_t *sata, void *phys)
     338static void ahci_identify_device_cmd(sata_dev_t *sata, uintptr_t phys)
    339339{
    340340        volatile sata_std_command_frame_t *cmd =
     
    381381 *
    382382 */
    383 static void ahci_identify_packet_device_cmd(sata_dev_t *sata, void *phys)
     383static void ahci_identify_packet_device_cmd(sata_dev_t *sata, uintptr_t phys)
    384384{
    385385        volatile sata_std_command_frame_t *cmd =
     
    435435        }
    436436       
    437         void *phys;
     437        uintptr_t phys;
    438438        sata_identify_data_t *idata;
    439439        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);
    441442        if (rc != EOK) {
    442443                ddf_msg(LVL_ERROR, "Cannot allocate buffer to identify device.");
     
    561562 *
    562563 */
    563 static void ahci_set_mode_cmd(sata_dev_t *sata, void* phys, uint8_t mode)
     564static void ahci_set_mode_cmd(sata_dev_t *sata, uintptr_t phys, uint8_t mode)
    564565{
    565566        volatile sata_std_command_frame_t *cmd =
     
    567568       
    568569        cmd->fis_type = SATA_CMD_FIS_TYPE;
    569         cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR; 
     570        cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
    570571        cmd->command = 0xef;
    571572        cmd->features = 0x03;
     
    628629        }
    629630       
    630         void *phys;
     631        uintptr_t phys;
    631632        sata_identify_data_t *idata;
    632633        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);
    634636        if (rc != EOK) {
    635637                ddf_msg(LVL_ERROR, "Cannot allocate buffer for device set mode.");
     
    677679 *
    678680 */
    679 static void ahci_rb_fpdma_cmd(sata_dev_t *sata, void *phys, uint64_t blocknum)
     681static void ahci_rb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys,
     682    uint64_t blocknum)
    680683{
    681684        volatile sata_ncq_command_frame_t *cmd =
     
    734737 *
    735738 */
    736 static int ahci_rb_fpdma(sata_dev_t *sata, void *phys, uint64_t blocknum)
     739static int ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
    737740{
    738741        if (sata->is_invalid_device) {
     
    763766 *
    764767 */
    765 static void ahci_wb_fpdma_cmd(sata_dev_t *sata, void *phys, uint64_t blocknum)
     768static void ahci_wb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys,
     769    uint64_t blocknum)
    766770{
    767771        volatile sata_ncq_command_frame_t *cmd =
     
    821825 *
    822826 */
    823 static int ahci_wb_fpdma(sata_dev_t *sata, void *phys, uint64_t blocknum)
     827static int ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
    824828{
    825829        if (sata->is_invalid_device) {
     
    933937{
    934938        size_t size = 4096;
    935         void *phys = NULL;
     939        uintptr_t phys = 0;
    936940        void *virt_fb = NULL;
    937941        void *virt_cmd = NULL;
     
    949953       
    950954        /* 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);
    953957        if (rc != EOK)
    954958                goto error_retfis;
     
    959963       
    960964        /* 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);
    963967        if (rc != EOK)
    964968                goto error_cmd;
     
    970974       
    971975        /* 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);
    974978        if (rc != EOK)
    975979                goto error_table;
     
    11531157        ahci->memregs = NULL;
    11541158       
    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]),
    11561160            AHCI_MEMREGS_PAGES_COUNT, AS_AREA_READ | AS_AREA_WRITE,
    11571161            (void **) &ahci->memregs);
     
    11601164       
    11611165        /* 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]);
    11631167        ahci_ranges[0].size = sizeof(ahci_memregs_t);
    11641168       
     
    11671171               
    11681172                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])) +
    11701174                    AHCI_PORTS_REGISTERS_OFFSET + port * AHCI_PORT_REGISTERS_SIZE +
    11711175                    AHCI_PORT_IS_REGISTER_OFFSET;
     
    11731177               
    11741178                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])) +
    11761180                    AHCI_GHC_IS_REGISTER_OFFSET;
    11771181                ahci_cmds[base + 4].addr = ahci_cmds[base + 3].addr;
Note: See TracChangeset for help on using the changeset viewer.