Deleted Added
full compact
ofw_syscons.c (186055) ofw_syscons.c (190681)
1/*-
2 * Copyright (c) 2003 Peter Grehan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Peter Grehan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/powerpc/ofw/ofw_syscons.c 186055 2008-12-13 20:53:57Z nwhitehorn $");
28__FBSDID("$FreeBSD: head/sys/powerpc/ofw/ofw_syscons.c 190681 2009-04-04 00:22:44Z nwhitehorn $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/module.h>
33#include <sys/bus.h>
34#include <sys/kernel.h>
35#include <sys/sysctl.h>
36#include <sys/limits.h>

--- 174 unchanged lines hidden (view full) ---

211
212static int
213ofwfb_configure(int flags)
214{
215 struct ofwfb_softc *sc;
216 phandle_t chosen;
217 ihandle_t stdout;
218 phandle_t node;
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/module.h>
33#include <sys/bus.h>
34#include <sys/kernel.h>
35#include <sys/sysctl.h>
36#include <sys/limits.h>

--- 174 unchanged lines hidden (view full) ---

211
212static int
213ofwfb_configure(int flags)
214{
215 struct ofwfb_softc *sc;
216 phandle_t chosen;
217 ihandle_t stdout;
218 phandle_t node;
219 bus_addr_t fb_phys;
219 int depth;
220 int disable;
221 int len;
222 char type[16];
223 static int done = 0;
224
225 disable = 0;
226 TUNABLE_INT_FETCH("hw.syscons.disable", &disable);

--- 38 unchanged lines hidden (view full) ---

265 sc->sc_depth = depth;
266 sc->sc_node = node;
267 sc->sc_console = 1;
268 OF_getprop(node, "height", &sc->sc_height, sizeof(sc->sc_height));
269 OF_getprop(node, "width", &sc->sc_width, sizeof(sc->sc_width));
270 OF_getprop(node, "linebytes", &sc->sc_stride, sizeof(sc->sc_stride));
271
272 /*
220 int depth;
221 int disable;
222 int len;
223 char type[16];
224 static int done = 0;
225
226 disable = 0;
227 TUNABLE_INT_FETCH("hw.syscons.disable", &disable);

--- 38 unchanged lines hidden (view full) ---

266 sc->sc_depth = depth;
267 sc->sc_node = node;
268 sc->sc_console = 1;
269 OF_getprop(node, "height", &sc->sc_height, sizeof(sc->sc_height));
270 OF_getprop(node, "width", &sc->sc_width, sizeof(sc->sc_width));
271 OF_getprop(node, "linebytes", &sc->sc_stride, sizeof(sc->sc_stride));
272
273 /*
273 * XXX the physical address of the frame buffer is assumed to be
274 * BAT-mapped so it can be accessed directly
274 * Grab the physical address of the framebuffer, and then map it
275 * into our memory space. If the MMU is not yet up, it will be
276 * remapped for us when relocation turns on.
277 *
278 * XXX We assume #address-cells is 1 at this point.
275 */
279 */
276 OF_getprop(node, "address", &sc->sc_addr, sizeof(sc->sc_addr));
280 OF_getprop(node, "address", &fb_phys, sizeof(fb_phys));
277
281
282 bus_space_map(&bs_be_tag, fb_phys, sc->sc_height * sc->sc_stride,
283 0, &sc->sc_addr);
284
278 /*
279 * Get the PCI addresses of the adapter. The node may be the
280 * child of the PCI device: in that case, try the parent for
281 * the assigned-addresses property.
282 */
283 len = OF_getprop(node, "assigned-addresses", sc->sc_pciaddrs,
284 sizeof(sc->sc_pciaddrs));
285 if (len == -1) {
285 /*
286 * Get the PCI addresses of the adapter. The node may be the
287 * child of the PCI device: in that case, try the parent for
288 * the assigned-addresses property.
289 */
290 len = OF_getprop(node, "assigned-addresses", sc->sc_pciaddrs,
291 sizeof(sc->sc_pciaddrs));
292 if (len == -1) {
286 len = OF_getprop(OF_parent(node), "assigned-addresses", sc->sc_pciaddrs,
287 sizeof(sc->sc_pciaddrs));
293 len = OF_getprop(OF_parent(node), "assigned-addresses",
294 sc->sc_pciaddrs, sizeof(sc->sc_pciaddrs));
288 }
289
290 if (len != -1) {
291 sc->sc_num_pciaddrs = len / sizeof(struct ofw_pci_register);
292 }
293
294 ofwfb_init(0, &sc->sc_va, 0);
295

--- 640 unchanged lines hidden (view full) ---

936 * the device list
937 */
938 child = BUS_ADD_CHILD(parent, INT_MAX, SC_DRIVER_NAME, 0);
939}
940
941static int
942ofwfb_scprobe(device_t dev)
943{
295 }
296
297 if (len != -1) {
298 sc->sc_num_pciaddrs = len / sizeof(struct ofw_pci_register);
299 }
300
301 ofwfb_init(0, &sc->sc_va, 0);
302

--- 640 unchanged lines hidden (view full) ---

943 * the device list
944 */
945 child = BUS_ADD_CHILD(parent, INT_MAX, SC_DRIVER_NAME, 0);
946}
947
948static int
949ofwfb_scprobe(device_t dev)
950{
944 /* This is a fake device, so make sure there is no OF node for it */
945 if (ofw_bus_get_node(dev) != -1)
946 return ENXIO;
947
951 int error;
952
948 device_set_desc(dev, "System console");
953 device_set_desc(dev, "System console");
949 return (sc_probe_unit(device_get_unit(dev),
950 device_get_flags(dev) | SC_AUTODETECT_KBD));
954
955 error = sc_probe_unit(device_get_unit(dev),
956 device_get_flags(dev) | SC_AUTODETECT_KBD);
957 if (error != 0)
958 return (error);
959
960 /* This is a fake device, so make sure we added it ourselves */
961 return (BUS_PROBE_NOWILDCARD);
951}
952
953static int
954ofwfb_scattach(device_t dev)
955{
956 return (sc_attach_unit(device_get_unit(dev),
957 device_get_flags(dev) | SC_AUTODETECT_KBD));
958}

--- 72 unchanged lines hidden ---
962}
963
964static int
965ofwfb_scattach(device_t dev)
966{
967 return (sc_attach_unit(device_get_unit(dev),
968 device_get_flags(dev) | SC_AUTODETECT_KBD));
969}

--- 72 unchanged lines hidden ---