usbuhci, usbehci: remove portlck qlock

Everything is already serialized by usbd. For ehci, portlck
also doubled for waiting for doorbell, so rename it to match
its use case.
This commit is contained in:
cinap_lenrek 2024-12-29 17:09:51 +00:00
parent 68c89f4a43
commit 5ea80693ba
6 changed files with 6 additions and 21 deletions

View file

@ -167,7 +167,7 @@ struct Ctlr
{
Rendez; /* for waiting to async advance doorbell */
Lock; /* for ilock. qh lists and basic ctlr I/O */
QLock portlck; /* for port resets/enable... (and doorbell) */
QLock doorbell; /* for doorbell */
int active; /* in use or not */
Ecapio* capio; /* Capability i/o regs */
Eopio* opio; /* Operational i/o regs */

View file

@ -145,7 +145,7 @@ struct Ctlr
{
Rendez; /* for waiting to async advance doorbell */
Lock; /* for ilock. qh lists and basic ctlr I/O */
QLock portlck; /* for port resets/enable... (and doorbell) */
QLock doorbell; /* for doorbell */
int active; /* in use or not */
Ecapio* capio; /* Capability i/o regs */
Eopio* opio; /* Operational i/o regs */

View file

@ -168,7 +168,7 @@ struct Ctlr
{
Rendez; /* for waiting to async advance doorbell */
Lock; /* for ilock. qh lists and basic ctlr I/O */
QLock portlck; /* for port resets/enable... (and doorbell) */
QLock doorbell; /* for doorbell */
int active; /* in use or not */
Ctlr* next;
uvlong base;

View file

@ -141,7 +141,6 @@ enum
struct Ctlr
{
Lock; /* for ilock. qh lists and basic ctlr I/O */
QLock portlck; /* for port resets/enable... */
Pcidev* pcidev;
Ctlr *next;
int active;
@ -2030,7 +2029,6 @@ portenable(Hci *hp, int port, int on)
ctlr = hp->aux;
ioport = PORT(port-1);
eqlock(&ctlr->portlck);
ilock(ctlr);
s = INS(ioport);
if(on)
@ -2038,7 +2036,6 @@ portenable(Hci *hp, int port, int on)
else
OUTS(ioport, s & ~PSenable);
iunlock(ctlr);
qunlock(&ctlr->portlck);
}
static void
@ -2049,14 +2046,12 @@ portreset(Hci *hp, int port, int on)
ctlr = hp->aux;
ioport = PORT(port-1);
eqlock(&ctlr->portlck);
ilock(ctlr);
if(on)
OUTS(ioport, PSreset);
else
OUTS(ioport, INS(ioport) & ~PSreset);
iunlock(ctlr);
qunlock(&ctlr->portlck);
}
static int
@ -2067,7 +2062,6 @@ portstatus(Hci *hp, int port)
ctlr = hp->aux;
ioport = PORT(port-1);
eqlock(&ctlr->portlck);
ilock(ctlr);
s = INS(ioport);
if(s & (PSstatuschg | PSchange)){
@ -2075,7 +2069,6 @@ portstatus(Hci *hp, int port)
ddprint("uhci %#ux port %d status %#x\n", ctlr->port, port, s);
}
iunlock(ctlr);
qunlock(&ctlr->portlck);
/*
* We must return status bits as a

View file

@ -738,7 +738,7 @@ qhcoherency(Ctlr *ctlr)
{
int i;
qlock(&ctlr->portlck);
qlock(&ctlr->doorbell);
ctlr->opio->cmd |= Ciasync; /* ask for intr. on async advance */
coherence();
for(i = 0; i < 3 && qhadvanced(ctlr) == 0; i++){
@ -751,7 +751,7 @@ qhcoherency(Ctlr *ctlr)
if(i == 3)
print("ehci: async advance doorbell did not ring\n");
ctlr->opio->cmd &= ~Ciasync; /* try to clean */
qunlock(&ctlr->portlck);
qunlock(&ctlr->doorbell);
}
static void
@ -1657,7 +1657,6 @@ portpower(Hci *hp, int port, int on)
ctlr = hp->aux;
opio = ctlr->opio;
eqlock(&ctlr->portlck);
ilock(ctlr);
s = opio->portsc[port-1] & ~(Pschange|Psstatuschg);
if(on)
@ -1666,7 +1665,6 @@ portpower(Hci *hp, int port, int on)
s &= ~Pspower;
opio->portsc[port-1] = s;
iunlock(ctlr);
qunlock(&ctlr->portlck);
}
static void
@ -1678,7 +1676,6 @@ portenable(Hci *hp, int port, int on)
ctlr = hp->aux;
opio = ctlr->opio;
eqlock(&ctlr->portlck);
ilock(ctlr);
s = opio->portsc[port-1];
if(s & (Psstatuschg | Pschange))
@ -1691,7 +1688,6 @@ portenable(Hci *hp, int port, int on)
opio->portsc[port-1] &= ~Psenable;
}
iunlock(ctlr);
qunlock(&ctlr->portlck);
}
static void
@ -1702,14 +1698,12 @@ portreset(Hci *hp, int port, int on)
ctlr = hp->aux;
opio = ctlr->opio;
eqlock(&ctlr->portlck);
ilock(ctlr);
if(on)
opio->portsc[port-1] = (opio->portsc[port-1] & ~Psenable) | Psreset; /* initiate reset */
else
opio->portsc[port-1] &= ~Psreset; /* terminate reset */
iunlock(ctlr);
qunlock(&ctlr->portlck);
}
static int
@ -1721,7 +1715,6 @@ portstatus(Hci *hp, int port)
ctlr = hp->aux;
opio = ctlr->opio;
eqlock(&ctlr->portlck);
ilock(ctlr);
s = opio->portsc[port-1];
if(s & (Psstatuschg | Pschange))
@ -1735,7 +1728,6 @@ portstatus(Hci *hp, int port)
s &= ~Pspresent; /* not for us this time */
}
iunlock(ctlr);
qunlock(&ctlr->portlck);
/*
* We must return status bits as a

View file

@ -122,7 +122,7 @@ struct Ctlr
{
Rendez; /* for waiting to async advance doorbell */
Lock; /* for ilock. qh lists and basic ctlr I/O */
QLock portlck; /* for port resets/enable... (and doorbell) */
QLock doorbell; /* for doorbell */
int active; /* in use or not */
void* capio; /* base address for debug info */
Eopio* opio; /* Operational i/o regs */