Module Name:    src
Committed By:   mrg
Date:           Tue Feb  6 23:57:41 UTC 2024

Modified Files:
        src/sys/dev/usb: ehci.c ehcireg.h

Log Message:
avoid different struct type problem.


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/ehcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.321 src/sys/dev/usb/ehci.c:1.322
--- src/sys/dev/usb/ehci.c:1.321	Mon Feb  5 23:04:18 2024
+++ src/sys/dev/usb/ehci.c	Tue Feb  6 23:57:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.321 2024/02/05 23:04:18 jmcneill Exp $ */
+/*	$NetBSD: ehci.c,v 1.322 2024/02/06 23:57:41 mrg Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.321 2024/02/05 23:04:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.322 2024/02/06 23:57:41 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -294,6 +294,7 @@ void			ehci_dump(void);
 Static void		ehci_dump_regs(ehci_softc_t *);
 Static void		ehci_dump_sqtds(ehci_soft_qtd_t *);
 Static void		ehci_dump_sqtd(ehci_soft_qtd_t *);
+Static void		ehci_dump_qh_qtd(struct ehci_qh_qtd_t *);
 Static void		ehci_dump_qtd(ehci_qtd_t *);
 Static void		ehci_dump_sqh(ehci_soft_qh_t *);
 Static void		ehci_dump_sitd(struct ehci_soft_itd *);
@@ -1755,6 +1756,24 @@ ehci_dump_sqtd(ehci_soft_qtd_t *sqtd)
 }
 
 Static void
+ehci_dump_qh_qtd(struct ehci_qh_qtd_t *qh_qtd)
+{
+	ehci_qtd_t qtd = {
+		.qtd_next = qh_qtd->qtd_next,
+		.qtd_altnext = qh_qtd->qtd_altnext,
+		.qtd_status = qh_qtd->qtd_status,
+	};
+
+	/* Manually memcpy(), because of volatile. */
+	for (unsigned i = 0; i < EHCI_QTD_NBUFFERS; i++) {
+		qtd.qtd_buffer[i] = qh_qtd->qtd_buffer[i];
+		qtd.qtd_buffer_hi[i] = qh_qtd->qtd_buffer_hi[i];
+	}
+
+	ehci_dump_qtd(&qtd);
+}
+
+Static void
 ehci_dump_qtd(ehci_qtd_t *qtd)
 {
 	EHCIHIST_FUNC();	EHCIHIST_CALLED();
@@ -1830,7 +1849,7 @@ ehci_dump_sqh(ehci_soft_qh_t *sqh)
 	link = le32toh(qh->qh_curqtd);
 	ehci_dump_link(link, false);
 	DPRINTFN(10, "Overlay qTD:", 0, 0, 0, 0);
-	ehci_dump_qtd(&qh->qh_qtd);
+	ehci_dump_qh_qtd(&qh->qh_qtd);
 
 	usb_syncmem(&sqh->dma, sqh->offs, sizeof(sqh->qh),
 	    BUS_DMASYNC_PREREAD);

Index: src/sys/dev/usb/ehcireg.h
diff -u src/sys/dev/usb/ehcireg.h:1.38 src/sys/dev/usb/ehcireg.h:1.39
--- src/sys/dev/usb/ehcireg.h:1.38	Mon Feb  5 23:07:42 2024
+++ src/sys/dev/usb/ehcireg.h	Tue Feb  6 23:57:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcireg.h,v 1.38 2024/02/05 23:07:42 jmcneill Exp $	*/
+/*	$NetBSD: ehcireg.h,v 1.39 2024/02/06 23:57:41 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -394,7 +394,7 @@ typedef struct {
 	 * 32-byte aligned, so declare the fields instead of embedding
 	 * a ehci_qtd_t directly.
 	 */
-	struct {
+	struct ehci_qh_qtd_t {
 		volatile ehci_link_t	qtd_next;
 		volatile ehci_link_t	qtd_altnext;
 		volatile uint32_t	qtd_status;

Reply via email to