diff options
-rw-r--r-- | sys/arch/sgi/include/autoconf.h | 26 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/autoconf.c | 33 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/wscons_machdep.c | 4 |
3 files changed, 60 insertions, 3 deletions
diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h index b2325bd0212..5d86a3d2c22 100644 --- a/sys/arch/sgi/include/autoconf.h +++ b/sys/arch/sgi/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.29 2010/01/09 23:34:29 miod Exp $ */ +/* $OpenBSD: autoconf.h,v 1.30 2010/04/06 19:06:04 miod Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -58,11 +58,30 @@ struct sys_rec { extern struct sys_rec sys_config; +/* + * Attachment information for mainbus child devices. + */ struct mainbus_attach_args { const char *maa_name; int16_t maa_nasid; }; +/* + * Device physical location information. Used to match console and boot + * devices. + */ +struct sgi_device_location { + int16_t nasid; /* node identifier */ + uint widget; /* widget number */ + + int bus; /* bus number if connected to PIC */ + int device; /* device number if PCI */ + int fn; /* function number if PCI */ + + uint32_t specific; /* port on dual-scsibus controllers, + device id on serial controllers */ +}; + #include <mips64/autoconf.h> void enaddr_aton(const char *, u_int8_t *); @@ -80,4 +99,9 @@ extern char osloadpartition[256]; extern int16_t masternasid; extern int16_t currentnasid; +extern struct sgi_device_location console_output, console_input; + +int location_match(struct sgi_device_location *, + struct sgi_device_location *); + #endif /* _MACHINE_AUTOCONF_H_ */ diff --git a/sys/arch/sgi/sgi/autoconf.c b/sys/arch/sgi/sgi/autoconf.c index 09266b6c32b..9ec6efb6199 100644 --- a/sys/arch/sgi/sgi/autoconf.c +++ b/sys/arch/sgi/sgi/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.30 2010/01/13 22:57:29 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.31 2010/04/06 19:06:07 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. * @@ -649,3 +649,34 @@ atoi(const char *s, int b, const char **o) *o = s - 1; return val; } + +/* + * Relaxed comparison of two devices' physical location. + */ +int +location_match(struct sgi_device_location *l1, struct sgi_device_location *l2) +{ + /* must be on the same widget */ + if (l1->nasid != l2->nasid || l1->widget != l2->widget) + return 0; + + /* must be on the same PCI bus, if applicable */ + if (l1->bus == -1 || l2->bus == -1) + return 1; + if (l1->bus != l2->bus) + return 0; + + /* must be the same PCI device, if applicable */ + if (l1->device == -1 || l2->device == -1) + return 1; + if (l1->device != l2->device) + return 0; + + /* must be the same PCI function, if applicable */ + if (l1->fn == -1 || l2->fn == -1) + return 1; + if (l1->fn != l2->fn) + return 0; + + return 1; +} diff --git a/sys/arch/sgi/sgi/wscons_machdep.c b/sys/arch/sgi/sgi/wscons_machdep.c index 1e02e1c701e..e4ac54023c8 100644 --- a/sys/arch/sgi/sgi/wscons_machdep.c +++ b/sys/arch/sgi/sgi/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.6 2010/03/07 21:26:24 miod Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.7 2010/04/06 19:06:07 miod Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -91,6 +91,8 @@ cons_decl(ws); extern bus_addr_t comconsaddr; #if defined(TGT_OCTANE) || defined(TGT_ORIGIN) +struct sgi_device_location console_output; +struct sgi_device_location console_input; int16_t output_widget_nasid; int output_widget_id; int (*output_widget_cninit)(int16_t, int) = NULL; |