From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Kane Chen" <kane_chen@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: Jamin Lin <jamin_lin@aspeedtech.com>, Troy Lee <troy_lee@aspeedtech.com>
Subject: [PATCH v1 12/19] hw/usb/aspeed-udc: Rename the transfer helpers after their DMA mode
Date: Tue, 22 Sep 2026 09:02:10 +0000 [thread overview]
Message-ID: <20260922090154.1792077-13-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260922090154.1792077-1-jamin_lin@aspeedtech.com>
The controller can run an endpoint in descriptor list mode or in single
stage mode. Put the mode in the helper names. That makes the code
easier to read.
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
hw/usb/aspeed-udc.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/hw/usb/aspeed-udc.c b/hw/usb/aspeed-udc.c
index bdbd1a78b8..b43f077c2d 100644
--- a/hw/usb/aspeed-udc.c
+++ b/hw/usb/aspeed-udc.c
@@ -459,8 +459,8 @@ static bool aspeed_udc_ep_copy_to_pkt(AspeedUDCState *s, int ep, uint32_t addr,
* This function raises the endpoint ACK by itself when the ring becomes empty
* or when a descriptor asks for an interrupt.
*/
-static AspeedUDCXferResult aspeed_udc_ep_xfer_in(AspeedUDCState *s, int ep,
- USBPacket *p)
+static AspeedUDCXferResult aspeed_udc_ep_xfer_in_desc(AspeedUDCState *s,
+ int ep, USBPacket *p)
{
QEMUIOVector *pktiov = p->combined ? &p->combined->iov : &p->iov;
AspeedUDCEP *e = &s->ep[ep];
@@ -568,15 +568,15 @@ static AspeedUDCXferResult aspeed_udc_ep_xfer_in(AspeedUDCState *s, int ep,
/*
* OUT transfer: receive data from the host by copying its OUT packet into the
- * buffer the guest gadget driver set up (single-stage mode).
+ * buffer the guest gadget driver set up.
*
* A host packet can be bigger than one buffer, so we copy at most PKT_SIZE
* bytes per call, continuing from where the last call stopped
* (p->actual_length). The caller keeps the packet parked until it is fully
* copied.
*/
-static AspeedUDCXferResult aspeed_udc_ep_xfer_out(AspeedUDCState *s, int ep,
- USBPacket *p)
+static AspeedUDCXferResult aspeed_udc_ep_xfer_out_single(AspeedUDCState *s,
+ int ep, USBPacket *p)
{
AspeedUDCEP *e = &s->ep[ep];
uint32_t chunk = FIELD_EX32(e->regs[R_EP_DMA_STS], EP_DMA_STS, PKT_SIZE);
@@ -619,7 +619,7 @@ static AspeedUDCXferResult aspeed_udc_ep_xfer_out(AspeedUDCState *s, int ep,
* If the request needs more data than was queued, keep it parked and wait for
* the next kick.
*/
-static void aspeed_udc_ep_in_kick(AspeedUDCState *s, int ep, uint32_t val)
+static void aspeed_udc_ep_in_kick_desc(AspeedUDCState *s, int ep, uint32_t val)
{
AspeedUDCEP *e = &s->ep[ep];
uint32_t cur_rptr = FIELD_EX32(e->regs[R_EP_DMA_STS], EP_DMA_STS, RPTR);
@@ -649,7 +649,7 @@ static void aspeed_udc_ep_in_kick(AspeedUDCState *s, int ep, uint32_t val)
return;
}
- switch (aspeed_udc_ep_xfer_in(s, ep, p)) {
+ switch (aspeed_udc_ep_xfer_in_desc(s, ep, p)) {
case ASPEED_UDC_XFER_DONE:
e->pkt = NULL;
p->status = USB_RET_SUCCESS;
@@ -671,7 +671,7 @@ static void aspeed_udc_ep_in_kick(AspeedUDCState *s, int ep, uint32_t val)
* buffer before), copy its data into the buffer now and finish it. If the
* packet has more data than fits, keep it parked and wait for the next buffer.
*/
-static void aspeed_udc_ep_out_kick(AspeedUDCState *s, int ep)
+static void aspeed_udc_ep_out_kick_single(AspeedUDCState *s, int ep)
{
AspeedUDCEP *e = &s->ep[ep];
USBPacket *p = e->pkt;
@@ -681,7 +681,7 @@ static void aspeed_udc_ep_out_kick(AspeedUDCState *s, int ep)
return;
}
- switch (aspeed_udc_ep_xfer_out(s, ep, p)) {
+ switch (aspeed_udc_ep_xfer_out_single(s, ep, p)) {
case ASPEED_UDC_XFER_DONE:
e->pkt = NULL;
p->status = USB_RET_SUCCESS;
@@ -727,11 +727,11 @@ static void aspeed_udc_ep_write(void *opaque, hwaddr offset, uint64_t data,
val &= 0x77ffffff;
if (FIELD_EX32(e->regs[R_EP_DMA_CTRL], EP_DMA_CTRL, DESC_OP_EN)) {
/* IN, descriptor-list mode */
- aspeed_udc_ep_in_kick(s, e->index, val);
+ aspeed_udc_ep_in_kick_desc(s, e->index, val);
} else {
/* OUT, single-stage mode */
e->regs[reg] = val;
- aspeed_udc_ep_out_kick(s, e->index);
+ aspeed_udc_ep_out_kick_single(s, e->index);
}
break;
default:
@@ -895,7 +895,7 @@ static void aspeed_udc_ep_data_in(AspeedUDCState *s, int ep, USBPacket *p)
/*
* No IN data is queued yet. Save the packet and return ASYNC
* instead of NAK. A NAK would make the host retry slowly.
- * aspeed_udc_ep_in_kick() serves and completes this packet later,
+ * aspeed_udc_ep_in_kick_desc() serves and completes this packet later,
* once the guest gadget driver queues descriptors.
*/
e->pkt = p;
@@ -903,7 +903,7 @@ static void aspeed_udc_ep_data_in(AspeedUDCState *s, int ep, USBPacket *p)
return;
}
- switch (aspeed_udc_ep_xfer_in(s, ep, p)) {
+ switch (aspeed_udc_ep_xfer_in_desc(s, ep, p)) {
case ASPEED_UDC_XFER_DONE:
p->status = USB_RET_SUCCESS;
break;
@@ -931,7 +931,7 @@ static void aspeed_udc_ep_data_out(AspeedUDCState *s, int ep, USBPacket *p)
* No OUT buffer is ready yet. Save the packet and return ASYNC
* instead of NAK. Writing now could use an old buffer address and
* lose the data (for example a mass-storage CBW). A NAK would make
- * the host retry slowly. aspeed_udc_ep_out_kick() delivers this
+ * the host retry slowly. aspeed_udc_ep_out_kick_single() delivers this
* packet later, once the guest gadget driver sets up a buffer.
*/
e->pkt = p;
@@ -939,7 +939,7 @@ static void aspeed_udc_ep_data_out(AspeedUDCState *s, int ep, USBPacket *p)
return;
}
- switch (aspeed_udc_ep_xfer_out(s, ep, p)) {
+ switch (aspeed_udc_ep_xfer_out_single(s, ep, p)) {
case ASPEED_UDC_XFER_DONE:
p->status = USB_RET_SUCCESS;
break;
--
2.53.0
next prev parent reply other threads:[~2026-09-22 9:06 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 9:01 [PATCH v1 00/19] hw/usb: Add a usbredir server transport and AST1030 UDC support Jamin Lin
2026-09-22 9:01 ` [PATCH v1 01/19] hw/usb/bus: Let a bus opt out of automatic hub insertion Jamin Lin
2026-09-22 9:01 ` [PATCH v1 02/19] hw/usb/redirect-server: Add a usbredir server device Jamin Lin
2026-09-22 9:01 ` [PATCH v1 03/19] hw/usb/redirect-server: Connect usbredirparser to a chardev Jamin Lin
2026-09-22 9:02 ` [PATCH v1 04/19] hw/usb/redirect-server: Announce the exported device Jamin Lin
2026-09-22 9:02 ` [PATCH v1 05/19] hw/usb/redirect-server: Implement control transfers Jamin Lin
2026-09-22 9:02 ` [PATCH v1 06/19] hw/usb/redirect-server: Implement bulk and interrupt transfers Jamin Lin
2026-09-22 9:02 ` [PATCH v1 07/19] hw/usb/redirect-server: Stream interrupt IN endpoints Jamin Lin
2026-09-22 9:02 ` [PATCH v1 08/19] hw/arm/aspeed: Enable the usbredir server transport Jamin Lin
2026-09-22 9:02 ` [PATCH v1 09/19] hw/usb/aspeed-udc: Make the SETUP buffer byte addressable Jamin Lin
2026-09-22 9:02 ` [PATCH v1 10/19] hw/usb/aspeed-udc: Mask the reserved bits on register writes Jamin Lin
2026-09-22 9:02 ` [PATCH v1 11/19] hw/usb/aspeed-udc: Clear EP_POOL_ACK when no endpoint ack is left Jamin Lin
2026-09-22 9:02 ` Jamin Lin [this message]
2026-09-22 9:02 ` [PATCH v1 13/19] hw/usb/aspeed-udc: Store the EP_DMA_STS write first Jamin Lin
2026-09-22 9:02 ` [PATCH v1 14/19] hw/usb/aspeed-udc: Pick the EP_DMA_STS path by direction Jamin Lin
2026-09-22 9:02 ` [PATCH v1 15/19] hw/usb/aspeed-udc: Support single-stage IN transfers Jamin Lin
2026-09-22 9:02 ` [PATCH v1 16/19] hw/usb/aspeed-udc: Use the endpoint max packet size for OUT transfers Jamin Lin
2026-09-22 9:02 ` [PATCH v1 17/19] hw/usb/aspeed-udc: Add trace events for the transfer paths Jamin Lin
2026-09-22 9:02 ` [PATCH v1 18/19] hw/arm/aspeed_ast10x0: Add the USB device controller Jamin Lin
2026-09-22 9:02 ` [PATCH v1 19/19] tests/functional/arm/test_aspeed_ast1030: Test the usbredir server transport Jamin Lin
2026-09-30 7:48 ` [PATCH v1 00/19] hw/usb: Add a usbredir server transport and AST1030 UDC support Jamin Lin
2026-09-30 7:59 ` Cédric Le Goater
2026-09-30 8:05 ` Jamin Lin
2026-09-30 8:22 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260922090154.1792077-13-jamin_lin@aspeedtech.com \
--to=jamin_lin@aspeedtech.com \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.