diff options
author | Denis Orlov <denorl2009@gmail.com> | 2022-05-04 12:25:48 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-05-05 09:47:04 +0200 |
commit | f7ce1cd0c78de6bb0357e2b9132c59210e1722c7 (patch) | |
tree | 11b5729b32f5098007a74181e4f5d24138a159e2 /drivers/ata | |
parent | f4b2f6145cef08f7ca00f7c617900f11181fe2bc (diff) | |
download | barebox-f7ce1cd0c78de6bb0357e2b9132c59210e1722c7.tar.gz barebox-f7ce1cd0c78de6bb0357e2b9132c59210e1722c7.tar.xz |
ata: ahci: use 64-bit addressing if available
Signed-off-by: Denis Orlov <denorl2009@gmail.com>
Link: https://lore.barebox.org/20220504092553.27961-11-denorl2009@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ff9093c7b7..d423da3a48 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -117,8 +117,10 @@ static void ahci_fill_cmd_slot(struct ahci_port *ahci_port, u32 opts) ahci_port->cmd_slot->opts = cpu_to_le32(opts); ahci_port->cmd_slot->status = 0; ahci_port->cmd_slot->tbl_addr = - cpu_to_le32(ahci_port->cmd_tbl_dma & 0xffffffff); - ahci_port->cmd_slot->tbl_addr_hi = 0; + cpu_to_le32(lower_32_bits(ahci_port->cmd_tbl_dma)); + if (ahci_port->ahci->cap & HOST_CAP_64) + ahci_port->cmd_slot->tbl_addr_hi = + cpu_to_le32(upper_32_bits(ahci_port->cmd_tbl_dma)); } static int ahci_fill_sg(struct ahci_port *ahci_port, dma_addr_t buf_dma, int buf_len) @@ -133,8 +135,9 @@ static int ahci_fill_sg(struct ahci_port *ahci_port, dma_addr_t buf_dma, int buf while (buf_len) { unsigned int now = min(AHCI_MAX_DATA_BYTE_COUNT, buf_len); - ahci_sg->addr = cpu_to_le32(buf_dma); - ahci_sg->addr_hi = 0; + ahci_sg->addr = cpu_to_le32(lower_32_bits(buf_dma)); + if (ahci_port->ahci->cap & HOST_CAP_64) + ahci_sg->addr_hi = cpu_to_le32(upper_32_bits(buf_dma)); ahci_sg->flags_size = cpu_to_le32(now - 1); buf_len -= now; @@ -327,8 +330,12 @@ static int ahci_init_port(struct ahci_port *ahci_port) ahci_port->cmd_tbl_sg = ahci_port->cmd_tbl + AHCI_CMD_TBL_HDR_SZ; - ahci_port_write_f(ahci_port, PORT_LST_ADDR, ahci_port->cmd_slot_dma); - ahci_port_write_f(ahci_port, PORT_FIS_ADDR, ahci_port->rx_fis_dma); + ahci_port_write_f(ahci_port, PORT_LST_ADDR, lower_32_bits(ahci_port->cmd_slot_dma)); + if (ahci_port->ahci->cap & HOST_CAP_64) + ahci_port_write_f(ahci_port, PORT_LST_ADDR_HI, upper_32_bits(ahci_port->cmd_slot_dma)); + ahci_port_write_f(ahci_port, PORT_FIS_ADDR, lower_32_bits(ahci_port->rx_fis_dma)); + if (ahci_port->ahci->cap & HOST_CAP_64) + ahci_port_write_f(ahci_port, PORT_FIS_ADDR_HI, upper_32_bits(ahci_port->rx_fis_dma)); /* * Add the spinup command to whatever mode bits may |