mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
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:
parent
68c89f4a43
commit
5ea80693ba
6 changed files with 6 additions and 21 deletions
|
@ -167,7 +167,7 @@ struct Ctlr
|
||||||
{
|
{
|
||||||
Rendez; /* for waiting to async advance doorbell */
|
Rendez; /* for waiting to async advance doorbell */
|
||||||
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
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 */
|
int active; /* in use or not */
|
||||||
Ecapio* capio; /* Capability i/o regs */
|
Ecapio* capio; /* Capability i/o regs */
|
||||||
Eopio* opio; /* Operational i/o regs */
|
Eopio* opio; /* Operational i/o regs */
|
||||||
|
|
|
@ -145,7 +145,7 @@ struct Ctlr
|
||||||
{
|
{
|
||||||
Rendez; /* for waiting to async advance doorbell */
|
Rendez; /* for waiting to async advance doorbell */
|
||||||
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
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 */
|
int active; /* in use or not */
|
||||||
Ecapio* capio; /* Capability i/o regs */
|
Ecapio* capio; /* Capability i/o regs */
|
||||||
Eopio* opio; /* Operational i/o regs */
|
Eopio* opio; /* Operational i/o regs */
|
||||||
|
|
|
@ -168,7 +168,7 @@ struct Ctlr
|
||||||
{
|
{
|
||||||
Rendez; /* for waiting to async advance doorbell */
|
Rendez; /* for waiting to async advance doorbell */
|
||||||
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
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 */
|
int active; /* in use or not */
|
||||||
Ctlr* next;
|
Ctlr* next;
|
||||||
uvlong base;
|
uvlong base;
|
||||||
|
|
|
@ -141,7 +141,6 @@ enum
|
||||||
struct Ctlr
|
struct Ctlr
|
||||||
{
|
{
|
||||||
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
||||||
QLock portlck; /* for port resets/enable... */
|
|
||||||
Pcidev* pcidev;
|
Pcidev* pcidev;
|
||||||
Ctlr *next;
|
Ctlr *next;
|
||||||
int active;
|
int active;
|
||||||
|
@ -2030,7 +2029,6 @@ portenable(Hci *hp, int port, int on)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
ioport = PORT(port-1);
|
ioport = PORT(port-1);
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
s = INS(ioport);
|
s = INS(ioport);
|
||||||
if(on)
|
if(on)
|
||||||
|
@ -2038,7 +2036,6 @@ portenable(Hci *hp, int port, int on)
|
||||||
else
|
else
|
||||||
OUTS(ioport, s & ~PSenable);
|
OUTS(ioport, s & ~PSenable);
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2049,14 +2046,12 @@ portreset(Hci *hp, int port, int on)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
ioport = PORT(port-1);
|
ioport = PORT(port-1);
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
if(on)
|
if(on)
|
||||||
OUTS(ioport, PSreset);
|
OUTS(ioport, PSreset);
|
||||||
else
|
else
|
||||||
OUTS(ioport, INS(ioport) & ~PSreset);
|
OUTS(ioport, INS(ioport) & ~PSreset);
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2067,7 +2062,6 @@ portstatus(Hci *hp, int port)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
ioport = PORT(port-1);
|
ioport = PORT(port-1);
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
s = INS(ioport);
|
s = INS(ioport);
|
||||||
if(s & (PSstatuschg | PSchange)){
|
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);
|
ddprint("uhci %#ux port %d status %#x\n", ctlr->port, port, s);
|
||||||
}
|
}
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must return status bits as a
|
* We must return status bits as a
|
||||||
|
|
|
@ -738,7 +738,7 @@ qhcoherency(Ctlr *ctlr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
qlock(&ctlr->portlck);
|
qlock(&ctlr->doorbell);
|
||||||
ctlr->opio->cmd |= Ciasync; /* ask for intr. on async advance */
|
ctlr->opio->cmd |= Ciasync; /* ask for intr. on async advance */
|
||||||
coherence();
|
coherence();
|
||||||
for(i = 0; i < 3 && qhadvanced(ctlr) == 0; i++){
|
for(i = 0; i < 3 && qhadvanced(ctlr) == 0; i++){
|
||||||
|
@ -751,7 +751,7 @@ qhcoherency(Ctlr *ctlr)
|
||||||
if(i == 3)
|
if(i == 3)
|
||||||
print("ehci: async advance doorbell did not ring\n");
|
print("ehci: async advance doorbell did not ring\n");
|
||||||
ctlr->opio->cmd &= ~Ciasync; /* try to clean */
|
ctlr->opio->cmd &= ~Ciasync; /* try to clean */
|
||||||
qunlock(&ctlr->portlck);
|
qunlock(&ctlr->doorbell);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1657,7 +1657,6 @@ portpower(Hci *hp, int port, int on)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
opio = ctlr->opio;
|
opio = ctlr->opio;
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
s = opio->portsc[port-1] & ~(Pschange|Psstatuschg);
|
s = opio->portsc[port-1] & ~(Pschange|Psstatuschg);
|
||||||
if(on)
|
if(on)
|
||||||
|
@ -1666,7 +1665,6 @@ portpower(Hci *hp, int port, int on)
|
||||||
s &= ~Pspower;
|
s &= ~Pspower;
|
||||||
opio->portsc[port-1] = s;
|
opio->portsc[port-1] = s;
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1678,7 +1676,6 @@ portenable(Hci *hp, int port, int on)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
opio = ctlr->opio;
|
opio = ctlr->opio;
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
s = opio->portsc[port-1];
|
s = opio->portsc[port-1];
|
||||||
if(s & (Psstatuschg | Pschange))
|
if(s & (Psstatuschg | Pschange))
|
||||||
|
@ -1691,7 +1688,6 @@ portenable(Hci *hp, int port, int on)
|
||||||
opio->portsc[port-1] &= ~Psenable;
|
opio->portsc[port-1] &= ~Psenable;
|
||||||
}
|
}
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1702,14 +1698,12 @@ portreset(Hci *hp, int port, int on)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
opio = ctlr->opio;
|
opio = ctlr->opio;
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
if(on)
|
if(on)
|
||||||
opio->portsc[port-1] = (opio->portsc[port-1] & ~Psenable) | Psreset; /* initiate reset */
|
opio->portsc[port-1] = (opio->portsc[port-1] & ~Psenable) | Psreset; /* initiate reset */
|
||||||
else
|
else
|
||||||
opio->portsc[port-1] &= ~Psreset; /* terminate reset */
|
opio->portsc[port-1] &= ~Psreset; /* terminate reset */
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1721,7 +1715,6 @@ portstatus(Hci *hp, int port)
|
||||||
|
|
||||||
ctlr = hp->aux;
|
ctlr = hp->aux;
|
||||||
opio = ctlr->opio;
|
opio = ctlr->opio;
|
||||||
eqlock(&ctlr->portlck);
|
|
||||||
ilock(ctlr);
|
ilock(ctlr);
|
||||||
s = opio->portsc[port-1];
|
s = opio->portsc[port-1];
|
||||||
if(s & (Psstatuschg | Pschange))
|
if(s & (Psstatuschg | Pschange))
|
||||||
|
@ -1735,7 +1728,6 @@ portstatus(Hci *hp, int port)
|
||||||
s &= ~Pspresent; /* not for us this time */
|
s &= ~Pspresent; /* not for us this time */
|
||||||
}
|
}
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
qunlock(&ctlr->portlck);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must return status bits as a
|
* We must return status bits as a
|
||||||
|
|
|
@ -122,7 +122,7 @@ struct Ctlr
|
||||||
{
|
{
|
||||||
Rendez; /* for waiting to async advance doorbell */
|
Rendez; /* for waiting to async advance doorbell */
|
||||||
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
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 */
|
int active; /* in use or not */
|
||||||
void* capio; /* base address for debug info */
|
void* capio; /* base address for debug info */
|
||||||
Eopio* opio; /* Operational i/o regs */
|
Eopio* opio; /* Operational i/o regs */
|
||||||
|
|
Loading…
Reference in a new issue