Subject: port-hp300/3097: scode->pa mapping for DIO-II devices is way off
To: None <gnats-bugs@gnats.netbsd.org>
From: Klaus Klein <kleink@layla.inka.de>
List: netbsd-bugs
Date: 01/11/1997 14:19:25
>Number:         3097
>Category:       port-hp300
>Synopsis:       scode->pa mapping for DIO-II devices is way off
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 11 05:35:00 1997
>Last-Modified:
>Originator:     Klaus Klein
>Organization:
private site
>Release:        970110
>Environment:
System: NetBSD quesera.inka.de 1.2B NetBSD 1.2B (QUESERA) #42: Sat Jan 11 04:34:29 CET 1997 kleink@quesera.inka.de:/mnt/src/sys/arch/hp300/compile/QUESERA hp300

NB: this is a 425t.

>Description:
In hp300/dev/dio.c:dio_scodetopa(), the scode->pa mapping computes the
physical addresses of DIO-II devices wrong with an offset of
(132 * DIOII_DEVSIZE) from the correct pa; DIO-II devices have scodes
from 132--256.

>How-To-Repeat:
Boot a post-961217 kernel on a 400 series machine with e.g. the frame buffer
living on the DIO-II bus.

>Fix:
(Someone should pick a reasonable #define for this.)

Index: dio.c
===================================================================
RCS file: /cvsroot/netbsd/src/sys/arch/hp300/dev/dio.c,v
retrieving revision 1.1.1.1
diff -b -c -r1.1.1.1 dio.c
*** dio.c	1996/12/20 13:25:10	1.1.1.1
--- dio.c	1997/01/11 02:14:19
***************
*** 206,212 ****
  	else if (DIO_ISDIO(scode))
  		rval = DIO_BASE + (scode * DIO_DEVSIZE);
  	else if (DIO_ISDIOII(scode))
! 		rval = DIOII_BASE + (scode * DIOII_DEVSIZE);
  	else
  		rval = 0;
  
--- 206,212 ----
  	else if (DIO_ISDIO(scode))
  		rval = DIO_BASE + (scode * DIO_DEVSIZE);
  	else if (DIO_ISDIOII(scode))
! 		rval = DIOII_BASE + ((scode - 132) * DIOII_DEVSIZE);
  	else
  		rval = 0;
  
>Audit-Trail:
>Unformatted: