Use FDT properties to identify a PS3 if present.

This commit is contained in:
Nathan Whitehorn 2015-01-05 01:05:35 +00:00
parent f1d2752f31
commit fd520b6e21
2 changed files with 18 additions and 10 deletions

View File

@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$");
#include <machine/spr.h>
#include <machine/vmparam.h>
#include <dev/ofw/openfirm.h>
#include "platform_if.h"
#include "ps3-hvcall.h"
@ -103,8 +105,17 @@ PLATFORM_DEF(ps3_platform);
static int
ps3_probe(platform_t plat)
{
phandle_t root;
char compatible[64];
return (BUS_PROBE_NOWILDCARD);
root = OF_finddevice("/");
if (OF_getprop(root, "compatible", compatible, sizeof(compatible)) <= 0)
return (BUS_PROBE_NOWILDCARD);
if (strncmp(compatible, "sony,ps3", sizeof(compatible)) != 0)
return (BUS_PROBE_NOWILDCARD);
return (BUS_PROBE_SPECIFIC);
}
static int

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <machine/platform.h>
#include <machine/pmap.h>
#include <dev/ofw/openfirm.h>
#include <dev/vt/vt.h>
#include <dev/vt/hw/fb/vt_fb.h>
#include <dev/vt/colors/vt_termcolors.h>
@ -95,9 +96,7 @@ ps3fb_probe(struct vt_device *vd)
struct ps3fb_softc *sc;
int disable;
char compatible[64];
#if 0
phandle_t root;
#endif
disable = 0;
TUNABLE_INT_FETCH("hw.syscons.disable", &disable);
@ -106,18 +105,16 @@ ps3fb_probe(struct vt_device *vd)
sc = &ps3fb_softc;
#if 0
TUNABLE_STR_FETCH("hw.platform", compatible, sizeof(compatible));
if (strcmp(compatible, "ps3") == 0)
return (CN_INTERNAL);
root = OF_finddevice("/");
if (OF_getprop(root, "compatible", compatible, sizeof(compatible)) <= 0)
return (0);
return (CN_DEAD);
if (strncmp(compatible, "sony,ps3", sizeof(compatible)) != 0)
return (0);
#else
TUNABLE_STR_FETCH("hw.platform", compatible, sizeof(compatible));
if (strcmp(compatible, "ps3") != 0)
return (CN_DEAD);
#endif
return (CN_INTERNAL);
}