mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly
@ 2022-05-04  9:25 Denis Orlov
  2022-05-04  9:25 ` [PATCH 02/16] ata: ahci: replace magic numbers with named constants Denis Orlov
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Currently those are used in some routines side by side with underlying
functions with no apparent reason for it. Make their usage uniform, this
cleans up code a bit and allows to remove unneeded variables.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 3c0b0a5450..ad9e2f950f 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -172,7 +172,7 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
 	ahci_port_write_f(ahci_port, PORT_CMD_ISSUE, 1);
 
 	ret = wait_on_timeout(WAIT_DATAIO,
-			(readl(ahci_port->port_mmio + PORT_CMD_ISSUE) & 0x1) == 0);
+			(ahci_port_read(ahci_port, PORT_CMD_ISSUE) & 0x1) == 0);
 	if (ret)
 		return -ETIMEDOUT;
 
@@ -274,12 +274,9 @@ static int ahci_write(struct ata_port *ata, const void *buf, sector_t block,
 
 static int ahci_init_port(struct ahci_port *ahci_port)
 {
-	void __iomem *port_mmio;
 	u32 val, cmd;
 	int ret;
 
-	port_mmio = ahci_port->port_mmio;
-
 	/* make sure port is not active */
 	val = ahci_port_read(ahci_port, PORT_CMD);
 	if (val & (PORT_CMD_LIST_ON | PORT_CMD_FIS_ON | PORT_CMD_FIS_RX | PORT_CMD_START)) {
@@ -375,16 +372,16 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	ahci_port_info(ahci_port, "Spinning up device...\n");
 
 	ret = wait_on_timeout(WAIT_SPINUP,
-			((readl(port_mmio + PORT_TFDATA) &
+			((ahci_port_read(ahci_port, PORT_TFDATA) &
 			 (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0)
-			|| ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1));
+			|| ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1));
 	if (ret) {
 		ahci_port_info(ahci_port, "timeout.\n");
 		ret = -ENODEV;
 		goto err_init;
 	}
 
-	if ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1) {
+	if ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1) {
 		ahci_port_info(ahci_port, "down.\n");
 		ret = -ENODEV;
 		goto err_init;
@@ -570,7 +567,6 @@ static int ahci_detect(struct device_d *dev)
 
 int ahci_add_host(struct ahci_device *ahci)
 {
-	u8 *mmio = (u8 *)ahci->mmio_base;
 	u32 tmp, cap_save;
 	int i, ret;
 
@@ -584,7 +580,7 @@ int ahci_add_host(struct ahci_device *ahci)
 
 	ahci_debug(ahci, "ahci_host_init: start\n");
 
-	cap_save = readl(mmio + HOST_CAP);
+	cap_save = ahci_ioread(ahci, HOST_CAP);
 	cap_save &= ((1 << 28) | (1 << 17));
 	cap_save |= (1 << 27);  /* Staggered Spin-up. Not needed. */
 
@@ -597,7 +593,7 @@ int ahci_add_host(struct ahci_device *ahci)
 	 * reset must complete within 1 second, or
 	 * the hardware should be considered fried.
 	 */
-	ret = wait_on_timeout(SECOND, (readl(mmio + HOST_CTL) & HOST_RESET) == 0);
+	ret = wait_on_timeout(SECOND, (ahci_ioread(ahci, HOST_CTL) & HOST_RESET) == 0);
 	if (ret) {
 		ahci_debug(ahci,"controller reset failed (0x%x)\n", tmp);
 		return -ENODEV;
@@ -620,7 +616,7 @@ int ahci_add_host(struct ahci_device *ahci)
 		ahci_port->num = i;
 		ahci_port->ahci = ahci;
 		ahci_port->ata.dev = ahci->dev;
-		ahci_port->port_mmio = ahci_port_base(mmio, i);
+		ahci_port->port_mmio = ahci_port_base(ahci->mmio_base, i);
 		ahci_port->ata.ops = &ahci_ops;
 		ata_port_register(&ahci_port->ata);
 	}
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 02/16] ata: ahci: replace magic numbers with named constants
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 03/16] ata: ahci: fix missing whitespace in ahci_add_host() Denis Orlov
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 21 +++++++++++----------
 drivers/ata/ahci.h | 12 ++++++++++++
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index ad9e2f950f..c64c856f94 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -101,7 +101,7 @@ static inline void __iomem *ahci_port_base(void __iomem *base, int port)
 
 static int ahci_link_ok(struct ahci_port *ahci_port, int verbose)
 {
-	u32 val = ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf;
+	u32 val = ahci_port_read(ahci_port, PORT_SCR_STAT) & PORT_SCR_STAT_DET;
 
 	if (val == 0x3)
 		return true;
@@ -166,7 +166,7 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
 	sg_count = ahci_fill_sg(ahci_port, rbuf ? rbuf : wbuf, buf_len);
 	opts = (fis_len >> 2) | (sg_count << 16);
 	if (wbuf)
-		opts |= 1 << 6;
+		opts |= CMD_LIST_OPTS_WRITE;
 	ahci_fill_cmd_slot(ahci_port, opts);
 
 	ahci_port_write_f(ahci_port, PORT_CMD_ISSUE, 1);
@@ -355,7 +355,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	 * rarely has it taken between 1-2 ms. Never seen it above 2 ms.
 	 */
 	ret = wait_on_timeout(WAIT_LINKUP,
-			(ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 0x3);
+			(ahci_port_read(ahci_port, PORT_SCR_STAT) & PORT_SCR_STAT_DET) == 0x3);
 	if (ret) {
 		ahci_port_info(ahci_port, "SATA link timeout\n");
 		ret = -ETIMEDOUT;
@@ -373,15 +373,16 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 
 	ret = wait_on_timeout(WAIT_SPINUP,
 			((ahci_port_read(ahci_port, PORT_TFDATA) &
-			 (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0)
-			|| ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1));
+			 (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0) ||
+			((ahci_port_read(ahci_port, PORT_SCR_STAT) &
+			 PORT_SCR_STAT_DET) == 1));
 	if (ret) {
 		ahci_port_info(ahci_port, "timeout.\n");
 		ret = -ENODEV;
 		goto err_init;
 	}
 
-	if ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1) {
+	if ((ahci_port_read(ahci_port, PORT_SCR_STAT) & PORT_SCR_STAT_DET) == 1) {
 		ahci_port_info(ahci_port, "down.\n");
 		ret = -ENODEV;
 		goto err_init;
@@ -408,7 +409,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 
 	ahci_port_debug(ahci_port, "status: 0x%08x\n", val);
 
-	if ((val & 0xf) == 0x03)
+	if ((val & PORT_SCR_STAT_DET) == 0x3)
 		return 0;
 
 	ret = -ENODEV;
@@ -581,8 +582,8 @@ int ahci_add_host(struct ahci_device *ahci)
 	ahci_debug(ahci, "ahci_host_init: start\n");
 
 	cap_save = ahci_ioread(ahci, HOST_CAP);
-	cap_save &= ((1 << 28) | (1 << 17));
-	cap_save |= (1 << 27);  /* Staggered Spin-up. Not needed. */
+	cap_save &= (HOST_SMPS | HOST_SPM);
+	cap_save |= HOST_SSS;  /* Staggered Spin-up. Not needed. */
 
 	/* global controller reset */
 	tmp = ahci_ioread(ahci, HOST_CTL);
@@ -605,7 +606,7 @@ int ahci_add_host(struct ahci_device *ahci)
 
 	ahci->cap = ahci_ioread(ahci, HOST_CAP);
 	ahci->port_map = ahci_ioread(ahci, HOST_PORTS_IMPL);
-	ahci->n_ports = (ahci->cap & 0x1f) + 1;
+	ahci->n_ports = (ahci->cap & HOST_NP) + 1;
 
 	ahci_debug(ahci, "cap 0x%x  port_map 0x%x  n_ports %d\n",
 	      ahci->cap, ahci->port_map, ahci->n_ports);
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 7fed43045a..5a187fd2e1 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -33,6 +33,12 @@
 #define HOST_VERSION		0x10 /* AHCI spec. version compliancy */
 #define HOST_CAP2		0x24 /* host capabilities, extended */
 
+/* HOST_CAP bits */
+#define HOST_SMPS		(1 << 28)   /* supports mechanical presence switch */
+#define HOST_SSS		(1 << 27)   /* supports staggered spin-up */
+#define HOST_SPM		(1 << 17)   /* supports port multiplier */
+#define HOST_NP			(0x1f << 0) /* number of ports */
+
 /* HOST_CTL bits */
 #define HOST_RESET		(1 << 0)  /* reset controller; self-clear */
 #define HOST_IRQ_EN		(1 << 1)  /* global IRQ enable */
@@ -98,6 +104,9 @@
 #define PORT_CMD_ICC_PARTIAL	(0x2 << 28) /* Put i/f in partial state */
 #define PORT_CMD_ICC_SLUMBER	(0x6 << 28) /* Put i/f in slumber state */
 
+/* PORT_SCR_STAT bits */
+#define PORT_SCR_STAT_DET	(0xf << 0) /* device detection */
+
 #define AHCI_MAX_PORTS		32
 
 /* SETFEATURES stuff */
@@ -130,6 +139,9 @@
 #define ATA_FLAG_PIO_DMA	(1 << 8) /* PIO cmds via DMA */
 #define ATA_FLAG_NO_ATAPI	(1 << 11) /* No ATAPI support */
 
+/* Command list entry DW0 bits */
+#define CMD_LIST_OPTS_WRITE	(1 << 6) /* the direction is a device write */
+
 struct ahci_device;
 
 struct ahci_port {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 03/16] ata: ahci: fix missing whitespace in ahci_add_host()
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
  2022-05-04  9:25 ` [PATCH 02/16] ata: ahci: replace magic numbers with named constants Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 04/16] ata: ahci: simplify fis structure creation Denis Orlov
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index c64c856f94..5aab81fcef 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -596,7 +596,7 @@ int ahci_add_host(struct ahci_device *ahci)
 	 */
 	ret = wait_on_timeout(SECOND, (ahci_ioread(ahci, HOST_CTL) & HOST_RESET) == 0);
 	if (ret) {
-		ahci_debug(ahci,"controller reset failed (0x%x)\n", tmp);
+		ahci_debug(ahci, "controller reset failed (0x%x)\n", tmp);
 		return -ENODEV;
 	}
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 04/16] ata: ahci: simplify fis structure creation
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
  2022-05-04  9:25 ` [PATCH 02/16] ata: ahci: replace magic numbers with named constants Denis Orlov
  2022-05-04  9:25 ` [PATCH 03/16] ata: ahci: fix missing whitespace in ahci_add_host() Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 05/16] ata: ahci: do not ignore dma handles Denis Orlov
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 5aab81fcef..026f83046c 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -192,14 +192,12 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
 static int ahci_read_id(struct ata_port *ata, void *buf)
 {
 	struct ahci_port *ahci = container_of(ata, struct ahci_port, ata);
-	u8 fis[20];
-
-	memset(fis, 0, sizeof(fis));
 
-	/* Construct the FIS */
-	fis[0] = 0x27;			/* Host to device FIS. */
-	fis[1] = 1 << 7;		/* Command FIS. */
-	fis[2] = ATA_CMD_ID_ATA;	/* Command byte. */
+	u8 fis[20] = {
+		0x27,			/* Host to device FIS. */
+		1 << 7,			/* Command FIS. */
+		ATA_CMD_ID_ATA		/* Command byte. */
+	};
 
 	return ahci_io(ahci, fis, sizeof(fis), buf, NULL, SECTOR_SIZE);
 }
@@ -208,16 +206,13 @@ static int ahci_rw(struct ata_port *ata, void *rbuf, const void *wbuf,
 		sector_t block, blkcnt_t num_blocks)
 {
 	struct ahci_port *ahci = container_of(ata, struct ahci_port, ata);
-	u8 fis[20];
+	u8 fis[20] = {
+		0x27,			/* Host to device FIS. */
+		1 << 7			/* Command FIS. */
+	};
 	int ret;
 	int lba48 = ata_id_has_lba48(ata->id);
 
-	memset(fis, 0, sizeof(fis));
-
-	/* Construct the FIS */
-	fis[0] = 0x27;			/* Host to device FIS. */
-	fis[1] = 1 << 7;		/* Command FIS. */
-
 	/* Command byte. */
 	if (lba48)
 		fis[2] = wbuf ? ATA_CMD_WRITE_EXT : ATA_CMD_READ_EXT;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 05/16] ata: ahci: do not ignore dma handles
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (2 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 04/16] ata: ahci: simplify fis structure creation Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 06/16] ata: ahci: adjust debug messages in ahci_init_port() Denis Orlov
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

They represent addresses from the device side and should be used instead
of cpu side ones when populating device registers than hold addresses.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 21 ++++++++++++---------
 drivers/ata/ahci.h |  3 +++
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 026f83046c..095eb93a08 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -117,7 +117,7 @@ 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((unsigned long)ahci_port->cmd_tbl & 0xffffffff);
+		cpu_to_le32(ahci_port->cmd_tbl_dma & 0xffffffff);
 	ahci_port->cmd_slot->tbl_addr_hi = 0;
 }
 
@@ -292,7 +292,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	 * 32 bytes each in size
 	 */
 	ahci_port->cmd_slot = dma_alloc_coherent(AHCI_CMD_SLOT_SZ * 32,
-						 DMA_ADDRESS_BROKEN);
+						  &ahci_port->cmd_slot_dma);
 	if (!ahci_port->cmd_slot) {
 		ret = -ENOMEM;
 		goto err_alloc;
@@ -304,7 +304,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	 * Second item: Received-FIS area
 	 */
 	ahci_port->rx_fis = (unsigned long)dma_alloc_coherent(AHCI_RX_FIS_SZ,
-							      DMA_ADDRESS_BROKEN);
+						&ahci_port->rx_fis_dma);
 	if (!ahci_port->rx_fis) {
 		ret = -ENOMEM;
 		goto err_alloc1;
@@ -315,7 +315,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	 * and its scatter-gather table
 	 */
 	ahci_port->cmd_tbl = dma_alloc_coherent(AHCI_CMD_TBL_SZ,
-						DMA_ADDRESS_BROKEN);
+						 &ahci_port->cmd_tbl_dma);
 	if (!ahci_port->cmd_tbl) {
 		ret = -ENOMEM;
 		goto err_alloc2;
@@ -325,8 +325,8 @@ 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, (u32)ahci_port->cmd_slot);
-	ahci_port_write_f(ahci_port, PORT_FIS_ADDR, ahci_port->rx_fis);
+	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);
 
 	/*
 	 * Add the spinup command to whatever mode bits may
@@ -410,11 +410,14 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	ret = -ENODEV;
 
 err_init:
-	dma_free_coherent(ahci_port->cmd_tbl, 0, AHCI_CMD_TBL_SZ);
+	dma_free_coherent(ahci_port->cmd_tbl, ahci_port->cmd_tbl_dma,
+			  AHCI_CMD_TBL_SZ);
 err_alloc2:
-	dma_free_coherent((void *)ahci_port->rx_fis, 0, AHCI_RX_FIS_SZ);
+	dma_free_coherent((void *)ahci_port->rx_fis, ahci_port->rx_fis_dma,
+			  AHCI_RX_FIS_SZ);
 err_alloc1:
-	dma_free_coherent(ahci_port->cmd_slot, 0, AHCI_CMD_SLOT_SZ * 32);
+	dma_free_coherent(ahci_port->cmd_slot, ahci_port->cmd_slot_dma,
+			  AHCI_CMD_SLOT_SZ * 32);
 err_alloc:
 	return ret;
 }
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 5a187fd2e1..3ca64c3d70 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -151,9 +151,12 @@ struct ahci_port {
 	unsigned		flags;
 	void __iomem		*port_mmio;
 	struct ahci_cmd_hdr	*cmd_slot;
+	dma_addr_t		cmd_slot_dma;
 	struct ahci_sg		*cmd_tbl_sg;
 	void			*cmd_tbl;
+	dma_addr_t		cmd_tbl_dma;
 	u32			rx_fis;
+	dma_addr_t		rx_fis_dma;
 };
 
 struct ahci_device {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 06/16] ata: ahci: adjust debug messages in ahci_init_port()
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (3 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 05/16] ata: ahci: do not ignore dma handles Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 07/16] ata: ahci: correct named constants values and names Denis Orlov
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

The output was a bit misleading, not displaying physical addresses while
for some reason using "dma" to specify a variable in one case. Make it
print both types of addresses.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 095eb93a08..c02f499ac1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -298,7 +298,8 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 		goto err_alloc;
 	}
 
-	ahci_port_debug(ahci_port, "cmd_slot = 0x%x\n", (unsigned)ahci_port->cmd_slot);
+	ahci_port_debug(ahci_port, "cmd_slot = 0x%p (0x%pa)\n",
+			ahci_port->cmd_slot, ahci_port->cmd_slot_dma);
 
 	/*
 	 * Second item: Received-FIS area
@@ -321,7 +322,8 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 		goto err_alloc2;
 	}
 
-	ahci_port_debug(ahci_port, "cmd_tbl_dma = 0x%p\n", ahci_port->cmd_tbl);
+	ahci_port_debug(ahci_port, "cmd_tbl = 0x%p (0x%pa)\n",
+			ahci_port->cmd_tbl, ahci_port->cmd_tbl_dma);
 
 	ahci_port->cmd_tbl_sg = ahci_port->cmd_tbl + AHCI_CMD_TBL_HDR_SZ;
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 07/16] ata: ahci: correct named constants values and names
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (4 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 06/16] ata: ahci: adjust debug messages in ahci_init_port() Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 08/16] ata: ahci: properly fill scatter/gather table Denis Orlov
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

This gives more clear names to some of the macros that designate the
sizes of various memory structures and fixes a mistake in one of them.
The command table item was regarded as taking 32 bytes in size while
it is actually supposed to only take 16 bytes according to the spec.
This also changes a somewhat misleading comment that calls the command
list a command table. There is a cmt_tbl field that actually holds a
pointer to a different structure that is called a command table in the
specification, so it seems better to more clearly disambiguate them.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c |  6 +++---
 drivers/ata/ahci.h | 10 ++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index c02f499ac1..f7eb35c09d 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -288,10 +288,10 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	}
 
 	/*
-	 * First item in chunk of DMA memory: 32-slot command table,
+	 * First item in chunk of DMA memory: 32-slot command list,
 	 * 32 bytes each in size
 	 */
-	ahci_port->cmd_slot = dma_alloc_coherent(AHCI_CMD_SLOT_SZ * 32,
+	ahci_port->cmd_slot = dma_alloc_coherent(AHCI_CMD_LIST_SZ,
 						  &ahci_port->cmd_slot_dma);
 	if (!ahci_port->cmd_slot) {
 		ret = -ENOMEM;
@@ -419,7 +419,7 @@ err_alloc2:
 			  AHCI_RX_FIS_SZ);
 err_alloc1:
 	dma_free_coherent(ahci_port->cmd_slot, ahci_port->cmd_slot_dma,
-			  AHCI_CMD_SLOT_SZ * 32);
+			  AHCI_CMD_LIST_SZ);
 err_alloc:
 	return ret;
 }
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 3ca64c3d70..99c45f30fc 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -10,13 +10,15 @@
 #define AHCI_PCI_BAR		0x24
 #define AHCI_MAX_SG		56 /* hardware max is 64K */
 #define AHCI_CMD_SLOT_SZ	32
-#define AHCI_MAX_CMD_SLOT	32
+#define AHCI_MAX_CMDS		32
+#define AHCI_CMD_LIST_SZ	(AHCI_CMD_SLOT_SZ * AHCI_MAX_CMDS)
 #define AHCI_RX_FIS_SZ		256
 #define AHCI_CMD_TBL_HDR_SZ	0x80
 #define AHCI_CMD_TBL_CDB	0x40
-#define AHCI_CMD_TBL_SZ		AHCI_CMD_TBL_HDR_SZ + (AHCI_MAX_SG * 32)
-#define AHCI_PORT_PRIV_DMA_SZ	(AHCI_CMD_SLOT_SZ * AHCI_MAX_CMD_SLOT + \
-				AHCI_CMD_TBL_SZ	+ AHCI_RX_FIS_SZ)
+#define AHCI_CMD_TBL_ITM_SZ	16
+#define AHCI_CMD_TBL_SZ		(AHCI_CMD_TBL_HDR_SZ + (AHCI_MAX_SG * AHCI_CMD_TBL_ITM_SZ))
+#define AHCI_PORT_PRIV_DMA_SZ	(AHCI_CMD_LIST_SZ + AHCI_CMD_TBL_SZ + AHCI_RX_FIS_SZ)
+
 #define AHCI_CMD_ATAPI		(1 << 5)
 #define AHCI_CMD_WRITE		(1 << 6)
 #define AHCI_CMD_PREFETCH	(1 << 7)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 08/16] ata: ahci: properly fill scatter/gather table
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (5 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 07/16] ata: ahci: correct named constants values and names Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 09/16] ata: ahci: use named constants for capabilities bits Denis Orlov
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

We are supposed to populate a table, but instead we were just
overwriting the same entry over and over in a loop.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index f7eb35c09d..2d7b527755 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -139,6 +139,7 @@ static int ahci_fill_sg(struct ahci_port *ahci_port, const void *buf, int buf_le
 
 		buf_len -= now;
 		buf += now;
+		ahci_sg++;
 	}
 
 	return sg_count;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 09/16] ata: ahci: use named constants for capabilities bits
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (6 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 08/16] ata: ahci: properly fill scatter/gather table Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 10/16] ata: ahci: map buffers properly Denis Orlov
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 51 +++++++++++++++++++++++-----------------------
 drivers/ata/ahci.h | 30 +++++++++++++++++++++++----
 2 files changed, 52 insertions(+), 29 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 2d7b527755..1d8099c2ee 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -500,7 +500,7 @@ void ahci_print_info(struct ahci_device *ahci)
 	cap2 = ahci_ioread(ahci, HOST_CAP2);
 	impl = ahci->port_map;
 
-	speed = (cap >> 20) & 0xf;
+	speed = (cap & HOST_CAP_ISS) >> 20;
 	if (speed == 1)
 		speed_s = "1.5";
 	else if (speed == 2)
@@ -518,32 +518,33 @@ void ahci_print_info(struct ahci_device *ahci)
 	       (vers >> 16) & 0xff,
 	       (vers >> 8) & 0xff,
 	       vers & 0xff,
-	       ((cap >> 8) & 0x1f) + 1, (cap & 0x1f) + 1, speed_s, impl, scc_s);
+	       ((cap & HOST_CAP_NCS) >> 8) + 1,
+	       (cap & HOST_CAP_NP) + 1, speed_s, impl, scc_s);
 
 	printf("flags: "
 	       "%s%s%s%s%s%s%s"
 	       "%s%s%s%s%s%s%s"
 	       "%s%s%s%s%s%s\n",
-	       cap & (1 << 31) ? "64bit " : "",
-	       cap & (1 << 30) ? "ncq " : "",
-	       cap & (1 << 28) ? "ilck " : "",
-	       cap & (1 << 27) ? "stag " : "",
-	       cap & (1 << 26) ? "pm " : "",
-	       cap & (1 << 25) ? "led " : "",
-	       cap & (1 << 24) ? "clo " : "",
-	       cap & (1 << 19) ? "nz " : "",
-	       cap & (1 << 18) ? "only " : "",
-	       cap & (1 << 17) ? "pmp " : "",
-	       cap & (1 << 16) ? "fbss " : "",
-	       cap & (1 << 15) ? "pio " : "",
-	       cap & (1 << 14) ? "slum " : "",
-	       cap & (1 << 13) ? "part " : "",
-	       cap & (1 << 7) ? "ccc " : "",
-	       cap & (1 << 6) ? "ems " : "",
-	       cap & (1 << 5) ? "sxs " : "",
-	       cap2 & (1 << 2) ? "apst " : "",
-	       cap2 & (1 << 1) ? "nvmp " : "",
-	       cap2 & (1 << 0) ? "boh " : "");
+	       cap & HOST_CAP_64 ? "64bit " : "",
+	       cap & HOST_CAP_NCQ ? "ncq " : "",
+	       cap & HOST_CAP_SMPS ? "ilck " : "",
+	       cap & HOST_CAP_SSS ? "stag " : "",
+	       cap & HOST_CAP_ALPM ? "pm " : "",
+	       cap & HOST_CAP_LED ? "led " : "",
+	       cap & HOST_CAP_CLO ? "clo " : "",
+	       cap & HOST_CAP_RESERVED ? "nz " : "",
+	       cap & HOST_CAP_ONLY ? "only " : "",
+	       cap & HOST_CAP_SPM ? "pmp " : "",
+	       cap & HOST_CAP_FBS ? "fbss " : "",
+	       cap & HOST_CAP_PIO_MULTI ? "pio " : "",
+	       cap & HOST_CAP_SSC ? "slum " : "",
+	       cap & HOST_CAP_PART ? "part " : "",
+	       cap & HOST_CAP_CCC ? "ccc " : "",
+	       cap & HOST_CAP_EMS ? "ems " : "",
+	       cap & HOST_CAP_SXS ? "sxs " : "",
+	       cap2 & HOST_CAP2_APST ? "apst " : "",
+	       cap2 & HOST_CAP2_NVMHCI ? "nvmp " : "",
+	       cap2 & HOST_CAP2_BOH ? "boh " : "");
 }
 
 void ahci_info(struct device_d *dev)
@@ -583,8 +584,8 @@ int ahci_add_host(struct ahci_device *ahci)
 	ahci_debug(ahci, "ahci_host_init: start\n");
 
 	cap_save = ahci_ioread(ahci, HOST_CAP);
-	cap_save &= (HOST_SMPS | HOST_SPM);
-	cap_save |= HOST_SSS;  /* Staggered Spin-up. Not needed. */
+	cap_save &= (HOST_CAP_SMPS | HOST_CAP_SPM);
+	cap_save |= HOST_CAP_SSS;  /* Staggered Spin-up. Not needed. */
 
 	/* global controller reset */
 	tmp = ahci_ioread(ahci, HOST_CTL);
@@ -607,7 +608,7 @@ int ahci_add_host(struct ahci_device *ahci)
 
 	ahci->cap = ahci_ioread(ahci, HOST_CAP);
 	ahci->port_map = ahci_ioread(ahci, HOST_PORTS_IMPL);
-	ahci->n_ports = (ahci->cap & HOST_NP) + 1;
+	ahci->n_ports = (ahci->cap & HOST_CAP_NP) + 1;
 
 	ahci_debug(ahci, "cap 0x%x  port_map 0x%x  n_ports %d\n",
 	      ahci->cap, ahci->port_map, ahci->n_ports);
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 99c45f30fc..de404e2e16 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -36,10 +36,32 @@
 #define HOST_CAP2		0x24 /* host capabilities, extended */
 
 /* HOST_CAP bits */
-#define HOST_SMPS		(1 << 28)   /* supports mechanical presence switch */
-#define HOST_SSS		(1 << 27)   /* supports staggered spin-up */
-#define HOST_SPM		(1 << 17)   /* supports port multiplier */
-#define HOST_NP			(0x1f << 0) /* number of ports */
+#define HOST_CAP_64		(1 << 31)   /* PCI DAC (64-bit DMA) support */
+#define HOST_CAP_NCQ		(1 << 30)   /* Native Command Queueing */
+#define HOST_CAP_SNTF		(1 << 29)   /* SNotification register */
+#define HOST_CAP_SMPS		(1 << 28)   /* Supports mechanical presence switch */
+#define HOST_CAP_SSS		(1 << 27)   /* Supports staggered spin-up */
+#define HOST_CAP_ALPM		(1 << 26)   /* Aggressive Link PM support */
+#define HOST_CAP_LED		(1 << 25)   /* Supports activity LED */
+#define HOST_CAP_CLO		(1 << 24)   /* Command List Override support */
+#define HOST_CAP_ISS		(0xf << 20) /* Interface Speed Support */
+#define HOST_CAP_RESERVED	(1 << 19)   /* Reserved bit */
+#define HOST_CAP_ONLY		(1 << 18)   /* Supports AHCI mode only */
+#define HOST_CAP_SPM		(1 << 17)   /* Supports port multiplier */
+#define HOST_CAP_FBS		(1 << 16)   /* FIS-based switching support */
+#define HOST_CAP_PIO_MULTI	(1 << 15)   /* PIO multiple DRQ support */
+#define HOST_CAP_SSC		(1 << 14)   /* Slumber state capable */
+#define HOST_CAP_PART		(1 << 13)   /* Partial state capable */
+#define HOST_CAP_NCS		(0x1f << 8) /* Number of Command Slots */
+#define HOST_CAP_CCC		(1 << 7)    /* Command Completion Coalescing */
+#define HOST_CAP_EMS		(1 << 6)    /* Enclosure Management support */
+#define HOST_CAP_SXS		(1 << 5)    /* Supports External SATA */
+#define HOST_CAP_NP		(0x1f << 0) /* Number of ports */
+
+/* HOST_CAP2 bits */
+#define HOST_CAP2_APST		(1 << 2)    /* Automatic partial to slumber */
+#define HOST_CAP2_NVMHCI	(1 << 1)    /* NVMHCI supported */
+#define HOST_CAP2_BOH		(1 << 0)    /* BIOS/OS handoff supported */
 
 /* HOST_CTL bits */
 #define HOST_RESET		(1 << 0)  /* reset controller; self-clear */
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 10/16] ata: ahci: map buffers properly
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (7 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 09/16] ata: ahci: use named constants for capabilities bits Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 11/16] ata: ahci: use 64-bit addressing if available Denis Orlov
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Using dma_sync_single_for_*() does not make sense in there - we are
given a cpu side address of a buffer and need to actually map it for
the device.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 1d8099c2ee..ff9093c7b7 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -121,7 +121,7 @@ static void ahci_fill_cmd_slot(struct ahci_port *ahci_port, u32 opts)
 	ahci_port->cmd_slot->tbl_addr_hi = 0;
 }
 
-static int ahci_fill_sg(struct ahci_port *ahci_port, const void *buf, int buf_len)
+static int ahci_fill_sg(struct ahci_port *ahci_port, dma_addr_t buf_dma, int buf_len)
 {
 	struct ahci_sg *ahci_sg = ahci_port->cmd_tbl_sg;
 	u32 sg_count;
@@ -133,12 +133,12 @@ static int ahci_fill_sg(struct ahci_port *ahci_port, const void *buf, int buf_le
 	while (buf_len) {
 		unsigned int now = min(AHCI_MAX_DATA_BYTE_COUNT, buf_len);
 
-		ahci_sg->addr = cpu_to_le32((u32)buf);
+		ahci_sg->addr = cpu_to_le32(buf_dma);
 		ahci_sg->addr_hi = 0;
 		ahci_sg->flags_size = cpu_to_le32(now - 1);
 
 		buf_len -= now;
-		buf += now;
+		buf_dma += now;
 		ahci_sg++;
 	}
 
@@ -151,20 +151,26 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
 	u32 opts;
 	int sg_count;
 	int ret;
+	void *buf;
+	dma_addr_t buf_dma;
+	enum dma_data_direction dma_dir;
 
 	if (!ahci_link_ok(ahci_port, 1))
 		return -EIO;
 
-	if (wbuf)
-		dma_sync_single_for_device((unsigned long)wbuf, buf_len,
-					   DMA_TO_DEVICE);
-	if (rbuf)
-		dma_sync_single_for_device((unsigned long)rbuf, buf_len,
-					   DMA_FROM_DEVICE);
+	if (wbuf) {
+		buf = (void *)wbuf;
+		dma_dir = DMA_TO_DEVICE;
+	} else {
+		buf = rbuf;
+		dma_dir = DMA_FROM_DEVICE;
+	}
+
+	buf_dma = dma_map_single(ahci_port->ahci->dev, buf, buf_len, dma_dir);
 
 	memcpy((unsigned char *)ahci_port->cmd_tbl, fis, fis_len);
 
-	sg_count = ahci_fill_sg(ahci_port, rbuf ? rbuf : wbuf, buf_len);
+	sg_count = ahci_fill_sg(ahci_port, buf_dma, buf_len);
 	opts = (fis_len >> 2) | (sg_count << 16);
 	if (wbuf)
 		opts |= CMD_LIST_OPTS_WRITE;
@@ -174,17 +180,10 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
 
 	ret = wait_on_timeout(WAIT_DATAIO,
 			(ahci_port_read(ahci_port, PORT_CMD_ISSUE) & 0x1) == 0);
-	if (ret)
-		return -ETIMEDOUT;
 
-	if (wbuf)
-		dma_sync_single_for_cpu((unsigned long)wbuf, buf_len,
-					DMA_TO_DEVICE);
-	if (rbuf)
-		dma_sync_single_for_cpu((unsigned long)rbuf, buf_len,
-					DMA_FROM_DEVICE);
+	dma_unmap_single(ahci_port->ahci->dev, buf_dma, buf_len, dma_dir);
 
-	return 0;
+	return ret;
 }
 
 /*
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 11/16] ata: ahci: use 64-bit addressing if available
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (8 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 10/16] ata: ahci: map buffers properly Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 12/16] ata: ahci: make rx_fis field in ahci_port of type void* Denis Orlov
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 19 +++++++++++++------
 1 file 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
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 12/16] ata: ahci: make rx_fis field in ahci_port of type void*
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (9 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 11/16] ata: ahci: use 64-bit addressing if available Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 13/16] ata: ahci: add missing capability in ahci_print_info() Denis Orlov
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

It is supposed to represent a pointer so make it actually be one.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 5 ++---
 drivers/ata/ahci.h | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index d423da3a48..23085ebe09 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -307,8 +307,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	/*
 	 * Second item: Received-FIS area
 	 */
-	ahci_port->rx_fis = (unsigned long)dma_alloc_coherent(AHCI_RX_FIS_SZ,
-						&ahci_port->rx_fis_dma);
+	ahci_port->rx_fis = dma_alloc_coherent(AHCI_RX_FIS_SZ, &ahci_port->rx_fis_dma);
 	if (!ahci_port->rx_fis) {
 		ret = -ENOMEM;
 		goto err_alloc1;
@@ -422,7 +421,7 @@ err_init:
 	dma_free_coherent(ahci_port->cmd_tbl, ahci_port->cmd_tbl_dma,
 			  AHCI_CMD_TBL_SZ);
 err_alloc2:
-	dma_free_coherent((void *)ahci_port->rx_fis, ahci_port->rx_fis_dma,
+	dma_free_coherent(ahci_port->rx_fis, ahci_port->rx_fis_dma,
 			  AHCI_RX_FIS_SZ);
 err_alloc1:
 	dma_free_coherent(ahci_port->cmd_slot, ahci_port->cmd_slot_dma,
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index de404e2e16..77196592ed 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -179,7 +179,7 @@ struct ahci_port {
 	struct ahci_sg		*cmd_tbl_sg;
 	void			*cmd_tbl;
 	dma_addr_t		cmd_tbl_dma;
-	u32			rx_fis;
+	void			*rx_fis;
 	dma_addr_t		rx_fis_dma;
 };
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 13/16] ata: ahci: add missing capability in ahci_print_info()
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (10 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 12/16] ata: ahci: make rx_fis field in ahci_port of type void* Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 14/16] ata: ahci: remove redundant cast in ahci_io() Denis Orlov
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 23085ebe09..2d5adcfca9 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -532,6 +532,7 @@ void ahci_print_info(struct ahci_device *ahci)
 	       "%s%s%s%s%s%s\n",
 	       cap & HOST_CAP_64 ? "64bit " : "",
 	       cap & HOST_CAP_NCQ ? "ncq " : "",
+	       cap & HOST_CAP_SNTF ? "sntf " : "",
 	       cap & HOST_CAP_SMPS ? "ilck " : "",
 	       cap & HOST_CAP_SSS ? "stag " : "",
 	       cap & HOST_CAP_ALPM ? "pm " : "",
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 14/16] ata: ahci: remove redundant cast in ahci_io()
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (11 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 13/16] ata: ahci: add missing capability in ahci_print_info() Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 15/16] ata: ahci: register only implemented ports Denis Orlov
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 2d5adcfca9..f9056ff418 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -171,7 +171,7 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
 
 	buf_dma = dma_map_single(ahci_port->ahci->dev, buf, buf_len, dma_dir);
 
-	memcpy((unsigned char *)ahci_port->cmd_tbl, fis, fis_len);
+	memcpy(ahci_port->cmd_tbl, fis, fis_len);
 
 	sg_count = ahci_fill_sg(ahci_port, buf_dma, buf_len);
 	opts = (fis_len >> 2) | (sg_count << 16);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 15/16] ata: ahci: register only implemented ports
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (12 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 14/16] ata: ahci: remove redundant cast in ahci_io() Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-04  9:25 ` [PATCH 16/16] ata: ahci: allocate memory in one call in ahci_init_port() Denis Orlov
  2022-05-05  7:48 ` [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Sascha Hauer
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

The value from the "ports implemented" register should be kept in mind
when registering ports or detecting devices on them.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index f9056ff418..24098ada08 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -563,11 +563,15 @@ void ahci_info(struct device_d *dev)
 static int ahci_detect(struct device_d *dev)
 {
 	struct ahci_device *ahci = dev->priv;
+	int n_ports = max_t(int, ahci->n_ports, fls(ahci->port_map));
 	int i;
 
-	for (i = 0; i < ahci->n_ports; i++) {
+	for (i = 0; i < n_ports; i++) {
 		struct ahci_port *ahci_port = &ahci->ports[i];
 
+		if (!(ahci->port_map & (1 << i)))
+			continue;
+
 		ata_port_detect(&ahci_port->ata);
 	}
 
@@ -577,7 +581,7 @@ static int ahci_detect(struct device_d *dev)
 int ahci_add_host(struct ahci_device *ahci)
 {
 	u32 tmp, cap_save;
-	int i, ret;
+	int n_ports, i, ret;
 
 	ahci->host_flags = ATA_FLAG_SATA
 				| ATA_FLAG_NO_LEGACY
@@ -619,9 +623,14 @@ int ahci_add_host(struct ahci_device *ahci)
 	ahci_debug(ahci, "cap 0x%x  port_map 0x%x  n_ports %d\n",
 	      ahci->cap, ahci->port_map, ahci->n_ports);
 
-	for (i = 0; i < ahci->n_ports; i++) {
+	n_ports = max_t(int, ahci->n_ports, fls(ahci->port_map));
+
+	for (i = 0; i < n_ports; i++) {
 		struct ahci_port *ahci_port = &ahci->ports[i];
 
+		if (!(ahci->port_map & (1 << i)))
+			continue;
+
 		ahci_port->num = i;
 		ahci_port->ahci = ahci;
 		ahci_port->ata.dev = ahci->dev;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 16/16] ata: ahci: allocate memory in one call in ahci_init_port()
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (13 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 15/16] ata: ahci: register only implemented ports Denis Orlov
@ 2022-05-04  9:25 ` Denis Orlov
  2022-05-05  7:48 ` [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Sascha Hauer
  15 siblings, 0 replies; 17+ messages in thread
From: Denis Orlov @ 2022-05-04  9:25 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Memory allocated with dma_alloc_coherent() is aligned by page size.
Calling it multiple times leads to unnecessary fragmentation and
overhead considering that we are actually able to allocate all the
memory that we need at once by issuing only one call.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/ata/ahci.c | 40 ++++++++++++++--------------------------
 1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 24098ada08..f707efb50f 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -273,6 +273,8 @@ static int ahci_write(struct ata_port *ata, const void *buf, sector_t block,
 static int ahci_init_port(struct ahci_port *ahci_port)
 {
 	u32 val, cmd;
+	void *mem;
+	dma_addr_t mem_dma;
 	int ret;
 
 	/* make sure port is not active */
@@ -290,16 +292,17 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 		mdelay(500);
 	}
 
+	mem = dma_alloc_coherent(AHCI_PORT_PRIV_DMA_SZ, &mem_dma);
+	if (!mem) {
+		return -ENOMEM;
+	}
+
 	/*
 	 * First item in chunk of DMA memory: 32-slot command list,
 	 * 32 bytes each in size
 	 */
-	ahci_port->cmd_slot = dma_alloc_coherent(AHCI_CMD_LIST_SZ,
-						  &ahci_port->cmd_slot_dma);
-	if (!ahci_port->cmd_slot) {
-		ret = -ENOMEM;
-		goto err_alloc;
-	}
+	ahci_port->cmd_slot = mem;
+	ahci_port->cmd_slot_dma = mem_dma;
 
 	ahci_port_debug(ahci_port, "cmd_slot = 0x%p (0x%pa)\n",
 			ahci_port->cmd_slot, ahci_port->cmd_slot_dma);
@@ -307,22 +310,15 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	/*
 	 * Second item: Received-FIS area
 	 */
-	ahci_port->rx_fis = dma_alloc_coherent(AHCI_RX_FIS_SZ, &ahci_port->rx_fis_dma);
-	if (!ahci_port->rx_fis) {
-		ret = -ENOMEM;
-		goto err_alloc1;
-	}
+	ahci_port->rx_fis = mem + AHCI_CMD_SLOT_SZ;
+	ahci_port->rx_fis_dma = mem_dma + AHCI_CMD_SLOT_SZ;
 
 	/*
 	 * Third item: data area for storing a single command
 	 * and its scatter-gather table
 	 */
-	ahci_port->cmd_tbl = dma_alloc_coherent(AHCI_CMD_TBL_SZ,
-						 &ahci_port->cmd_tbl_dma);
-	if (!ahci_port->cmd_tbl) {
-		ret = -ENOMEM;
-		goto err_alloc2;
-	}
+	ahci_port->cmd_tbl = mem + AHCI_CMD_SLOT_SZ + AHCI_RX_FIS_SZ;
+	ahci_port->cmd_tbl_dma = mem_dma + AHCI_CMD_SLOT_SZ + AHCI_RX_FIS_SZ;
 
 	ahci_port_debug(ahci_port, "cmd_tbl = 0x%p (0x%pa)\n",
 			ahci_port->cmd_tbl, ahci_port->cmd_tbl_dma);
@@ -418,15 +414,7 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	ret = -ENODEV;
 
 err_init:
-	dma_free_coherent(ahci_port->cmd_tbl, ahci_port->cmd_tbl_dma,
-			  AHCI_CMD_TBL_SZ);
-err_alloc2:
-	dma_free_coherent(ahci_port->rx_fis, ahci_port->rx_fis_dma,
-			  AHCI_RX_FIS_SZ);
-err_alloc1:
-	dma_free_coherent(ahci_port->cmd_slot, ahci_port->cmd_slot_dma,
-			  AHCI_CMD_LIST_SZ);
-err_alloc:
+	dma_free_coherent(mem, mem_dma, AHCI_PORT_PRIV_DMA_SZ);
 	return ret;
 }
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly
  2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
                   ` (14 preceding siblings ...)
  2022-05-04  9:25 ` [PATCH 16/16] ata: ahci: allocate memory in one call in ahci_init_port() Denis Orlov
@ 2022-05-05  7:48 ` Sascha Hauer
  15 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2022-05-05  7:48 UTC (permalink / raw)
  To: Denis Orlov; +Cc: barebox

On Wed, May 04, 2022 at 12:25:38PM +0300, Denis Orlov wrote:
> Currently those are used in some routines side by side with underlying
> functions with no apparent reason for it. Make their usage uniform, this
> cleans up code a bit and allows to remove unneeded variables.
> 
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
>  drivers/ata/ahci.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)

Applied all, thanks

Sascha

> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 3c0b0a5450..ad9e2f950f 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -172,7 +172,7 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
>  	ahci_port_write_f(ahci_port, PORT_CMD_ISSUE, 1);
>  
>  	ret = wait_on_timeout(WAIT_DATAIO,
> -			(readl(ahci_port->port_mmio + PORT_CMD_ISSUE) & 0x1) == 0);
> +			(ahci_port_read(ahci_port, PORT_CMD_ISSUE) & 0x1) == 0);
>  	if (ret)
>  		return -ETIMEDOUT;
>  
> @@ -274,12 +274,9 @@ static int ahci_write(struct ata_port *ata, const void *buf, sector_t block,
>  
>  static int ahci_init_port(struct ahci_port *ahci_port)
>  {
> -	void __iomem *port_mmio;
>  	u32 val, cmd;
>  	int ret;
>  
> -	port_mmio = ahci_port->port_mmio;
> -
>  	/* make sure port is not active */
>  	val = ahci_port_read(ahci_port, PORT_CMD);
>  	if (val & (PORT_CMD_LIST_ON | PORT_CMD_FIS_ON | PORT_CMD_FIS_RX | PORT_CMD_START)) {
> @@ -375,16 +372,16 @@ static int ahci_init_port(struct ahci_port *ahci_port)
>  	ahci_port_info(ahci_port, "Spinning up device...\n");
>  
>  	ret = wait_on_timeout(WAIT_SPINUP,
> -			((readl(port_mmio + PORT_TFDATA) &
> +			((ahci_port_read(ahci_port, PORT_TFDATA) &
>  			 (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0)
> -			|| ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1));
> +			|| ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1));
>  	if (ret) {
>  		ahci_port_info(ahci_port, "timeout.\n");
>  		ret = -ENODEV;
>  		goto err_init;
>  	}
>  
> -	if ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1) {
> +	if ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1) {
>  		ahci_port_info(ahci_port, "down.\n");
>  		ret = -ENODEV;
>  		goto err_init;
> @@ -570,7 +567,6 @@ static int ahci_detect(struct device_d *dev)
>  
>  int ahci_add_host(struct ahci_device *ahci)
>  {
> -	u8 *mmio = (u8 *)ahci->mmio_base;
>  	u32 tmp, cap_save;
>  	int i, ret;
>  
> @@ -584,7 +580,7 @@ int ahci_add_host(struct ahci_device *ahci)
>  
>  	ahci_debug(ahci, "ahci_host_init: start\n");
>  
> -	cap_save = readl(mmio + HOST_CAP);
> +	cap_save = ahci_ioread(ahci, HOST_CAP);
>  	cap_save &= ((1 << 28) | (1 << 17));
>  	cap_save |= (1 << 27);  /* Staggered Spin-up. Not needed. */
>  
> @@ -597,7 +593,7 @@ int ahci_add_host(struct ahci_device *ahci)
>  	 * reset must complete within 1 second, or
>  	 * the hardware should be considered fried.
>  	 */
> -	ret = wait_on_timeout(SECOND, (readl(mmio + HOST_CTL) & HOST_RESET) == 0);
> +	ret = wait_on_timeout(SECOND, (ahci_ioread(ahci, HOST_CTL) & HOST_RESET) == 0);
>  	if (ret) {
>  		ahci_debug(ahci,"controller reset failed (0x%x)\n", tmp);
>  		return -ENODEV;
> @@ -620,7 +616,7 @@ int ahci_add_host(struct ahci_device *ahci)
>  		ahci_port->num = i;
>  		ahci_port->ahci = ahci;
>  		ahci_port->ata.dev = ahci->dev;
> -		ahci_port->port_mmio = ahci_port_base(mmio, i);
> +		ahci_port->port_mmio = ahci_port_base(ahci->mmio_base, i);
>  		ahci_port->ata.ops = &ahci_ops;
>  		ata_port_register(&ahci_port->ata);
>  	}
> -- 
> 2.20.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-05-05  7:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04  9:25 [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Denis Orlov
2022-05-04  9:25 ` [PATCH 02/16] ata: ahci: replace magic numbers with named constants Denis Orlov
2022-05-04  9:25 ` [PATCH 03/16] ata: ahci: fix missing whitespace in ahci_add_host() Denis Orlov
2022-05-04  9:25 ` [PATCH 04/16] ata: ahci: simplify fis structure creation Denis Orlov
2022-05-04  9:25 ` [PATCH 05/16] ata: ahci: do not ignore dma handles Denis Orlov
2022-05-04  9:25 ` [PATCH 06/16] ata: ahci: adjust debug messages in ahci_init_port() Denis Orlov
2022-05-04  9:25 ` [PATCH 07/16] ata: ahci: correct named constants values and names Denis Orlov
2022-05-04  9:25 ` [PATCH 08/16] ata: ahci: properly fill scatter/gather table Denis Orlov
2022-05-04  9:25 ` [PATCH 09/16] ata: ahci: use named constants for capabilities bits Denis Orlov
2022-05-04  9:25 ` [PATCH 10/16] ata: ahci: map buffers properly Denis Orlov
2022-05-04  9:25 ` [PATCH 11/16] ata: ahci: use 64-bit addressing if available Denis Orlov
2022-05-04  9:25 ` [PATCH 12/16] ata: ahci: make rx_fis field in ahci_port of type void* Denis Orlov
2022-05-04  9:25 ` [PATCH 13/16] ata: ahci: add missing capability in ahci_print_info() Denis Orlov
2022-05-04  9:25 ` [PATCH 14/16] ata: ahci: remove redundant cast in ahci_io() Denis Orlov
2022-05-04  9:25 ` [PATCH 15/16] ata: ahci: register only implemented ports Denis Orlov
2022-05-04  9:25 ` [PATCH 16/16] ata: ahci: allocate memory in one call in ahci_init_port() Denis Orlov
2022-05-05  7:48 ` [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git