Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Use htole32() and le32toh() instead of SCR_BO().
details: https://anonhg.NetBSD.org/src/rev/b8e15d51e1df
branches: trunk
changeset: 479903:b8e15d51e1df
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Dec 26 10:41:22 1999 +0000
description:
Use htole32() and le32toh() instead of SCR_BO().
XXX Should we still keep non-NetBSD part?
diffstat:
sys/dev/pci/ncr.c | 152 +++++++++++++++++++++++++-------------------------
sys/dev/pci/ncrreg.h | 8 +--
2 files changed, 77 insertions(+), 83 deletions(-)
diffs (truncated from 389 to 300 lines):
diff -r 09feba8082be -r b8e15d51e1df sys/dev/pci/ncr.c
--- a/sys/dev/pci/ncr.c Sun Dec 26 09:42:18 1999 +0000
+++ b/sys/dev/pci/ncr.c Sun Dec 26 10:41:22 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr.c,v 1.92 1999/12/20 03:37:06 tsutsui Exp $ */
+/* $NetBSD: ncr.c,v 1.93 1999/12/26 10:41:22 tsutsui Exp $ */
/**************************************************************************
**
@@ -342,16 +342,16 @@
bus_space_write_4 (np->sc_st, np->sc_sh, (o), (val))
#define READSCRIPT_OFF(base, off) \
- SCR_BO(base ? *((INT32 *)((char *)base + (off))) : \
+ le32toh(base ? *((INT32 *)((char *)base + (off))) : \
bus_space_read_stream_4(np->ram_tag, np->ram_handle, off))
#define WRITESCRIPT_OFF(base, off, val) \
do { \
if (base) \
- *((INT32 *)((char *)base + (off))) = (SCR_BO(val)); \
+ *((INT32 *)((char *)base + (off))) = (htole32(val)); \
else \
bus_space_write_stream_4(np->ram_tag, np->ram_handle, \
- off, SCR_BO(val)); \
+ off, htole32(val)); \
} while (0)
#define READSCRIPT(r) \
@@ -1524,7 +1524,7 @@
#if 0
static char ident[] =
- "\n$NetBSD: ncr.c,v 1.92 1999/12/20 03:37:06 tsutsui Exp $\n";
+ "\n$NetBSD: ncr.c,v 1.93 1999/12/26 10:41:22 tsutsui Exp $\n";
#endif
static const u_long ncr_version = NCR_VERSION * 11
@@ -4280,8 +4280,8 @@
** init data structure
*/
- np->ncb_dma->jump_tcb.l_cmd = SCR_BO(SCR_JUMP);
- np->ncb_dma->jump_tcb.l_paddr = SCR_BO(NCB_SCRIPTH_PHYS (np, abort));
+ np->ncb_dma->jump_tcb.l_cmd = htole32(SCR_JUMP);
+ np->ncb_dma->jump_tcb.l_paddr = htole32(NCB_SCRIPTH_PHYS (np, abort));
/*
** Get SCSI addr of host adapter (set by bios?).
@@ -4845,14 +4845,14 @@
if (flags & XS_CTL_DATA_IN) {
bus_addr_t sp = NCB_SCRIPT_PHYS (np, data_in);
- cp->phys.header.savep = SCR_BO(sp);
- cp->phys.header.goalp = SCR_BO(sp + 20 + segments * 16);
+ cp->phys.header.savep = htole32(sp);
+ cp->phys.header.goalp = htole32(sp + 20 + segments * 16);
} else if (flags & XS_CTL_DATA_OUT) {
bus_addr_t sp = NCB_SCRIPT_PHYS (np, data_out);
- cp->phys.header.savep = SCR_BO(sp);
- cp->phys.header.goalp = SCR_BO(sp + 20 + segments * 16);
+ cp->phys.header.savep = htole32(sp);
+ cp->phys.header.goalp = htole32(sp + 20 + segments * 16);
} else {
- cp->phys.header.savep = SCR_BO(NCB_SCRIPT_PHYS (np, no_data));
+ cp->phys.header.savep = htole32(NCB_SCRIPT_PHYS (np, no_data));
cp->phys.header.goalp = cp->phys.header.savep;
};
cp->phys.header.lastp = cp->phys.header.savep;
@@ -4881,8 +4881,8 @@
/*
** Startqueue
*/
- cp->phys.header.launch.l_paddr = SCR_BO(NCB_SCRIPT_PHYS (np, select));
- cp->phys.header.launch.l_cmd = SCR_BO(SCR_JUMP);
+ cp->phys.header.launch.l_paddr = htole32(NCB_SCRIPT_PHYS (np, select));
+ cp->phys.header.launch.l_cmd = htole32(SCR_JUMP);
/*
** select
*/
@@ -4892,21 +4892,21 @@
/*
** message
*/
- cp->phys.smsg.addr = SCR_BO(CCB_PHYS (cp, scsi_smsg));
- cp->phys.smsg.size = SCR_BO(msglen);
-
- cp->phys.smsg2.addr = SCR_BO(CCB_PHYS (cp, scsi_smsg2));
- cp->phys.smsg2.size = SCR_BO(msglen2);
+ cp->phys.smsg.addr = htole32(CCB_PHYS (cp, scsi_smsg));
+ cp->phys.smsg.size = htole32(msglen);
+
+ cp->phys.smsg2.addr = htole32(CCB_PHYS (cp, scsi_smsg2));
+ cp->phys.smsg2.size = htole32(msglen2);
/*
** command
*/
- cp->phys.cmd.addr = SCR_BO(CCB_PHYS (cp, scsi_cmd));
- cp->phys.cmd.size = SCR_BO(xp->cmdlen);
+ cp->phys.cmd.addr = htole32(CCB_PHYS (cp, scsi_cmd));
+ cp->phys.cmd.size = htole32(xp->cmdlen);
/*
** sense command
*/
- cp->phys.scmd.addr = SCR_BO(CCB_PHYS (cp, sensecmd));
- cp->phys.scmd.size = SCR_BO(6);
+ cp->phys.scmd.addr = htole32(CCB_PHYS (cp, sensecmd));
+ cp->phys.scmd.size = htole32(6);
/*
** patch requested size into sense command
*/
@@ -4918,8 +4918,8 @@
/*
** sense data
*/
- cp->phys.sense.addr = SCR_BO(CCB_PHYS (cp, sense_data));
- cp->phys.sense.size = SCR_BO(sizeof(struct scsipi_sense_data));
+ cp->phys.sense.addr = htole32(CCB_PHYS (cp, sense_data));
+ cp->phys.sense.size = htole32(sizeof(struct scsipi_sense_data));
/*
** status
*/
@@ -4944,7 +4944,7 @@
** reselect pattern and activate this job.
*/
- cp->jump_ccb.l_cmd = SCR_BO((SCR_JUMP ^ IFFALSE (DATA (cp->tag))));
+ cp->jump_ccb.l_cmd = htole32(SCR_JUMP ^ IFFALSE (DATA (cp->tag)));
#ifdef __NetBSD__
cp->tlimit = mono_time.tv_sec + xp->timeout / 1000 + 2;
#else
@@ -4958,8 +4958,8 @@
qidx = np->squeueput + 1;
if (qidx >= MAX_START) qidx=0;
- np->ncb_dma->squeue [qidx ] = SCR_BO(NCB_SCRIPT_PHYS (np, idle));
- np->ncb_dma->squeue [np->squeueput] = SCR_BO(CCB_PHYS (cp, phys));
+ np->ncb_dma->squeue [qidx ] = htole32(NCB_SCRIPT_PHYS (np, idle));
+ np->ncb_dma->squeue [np->squeueput] = htole32(CCB_PHYS (cp, phys));
np->squeueput = qidx;
if(DEBUG_FLAGS & DEBUG_QUEUE)
@@ -5070,12 +5070,12 @@
/*
** No Reselect anymore.
*/
- cp->jump_ccb.l_cmd = SCR_BO((SCR_JUMP));
+ cp->jump_ccb.l_cmd = htole32(SCR_JUMP);
/*
** No starting.
*/
- cp->phys.header.launch.l_paddr= SCR_BO(NCB_SCRIPT_PHYS (np, idle));
+ cp->phys.header.launch.l_paddr= htole32(NCB_SCRIPT_PHYS (np, idle));
/*
** timestamp
@@ -5397,7 +5397,7 @@
*/
for (i=0;i<MAX_START;i++)
- np -> ncb_dma -> squeue [i] = SCR_BO(NCB_SCRIPT_PHYS (np, idle));
+ np -> ncb_dma -> squeue [i] = htole32(NCB_SCRIPT_PHYS (np, idle));
/*
** Start at first entry.
@@ -6000,13 +6000,13 @@
** Disable reselect.
** Remove it from startqueue.
*/
- cp->jump_ccb.l_cmd = SCR_BO((SCR_JUMP));
+ cp->jump_ccb.l_cmd = htole32(SCR_JUMP);
if (cp->phys.header.launch.l_paddr ==
- SCR_BO(NCB_SCRIPT_PHYS (np, select))) {
+ htole32(NCB_SCRIPT_PHYS (np, select))) {
printf ("%s: timeout ccb=%p (skip)\n",
ncr_name (np), cp);
cp->phys.header.launch.l_paddr
- = SCR_BO(NCB_SCRIPT_PHYS (np, skip));
+ = htole32(NCB_SCRIPT_PHYS (np, skip));
};
switch (cp->host_status) {
@@ -6017,7 +6017,7 @@
** still in start queue ?
*/
if (cp->phys.header.launch.l_paddr ==
- SCR_BO(NCB_SCRIPT_PHYS (np, skip)))
+ htole32(NCB_SCRIPT_PHYS (np, skip)))
continue;
/* fall through */
@@ -6611,8 +6611,8 @@
if (cmd & 0x10) { /* Table indirect */
tblp = (u_int32_t *) ((char*) &cp->phys + oadr);
- olen = SCR_BO(tblp[0]);
- oadr = SCR_BO(tblp[1]);
+ olen = le32toh(tblp[0]);
+ oadr = le32toh(tblp[1]);
} else {
tblp = (u_int32_t *) 0;
olen = READSCRIPT_OFF(vdsp_base, vdsp_off) & 0xffffff;
@@ -6654,25 +6654,25 @@
*/
newcmd = cp->patch;
- if (cp->phys.header.savep == SCR_BO(vtophys (newcmd))) newcmd+=4;
+ if (cp->phys.header.savep == htole32(vtophys (newcmd))) newcmd+=4;
/*
** fillin the commands
*/
- newcmd[0] = SCR_BO(((cmd & 0x0f) << 24) | rest);
- newcmd[1] = SCR_BO(oadr + olen - rest);
- newcmd[2] = SCR_BO(SCR_JUMP);
- newcmd[3] = SCR_BO(nxtdsp);
+ newcmd[0] = htole32(((cmd & 0x0f) << 24) | rest);
+ newcmd[1] = htole32(oadr + olen - rest);
+ newcmd[2] = htole32(SCR_JUMP);
+ newcmd[3] = htole32(nxtdsp);
if (DEBUG_FLAGS & DEBUG_PHASE) {
PRINT_ADDR(cp->xfer);
printf ("newcmd[%ld] %x %x %x %x.\n",
(long)(newcmd - cp->patch),
- (unsigned)SCR_BO(newcmd[0]),
- (unsigned)SCR_BO(newcmd[1]),
- (unsigned)SCR_BO(newcmd[2]),
- (unsigned)SCR_BO(newcmd[3]));
+ (unsigned)le32toh(newcmd[0]),
+ (unsigned)le32toh(newcmd[1]),
+ (unsigned)le32toh(newcmd[2]),
+ (unsigned)le32toh(newcmd[3]));
}
/*
** fake the return address (to the patch).
@@ -7211,8 +7211,8 @@
printf ("M_DISCONNECT received, but datapointer not saved:\n"
"\tdata=%x save=%x goal=%x.\n",
(unsigned) INL (nc_temp),
- SCR_BO((unsigned) np->ncb_dma->header.savep),
- SCR_BO((unsigned) np->ncb_dma->header.goalp));
+ le32toh((unsigned) np->ncb_dma->header.savep),
+ le32toh((unsigned) np->ncb_dma->header.goalp));
break;
/*--------------------------------------------------------------------
@@ -7436,28 +7436,28 @@
/*
** initialize it.
*/
- tp->jump_tcb.l_cmd = SCR_BO((SCR_JUMP^IFFALSE (DATA (0x80 + target))));
+ tp->jump_tcb.l_cmd = htole32(SCR_JUMP^IFFALSE (DATA (0x80 + target)));
tp->jump_tcb.l_paddr = np->ncb_dma->jump_tcb.l_paddr;
tp->getscr[0] =
- (np->features & FE_PFEN)? SCR_BO(SCR_COPY(1)) : SCR_BO(SCR_COPY_F(1));
- tp->getscr[1] = SCR_BO(vtophys (&tp->sval));
- tp->getscr[2] = SCR_BO(np->paddr + offsetof (struct ncr_reg, nc_sxfer));
+ (np->features & FE_PFEN)? htole32(SCR_COPY(1)) : htole32(SCR_COPY_F(1));
+ tp->getscr[1] = htole32(vtophys (&tp->sval));
+ tp->getscr[2] = htole32(np->paddr + offsetof (struct ncr_reg, nc_sxfer));
tp->getscr[3] = tp->getscr[0];
- tp->getscr[4] = SCR_BO(vtophys (&tp->wval));
- tp->getscr[5] = SCR_BO(np->paddr + offsetof (struct ncr_reg, nc_scntl3));
+ tp->getscr[4] = htole32(vtophys (&tp->wval));
+ tp->getscr[5] = htole32(np->paddr + offsetof (struct ncr_reg, nc_scntl3));
assert (( (offsetof(struct ncr_reg, nc_sxfer) ^
offsetof(struct tcb , sval )) &3) == 0);
assert (( (offsetof(struct ncr_reg, nc_scntl3) ^
offsetof(struct tcb , wval )) &3) == 0);
- tp->call_lun.l_cmd = SCR_BO((SCR_CALL));
- tp->call_lun.l_paddr = SCR_BO(NCB_SCRIPT_PHYS (np, resel_lun));
-
- tp->jump_lcb.l_cmd = SCR_BO((SCR_JUMP));
- tp->jump_lcb.l_paddr = SCR_BO(NCB_SCRIPTH_PHYS (np, abort));
- np->ncb_dma->jump_tcb.l_paddr = SCR_BO(vtophys (&tp->jump_tcb));
+ tp->call_lun.l_cmd = htole32(SCR_CALL);
+ tp->call_lun.l_paddr = htole32(NCB_SCRIPT_PHYS (np, resel_lun));
+
+ tp->jump_lcb.l_cmd = htole32(SCR_JUMP);
+ tp->jump_lcb.l_paddr = htole32(NCB_SCRIPTH_PHYS (np, abort));
+ np->ncb_dma->jump_tcb.l_paddr = htole32(vtophys (&tp->jump_tcb));
tp->usrtags = SCSI_NCR_DFLT_TAGS;
ncr_setmaxtags (tp, tp->usrtags);
@@ -7478,21 +7478,21 @@
** Initialize it
*/
bzero (lp, sizeof (*lp));
- lp->jump_lcb.l_cmd = SCR_BO((SCR_JUMP ^ IFFALSE (DATA (lun))));
+ lp->jump_lcb.l_cmd = htole32(SCR_JUMP ^ IFFALSE (DATA (lun)));
lp->jump_lcb.l_paddr = tp->jump_lcb.l_paddr;
- lp->call_tag.l_cmd = SCR_BO((SCR_CALL));
- lp->call_tag.l_paddr = SCR_BO(NCB_SCRIPT_PHYS (np, resel_tag));
Home |
Main Index |
Thread Index |
Old Index