Make this compile on sparc64:

1 s/next_tick/next_tint/ because next_tick shadows a global on sparc64.

2 Fix the bus-barrier helper routines, which had the tag & handle
  swapped (!!).  Move the helpers from rtwreg.h to rtwvar.h, and
  change RTW_BARRIER() into an inline subroutine called rtw_barrier().
This commit is contained in:
dyoung 2010-03-15 23:21:08 +00:00
parent 724aa20200
commit 14d897a9e1
3 changed files with 50 additions and 47 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtw.c,v 1.114 2010/02/24 22:37:58 dyoung Exp $ */
/* $NetBSD: rtw.c,v 1.115 2010/03/15 23:21:08 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights
* reserved.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.114 2010/02/24 22:37:58 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.115 2010/03/15 23:21:08 dyoung Exp $");
#include <sys/param.h>
@ -2095,19 +2095,19 @@ rtw_suspend_ticks(struct rtw_softc *sc)
static inline void
rtw_resume_ticks(struct rtw_softc *sc)
{
uint32_t tsftrl0, tsftrl1, next_tick;
uint32_t tsftrl0, tsftrl1, next_tint;
tsftrl0 = RTW_READ(&sc->sc_regs, RTW_TSFTRL);
tsftrl1 = RTW_READ(&sc->sc_regs, RTW_TSFTRL);
next_tick = tsftrl1 + 1000000;
RTW_WRITE(&sc->sc_regs, RTW_TINT, next_tick);
next_tint = tsftrl1 + 1000000;
RTW_WRITE(&sc->sc_regs, RTW_TINT, next_tint);
sc->sc_do_tick = 1;
RTW_DPRINTF(RTW_DEBUG_TIMEOUT,
("%s: resume ticks delta %#08x now %#08x next %#08x\n",
device_xname(sc->sc_dev), tsftrl1 - tsftrl0, tsftrl1, next_tick));
device_xname(sc->sc_dev), tsftrl1 - tsftrl0, tsftrl1, next_tint));
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtwreg.h,v 1.27 2009/10/19 23:19:39 rmind Exp $ */
/* $NetBSD: rtwreg.h,v 1.28 2010/03/15 23:21:08 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -1012,45 +1012,6 @@ struct rtw_rxdesc {
#define BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE BUS_SPACE_BARRIER_WRITE
#endif
/*
* Bus barrier
*
* Complete outstanding read and/or write ops on [reg0, reg1]
* ([reg1, reg0]) before starting new ops on the same region. See
* acceptable bus_space_barrier(9) for the flag definitions.
*/
#define RTW_BARRIER(regs, reg0, reg1, flags) \
bus_space_barrier((regs)->r_bh, (regs)->r_bt, \
MIN(reg0, reg1), MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags)
/*
* Barrier convenience macros.
*/
/* sync */
#define RTW_SYNC(regs, reg0, reg1) \
RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_SYNC)
/* write-before-write */
#define RTW_WBW(regs, reg0, reg1) \
RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
/* write-before-read */
#define RTW_WBR(regs, reg0, reg1) \
RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_READ)
/* read-before-read */
#define RTW_RBR(regs, reg0, reg1) \
RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_READ)
/* read-before-write */
#define RTW_RBW(regs, reg0, reg1) \
RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_WRITE)
#define RTW_WBRW(regs, reg0, reg1) \
RTW_BARRIER(regs, reg0, reg1, \
BUS_SPACE_BARRIER_WRITE_BEFORE_READ | \
BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
/*
* Registers for RTL8180L's built-in baseband modem.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtwvar.h,v 1.42 2010/02/24 22:37:58 dyoung Exp $ */
/* $NetBSD: rtwvar.h,v 1.43 2010/03/15 23:21:08 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -112,6 +112,48 @@ struct rtw_regs {
enum rtw_access r_access;
};
/*
* Bus barrier
*
* Complete outstanding read and/or write ops on [reg0, reg1]
* ([reg1, reg0]) before starting new ops on the same region. See
* acceptable bus_space_barrier(9) for the flag definitions.
*/
static inline void
rtw_barrier(const struct rtw_regs *r, int reg0, int reg1, int flags)
{
bus_space_barrier(r->r_bt, r->r_bh, MIN(reg0, reg1),
MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags);
}
/*
* Barrier convenience macros.
*/
/* sync */
#define RTW_SYNC(regs, reg0, reg1) \
rtw_barrier(regs, reg0, reg1, BUS_SPACE_BARRIER_SYNC)
/* write-before-write */
#define RTW_WBW(regs, reg0, reg1) \
rtw_barrier(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
/* write-before-read */
#define RTW_WBR(regs, reg0, reg1) \
rtw_barrier(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_READ)
/* read-before-read */
#define RTW_RBR(regs, reg0, reg1) \
rtw_barrier(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_READ)
/* read-before-write */
#define RTW_RBW(regs, reg0, reg1) \
rtw_barrier(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_WRITE)
#define RTW_WBRW(regs, reg0, reg1) \
rtw_barrier(regs, reg0, reg1, \
BUS_SPACE_BARRIER_WRITE_BEFORE_READ | \
BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
#define RTW_SR_GET(sr, ofs) \
(((sr)->sr_content[(ofs)/2] >> (((ofs) % 2 == 0) ? 0 : 8)) & 0xff)