diff --git a/sys/arch/sparc64/include/openpromio.h b/sys/arch/sparc64/include/openpromio.h index 4382fb3206f1..99b221a5ee76 100644 --- a/sys/arch/sparc64/include/openpromio.h +++ b/sys/arch/sparc64/include/openpromio.h @@ -1,4 +1,4 @@ -/* $NetBSD: openpromio.h,v 1.1.1.1 1998/06/20 04:58:52 eeh Exp $ */ +/* $NetBSD: openpromio.h,v 1.2 2002/01/10 20:38:11 briggs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -58,3 +58,4 @@ struct opiocdesc { #define OPIOCGETOPTNODE _IOR('O', 4, int) /* get openprom field */ #define OPIOCGETNEXT _IOWR('O', 5, int) /* get next node of node */ #define OPIOCGETCHILD _IOWR('O', 6, int) /* get first child of node */ +#define OPIOCFINDDEVICE _IOWR('O', 7, struct opiocdesc) /* find a specific device */ diff --git a/sys/arch/sparc64/sparc64/openprom.c b/sys/arch/sparc64/sparc64/openprom.c index 4c8b35a65603..bb5562c8e57f 100644 --- a/sys/arch/sparc64/sparc64/openprom.c +++ b/sys/arch/sparc64/sparc64/openprom.c @@ -1,4 +1,4 @@ -/* $NetBSD: openprom.c,v 1.5 2002/01/10 16:04:43 briggs Exp $ */ +/* $NetBSD: openprom.c,v 1.6 2002/01/10 20:38:11 briggs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -259,6 +259,20 @@ openpromioctl(dev, cmd, data, flags, p) *(int *)data = lastnode = node; break; + case OPIOCFINDDEVICE: + if ((flags & FREAD) == 0) + return (EBADF); + error = openpromgetstr(op->op_namelen, op->op_name, &name); + if (error) + break; + node = OF_finddevice(name); + if (node == 0 || node == -1) { + error = ENOENT; + break; + } + op->op_nodeid = lastnode = node; + break; + default: return (ENOTTY); }