diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-08-31 19:56:33 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-08-31 19:56:33 +0000 |
commit | 15599d2b7cc9e9eaa774ef119d027ba46d462cac (patch) | |
tree | d12a4d4b80f2dc8a75424d2c4087843bf247b498 /sys/arch | |
parent | 74c44a0647ba5237d48077ceb5e982809bea4b45 (diff) |
Check driver name in match function such that driver only attempts to attach
when we actually want it to.
ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/efifb.c | 7 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mainbus.c | 11 | ||||
-rw-r--r-- | sys/arch/amd64/include/efifbvar.h | 11 |
3 files changed, 24 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/efifb.c b/sys/arch/amd64/amd64/efifb.c index 064522935a8..848f6fd8e62 100644 --- a/sys/arch/amd64/amd64/efifb.c +++ b/sys/arch/amd64/amd64/efifb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efifb.c,v 1.1 2015/08/30 10:05:09 yasuoka Exp $ */ +/* $OpenBSD: efifb.c,v 1.2 2015/08/31 19:56:32 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -90,7 +90,10 @@ struct efifb efifb_console; int efifb_match(struct device *parent, void *cf, void *aux) { - if (bios_efiinfo != NULL) + struct efifb_attach_args *eaa = aux; + + if (strcmp(eaa->eaa_name, efifb_cd.cd_name) == 0 && + bios_efiinfo != NULL) return (1); return (0); diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c index 951fd69923b..b236fed7ade 100644 --- a/sys/arch/amd64/amd64/mainbus.c +++ b/sys/arch/amd64/amd64/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.32 2015/08/30 18:08:24 kettenis Exp $ */ +/* $OpenBSD: mainbus.c,v 1.33 2015/08/31 19:56:32 kettenis Exp $ */ /* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */ /* @@ -68,6 +68,10 @@ #include <machine/biosvar.h> #endif +#if NEFIFB > 0 +#include <machine/efifbvar.h> +#endif + int mainbus_match(struct device *, void *, void *); void mainbus_attach(struct device *, struct device *, void *); @@ -96,6 +100,9 @@ union mainbus_attach_args { #if NPVBUS > 0 struct pvbus_attach_args mba_pvba; #endif +#if NEFIFB > 0 + struct efifb_attach_args mba_eaa; +#endif }; /* @@ -234,7 +241,7 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) #if NEFIFB > 0 if (bios_efiinfo != NULL) { - mba.mba_busname = "efifb"; + mba.mba_eaa.eaa_name = "efifb"; config_found(self, &mba, mainbus_print); } #endif diff --git a/sys/arch/amd64/include/efifbvar.h b/sys/arch/amd64/include/efifbvar.h index 353e31e3800..bf5668c9a0d 100644 --- a/sys/arch/amd64/include/efifbvar.h +++ b/sys/arch/amd64/include/efifbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: efifbvar.h,v 1.1 2015/08/30 10:05:09 yasuoka Exp $ */ +/* $OpenBSD: efifbvar.h,v 1.2 2015/08/31 19:56:32 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -16,4 +16,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef _MACHINE_EFIFB_H_ +#define _MACHINE_EFIFB_H_ + +struct efifb_attach_args { + const char *eaa_name; +}; + int efifb_cnattach(void); + +#endif /* _MACHINE_EFIFB_H_ */ |