Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2010 21:47:50 +0100
From:      Rafal Jaworowski <raj@semihalf.com>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 174261 for review
Message-ID:  <95088A21-2657-424D-AD80-725F05F26AAB@semihalf.com>
In-Reply-To: <4B69DB88.2050502@freebsd.org>
References:  <201002032021.o13KLkPO006520@repoman.freebsd.org> <4B69DB88.2050502@freebsd.org>

index | next in thread | previous in thread | raw e-mail


On 2010-02-03, at 21:24, Nathan Whitehorn wrote:

> Rafal Jaworowski wrote:
>> http://p4web.freebsd.org/chv.cgi?CH=174261
>> 
>> Change 174261 by raj@raj_fdt on 2010/02/03 20:20:54
>> 
>> 	Bring more endian-safety for FDT uart(4) attachment.
>> 
>> Affected files ...
>> 
>> .. //depot/projects/fdt/sys/dev/uart/uart_bus_fdt.c#5 edit
>> 
>> Differences ...
>> 
>> ==== //depot/projects/fdt/sys/dev/uart/uart_bus_fdt.c#5 (text+ko) ====
>> 
>> @@ -1,5 +1,5 @@
>> /*-
>> - * Copyright (c) 2009 The FreeBSD Foundation
>> + * Copyright (c) 2009-2010 The FreeBSD Foundation
>>  * All rights reserved.
>>  *
>>  * This software was developed by Semihalf under sponsorship from
>> @@ -35,11 +35,15 @@
>> #include <sys/kernel.h>
>> #include <sys/module.h>
>> +#include <machine/bus.h>
>> +
>> #include <dev/ofw/ofw_bus.h>
>> #include <dev/ofw/ofw_bus_subr.h>
>> #include <dev/uart/uart.h>
>> #include <dev/uart/uart_bus.h>
>> +#include "../../contrib/dtc/libfdt/libfdt_env.h"
>> +
>> static int uart_fdt_probe(device_t);
>>  static device_method_t uart_fdt_methods[] = {
>> @@ -81,8 +85,11 @@
>> 		    sizeof(clock))) <= 0)
>> 			clock = 0;
>> +	clock = fdt32_to_cpu(clock);
>> +
> Can't you just use ntoh*? As far as I know, FDT (and Open Firmware) are defined to always use network byte order.

Techinically yes, although the fdt* accessors are native for libfdt, so I'd rather stay with uniform behaviour. Also, they are explict in name while noth* could be a bit confusing, I think, for people not intimate with FDT internals.

Rafal



help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95088A21-2657-424D-AD80-725F05F26AAB>