Compute the correct number of pages spanned by the firmware.
The old code just uses the firmware size and rounds up to full pages. However, if the firmware isn't loaded aligned to a page boundary (which it isn't), then one more page (and thus DMA segment) might be necessary.
This commit is contained in:
parent
04608dd0bf
commit
c2b3f9acc5
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_iwi.c,v 1.72 2008/03/21 07:47:43 dyoung Exp $ */
|
||||
/* $NetBSD: if_iwi.c,v 1.73 2008/06/16 06:19:24 mlelstv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004, 2005
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.72 2008/03/21 07:47:43 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.73 2008/06/16 06:19:24 mlelstv Exp $");
|
||||
|
||||
/*-
|
||||
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
|
||||
|
@ -2015,7 +2015,7 @@ iwi_load_firmware(struct iwi_softc *sc, void *fw, int size)
|
|||
int ntries, nsegs, error;
|
||||
int sn;
|
||||
|
||||
nsegs = (size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
nsegs = atop((char*)fw+size-1) - atop((char *)fw) + 1;
|
||||
|
||||
/* Create a DMA map for the firmware image */
|
||||
error = bus_dmamap_create(sc->sc_dmat, size, nsegs, size, 0,
|
||||
|
|
Loading…
Reference in New Issue