NBPG is not constant on the sparc, so don't use CPP tricks.
This commit is contained in:
parent
0c5fed7eec
commit
7db182d94d
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ld_twe.c,v 1.9 2002/05/18 20:59:20 ad Exp $ */
|
||||
/* $NetBSD: ld_twe.c,v 1.10 2002/05/24 18:10:06 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.9 2002/05/18 20:59:20 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.10 2002/05/24 18:10:06 christos Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -105,7 +105,7 @@ ld_twe_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
sc->sc_hwunit = twea->twea_unit;
|
||||
ld->sc_flags = LDF_ENABLED;
|
||||
ld->sc_maxxfer = TWE_MAX_XFER;
|
||||
ld->sc_maxxfer = twe_get_maxxfer(twe_get_maxsegs());
|
||||
ld->sc_secperunit = twe->sc_dsize[twea->twea_unit];
|
||||
ld->sc_secsize = TWE_SECTOR_SIZE;
|
||||
ld->sc_maxqueuecnt = (TWE_MAX_QUEUECNT - 1) / twe->sc_nunits;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: twe.c,v 1.23 2002/05/24 15:58:06 christos Exp $ */
|
||||
/* $NetBSD: twe.c,v 1.24 2002/05/24 18:10:07 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -70,7 +70,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.23 2002/05/24 15:58:06 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.24 2002/05/24 18:10:07 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -270,12 +270,8 @@ twe_attach(struct device *parent, struct device *self, void *aux)
|
||||
ccb = malloc(sizeof(*ccb) * TWE_MAX_QUEUECNT, M_DEVBUF, M_NOWAIT);
|
||||
sc->sc_ccbs = ccb;
|
||||
tc = (struct twe_cmd *)sc->sc_cmds;
|
||||
max_segs = ((MAXPHYS + PAGE_SIZE - 1) / PAGE_SIZE) + 1;
|
||||
#ifdef TWE_SG_SIZE
|
||||
if (TWE_SG_SIZE < max_segs)
|
||||
max_segs = TWE_SG_SIZE;
|
||||
#endif
|
||||
max_xfer = (max_segs - 1) * PAGE_SIZE;
|
||||
max_segs = twe_get_maxsegs();
|
||||
max_xfer = twe_get_maxxfer(max_segs);
|
||||
|
||||
for (i = 0; i < TWE_MAX_QUEUECNT; i++, tc++, ccb++) {
|
||||
ccb->ccb_cmd = tc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: twevar.h,v 1.11 2002/05/24 15:58:06 christos Exp $ */
|
||||
/* $NetBSD: twevar.h,v 1.12 2002/05/24 18:10:07 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -106,4 +106,17 @@ int twe_ccb_poll(struct twe_softc *, struct twe_ccb *, int);
|
||||
int twe_ccb_submit(struct twe_softc *, struct twe_ccb *);
|
||||
void twe_ccb_unmap(struct twe_softc *, struct twe_ccb *);
|
||||
|
||||
static __inline__ size_t twe_get_maxsegs(void) {
|
||||
size_t max_segs = ((MAXPHYS + PAGE_SIZE - 1) / PAGE_SIZE) + 1;
|
||||
#ifdef TWE_SG_SIZE
|
||||
if (TWE_SG_SIZE < max_segs)
|
||||
max_segs = TWE_SG_SIZE;
|
||||
#endif
|
||||
return max_segs;
|
||||
}
|
||||
|
||||
static __inline__ size_t twe_get_maxxfer(size_t maxsegs) {
|
||||
return (maxsegs - 1) * PAGE_SIZE;
|
||||
}
|
||||
|
||||
#endif /* !_PCI_TWEVAR_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user