1
0
mirror of https://github.com/prirun/p50em.git synced 2026-01-16 16:17:57 +00:00

Fix several devpnc bugs:

1. Need 32-bit integer for dma address so newer Primos can use I/O
segments other than 0.
2. Ignore interrupted select()
3. Set fd to -1 after closing when not connected, to avoid bad
file descriptor error
This commit is contained in:
Jim 2011-08-18 14:04:55 -04:00
parent 05251fbcce
commit 063a23144a

View File

@ -318,7 +318,8 @@ typedef struct {
short toid, fromid;
short state;
short pktsize; /* size of packet in bytes */
unsigned short dmachan, dmareg, dmaaddr;
unsigned short dmachan, dmareg;
unsigned int dmaaddr;
short dmanw;
unsigned short *memp; /* ptr to Prime memory */
unsigned char iobuf[MAXPKTBYTES];
@ -464,9 +465,8 @@ pncaccept(time_t timenow) {
return;
}
if (!(pncstat & PNCNSCONNECTED)) {
close(fd);
TRACE(T_RIO, " not connected, closed new PNC connection, fd %d\n", fd);
return;
goto disc;
}
TRACE(T_RIO, " new PNC connection, fd %d\n", fd);
}
@ -628,9 +628,9 @@ pncinitdma(t_dma *iob, char *iotype) {
if ((*iob).dmanw > MAXPNCWORDS)
(*iob).dmanw = MAXPNCWORDS; /* clamp it */
(*iob).dmaaddr = ((regs.sym.regdmx[(*iob).dmareg] & 3)<<16) | regs.sym.regdmx[(*iob).dmareg+1];
TRACE(T_RIO, " pncinitdma: %s dmachan=%o, dmareg=%o, [dmaregs]=%o|%o, dmaaddr=%o/%o, dmanw=%d\n", iotype, (*iob).dmachan, (*iob).dmareg, regs.sym.regdmx[(*iob).dmareg], regs.sym.regdmx[(*iob).dmareg+1], (*iob).dmaaddr>>16, (*iob).dmaaddr&0xFFFF, (*iob).dmanw);
(*iob).memp = MEM + mapio((*iob).dmaaddr);
(*iob).state = PNCBSRDY;
TRACE(T_RIO, " pncinitdma: %s dmachan=%o, dmareg=%o, dmaaddr=%o, dmanw=%d\n", iotype, (*iob).dmachan, (*iob).dmareg, (*iob).dmaaddr, (*iob).dmanw);
}
@ -714,6 +714,8 @@ pncrecv() {
FD_SET(ni[nodeid].fd, &fds);
n = select(nodeid, &fds, NULL, NULL, &timeout);
if (n == -1) {
if (errno == EINTR || errno == EAGAIN)
return 0;
perror("unable to do read select on PNC fds");
fatal(NULL);
}