Index: arch/macppc/include/autoconf.h =================================================================== RCS file: /cvsroot/src/sys/arch/macppc/include/autoconf.h,v retrieving revision 1.18 diff -p -u -r1.18 autoconf.h --- arch/macppc/include/autoconf.h 1 Jul 2011 21:02:15 -0000 1.18 +++ arch/macppc/include/autoconf.h 8 Jan 2019 07:17:13 -0000 @@ -34,7 +34,9 @@ #ifndef _MACHINE_AUTOCONF_H_ #define _MACHINE_AUTOCONF_H_ -#include /* for bus_space_tag_t */ +#include + +#include struct confargs { const char *ca_name; Index: arch/ofppc/include/autoconf.h =================================================================== RCS file: /cvsroot/src/sys/arch/ofppc/include/autoconf.h,v retrieving revision 1.15 diff -p -u -r1.15 autoconf.h --- arch/ofppc/include/autoconf.h 1 Jul 2011 21:02:15 -0000 1.15 +++ arch/ofppc/include/autoconf.h 8 Jan 2019 07:17:13 -0000 @@ -5,6 +5,8 @@ #include +#include + struct confargs { const char *ca_name; u_int ca_node; Index: arch/powerpc/include/types.h =================================================================== RCS file: /cvsroot/src/sys/arch/powerpc/include/types.h,v retrieving revision 1.56 diff -p -u -r1.56 types.h --- arch/powerpc/include/types.h 27 Jan 2017 17:22:39 -0000 1.56 +++ arch/powerpc/include/types.h 8 Jan 2019 07:17:13 -0000 @@ -87,6 +87,8 @@ typedef __uint32_t tlb_asid_t; /* for b #define __HAVE___LWP_GETTCB_FAST #define __HAVE___LWP_SETTCB #define __HAVE_TLS_VARIANT_I +#define __OPENFIRMIO_OPEN_CHECK_BROKEN +int __openfirmio_open_check_broken(void); #if defined(_KERNEL) || defined(_KMEMUSER) #define PCU_FPU 0 /* FPU */ Index: arch/powerpc/powerpc/openfirm.c =================================================================== RCS file: /cvsroot/src/sys/arch/powerpc/powerpc/openfirm.c,v retrieving revision 1.26 diff -p -u -r1.26 openfirm.c --- arch/powerpc/powerpc/openfirm.c 3 Sep 2018 16:29:26 -0000 1.26 +++ arch/powerpc/powerpc/openfirm.c 8 Jan 2019 07:17:13 -0000 @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: openfirm.c,v #include #include +#include #include @@ -757,3 +758,11 @@ ofbcopy(const void *src, void *dst, size while (len-- > 0) *dp++ = *sp++; } + +#ifdef __OPENFIRMIO_OPEN_CHECK_BROKEN +int +__openfirmio_open_check_broken(void) +{ + return strncmp(model_name, "Pegasos", 7) == 0 ? ENXIO : 0; +} +#endif Index: dev/ofw/openfirmio.c =================================================================== RCS file: /cvsroot/src/sys/dev/ofw/openfirmio.c,v retrieving revision 1.13 diff -p -u -r1.13 openfirmio.c --- dev/ofw/openfirmio.c 25 Jul 2014 08:10:37 -0000 1.13 +++ dev/ofw/openfirmio.c 8 Jan 2019 07:17:13 -0000 @@ -63,10 +63,11 @@ static int openfirmgetstr (int, char *, void openfirmattach (int); -dev_type_ioctl(openfirmioctl); +static dev_type_open(openfirmopen); +static dev_type_ioctl(openfirmioctl); const struct cdevsw openfirm_cdevsw = { - .d_open = nullopen, + .d_open = openfirmopen, .d_close = nullclose, .d_read = noread, .d_write = nowrite, @@ -117,7 +118,17 @@ openfirmgetstr(int len, char *user, char return (error); } -int +static int +openfirmopen(dev_t dev, int flag, int mode, struct lwp *l) +{ +#ifdef __OPENFIRMIO_OPEN_CHECK_BROKEN + return __openfirmio_open_check_broken(); +#else + return 0; +#endif +} + +static int openfirmioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) { struct ofiocdesc *of;