Subject: kernel config and DDB
To: None <port-i386@netbsd.org>
From: Gregory McGarry <g.mcgarry@qut.edu.au>
List: port-i386
Date: 01/19/2000 18:15:39
Using DDB to edit the autoconfig tables isn't the easiest task
for the first time user.  The attached patch might be useful.

Used something like this:

boot netbsd -d
...
db> call autoconf_dump
...
we at isa: port 0x340 [0xf026a4d0], size 0x0 [0xf026a4d4], iomem 0xd0000 [0dxf02
6a4d8], iosiz 0x0 [0xf026a4dc], irq 0xb [0xf026a4e0]
...
db> w/l 0xf026a4d0 0x300
_loc                 0x340 =    0x300
db> w/l 0xf026a4e0 5
_loc+0x10                 0xb =    0x5
db> call autoconf_dump
...
we at isa: port 0x300 [0xf026a4d0], size 0x0 [0xf026a4d4], iomem 0xd0000 [0dxf02
6a4d8], iosiz 0x0 [0xf026a4dc], irq 0x5 [0xf026a4e0]
...
db> c


	-- Gregory McGarry <g.mcgarry@qut.edu.au>


*** subr_autoconf.c.orig	Wed Jan 19 11:53:44 2000
--- subr_autoconf.c	Wed Jan 19 17:00:00 2000
***************
*** 1,4 ****
! /*	$NetBSD: subr_autoconf.c,v 1.44 1999/09/23 15:14:57 minoura Exp $	*/
  
  /*
   * Copyright (c) 1992, 1993
--- 1,4 ----
! /*	$NetBSD$	*/
  
  /*
   * Copyright (c) 1992, 1993
***************
*** 679,681 ****
--- 679,724 ----
  
  	TAILQ_REMOVE(&allevents, ev, ev_list);
  }
+ 
+ 
+ /*
+  *  If DDB is enabled then dump the autoconfiguration details.
+  */
+ #include "opt_ddb.h"
+ #ifdef DDB
+ #include <ddb/db_output.h>
+ void autoconf_dump __P((void));
+ void
+ autoconf_dump (void)
+ {
+ 	struct cfdata *cf;
+ 	short *p;
+ 	const char **l;
+ 	int i;
+ 	int needcomma;
+ 
+ 	for (cf = cfdata; cf->cf_driver; cf++) {
+ 		if (cf->cf_locnames[0] == NULL)
+ 			continue;
+ 		db_printf("%s at", cf->cf_driver->cd_name);
+ 		needcomma = 0;
+ 		for (p = cf->cf_parents; *p >= 0; p++) {
+ 			db_printf("%s%s", (needcomma ? ", " : " "),
+ 				cfdata[*p].cf_driver->cd_name);
+ 			needcomma = 1;
+ 		}
+ 		db_printf(":");
+ 		needcomma = 0;
+ 		for (l = cf->cf_locnames, i = 0; *l != NULL; i++, l++) {
+ 			if (cf->cf_loc[i] != -1) {
+ 				db_printf("%s%s 0x%x [%p]",
+ 					(needcomma ? ", " : " "), *l,
+ 					cf->cf_loc[i], &cf->cf_loc[i]);
+ 				needcomma = 1;
+ 			}
+ 		}
+ 		db_printf("\n");
+ 	}
+ 
+ }
+ #endif