Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115615754
D37408.id113265.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37408.id113265.diff
View Options
diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c
--- a/usr.sbin/bhyve/pci_xhci.c
+++ b/usr.sbin/bhyve/pci_xhci.c
@@ -568,6 +568,10 @@
*/
p->porthlpmc = value;
break;
+ default:
+ DPRINTF(("pci_xhci: unaligned portreg write offset %#lx",
+ offset));
+ break;
}
}
@@ -2129,12 +2133,13 @@
{
struct pci_xhci_portregs *portregs;
int port;
- uint32_t *p;
+ uint32_t reg;
if (sc->portregs == NULL)
return (0);
- port = (offset - 0x3F0) / 0x10;
+ port = (offset - XHCI_PORTREGS_PORT0) / XHCI_PORTREGS_SETSZ;
+ offset = (offset - XHCI_PORTREGS_PORT0) % XHCI_PORTREGS_SETSZ;
if (port > XHCI_MAX_DEVS) {
DPRINTF(("pci_xhci: portregs_read port %d >= XHCI_MAX_DEVS",
@@ -2144,16 +2149,31 @@
return (XHCI_PS_SPEED_SET(3));
}
- offset = (offset - 0x3F0) % 0x10;
-
portregs = XHCI_PORTREG_PTR(sc, port);
- p = &portregs->portsc;
- p += offset / sizeof(uint32_t);
+ switch (offset) {
+ case 0:
+ reg = portregs->portsc;
+ break;
+ case 4:
+ reg = portregs->portpmsc;
+ break;
+ case 8:
+ reg = portregs->portli;
+ break;
+ case 12:
+ reg = portregs->porthlpmc;
+ break;
+ default:
+ DPRINTF(("pci_xhci: unaligned portregs read offset %#lx",
+ offset));
+ reg = 0xffffffff;
+ break;
+ }
DPRINTF(("pci_xhci: portregs read offset 0x%lx port %u -> 0x%x",
- offset, port, *p));
+ offset, port, reg));
- return (*p);
+ return (reg);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 1:15 AM (16 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17811581
Default Alt Text
D37408.id113265.diff (1 KB)
Attached To
Mode
D37408: bhyve: Avoid using a packed struct for xhci port registers
Attached
Detach File
Event Timeline
Log In to Comment