Carl-Daniel Hailfinger | 1 Mar 01:31 2012
Picon
Picon

Re: libpayload alloc() gcc 4.6.2 bug?

Am 29.02.2012 08:39 schrieb Patrick Georgi:
> Am 28.02.2012 23:06, schrieb Marc Jones:
>> I found this bug building tint with libpayload. libpayload is built
>> with defconfig and using the same coreboot crosstools gcc. The bug
>> happens in the first call to alloc() when the first header of the
>> first region is installed. The header memory location is checked,
>> found to be 0, and then loaded with the header. The bug is that the
>> original value of the location is used after the memory was updated.
>> It should have been reloaded. It is pretty easy to see in the
>> disassembly below.
> workaround: mark setup() __attribute__((noinline))
>
> The proper fix is to clean up the various casts so the aliasing based
> optimizations in gcc do the right thing.

Can't you use __attribute__((may_alias)) for the affected variables?

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Kostas Gounaris | 1 Mar 08:18 2012
Picon

(no subject)

I would like to test coreboot on my PC, as I trust opensource far more than proprietary and besides the official BIOS for my MB has a couple o infuriating bugs (*) that drive me crazy. My MB is Gigabyte's GA-8I945PL-G v1.x and I am using the latest F8 BIOS. I could not find this model on the supported list, but I can see that the chipsets (945PL/IHC7) are! Is it possible to support my MB and try out coreboot on it? Thanx in advance :)

(*) First, if I enable the onboard NIC PXE BIOS by checking "Enable boot from LAN" in BIOS settings, I can not enter the BIOS setup anymore - I have to clear the CMOS. The second one is not considered a bug, but a feature : the BIOS creates an HPA on the HD and saves a copy of itself there to facilitate recovery just in case...
--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot
Mathias Krause | 1 Mar 14:14 2012

New patch to review for filo: fa8dac1 Remove unused LZMA implementation

Mathias Krause (mathias.krause <at> secunet.com) just uploaded a new patch set to gerrit, which you can find
at http://review.coreboot.org/689

-gerrit

commit fa8dac159f025a9870fabc6859fc4c98039081cd
Author: Mathias Krause <mathias.krause <at> secunet.com>
Date:   Thu Mar 1 13:57:20 2012 +0100

    Remove unused LZMA implementation

    This patch complements commit 466dbb3 ("Adapt filo to libpayload
    changes") by also removing the stale LZMA implementation, which is no
    longer needed. We're using the libpayload based CBFS support since.

    Change-Id: I477b6425d74dd3a2ad08c3aeee891b013ce8eab4
    Signed-off-by: Mathias Krause <mathias.krause <at> secunet.com>
---
 fs/lzma.c       |   47 -------
 fs/lzmadecode.c |  398 -------------------------------------------------------
 fs/lzmadecode.h |   67 ---------
 3 files changed, 0 insertions(+), 512 deletions(-)

diff --git a/fs/lzma.c b/fs/lzma.c
deleted file mode 100644
index a9c5f56..0000000
--- a/fs/lzma.c
+++ /dev/null
 <at>  <at>  -1,47 +0,0  <at>  <at> 
-/* 
-
-Coreboot interface to memory-saving variant of LZMA decoder
-
-(C)opyright 2006 Carl-Daniel Hailfinger
-Released under the GNU GPL v2 or later
-
-Parts of this file are based on C/7zip/Compress/LZMA_C/LzmaTest.c from the LZMA
-SDK 4.42, which is written and distributed to public domain by Igor Pavlov.
-
-*/
-
-#include "lzmadecode.c"
-#define printk_warning printf
-
-
-unsigned long ulzma(unsigned char * src, unsigned char * dst)
-{
-	unsigned char properties[LZMA_PROPERTIES_SIZE];
-	UInt32 outSize;
-	SizeT inProcessed;
-	SizeT outProcessed;
-	int res;
-	CLzmaDecoderState state;
-	SizeT mallocneeds;
-	unsigned char scratchpad[15980];
-
-	memcpy(properties, src, LZMA_PROPERTIES_SIZE);
-	outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE);
-	if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) !=
LZMA_RESULT_OK) {
-		printk_warning("lzma: Incorrect stream properties.\n");
-		return 0;
-	}
-	mallocneeds = (LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
-	if (mallocneeds > 15980) {
-		printk_warning("lzma: Decoder scratchpad too small!\n");
-		return 0;
-	}
-	state.Probs = (CProb *)scratchpad;
-	res = LzmaDecode(&state, src + LZMA_PROPERTIES_SIZE + 8, (SizeT)0xffffffff, &inProcessed,
-		dst, outSize, &outProcessed);
-	if (res != 0) {
-		printk_warning("lzma: Decoding error = %d\n", res);
-		return 0;
-	}
-	return outSize;
-}
diff --git a/fs/lzmadecode.c b/fs/lzmadecode.c
deleted file mode 100644
index 65819b5..0000000
--- a/fs/lzmadecode.c
+++ /dev/null
 <at>  <at>  -1,398 +0,0  <at>  <at> 
-/*
-  LzmaDecode.c
-  LZMA Decoder (optimized for Speed version)
-  
-  LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this Code, expressly permits you to 
-  statically or dynamically link your Code (or bind by name) to the 
-  interfaces of this file without subjecting your linked Code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "lzmadecode.h"
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*Buffer++)
-
-#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
-  { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
-
-
-#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
-
-#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
- 
-
-#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
-
-#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
-#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
-#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
-
-#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
-  { UpdateBit0(p); mi <<= 1; A0; } else \
-  { UpdateBit1(p); mi = (mi + mi) + 1; A1; } 
-  
-#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)               
-
-#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
-  { int i = numLevels; res = 1; \
-  do { CProb *cp = probs + res; RC_GET_BIT(cp, res) } while(--i != 0); \
-  res -= (1 << numLevels); }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
-{
-  unsigned char prop0;
-  if (size < LZMA_PROPERTIES_SIZE)
-    return LZMA_RESULT_DATA_ERROR;
-  prop0 = propsData[0];
-  if (prop0 >= (9 * 5 * 5))
-    return LZMA_RESULT_DATA_ERROR;
-  {
-    for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
-    for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
-    propsRes->lc = prop0;
-    /*
-    unsigned char remainder = (unsigned char)(prop0 / 9);
-    propsRes->lc = prop0 % 9;
-    propsRes->pb = remainder / 5;
-    propsRes->lp = remainder % 5;
-    */
-  }
-
-  return LZMA_RESULT_OK;
-}
-
-#define kLzmaStreamWasFinishedId (-1)
-
-int LzmaDecode(CLzmaDecoderState *vs,
-    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
-    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
-{
-  CProb *p = vs->Probs;
-  SizeT nowPos = 0;
-  Byte previousByte = 0;
-  UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
-  UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
-  int lc = vs->Properties.lc;
-
-
-  int state = 0;
-  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
-  int len = 0;
-  const Byte *Buffer;
-  const Byte *BufferLim;
-  UInt32 Range;
-  UInt32 Code;
-
-  *inSizeProcessed = 0;
-  *outSizeProcessed = 0;
-
-  {
-    UInt32 i;
-    UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
-    for (i = 0; i < numProbs; i++)
-      p[i] = kBitModelTotal >> 1;
-  }
-  
-  RC_INIT(inStream, inSize);
-
-
-  while(nowPos < outSize)
-  {
-    CProb *prob;
-    UInt32 bound;
-    int posState = (int)(
-        (nowPos 
-        )
-        & posStateMask);
-
-    prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
-    IfBit0(prob)
-    {
-      int symbol = 1;
-      UpdateBit0(prob)
-      prob = p + Literal + (LZMA_LIT_SIZE * 
-        (((
-        (nowPos 
-        )
-        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
-      if (state >= kNumLitStates)
-      {
-        int matchByte;
-        matchByte = outStream[nowPos - rep0];
-        do
-        {
-          int bit;
-          CProb *probLit;
-          matchByte <<= 1;
-          bit = (matchByte & 0x100);
-          probLit = prob + 0x100 + bit + symbol;
-          RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
-        }
-        while (symbol < 0x100);
-      }
-      while (symbol < 0x100)
-      {
-        CProb *probLit = prob + symbol;
-        RC_GET_BIT(probLit, symbol)
-      }
-      previousByte = (Byte)symbol;
-
-      outStream[nowPos++] = previousByte;
-      if (state < 4) state = 0;
-      else if (state < 10) state -= 3;
-      else state -= 6;
-    }
-    else             
-    {
-      UpdateBit1(prob);
-      prob = p + IsRep + state;
-      IfBit0(prob)
-      {
-        UpdateBit0(prob);
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        state = state < kNumLitStates ? 0 : 3;
-        prob = p + LenCoder;
-      }
-      else
-      {
-        UpdateBit1(prob);
-        prob = p + IsRepG0 + state;
-        IfBit0(prob)
-        {
-          UpdateBit0(prob);
-          prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
-          IfBit0(prob)
-          {
-            UpdateBit0(prob);
-            
-            if (nowPos == 0)
-              return LZMA_RESULT_DATA_ERROR;
-            
-            state = state < kNumLitStates ? 9 : 11;
-            previousByte = outStream[nowPos - rep0];
-            outStream[nowPos++] = previousByte;
-
-            continue;
-          }
-          else
-          {
-            UpdateBit1(prob);
-          }
-        }
-        else
-        {
-          UInt32 distance;
-          UpdateBit1(prob);
-          prob = p + IsRepG1 + state;
-          IfBit0(prob)
-          {
-            UpdateBit0(prob);
-            distance = rep1;
-          }
-          else 
-          {
-            UpdateBit1(prob);
-            prob = p + IsRepG2 + state;
-            IfBit0(prob)
-            {
-              UpdateBit0(prob);
-              distance = rep2;
-            }
-            else
-            {
-              UpdateBit1(prob);
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        state = state < kNumLitStates ? 8 : 11;
-        prob = p + RepLenCoder;
-      }
-      {
-        int numBits, offset;
-        CProb *probLen = prob + LenChoice;
-        IfBit0(probLen)
-        {
-          UpdateBit0(probLen);
-          probLen = prob + LenLow + (posState << kLenNumLowBits);
-          offset = 0;
-          numBits = kLenNumLowBits;
-        }
-        else
-        {
-          UpdateBit1(probLen);
-          probLen = prob + LenChoice2;
-          IfBit0(probLen)
-          {
-            UpdateBit0(probLen);
-            probLen = prob + LenMid + (posState << kLenNumMidBits);
-            offset = kLenNumLowSymbols;
-            numBits = kLenNumMidBits;
-          }
-          else
-          {
-            UpdateBit1(probLen);
-            probLen = prob + LenHigh;
-            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-            numBits = kLenNumHighBits;
-          }
-        }
-        RangeDecoderBitTreeDecode(probLen, numBits, len);
-        len += offset;
-      }
-
-      if (state < 4)
-      {
-        int posSlot;
-        state += kNumLitStates;
-        prob = p + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
-            kNumPosSlotBits);
-        RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-          rep0 = (2 | ((UInt32)posSlot & 1));
-          if (posSlot < kEndPosModelIndex)
-          {
-            rep0 <<= numDirectBits;
-            prob = p + SpecPos + rep0 - posSlot - 1;
-          }
-          else
-          {
-            numDirectBits -= kNumAlignBits;
-            do
-            {
-              RC_NORMALIZE
-              Range >>= 1;
-              rep0 <<= 1;
-              if (Code >= Range)
-              {
-                Code -= Range;
-                rep0 |= 1;
-              }
-            }
-            while (--numDirectBits != 0);
-            prob = p + Align;
-            rep0 <<= kNumAlignBits;
-            numDirectBits = kNumAlignBits;
-          }
-          {
-            int i = 1;
-            int mi = 1;
-            do
-            {
-              CProb *prob3 = prob + mi;
-              RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
-              i <<= 1;
-            }
-            while(--numDirectBits != 0);
-          }
-        }
-        else
-          rep0 = posSlot;
-        if (++rep0 == (UInt32)(0))
-        {
-          /* it's for stream version */
-          len = kLzmaStreamWasFinishedId;
-          break;
-        }
-      }
-
-      len += kMatchMinLen;
-      if (rep0 > nowPos)
-        return LZMA_RESULT_DATA_ERROR;
-
-
-      do
-      {
-        previousByte = outStream[nowPos - rep0];
-        len--;
-        outStream[nowPos++] = previousByte;
-      }
-      while(len != 0 && nowPos < outSize);
-    }
-  }
-  RC_NORMALIZE;
-
-
-  *inSizeProcessed = (SizeT)(Buffer - inStream);
-  *outSizeProcessed = nowPos;
-  return LZMA_RESULT_OK;
-}
diff --git a/fs/lzmadecode.h b/fs/lzmadecode.h
deleted file mode 100644
index dedde0d..0000000
--- a/fs/lzmadecode.h
+++ /dev/null
 <at>  <at>  -1,67 +0,0  <at>  <at> 
-/* 
-  LzmaDecode.h
-  LZMA Decoder interface
-
-  LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMADECODE_H
-#define __LZMADECODE_H
-
-typedef unsigned char Byte;
-typedef unsigned short UInt16;
-typedef unsigned int UInt32;
-typedef UInt32 SizeT;
-
-#define CProb UInt16
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LZMA_PROPERTIES_SIZE 5
-
-typedef struct _CLzmaProperties
-{
-  int lc;
-  int lp;
-  int pb;
-}CLzmaProperties;
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
-
-#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
-
-#define kLzmaNeedInitId (-2)
-
-typedef struct _CLzmaDecoderState
-{
-  CLzmaProperties Properties;
-  CProb *Probs;
-
-
-} CLzmaDecoderState;
-
-
-int LzmaDecode(CLzmaDecoderState *vs,
-    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
-    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
-
-#endif

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

gerrit | 1 Mar 15:42 2012

Patch merged into filo/master: fa8dac1 Remove unused LZMA implementation

the following patch was just integrated into master:
commit fa8dac159f025a9870fabc6859fc4c98039081cd
Author: Mathias Krause <mathias.krause <at> secunet.com>
Date:   Thu Mar 1 13:57:20 2012 +0100

    Remove unused LZMA implementation

    This patch complements commit 466dbb3 ("Adapt filo to libpayload
    changes") by also removing the stale LZMA implementation, which is no
    longer needed. We're using the libpayload based CBFS support since.

    Change-Id: I477b6425d74dd3a2ad08c3aeee891b013ce8eab4
    Signed-off-by: Mathias Krause <mathias.krause <at> secunet.com>

Build-Tested: build bot (Jenkins) at Thu Mar  1 14:16:20 2012, giving +1
Reviewed-By: Peter Stuge <peter <at> stuge.se> at Thu Mar  1 15:42:37 2012, giving +2
See http://review.coreboot.org/689 for details.

-gerrit

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Peter Stuge | 1 Mar 15:49 2012
Picon

Re: (no subject)

Hi Kostas,

Kostas Gounaris wrote:
> I could not find this model on the supported list,

So your mainboard is not supported.

> but I can see that the chipsets (945PL/IHC7) are! Is it possible to
> support my MB

Sure it is. You need to spend some time on studying coreboot and the
other mainboard ports using the 945 chipset, and then you can start
developing the support for your board. Of course the community can
and will give advice during your work. I'm looking forward to your
patches!

//Peter

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Mike Bishton | 2 Mar 00:54 2012

Core i7 Support?

Is anyone working on porting coreboot to the newer Intel platforms with 
Core i7 CPUs?

Thanks,
Mike

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Marc Jones | 2 Mar 01:46 2012
Picon

Re: libpayload alloc() gcc 4.6.2 bug?

On Wed, Feb 29, 2012 at 5:31 PM, Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006 <at> gmx.net> wrote:
> Am 29.02.2012 08:39 schrieb Patrick Georgi:
>> Am 28.02.2012 23:06, schrieb Marc Jones:
>>> I found this bug building tint with libpayload. libpayload is built
>>> with defconfig and using the same coreboot crosstools gcc. The bug
>>> happens in the first call to alloc() when the first header of the
>>> first region is installed. The header memory location is checked,
>>> found to be 0, and then loaded with the header. The bug is that the
>>> original value of the location is used after the memory was updated.
>>> It should have been reloaded. It is pretty easy to see in the
>>> disassembly below.
>> workaround: mark setup() __attribute__((noinline))
>>
>> The proper fix is to clean up the various casts so the aliasing based
>> optimizations in gcc do the right thing.
>
> Can't you use __attribute__((may_alias)) for the affected variables?
>
> Regards,
> Carl-Daniel
>
> --
> http://www.hailfinger.org/
>

i think that I have resolved the issue by making the pointers
volatile. I wanted to get some comments here before I push it to
gerrit.

The asm generated:

  10b7d7:	8b 15 a0 5f 11 00    	mov    0x115fa0,%edx
  10b7dd:	81 e2 00 00 00 a8    	and    $0xa8000000,%edx
  10b7e3:	81 fa 00 00 00 a8    	cmp    $0xa8000000,%edx
  10b7e9:	74 0f                	je     10b7fa <alloc+0x3a>
  10b7eb:	25 fc ff ff 00       	and    $0xfffffc,%eax
  10b7f0:	0d 00 00 00 aa       	or     $0xaa000000,%eax
  10b7f5:	a3 a0 5f 11 00       	mov    %eax,0x115fa0
  10b7fa:	b8 a0 5f 11 00       	mov    $0x115fa0,%eax
  10b7ff:	90                   	nop
  10b800:	8b 10                	mov    (%eax),%edx
  10b802:	89 d1                	mov    %edx,%ecx

Marc

-- 
http://se-eng.com
--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot
Stefan Reinauer | 2 Mar 23:01 2012

New patch to review for coreboot: e3d53a2 Add support for the Startech PEX1XS1PMINI

Stefan Reinauer (stefan.reinauer <at> coreboot.org) just uploaded a new patch set to gerrit, which you can
find at http://review.coreboot.org/690

-gerrit

commit e3d53a2242c3c6dd522c58ad05a74847be80fa84
Author: Stefan Reinauer <reinauer <at> chromium.org>
Date:   Mon May 9 15:19:29 2011 -0700

    Add support for the Startech PEX1XS1PMINI

    It has a smaller footprint than the already supported MPEX2S952

    Change-Id: Ie36b67f9628882d516ca34ff164f0e8918955a5b
    Signed-off-by: Stefan Reinauer <reinauer <at> google.com>
    Tested-by: Stefan Reinauer <reinauer <at> google.com>
    Reviewed-by: Duncan Laurie <dlaurie <at> google.com>
---
 src/drivers/oxford/oxpcie/oxpcie.c       |    6 ++++++
 src/drivers/oxford/oxpcie/oxpcie_early.c |   26 +++++++++++++++++++++++---
 src/lib/uart8250mem.c                    |    2 ++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/drivers/oxford/oxpcie/oxpcie.c b/src/drivers/oxford/oxpcie/oxpcie.c
index 94c5b64..e1fb65f 100644
--- a/src/drivers/oxford/oxpcie/oxpcie.c
+++ b/src/drivers/oxford/oxpcie/oxpcie.c
 <at>  <at>  -54,3 +54,9  <at>  <at>  static const struct pci_driver oxford_oxpcie_driver __pci_driver = {
 	.vendor = 0x1415,
 	.device = 0xc158,
 };
+
+static const struct pci_driver oxford_oxpcie_driver_2 __pci_driver = {
+	.ops    = &oxford_oxpcie_ops,
+	.vendor = 0x1415,
+	.device = 0xc11b,
+};
diff --git a/src/drivers/oxford/oxpcie/oxpcie_early.c b/src/drivers/oxford/oxpcie/oxpcie_early.c
index 3480654..2c7767e 100644
--- a/src/drivers/oxford/oxpcie/oxpcie_early.c
+++ b/src/drivers/oxford/oxpcie/oxpcie_early.c
 <at>  <at>  -31,6 +31,9  <at>  <at> 
 #define OXPCIE_DEVICE \
 	PCI_DEV(CONFIG_OXFORD_OXPCIE_BRIDGE_SUBORDINATE, 0, 0)

+#define OXPCIE_DEVICE_3 \
+	PCI_DEV(CONFIG_OXFORD_OXPCIE_BRIDGE_SUBORDINATE, 0, 3)
+
 void oxford_init(void)
 {
 	u16 reg16;
 <at>  <at>  -72,14 +75,31  <at>  <at>  void oxford_init(void)
 	while ((id == 0) || (id == 0xffffffff))
 		id = pci_read_config32(OXPCIE_DEVICE, PCI_VENDOR_ID);

+	u32 device = OXPCIE_DEVICE; /* unknown default */
+	switch (id) {
+	case 0xc1181415: /* e.g. Startech PEX1S1PMINI */
+		/* On this device function 0 is the parallel port, and
+		 * function 3 is the serial port. So let's go look for
+		 * the UART.
+		 */
+		id = pci_read_config32(OXPCIE_DEVICE_3, PCI_VENDOR_ID);
+		if (id != 0xc11b1415)
+			return;
+		device = OXPCIE_DEVICE_3;
+		break;
+	case 0xc1581415: /* e.g. Startech MPEX2S952 */
+		device = OXPCIE_DEVICE;
+		break;
+	}
+
 	/* Setup base address on device */
-	pci_write_config32(OXPCIE_DEVICE, PCI_BASE_ADDRESS_0,
+	pci_write_config32(device, PCI_BASE_ADDRESS_0,
 				CONFIG_OXFORD_OXPCIE_BASE_ADDRESS);

 	/* Enable memory on device */
-	reg16 = pci_read_config16(OXPCIE_DEVICE, PCI_COMMAND);
+	reg16 = pci_read_config16(device, PCI_COMMAND);
 	reg16 |= PCI_COMMAND_MEMORY;
-	pci_write_config16(OXPCIE_DEVICE, PCI_COMMAND, reg16);
+	pci_write_config16(device, PCI_COMMAND, reg16);

 	/* Now the UART initialization */
 	u32 uart0_base = CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000;
diff --git a/src/lib/uart8250mem.c b/src/lib/uart8250mem.c
index 75d51ff..a38623e 100644
--- a/src/lib/uart8250mem.c
+++ b/src/lib/uart8250mem.c
 <at>  <at>  -117,6 +117,8  <at>  <at>  u32 uart_mem_init(void)

 #if defined(MORE_TESTING) && !defined(__SMM__) && !defined(__PRE_RAM__)
 	device_t dev = dev_find_device(0x1415, 0xc158, NULL);
+	if (!dev)
+		dev = dev_find_device(0x1415, 0xc11b, NULL);

 	if (dev) {
 		struct resource *res = find_resource(dev, 0x10);

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Stefan Reinauer | 2 Mar 23:01 2012

New patch to review for coreboot: fa84bc2 move console includes to central console/console.h

Stefan Reinauer (stefan.reinauer <at> coreboot.org) just uploaded a new patch set to gerrit, which you can
find at http://review.coreboot.org/691

-gerrit

commit fa84bc28c757a27cf768989db805e5636219366c
Author: Stefan Reinauer <reinauer <at> chromium.org>
Date:   Tue May 10 10:46:41 2011 -0700

    move console includes to central console/console.h

    Because it's included everywhere anyways.

    Change-Id: I99a9e6edac08df57c50ef3a706fdbd395cad0abc
    Signed-off-by: Stefan Reinauer <reinauer <at> google.com>
---
 src/console/console.c         |   24 ++++++------------------
 src/cpu/x86/smm/smiutil.c     |   10 ----------
 src/include/console/console.h |   17 ++++++++++-------
 src/include/uart8250.h        |   31 ++++++++++---------------------
 4 files changed, 26 insertions(+), 56 deletions(-)

diff --git a/src/console/console.c b/src/console/console.c
index 325170d..d933668 100644
--- a/src/console/console.c
+++ b/src/console/console.c
 <at>  <at>  -22,18 +22,6  <at>  <at> 
 #include <arch/hlt.h>
 #include <arch/io.h>

-#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM
-#include <uart8250.h>
-#endif
-
-#if CONFIG_CONSOLE_NE2K
-#include <console/ne2k.h>
-#endif
-
-#if CONFIG_USBDEBUG
-#include <usbdebug.h>
-#endif
-
 #ifndef __PRE_RAM__
 #include <string.h>
 #include <pc80/mc146818rtc.h>
 <at>  <at>  -52,21 +40,21  <at>  <at>  void console_init(void)
 	}
 }

-static void __console_tx_byte(unsigned char byte)
+void console_tx_flush(void)
 {
 	struct console_driver *driver;
 	for(driver = console_drivers; driver < econsole_drivers; driver++) {
-		driver->tx_byte(byte);
+		if (!driver->tx_flush)
+			continue;
+		driver->tx_flush();
 	}
 }

-void console_tx_flush(void)
+static void __console_tx_byte(unsigned char byte)
 {
 	struct console_driver *driver;
 	for(driver = console_drivers; driver < econsole_drivers; driver++) {
-		if (!driver->tx_flush)
-			continue;
-		driver->tx_flush();
+		driver->tx_byte(byte);
 	}
 }

diff --git a/src/cpu/x86/smm/smiutil.c b/src/cpu/x86/smm/smiutil.c
index d9057d8..9cd63ed 100644
--- a/src/cpu/x86/smm/smiutil.c
+++ b/src/cpu/x86/smm/smiutil.c
 <at>  <at>  -23,18 +23,8  <at>  <at> 
 #include <arch/romcc_io.h>
 #include <cpu/x86/cache.h>
 #include <cpu/x86/smm.h>
-
 #include <console/console.h>
 #include <console/vtxprintf.h>
-#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM
-#include <uart8250.h>
-#endif
-#if CONFIG_USBDEBUG
-#include <usbdebug.h>
-#endif
-#if CONFIG_CONSOLE_NE2K
-#include <console/ne2k.h>
-#endif

 #if CONFIG_CONSOLE_SERIAL8250MEM
 static u32 serial8250mem_base_address = 0;
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 8283f66..54c825c 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
 <at>  <at>  -24,15 +24,21  <at>  <at> 
 #include <console/loglevel.h>
 #include <console/post_codes.h>

+#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM
+#include <uart8250.h>
+#endif
+#if CONFIG_USBDEBUG
+#include <usbdebug.h>
+#endif
+#if CONFIG_CONSOLE_NE2K
+#include <console/ne2k.h>
+#endif
+
 #ifndef __PRE_RAM__
 void console_tx_byte(unsigned char byte);
 void console_tx_flush(void);
 unsigned char console_rx_byte(void);
 int console_tst_byte(void);
-#if CONFIG_USBDEBUG
-#include <usbdebug.h>
-#endif
-
 struct console_driver {
 	void (*init)(void);
 	void (*tx_byte)(unsigned char byte);
 <at>  <at>  -55,9 +61,6  <at>  <at>  extern int console_loglevel;
  * we could use the same code on all architectures.
  */
 #define console_loglevel CONFIG_DEFAULT_CONSOLE_LOGLEVEL
-#if CONFIG_CONSOLE_SERIAL8250
-#include <uart8250.h>
-#endif
 #endif

 #ifndef __ROMCC__
diff --git a/src/include/uart8250.h b/src/include/uart8250.h
index 3c8ea09..aa510e5 100644
--- a/src/include/uart8250.h
+++ b/src/include/uart8250.h
 <at>  <at>  -20,26 +20,7  <at>  <at> 
 #ifndef UART8250_H
 #define UART8250_H

-/* Base Address */
-#ifndef CONFIG_TTYS0_BASE
-#define CONFIG_TTYS0_BASE 0x3f8
-#endif
-
-#ifndef CONFIG_TTYS0_BAUD
-#define CONFIG_TTYS0_BAUD 115200
-#endif
-#if ((115200%CONFIG_TTYS0_BAUD) != 0)
-#error Bad ttys0 baud rate
-#endif
-
-/* Line Control Settings */
-#ifndef CONFIG_TTYS0_LCS
-/* Set 8bit, 1 stop bit, no parity */
-#define CONFIG_TTYS0_LCS	0x3
-#endif
-
-#define UART_LCS	CONFIG_TTYS0_LCS
-
+#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM

 /* Data */
 #define UART_RBR 0x00
 <at>  <at>  -126,6 +107,12  <at>  <at> 
 #define UART_SCR 0x07
 #define UART_SPR 0x07

+#if ((115200 % CONFIG_TTYS0_BAUD) != 0)
+#error Bad ttyS0 baud rate
+#endif
+
+/* Line Control Settings */
+#define UART_LCS	CONFIG_TTYS0_LCS

 #ifndef __ROMCC__
 unsigned char uart8250_rx_byte(unsigned base_port);
 <at>  <at>  -151,6 +138,8  <at>  <at>  u32 uartmem_getbaseaddr(void);
 /* and special init for OXPCIe based cards */
 void oxford_init(void);

-#endif
+#endif /* __ROMCC__ */
+
+#endif /* CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM */

 #endif /* UART8250_H */

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Stefan Reinauer | 2 Mar 23:01 2012

New patch to review for coreboot: cb562df OXPCIe: Reinitialize UART after pci_dev_set_resources() ... and only pull in early init code if the OXPCIe is used for console.

Stefan Reinauer (stefan.reinauer <at> coreboot.org) just uploaded a new patch set to gerrit, which you can
find at http://review.coreboot.org/692

-gerrit

commit cb562dff51087dabab2e1ccebc85ef2cacb99b5a
Author: Stefan Reinauer <reinauer <at> chromium.org>
Date:   Tue May 10 12:54:56 2011 -0700

    OXPCIe: Reinitialize UART after pci_dev_set_resources()
    ... and only pull in early init code if the OXPCIe is used for console.

    Change-Id: I01feca3b9e8376a75c17554ba1bd200d523dff8d
    Signed-off-by: Stefan Reinauer <reinauer <at> google.com>
---
 src/drivers/oxford/oxpcie/Makefile.inc |    2 ++
 src/drivers/oxford/oxpcie/oxpcie.c     |   14 ++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/drivers/oxford/oxpcie/Makefile.inc b/src/drivers/oxford/oxpcie/Makefile.inc
index 7d3a26f..7f4aa58 100644
--- a/src/drivers/oxford/oxpcie/Makefile.inc
+++ b/src/drivers/oxford/oxpcie/Makefile.inc
 <at>  <at>  -1,3 +1,5  <at>  <at> 
 driver-$(CONFIG_DRIVERS_OXFORD_OXPCIE) += oxpcie.c

+ifeq ($(CONFIG_CONSOLE_SERIAL8250MEM),y)
 romstage-$(CONFIG_DRIVERS_OXFORD_OXPCIE) += oxpcie_early.c
+endif
diff --git a/src/drivers/oxford/oxpcie/oxpcie.c b/src/drivers/oxford/oxpcie/oxpcie.c
index e1fb65f..8afdd1f 100644
--- a/src/drivers/oxford/oxpcie/oxpcie.c
+++ b/src/drivers/oxford/oxpcie/oxpcie.c
 <at>  <at>  -23,7 +23,6  <at>  <at> 
 #include <device/pci_ids.h>
 #include <console/console.h>
 #include <arch/io.h>
-#include <uart8250.h>

 static void oxford_oxpcie_enable(device_t dev)
 {
 <at>  <at>  -41,9 +40,20  <at>  <at>  static void oxford_oxpcie_enable(device_t dev)
 			(read32(res->base + 4) & 3));
 }

+
+static void oxford_oxpcie_set_resources(struct device *dev)
+{
+	pci_dev_set_resources(dev);
+
+#if CONFIG_CONSOLE_SERIAL8250MEM
+	/* Re-initialize OXPCIe base address after set_resources */
+	uartmem_init();
+#endif
+}
+
 static struct device_operations oxford_oxpcie_ops = {
 	.read_resources   = pci_dev_read_resources,
-	.set_resources    = pci_dev_set_resources,
+	.set_resources    = oxford_oxpcie_set_resources,
 	.enable_resources = pci_dev_enable_resources,
 	.init             = oxford_oxpcie_enable,
 	.scan_bus         = 0,

--

-- 
coreboot mailing list: coreboot <at> coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Gmane