Subject: port-i386/29683: mcd driver (1) fails to compile and (2) fails to attach device
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: "", reverse "\n", split)' <protected@mail11.mdx.safepages.com (echo "com . rdpnet @ buchanan" | perl -wpne '$_ = join>
List: netbsd-bugs
Date: 03/12/2005 22:32:00
>Number:         29683
>Category:       port-i386
>Synopsis:       mcd driver (1) fails to compile and (2) fails to attach device
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 12 22:32:00 +0000 2005
>Originator:     M. B. Buchanan
>Release:        NetBSD 2.0
>Organization:
N/A
>Environment:


System: NetBSD muleshoe.mbb.org 2.0 NetBSD 2.0 (V20050228) #12: Sat Mar 12 04:53:15 CST 2005 buchanan@woodrow.mbb.org:/usr/src/sys/arch/i386/compile/V20050228 i386
Architecture: i386
Machine: i386
>Description:
1) A printf() call in mcdstrategy() uses a format specifier that does not
   match its argument, which causes a compile error.
2) mcdprobe() assigns a length (MCD_NPORT) to the base I/O port address,
   preventing the kernel from attaching the device.

>How-To-Repeat:
Enable the mcd(4) driver in the kernel and compile it.  Fix the printf()
and boot the kernel.  You'll get "can't map i/o space" when mcd tries to
attach.

>Fix:
Apply this patch:

*** /tmp/usr/src/sys/dev/isa/mcd.c      Thu Nov  6 22:10:57 2003
--- /usr/src/sys/dev/isa/mcd.c  Sat Mar 12 05:51:13 2005
***************
*** 442,448 ****
            bp->b_blkno, bp->b_bcount, 0);
        if (bp->b_blkno < 0 ||
            (bp->b_bcount % sc->blksize) != 0) {
!               printf("%s: strategy: blkno = %d bcount = %ld\n",
                    sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount);
                bp->b_error = EINVAL;
                goto bad;
--- 442,449 ----
            bp->b_blkno, bp->b_bcount, 0);
        if (bp->b_blkno < 0 ||
            (bp->b_bcount % sc->blksize) != 0) {
! /*            printf("%s: strategy: blkno = %d bcount = %ld\n", */
!               printf("%s: strategy: blkno = % " PRId64 " bcount = %ld\n",
                    sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount);
                bp->b_error = EINVAL;
                goto bad;
***************
*** 953,959 ****
  
        if (rv) {
                ia->ia_nio = 1;
!               ia->ia_io[0].ir_addr = MCD_NPORT;
  
                ia->ia_nirq = 1;
  
--- 954,961 ----
  
        if (rv) {
                ia->ia_nio = 1;
! /*            ia->ia_io[0].ir_addr = MCD_NPORT; */
!               ia->ia_io[0].ir_size = MCD_NPORT;
  
                ia->ia_nirq = 1;


>Unformatted: