Date: Mon, 19 Jan 2015 11:06:56 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277378 - head/sys/dev/ofw Message-ID: <201501191106.t0JB6u4L054007@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Mon Jan 19 11:06:56 2015 New Revision: 277378 URL: https://svnweb.freebsd.org/changeset/base/277378 Log: Make the clock-frequency property optional as it may not be present on FDT systems. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/ofw/ofw_cpu.c Modified: head/sys/dev/ofw/ofw_cpu.c ============================================================================== --- head/sys/dev/ofw/ofw_cpu.c Mon Jan 19 11:02:23 2015 (r277377) +++ head/sys/dev/ofw/ofw_cpu.c Mon Jan 19 11:06:56 2015 (r277378) @@ -1,7 +1,11 @@ /*- * Copyright (C) 2009 Nathan Whitehorn + * Copyright (C) 2015 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -193,10 +197,11 @@ ofw_cpu_attach(device_t dev) } sc->sc_cpu_pcpu = pcpu_find(cell); if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) < 0) { - device_printf(dev, "missing 'clock-frequency' property\n"); - return (ENXIO); - } - sc->sc_nominal_mhz = cell / 1000000; /* convert to MHz */ + if (bootverbose) + device_printf(dev, + "missing 'clock-frequency' property\n"); + } else + sc->sc_nominal_mhz = cell / 1000000; /* convert to MHz */ bus_generic_probe(dev); return (bus_generic_attach(dev)); @@ -214,8 +219,11 @@ ofw_cpu_read_ivar(device_t dev, device_t *result = (uintptr_t)sc->sc_cpu_pcpu; return (0); case CPU_IVAR_NOMINAL_MHZ: - *result = (uintptr_t)sc->sc_nominal_mhz; - return (0); + if (sc->sc_nominal_mhz > 0) { + *result = (uintptr_t)sc->sc_nominal_mhz; + return (0); + } + break; } return (ENOENT);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501191106.t0JB6u4L054007>