Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Nov 2013 23:23:23 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        George Neville-Neil <gnn@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, Sergey Kandaurov <pluknet@freebsd.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r258142 - head/sys/net
Message-ID:  <20131115223304.R2093@besplex.bde.org>
In-Reply-To: <A2749F6A-4F91-4DC7-A2C4-0F75AE20DB5E@freebsd.org>
References:  <201311142007.rAEK7InH068095@svn.freebsd.org> <CAE-mSOKfAgZQMuXJ1mF0vyB6EgRVMQ5CpxNX%2BSh7Q6dHiA=fnQ@mail.gmail.com> <A2749F6A-4F91-4DC7-A2C4-0F75AE20DB5E@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 14 Nov 2013, George Neville-Neil wrote:

> On Nov 14, 2013, at 16:03 , Sergey Kandaurov <pluknet@FreeBSD.org> wrote:
>
>> On 15 November 2013 00:07, George V. Neville-Neil <gnn@freebsd.org> wrot=
e:
>>> Log:
>>>  Shift our OUI correctly.
>>>
>>>  Pointed out by: emaste
>>>
>>> Modified:
>>>  head/sys/net/ieee_oui.h
>>>
>>> Modified: head/sys/net/ieee_oui.h
>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
>>> --- head/sys/net/ieee_oui.h     Thu Nov 14 19:53:35 2013        (r25814=
1)
>>> +++ head/sys/net/ieee_oui.h     Thu Nov 14 20:07:17 2013        (r25814=
2)
>>> @@ -62,5 +62,5 @@
>>>  */
>>>
>>> /* Allocate 64K to bhyve */
>>> -#define OUI_FREEBSD_BHYVE_LOW  OUI_FREEBSD + 0x000001
>>> -#define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD + 0x00ffff
>>> +#define OUI_FREEBSD_BHYVE_LOW  ((OUI_FREEBSD << 3) + 0x000001)
>>> +#define OUI_FREEBSD_BHYVE_HIGH ((OUI_FREEBSD << 3) + 0x00ffff)

This also fixes the syntax bugs (missing parentheses).

>> Shouldn't it be rather shifted with 24 (3 x 8bits)?
>
> Correct, and it should really be an | not a +.  I=92ll commit a fix.

Any chance of also fixing the style bugs?  The most obvious ones are
spaces instead of tabs after #define's.

From=20the next commit:

% Modified: head/sys/net/ieee_oui.h
% =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
% --- head/sys/net/ieee_oui.h=09Thu Nov 14 21:31:58 2013=09(r258146)
% +++ head/sys/net/ieee_oui.h=09Thu Nov 14 21:57:37 2013=09(r258147)
% ...
% @@ -62,5 +62,5 @@
%   */
%=20
%  /* Allocate 64K to bhyve */
% -#define OUI_FREEBSD_BHYVE_LOW=09((OUI_FREEBSD << 3) + 0x000001)
% -#define OUI_FREEBSD_BHYVE_HIGH=09((OUI_FREEBSD << 3) + 0x00ffff)
% +#define OUI_FREEBSD_BHYVE_LOW=09(((uint64_t)OUI_FREEBSD << 24) | 0x00000=
1)
% +#define OUI_FREEBSD_BHYVE_HIGH=09(((uint64_t)OUI_FREEBSD << 24) | 0x00ff=
ff)
%

This introduces a new bug: uint64_t is used but isn't defined.  To avoid
all of the following design errors/style bugs:

- requiring applications to include <stdint.h> to use the BHYVE part of thi=
s
   header
- polluting this header for all applications by declaring uint64_t
   unconditionally in case the BHIVE parts are used
- same as previous, but without (user-visible) pollution by using __uint64_=
t
   instead of uint64_t
- breaking use of the definitions in cpp expressions by using any
   typedefed type in them
- using the long long abomination instead of uint64_t in the cast to
   avoid the pollution and make the definition possibly useable in cpp
   expressions, though it may still have the wrong type
- using the long long abomination as a type suffix for OUI_FREEBSD
   instead of casting OUI_FREEEBSD,

I suggest #defining OUI_FREEBSD as some literal constant shifted right
by 24.  Its type is then determined by the C rules for types of
literals combined with the rules for right shifts.  Shifting OUI_FREEBSD
back gives the same type as the original literal (this is not obvious)
the same value as the original literal, and the same value as the left
shift expressions above.  (Except in cpp expressions types don't work
normally.)

Does the API require defining OUI_FREEBSD as a value that needs to be
shifted left by 24 to use?  It would be more useful to define it as the
left-shifted value.  Then it gives the base for the FreeBSD range.
Values that aren't left shifted have the advantage of fitting in 32 bits,
so that their natural type is always int the type needed to hold the
left-shifted value can be implementation-defined (it should be int64_t
on 32-bit systems and long on 64-bit systems).

Bruce
From owner-svn-src-all@FreeBSD.ORG  Fri Nov 15 13:12:54 2013
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 85E5DFFB;
 Fri, 15 Nov 2013 13:12:54 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 74EBC281A;
 Fri, 15 Nov 2013 13:12:54 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAFDCs3Q016769;
 Fri, 15 Nov 2013 13:12:54 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
 by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAFDCsH3016766;
 Fri, 15 Nov 2013 13:12:54 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201311151312.rAFDCsH3016766@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 15 Nov 2013 13:12:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r258168 - head/sys/dev/sound/pci/hda
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.16
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>;
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 15 Nov 2013 13:12:54 -0000

Author: mav
Date: Fri Nov 15 13:12:53 2013
New Revision: 258168
URL: http://svnweb.freebsd.org/changeset/base/258168

Log:
  Add ID for Intel Lynx Point HDMI CODEC.
  
  Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>

Modified:
  head/sys/dev/sound/pci/hda/hdac.h
  head/sys/dev/sound/pci/hda/hdacc.c

Modified: head/sys/dev/sound/pci/hda/hdac.h
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.h	Fri Nov 15 12:12:50 2013	(r258167)
+++ head/sys/dev/sound/pci/hda/hdac.h	Fri Nov 15 13:12:53 2013	(r258168)
@@ -605,6 +605,7 @@
 #define HDA_CODEC_INTELIP2	HDA_CODEC_CONSTRUCT(INTEL, 0x2804)
 #define HDA_CODEC_INTELCPT	HDA_CODEC_CONSTRUCT(INTEL, 0x2805)
 #define HDA_CODEC_INTELPPT	HDA_CODEC_CONSTRUCT(INTEL, 0x2806)
+#define HDA_CODEC_INTELLP	HDA_CODEC_CONSTRUCT(INTEL, 0x2807)
 #define HDA_CODEC_INTELCL	HDA_CODEC_CONSTRUCT(INTEL, 0x29fb)
 #define HDA_CODEC_INTELXXXX	HDA_CODEC_CONSTRUCT(INTEL, 0xffff)
 

Modified: head/sys/dev/sound/pci/hda/hdacc.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdacc.c	Fri Nov 15 12:12:50 2013	(r258167)
+++ head/sys/dev/sound/pci/hda/hdacc.c	Fri Nov 15 13:12:53 2013	(r258168)
@@ -318,6 +318,7 @@ static const struct {
 	{ HDA_CODEC_INTELIP2, 0,	"Intel Ibex Peak" },
 	{ HDA_CODEC_INTELCPT, 0,	"Intel Cougar Point" },
 	{ HDA_CODEC_INTELPPT, 0,	"Intel Panther Point" },
+	{ HDA_CODEC_INTELLP, 0,		"Intel Lynx Point" },
 	{ HDA_CODEC_INTELCL, 0,		"Intel Crestline" },
 	{ HDA_CODEC_SII1390, 0,		"Silicon Image SiI1390" },
 	{ HDA_CODEC_SII1392, 0,		"Silicon Image SiI1392" },



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131115223304.R2093>