Module Name: src Committed By: tsutsui Date: Tue May 15 12:17:34 UTC 2012
Modified Files: src/sys/arch/x68k/dev: fd.c fdreg.h Log Message: - check bus_space_map(9) return value - use BUS_SPACE_MAP_SHIFTED_ODD for clarify - define and use proper macro instead of magic To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/x68k/dev/fd.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x68k/dev/fdreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x68k/dev/fd.c diff -u src/sys/arch/x68k/dev/fd.c:1.100 src/sys/arch/x68k/dev/fd.c:1.101 --- src/sys/arch/x68k/dev/fd.c:1.100 Sun May 13 03:00:40 2012 +++ src/sys/arch/x68k/dev/fd.c Tue May 15 12:17:33 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.100 2012/05/13 03:00:40 tsutsui Exp $ */ +/* $NetBSD: fd.c,v 1.101 2012/05/15 12:17:33 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.100 2012/05/13 03:00:40 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.101 2012/05/15 12:17:33 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_m68k_arch.h" @@ -377,7 +377,7 @@ fdcprobe(device_t parent, cfdata_t cf, v if ((ia->ia_intr & 0x03) != 0) return 0; - ia->ia_size = 0x2000; + ia->ia_size = FDC_MAPSIZE; if (intio_map_allocate_region(parent, ia, INTIO_MAP_TESTONLY)) return 0; @@ -423,12 +423,16 @@ fdcattach(device_t parent, device_t self aprint_normal("\n"); + /* Re-map the I/O space. */ + if (bus_space_map(iot, ia->ia_addr, ia->ia_size, + BUS_SPACE_MAP_SHIFTED_ODD, &ioh) != 0) { + aprint_error_dev(self, "unable to map I/O space\n"); + return; + } + callout_init(&fdc->sc_timo_ch, 0); callout_init(&fdc->sc_intr_ch, 0); - /* Re-map the I/O space. */ - bus_space_map(iot, ia->ia_addr, 0x2000, BUS_SPACE_MAP_SHIFTED, &ioh); - fdc->sc_iot = iot; fdc->sc_ioh = ioh; fdc->sc_addr = (void *)ia->ia_addr; Index: src/sys/arch/x68k/dev/fdreg.h diff -u src/sys/arch/x68k/dev/fdreg.h:1.4 src/sys/arch/x68k/dev/fdreg.h:1.5 --- src/sys/arch/x68k/dev/fdreg.h:1.4 Sun Dec 11 12:19:37 2005 +++ src/sys/arch/x68k/dev/fdreg.h Tue May 15 12:17:33 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: fdreg.h,v 1.4 2005/12/11 12:19:37 christos Exp $ */ +/* $NetBSD: fdreg.h,v 1.5 2012/05/15 12:17:33 tsutsui Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -56,6 +56,7 @@ /* default attach args */ #define FDC_ADDR 0xe94000 /* builtin fdc is here */ +#define FDC_MAPSIZE 0x2000 /* builtin fdc I/O range */ #define FDC_INTR 96 /* interrupt vector */ #define FDC_DMA 0 /* DMA ch# */ #define FDC_DMAINTR 100 /* DMA interrupt vector */