Commit Graph

7777 Commits

Author SHA1 Message Date
Ronald G. Minnich 9907c6edeb libpayload: Catch exceptions and print out an error message.
Give some indication what happened instead of just crashing.
As part of setup, cause an exception and make sure that we get
the right one, and that we recover correctly. Hence we have
some assurance that if they really happen we can handle them.

Built and booted into test payload on Snow. Saw the built in test function
worked correctly. Artificially added code which got an exception and saw that
the error information prints correctly.

Change-Id: I2e0d022f090ee422fb988074fbb197afa2485caa
Signed-off-by: Gabe Black <gabeblack@google.com>
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2569
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins)
2013-03-04 22:39:09 +01:00
Ronald G. Minnich 026bbda071 ARM: remove code that is IMHO a dangerous design
OK, this is tl;dr. But I need to write this in hopes we make
sure we don't put code like this into coreboot. Ever.

Our excuse in this case is that it was imported, not obviously wrong,
and easily changed. It made sense to get it in, make it work, then
do a cleanup pass, because changing everything up front is almost
impossible to debug.

The exynos code has bunch of base register values, e.g.

These are base addresses of things that look like a memory-mapped
struct. To get these to a pointer, they created the following macro,
which creates an inline function.

static inline unsigned int samsung_get_base_##device(void)	\
{								\
	return cpu_is_exynos5() ? EXYNOS5_##base : 0;		\
}

And then invoke it 31 times in a .h file, e.g.:
SAMSUNG_BASE(clock, CLOCK_BASE)

to create 31 functions.

And then use it:
        struct exynos5_clock *clk =
	                (struct exynos5_clock *)samsung_get_base_clock();

OK, what's wrong with this? It's easier to ask what's right with it. Answer: nothing.

I have a long list of what's wrong, and I may leave some things out,
but here goes:
1. the "function" can return a NULL if we're not on exynos5. Most uses of the code
   don't check the return value.
2. And why would this function be running, if we're not on an exynos5? Why compile it in?
3. Note the cast everywhere a samsung_get_base_xxx is used.
   The function returns an untyped variable, requiring the *user* to get two
   things right: the cast, and the function invocation. One can replace that _clock(); with
   _power(); in the code above, and they will be referencing the wrong registers, and
   they'll never get an error!
   We have a C compiler; use it to type data.
4. You're generating 31 functions using cpp each and every time the file is included.
   The C compiler has to parse these each time. It's not at all like a simple cpp
   macro which is only generated on use.
5. You can't tags or etags this code
6. In fact, any kind of analysis tool will be unable to do anything with this cpp magic.

That's only a partial list.

So what's the right way to do it? Just make typed constants, viz:

Or, since I expect people will want the lower case function syntax, I've left
it that way:

Now we've got something that is efficient, and we don't even need to protect with
any more.

Hence this change. We've got something that is type checked, does not require users to
cast on each use, will catch simple programming errors, can be analyzed with standard tools,
and builds faster.

So if we make a mistake:
       struct exynos5_clock *clk =
                       samsung_get_base_adc();

We'll see it:
src/cpu/samsung/exynos5250/clock.c: In function 'get_pll_clk':
src/cpu/samsung/exynos5250/clock.c:183:3: error: initialization from incompatible pointer type [-Werror]

which we would not have seen before.

As a minor benefit, it shaves most of a second off the compilation.

Change-Id: Ie67bc4bc038a8dd1837b977d07332d7d7fd6be1f
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2582
Tested-by: build bot (Jenkins)
2013-03-04 19:43:19 +01:00
Idwer Vollering 1a43309bf7 bump SeaBIOS to 1.7.2.1
Update coreboot to use SeaBIOS' tag rel-1.7.2.1

Change-Id: I01969407964a7cf64f7c4800b59c6aed845b24f9
Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Reviewed-on: http://review.coreboot.org/2575
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
2013-03-04 11:00:17 +01:00
Paul Menzel 56ad905e4c AMD Persimmon, LiPPERT Fam14: Fix typo code*c* in comment
Commit f154c018

    Author: Marc Jones <marcj303@gmail.com>
    Date:   Wed Dec 14 11:24:00 2011 -0700

        Persimmon audio codec verb patch.

    Reviewed-on: http://review.coreboot.org/490

has a typo code*c* in the comments for `AZALIA_OEM_VERB_TABLE`. As
this was copied over to the LiPPERT Fam14 boards, use the following
command to fix the typo.

    $ git grep -l cocec | xargs sed -i s,cocec,codec,

Change-Id: I1525b0445edab81ab136b3adece52b78ba7abc71
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2576
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
2013-03-03 22:36:39 +01:00
Paul Menzel f35ce497d1 ASRock E350M1: Remove non-existing PCI devices 12.1 and 13.1
Looking at the coreboot log

    […]
    PCI: 00:12.0 [1002/4397] enabled
    sb800_enable() PCI: Static device PCI: 00:12.1 not found, disabling it.
    sb800_enable() PCI: 00:12.2 [1002/4396] ops
    PCI: 00:12.2 [1002/4396] enabled
    sb800_enable() PCI: 00:13.0 [1002/4397] ops
    PCI: 00:13.0 [1002/4397] enabled
    sb800_enable() PCI: Static device PCI: 00:13.1 not found, disabling it.
    sb800_enable() PCI: 00:13.2 [1002/4396] ops
    PCI: 00:13.2 [1002/4396] enabled
    […]

and the `lspci -tnvv` output running the proprietary vendor BIOS
attached to the Wiki page of the ASRock E350M1 [1][2]

        -[0000:00]-+-00.0  1022:1510
                   +-01.0  1002:9802
                   +-01.1  1002:1314
                   +-04.0-[01]--
                   +-11.0  1002:4391
                   +-12.0  1002:4397
                   +-12.2  1002:4396
                   +-13.0  1002:4397
                   +-13.2  1002:4396
        […]

both PCI devices do not exist, so remove them from `devicetree.cb`.

Commit 48918f7 [3]

    Persimmon, Inagua: PCI devs 12.1, 13.1 (USB) don't exist, but 14.6 (GEC) does

did the same for AMD Inagua and AMD Persimmon.

[1] http://www.coreboot.org/ASRock_E350M1
[2] http://www.coreboot.org/File:ASRock_E350M1_info_dump.tar.bz2
[3] http://review.coreboot.org/2463

Change-Id: Ief6de1bda093d1f29d5925985e5c3839cdded537
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2536
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
2013-03-02 09:48:17 +01:00
Jens Rottmann f91c8f290b FrontRunner/Toucan-AF: work around AGESA RAM init crashing on reboot
If you try to reset the system with outb(3,0x92), outb(4,0xcf9) or a
triple-fault it will instead crash with a messy screen.  As the more common
outb(0xFE, 0x64) doesn't work with our setup, Linux will crash whenever you
ask it to reboot.  Closer inspection shows that on a warm boot of Coreboot
agesawrapper_amdinitpost() always fails with error code 7.  Looks like DDR3
re-init goes wrong somehow.  I tried find the reason for this but was
unable to.  I am convinced this is not board specific but a bug in AGESA.

In the end I had to settle for a workaround:  if amdinitpost returns 7 this
patch resets the system harder with outb(0x06, 0x0cf9), after that RAM init
will succeed.  As amdinitpost is early in POST this automatic reset is
quick enough not to be noticable.

I'd perfer a real fix, but that's all I have.

Change-Id: I4763254b489f42a135232e45328ecf0d5c4d961a
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2573
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-03-02 00:18:08 +01:00
Jens Rottmann 68c9f2bdc5 LiPPERT Toucan-AF [2/2]: actually implement mainboard support
Step 2: change the Persimmon code to adapt it to the new board's hardware.

The Toucan-AF is a COM Express Compact Type 6 form factor embedded board:
- AMD Fusion G-T56N (1.65 GHz dual core) or T40R (1 GHz single core) APU
  - 1-4 GB DDR3 memory down
  - 1x VGA, 2x DisplayPort (1 switchable to LVDS)
- AMD A55E (Hudson-E1) southbridge
  - 8x USB 2.0
  - 4x SATA
  - HD Audio (with codec on baseboard)
  - NEC uPD78F0532 microcontroller on I2C ("SEMA")
- 7x PCIe2.0 x1 (1 on PEG)
- Intel I210 GbE (on APU PCIe x1, can be disabled for additional PCIe)
- 2x SST 25VF032B (SO8, soldered) 4 MB SPI flash (BIOS and failsafe BIOS)

The Toucan-AF has no SIO on board.  This patch includes basic support for a
Winbond W83627DHG (PS/2, 2x RS232), because the ADLINK ExpressBase-6 used
for evaluation happens to have one.  The code may have to be adapted to the
actual baseboard of the application.

http://www.adlinktech.com/PD/web/PD_detail.php?pid=1132

Change-Id: I9041b905bad45852ac9b402fcbd5decbc98b377b
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2572
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-03-02 00:16:38 +01:00
Jens Rottmann 1664404652 LiPPERT Toucan-AF [1/2]: create board by forking AMD Persimmon
Step 1: copy all files unmodified from Persimmon.  This makes it much
easier later to see how the two boards actually and deliberately differ
when porting bugfixes from one to the other.  Git's copy detection is
imperfect (and slow).

Change-Id: I1ff02913479c07679f8c3ae5e6dd7876e6000b55
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2571
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-03-02 00:16:27 +01:00
Jens Rottmann 23d13b1d45 LiPPERT FrontRunner-AF [2/2]: actually implement mainboard support
Step 2: change the Persimmon code to adapt it to the new board's hardware.

The FrontRunner-AF is a PC/104+ form factor embedded board:
- AMD Fusion G-T56N (1.65 GHz dual core) or T40R (1 GHz single core) APU
  - DDR3 SO-DIMM socket (1.5 or 1.35V)
  - VGA and LVDS (via Analogix ANX3110)
- AMD A55E (Hudson-E1) southbridge
  - 6x USB 2.0
  - 1x SATA, 1x CFast socket
  - HD Audio (via Realtek ALC886)
  - PCI and ISA (via ITE IT8888)
  - NEC uPD78F0532 microcontroller on I2C ("SEMA")
- Intel I210 GbE (on APU PCIe x1)
- SMSC SCH3112 SIO
  - PS/2
  - 2x RS232/485
- 2x SST 25VF032B (SO8, soldered) 4 MB SPI flash (BIOS and failsafe BIOS)

http://www.adlinktech.com/PD/web/PD_detail.php?pid=1131

Change-Id: Id55f89d224ad669b351c36128b12299802b721ba
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2553
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-03-02 00:16:04 +01:00
Jens Rottmann 73d4965be9 LiPPERT FrontRunner-AF [1/2]: create board by forking AMD Persimmon
Step 1: copy all files unmodified from Persimmon.  This makes it much
easier later to see how the two boards actually and deliberately differ
when porting bugfixes from one to the other.  Git's copy detection is
imperfect (and slow).

Change-Id: I2fd1bf8428fc8a1e7becee888b6182b9bd8166a0
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2552
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-03-02 00:12:44 +01:00
Gabe Black d895827c0f libpayload: Mark "halt" as a function.
The linker uses that info so interworking can work correctly.

Built and booted into depthcharge on Snow and saw interworking start to
work correctly.

Change-Id: I0ac54f1c424ec70f8244edf6541a10b089ce47b4
Signed-off-by: Gabe Black <gabeblack@google.com>
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2568
Tested-by: build bot (Jenkins)
2013-03-01 16:49:41 +01:00
Paul Menzel a46a712610 GPLv2 notice: Unify all files to just use one space in »MA 02110-1301«
In the file `COPYING` in the coreboot repository and upstream [1]
just one space is used.

The following command was used to convert all files.

    $ git grep -l 'MA  02' | xargs sed -i 's/MA  02/MA 02/'

[1] http://www.gnu.org/licenses/gpl-2.0.txt

Change-Id: Ic956dab2820a9e2ccb7841cab66966ba168f305f
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2490
Tested-by: build bot (Jenkins)
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
2013-03-01 10:16:08 +01:00
Hung-Te Lin f12e561817 armv7/snow: Add S5P MSHC initialization in ROM stage.
The SD/MMC interface on Exynos 5250 must be first configured with, GPIO, and
pinmux settings before it can be detected and used in ramstage / payload.

Verified on armv7/snow and successfully boot into ramstage.

Change-Id: I26669eaaa212ab51ca72e8b7712970639a24e5c5
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2561
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-03-01 06:53:57 +01:00
Ronald G. Minnich 27bd64a8be Revert "ARMv7: drop special handling for stages.c"
This breaks booting, and in fact stages.c is always going to be special: for it to work it has to be compiled for arm only, no thumb allowed. It's probably better to leave the stages.o target in explicitly so it's clear that it has to be compiled with a particular set of flags, rather than try to remember that we must always have the default rules no break stages.c compilation. That would be a mess. I will be pushing a CL to get rid of the assembly dump, but will be a trivial fix.

This reverts commit 8f4647a24b

Change-Id: I5e3d8e5b991f6ccf4d49078378cd4615fb230ca0
Reviewed-on: http://review.coreboot.org/2554
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-28 18:16:43 +01:00
Stefan Reinauer 1bc9efaf65 CBMEM: always initialize early if the board supports it
This allows to drop some special cases in romstage.c

Change-Id: I53fdfcd1bb6ec21a5280afa07a40e3f0cba11c5d
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2551
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2013-02-28 18:02:29 +01:00
Stefan Reinauer f2e1f6a862 Drop SRC_ROOT from mainboard Makefile.incs
It's not used, and not needed.

Change-Id: Ifca92f3606ac58fc26e09676488c3add5d84ae79
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2548
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2013-02-28 17:59:44 +01:00
Gabe Black ef650a5d24 libpayload: Check for completion more often in ehci_set_periodic_schedule.
This function was using mdelay in a loop to check for the completion of an USB
controller operation. Since we're busy waiting anyway, we might as well wait
only 1 us before checking again and potentially seeing the completion 999 us
earlier than we would otherwise.

Change-Id: I177b303c5503a0078c608d5f945c395691d4bd8a
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2522
Tested-by: build bot (Jenkins)
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
2013-02-28 01:25:46 +01:00
Kyösti Mälkki 1cca340942 Use defines for some i82801ex/gx registers
Change-Id: I0069ec26278b82d61ce5bcfb94d77647dfd3254b
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/2530
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-28 00:36:55 +01:00
Stefan Reinauer 8f4647a24b ARMv7: drop special handling for stages.c
This is a leftover from when we were debugging
this code. Let's make it easier to understand.

Change-Id: Ia3d0ab1504ff9dd9634d5f393d3c59fe1e43a0c0
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2543
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-28 00:00:50 +01:00
Stefan Reinauer fd611f9c2c Drop CONFIG_WRITE_HIGH_TABLES
It's been on for all boards per default since several years now
and the old code path probably doesn't even work anymore. Let's
just have one consistent way of doing things.

Change-Id: I58da7fe9b89a648d9a7165d37e0e35c88c06ac7e
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2547
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-28 00:00:30 +01:00
Stefan Reinauer 9c29cfae8c Fix microcode selection code
The ARM CPUs we know of don't have CPU microcode updates,
so don't show the selection in Kconfig.

Also simplify (and fix) the microcode selection in the Makefile
that would try to include microcode even though none is available.

Change-Id: I502d9b48d4449c1a759b5e90478ad37eef866406
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2540
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
2013-02-27 21:01:53 +01:00
Ronald G. Minnich eeb36326b9 Google/snow: update the GPIO emulation.
Add two more GPIOs (total 6) as needed by the Google Snow laptop.
These are faking out settings for now. This code is tested and working.

Change-Id: I2077ffb8b85958eefdf54e19763d57cc1178ce89
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2538
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: build bot (Jenkins)
2013-02-27 19:27:45 +01:00
Jens Rottmann fc14874352 Persimmon: remove HDMI Audio, PCI device 00:01.1 from devicetree.cb
Commit 8487229b (Persimmon doesn't have HDMI so the GNB HD Audio should be
disabled.) turned off the device in AGESA.  Now remove it from
devicetree.cb, too.  This prevents the following boot message:

PCI: Left over static devices:
PCI: 00:01.1
PCI: Check your devicetree.cb.

Also clarify the line's comment a bit for the Fam14 boards which still
retain this device (to counter the loss of information ;-).

Change-Id: Ib671ed2e0d04bdef2869e8d70208d6e55cdea3fd
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2537
Tested-by: build bot (Jenkins)
Reviewed-by: Peter Stuge <peter@stuge.se>
2013-02-27 17:05:46 +01:00
Hung-Te Lin fdfd89f213 selfboot: Report correct entry point address in debug message.
Entry point in payload segment header is a 64 bit integer (ntohll). The debug
message is currently reading that as a 32 bit integer (which will produce
00000000 for most platforms).

Change-Id: I931072bbb82c099ce7fae04f15c8a35afa02e510
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2535
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins)
2013-02-27 10:26:26 +01:00
Aaron Durbin 62f100b028 smm: Update rev 0x30101 SMM revision save state
According to both Haswell and the SandyBridge/Ivybridge
BWGs the save state area actually starts at 0x7c00 offset
from 0x8000. Update the em64t101_smm_state_save_area_t
structure and introduce a define for the offset.

Note: I have no idea what eptp is. It's just listed in the
haswell BWG. The offsets should not be changed.

Change-Id: I38d1d1469e30628a83f10b188ab2fe53d5a50e5a
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2515
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-27 03:03:50 +01:00
Marc Jones da3087f67d Mainboard SMI S state handler was using the wrong defines
The PCH register bit definition for sleep type is a little confusing.
For example, 7 is S5. To make this simpler for the mainbaord developer,
the mainboard smi sleep hander is called as mainboard_sleep(slp_typ-2).
A couple mainboard SMI handlers were using the PCH define for slp_ty,
so S3 code would be run for S5 and S5 code would never be run.

Change-Id: Iaecf96bfd48cf00153600cd119760364fbdfc29e
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Reviewed-on: http://review.coreboot.org/2514
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-27 03:03:05 +01:00
Kyösti Mälkki db4f875a41 IOAPIC: Divide setup_ioapic() in two parts.
Currently some southbridge codes implement the set_ioapic_id() part
locally and do not implement the load_vectors() part at all.
This change allows clean-up of those southbridges without introducing
changed behaviour.

Change-Id: Ic5e860b9b669ecd1e9ddac4bbb92d80bdb9c2fca
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/300
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-27 00:27:45 +01:00
Kyösti Mälkki e614353194 Unify setting 82801a/b/c/d IOAPIC ID
Remove obscure local copy of writing the ioapic registers.

Change-Id: I133e710639ff57c6a0ac925e30efce2ebc43b856
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/2532
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-26 23:38:49 +01:00
Paul Menzel cf4ecfbe01 AMD Inagua: buildOpts.c: Adapt whitespace to coding style
Mainly replace spaces by tabs and format comments correctly.

Commit »Inagua: Indent and wihtespace cleanup« (f03360f3) [1] was
unfortunately incomplete and also used spaces instead of tabs in
some cases.

Hopefully fix this once and for all to have a template for the
other boards.

[1] http://review.coreboot.org/547

Change-Id: If15c797581dfefe2a57cd6f26e5bdac4cdd014dd
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2526
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-26 23:20:57 +01:00
Jens Rottmann 030902b774 AGESA: skip s3_resume.h if CONFIG_HAVE_ACPI_RESUME is disabled
Commit »AMD S3: Introduce Kconfig variable 'S3_DATA_SIZE'« (22ec9f9a) [1]
introduced a check throwing an error if S3_DATA_SIZE isn't big enough.

However without CONFIG_HAVE_ACPI_RESUME the variable S3_DATA_SIZE
isn't defined at all and compilation will fail if s3_resume.h is
included.

This patch makes it again possible turn off HAVE_ACPI_RESUME relatively
easily in Parmer/Thatcher/Persimmon's Kconfig if you don't care about S3
and don't want flash writes on every boot.

[1] http://review.coreboot.org/2383

Change-Id: I999e4b7634bf172d8380fd14cba6f7f03468fee3
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
Reviewed-by: Marc Jones <marcj303@gmail.com>
Reviewed-on: http://review.coreboot.org/2528
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins)
2013-02-26 23:10:59 +01:00
Gabe Black 89ccc9285e libpayload: Add a pointer for user data on the USB MSC data structure.
This is so the user of libpayload can attach data to the device which it can
retrieve when the device is referred to later, for instance in usbdisk_remove.
Otherwise, there's no direct connection from the usbdev_t structure to any
bookkeeping in the host firmware.

Change-Id: I36fe693b0dcd2098e359c26744e376e73bd3a723
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2513
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.huber@secunet.com>
2013-02-26 21:20:14 +01:00
Jens Rottmann 5e70766f14 AMD Fam14 boards: reduce unnecessary differences, 2nd attempt
This patch reduces unnecessary differences between AMD Inagua, Persimmon,
Union Station, South Station and Asrock E350M1. It's only cosmetical, but
makes them a little bit easier to compare.

This is the remainder of the original http://review.coreboot.org/2464,
parts of which somehow got lost in a flurry of refactoring and splitting
patches.

Change-Id: I034228be9edaaa4122506763d7bb4158f8e0ec53
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2529
Tested-by: build bot (Jenkins)
Reviewed-by: Peter Stuge <peter@stuge.se>
2013-02-26 16:53:16 +01:00
Gabe Black 37ef52d44b libpayload: Correct a constant used for scanning for USB controllers.
When checking to see if a PCI device exists at a particular bus/dev/func,
libpayload was checking the vendor and device id fields together against a 16
bit 0xffff. The two fields together are 32 bits, however, so the check was
never true, and all dev/func combinations on a particular bus would be
checked. That was slightly wasteful, but had relatively small impact.

Change-Id: Iad537295c33083243940b18e7a99af92857e1ef2
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2521
Tested-by: build bot (Jenkins)
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
2013-02-26 07:39:06 +01:00
Gabe Black b4523bb691 libpayload: Change the measurement interval for get_cpu_speed to 2 ms.
The interval used to be about 55 ms which is excessively long. Coreboot only
waits for 2 ms and gets a reasonable answer. That should be good enough for us
as well.

Change-Id: I4d4e8b25b6ba540c9e9839ed0bbaa1f04f67cce1
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2520
Tested-by: build bot (Jenkins)
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
2013-02-26 07:38:41 +01:00
Dave Frodin 502533f656 Revert "AMD S3: Program the flash in a bigger data packet"
This reverts commit ca6e1f6c04.
The packet size changes ends up corrupting the flash when booting
Persimmon. I did figure out that the maximum number of bytes that
can be sent is actually 8 bytes according to the sb800 spec. There
must be additional problems beyond that since setting the packet
size to 8 still causes problems.

Change-Id: Ieb24247cf79e95bb0e548c83601dfddffbf6be59
Signed-off-by: Dave Frodin <dave.frodin@se-eng.com>
Reviewed-on: http://review.coreboot.org/2509
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-by: Zheng Bao <zheng.bao@amd.com>
2013-02-26 03:34:08 +01:00
Mike Loptien a96d24d672 AMD Southbridge: Add RTC init to lpc_init
Adding RTC init code to the Southbridge initialization
code in 'lpc_init'.  This initializes the RTC so that the
Date Alarm register is set to a valid value (0x00) at
startup.  By setting the Date Alarm register to 0x00,
it does not get evaluated along with the seconds,
minutes, and hours when running 'fwts s3'.
Information about fwts (Firmware Test Suite) can be
found here:
https://wiki.ubuntu.com/Kernel/Reference/fwts

This is the same edit made to the CIMX SB800 titled
'AMD/Persimmon: Add RTC init to CIMX SB800' with commit
ID: c4d3d which can be viewed here:
http://review.coreboot.org/#/c/2488/

Change-Id: Iddb7a3cbabe736b511cde03d7dc0a4a0b1c7fd90
Signed-off-by: Mike Loptien <mike.loptien@se-eng.com>
Reviewed-on: http://review.coreboot.org/2510
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins)
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
2013-02-25 19:28:43 +01:00
Martin Roth 7675d8a481 Supermicro H8SCM & H8QGI: Fix printk warnings
Changes:
 - Fix printk warnings for these two platforms by getting rid of the
   l length specifier and casting to unsigned int.
   This gets rid of a bunch of warnings like this one:
     agesawrapper.c:279, GNU Compiler 4 (gcc), Priority: Normal
     format '%lu' expects argument of type 'long unsigned int',
       but argument 3 has type 'UINT32' [-Wformat]

Notes:
 - This is the same change that was done for Tyan s8226 in change:
   ddff32eb - http://review.coreboot.org/#/c/2451/
   Tyan S8226: Fix printk warnings

 - I have not tested this change on either of these platforms, I have
   just compiled it.

Change-Id: I46b4c13fde7473cd2a084c7c7cb5c893f1731b02
Signed-off-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-on: http://review.coreboot.org/2502
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 19:02:21 +01:00
Martin Roth 4f5a433a98 AMD Southstation: Fix final warning
Changes:
 - Add #include of delay.h in mainboard.c to pick up declaration of
   mdelay function.

Notes:
 - This fixes this warning:
   mainboard.c:69, GNU Compiler 4 (gcc), Priority: Normal
   implicit declaration of function 'mdelay' [-Wimplicit-function-declaration]

Change-Id: I72f333cd87215a7fc1e62d1d7ee4b2395444b03e
Signed-off-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-on: http://review.coreboot.org/2501
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 19:00:52 +01:00
Paul Menzel 4fc600442b AMD Fam14 boards: Set P_BLK length to 6 for all processors
Currently on for example on AMD Persimmon and ASRock E350M1 Linux
complains, that the PBLK length is invalid [1].

        ACPI: Invalid PBLK length [0]

Consequently, frequency scaling might not work correctly, though for
these two boards it seems to work according to PowerTOP.

Indeed, according to the ACPI specification [2], setting PBlockLength
to 0 is only allowed if there is no PBlockAddress. Otherwise it has to
be set to 6.

        18.5.93 Processor (Declare Processor)

        […]

        PBlockAddress provides the system I/O address for the processors
        register block. Each processor can supply a different such
        address. PBlockLength is the length of the processor register
        block, in bytes and is either 0 (for no P_BLK) or 6. With one
        exception, all processors are required to have the same
        PBlockLength. The exception is that the boot processor can have
        a non-zero PBlockLength when all other processors have a zero
        PBlockLength. It is valid for every processor to have a
        PBlockLength of 0.

And that is exactly what Linux is checking in
`drivers/acpi/processor_driver.c` [3].

        static int acpi_processor_get_info(struct acpi_device *device)
        {
        […]
                /*
                 * On some boxes several processors use the same processor bus id.
                 * But they are located in different scope. For example:
                 * \_SB.SCK0.CPU0
                 * \_SB.SCK1.CPU0
                 * Rename the processor device bus id. And the new bus id will be
                 * generated as the following format:
                 * CPU+CPU ID.
                 */
                sprintf(acpi_device_bid(device), "CPU%X", pr->id);
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
                                  pr->acpi_id));

                if (!object.processor.pblk_address)
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
                else if (object.processor.pblk_length != 6)
                        printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n",
                                    object.processor.pblk_length);
                else {
                        pr->throttling.address = object.processor.pblk_address;
                        pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset;
                        pr->throttling.duty_width = acpi_gbl_FADT.duty_width;

                        pr->pblk = object.processor.pblk_address;

                        /*
                         * We don't care about error returns - we just try to mark
                         * these reserved so that nobody else is confused into thinking
                         * that this region might be unused..
                         *
                         * (In particular, allocating the IO range for Cardbus)
                         */
                        request_region(pr->throttling.address, 6, "ACPI CPU throttle");
                }
        […]
        }

This issue has proliferated to all AMD based boards so fix it for
all of them by setting P_BLK length to 6.

The DSDT of for example AMD Parmer and AMD Thatcher also set it
to 6 everywhere so this solution is taken instead of setting the
P_BLK system I/O base to 0 for all but the first processor which
is how it is done for earlier AMD based boards.

As note having to set this manually should not be needed and
this should be autogenerated as done for most of the Intel boards
and the AMD K8 based boards (`src/cpu/amd/model_fxx/powernow_acpi.c`).

[1] http://www.coreboot.org/pipermail/coreboot/2013-January/073636.html
[2] http://acpi.info/DOWNLOADS/ACPIspec40a.pdf
[3] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/acpi/processor_driver.c;h=e83311bf1ebdaaaea1adbf2de1351cca907d3465;hb=5da1f88b8b727dc3a66c52d4513e871be6d43d19#l351

Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
• ASRock E350M1:
Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
• AMD Persimmon:
Tested-by: Martin Roth <martin.roth@se-eng.com>
Change-Id: Ie79fe4812532d124cc81747c75a4f3d88d00531c
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2189
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
2013-02-25 18:55:31 +01:00
Jens Rottmann a48918f75d Persimmon, Inagua: PCI devs 12.1, 13.1 (USB) don't exist, but 14.6 (GEC) does
USB ports 0-4 are handled by PCI devices 12.0 (OHCI) and 12.2 (EHCI). 12.1
simply does not exist, so remove it from devicetree.cb.  While at it make the
comment more detailed.  Likewise for all USB ports.

USB device 14.6 is the Broadcom GbE MAC integrated in the Hudson-E1.  Add it
to devicetree.cb.  It's used on Inagua (on), but not on Persimmon (off).

Change-Id: Idea27b3390fa4470f2592e79fdd633d5a218b97b
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Reviewed-on: http://review.coreboot.org/2463
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
2013-02-25 18:54:45 +01:00
Paul Menzel 12d60247ab AMD boards: ACPI DSDT: Use COREBOOT for the OEM Table ID field
The DSDT header contains the fields OEMID and OEM Table ID. See
for example ACPI specification 4.0a [1]

    5.2.11.1 Differentiated System Description Table (DSDT)

on page 135. There Table 5-16 contains the descriptions.

Field         Byte Length  Byte Offset  Description
===================================================
OEMID         6            10           OEM ID
OEM Table ID  8            16           The manufacture model ID.

Currently in coreboot there is no common method what to put in
these fields.

Mostly Intel based boards populate it with "CORE  " ore "COREv4"
and AMD based boards populate it with the board vendor and
model number, abbreviated appropriately to fit into these fields.

On most boards the proprietary vendor BIOS seems to leave these
fields – displayed with `sudo dmidecode` under System Information –
blank

    To Be Filled By O.E.M.

and fill out the Base Board Information with the board vendor and
model name.

In [2] Jens Rottmann argues that the this is really just the table
ID used for naming it and that »99% of the DSDT code is not board
specific«.

Both approaches seem to have their advantages, but using the
second one, developers often seem to forget to update them (for
example AMD Thather).

The current situation is at least not optimal. and therefore at
least unify the string in the OEM Table ID. If unifying the
OEM ID is also a good idea this should be done too.

If later on it should be decided that the board vendor and model
should be used again, this should be somehow derived from
Kconfig.

The following command was used for the change [3].

    $ git grep -l '\/\* TABLE ID \*\/' | xargs sed -i '/TABLE ID/s/"\([^"]*\)"/"COREBOOT"/'

This patch is split out from [2].

[1] http://www.acpi.info/spec40a.htm
[2] http://review.coreboot.org/#/c/2464/
[3] http://stackoverflow.com/questions/5207838/sed-regex-matching-text-between-to-double-quotes-when-a-certain-text-appears-i

Change-Id: Iec98c615ce37f928abc1b500eff5aa865d772cb2
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2472
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 18:51:29 +01:00
Ronald G. Minnich 3faa2c77ed google/snow: enable GPIO entries and CHROMEOS in building
These were not separable or it would have been two CLs.

Enable CHROMEOS configure option on snow. Write gpio support code for
the mainboard.  Right now the GPIO just returns hard-wired values for
"virtual" GPIOs.

Add a chromeos.c file for snow, needed to build.

This is tested and creates gpio table entries that our hardware can use.

Lots still missing but we can now start to fill in the blanks, since
we have enabled CHROMEOS for this board. We are getting further into
the process of actually booting a real kernel.

Change-Id: I5fdc68b0b76f9b2172271e991e11bef16f5adb27
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2467
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 18:50:00 +01:00
Paul Menzel 5f20b35222 QEMU x86: northbridge.c: Name enabling device function to `northbridge_enable`
Similar to the discussion on the coreboot list [1]

    Am Freitag, den 22.02.2013, 02:17 +0100 schrieb Peter Stuge:

    […]

    > Function names should try to be descriptive. "enable_dev" is not very
    > descriptive. I like "mainboard_enable" because it makes output such
    > as
    >
    > printk("%s: foo", __func__);
    >
    > useful.

rename the function for the northbridge to `northbridge_enable`.

[1] http://www.coreboot.org/pipermail/coreboot/2013-February/074549.html

Change-Id: I262311ec511e394550330214621b8c37780c1d4e
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2496
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 18:49:15 +01:00
Martin Roth 30901baabc Persimmon: Fix warning, enable warnings as errors
- Fix redefinition warning for SB_GPIO_REG50 introduced in commit
     fa8702cf - http://review.coreboot.org/#/c/2446/
     Persimmon: adapt PCIe reset code copied from Inagua to actually
                 match Persimmon
     The warning being fixed is:
        SB800.h:1491, GNU Compiler 4 (gcc), Priority: Normal
        "SB_GPIO_REG50" redefined [enabled by default]

 - Enable warnings as errors so no more warnings will be accidentally
     committed.

Change-Id: Ib443b2bd2067f0b7d5f93f79170899a0f8f61060
Signed-off-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-on: http://review.coreboot.org/2494
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 18:48:21 +01:00
Paul Menzel 528640d141 mainboard.c: Name enable_dev function uniformly `mainboard_enable`
To reduce the differences between these file name the enabling
device function in the directory `src/mainboard` uniformly
`mainboard_enable` [1].

Thanks to the awesome help of gnomon and BlastHardcheese in the
IRC channel #sed on <irc.freenode.net>. gnomon came up with the
following command to do the actual work.

    $ cd src/mainboard
    $ for f in */*/mainboard.c ; \
    > do src="$(awk '/\.enable_dev = /{v=$NF; sub(/,$/,"",v); print v}' "$f")" ; \
    > [[ -z $src ]] && continue ; \
    > printf '%s\n' "g/${src}/s/${src}\([,(]\)/mainboard_enable\1/p" w | ed -s "$f" ; \
    > done

`src/mainboard/digitallogic/msm586seg/mainboard.c` and
`src/mainboard/technologic/ts5300/mainboard.c` had to be adapted
manually as no comma was used separating the struct members.

And with the following statement, gnomon is even more likable!

    My pleasure entirely.  Good luck with coreboot; I'm a big fan of the project.

[1] http://www.coreboot.org/pipermail/coreboot/2013-February/074548.html

Change-Id: Ife9cd0c2d9cc1ed14afc6d40063450553f06a6c6
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2493
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 18:47:00 +01:00
Paul Menzel 1fc7416545 Technologic TS5300: mainboard.c: Move { to next line
This is coreboot’s coding style.

Change-Id: I7441f2c1927a49a3b7171112b7798dae6b56cfb5
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2492
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Bernhard Urban <lewurm@gmail.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2013-02-25 18:46:31 +01:00
Stefan Reinauer 1cd6160821 ARMv7: Simplify div64
We don't need the overly complex optimized version, since
we're only doing this in very few non-critical places.

Also, add the div* files to the bootblock, they're needed
if we do printk.

Signed-off-by: Stefan Reinauer <reinauer@google.com>

Change-Id: I83bd766d4b03b488326ade1c13b7c364a7119e7b
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2508
Tested-by: build bot (Jenkins)
2013-02-25 17:01:27 +01:00
Paul Menzel 14c2398ce9 Siemens SITEMP G1P1: mainboard.c: Rename `init` to `mainboard_init`
This is the common way to name that function, so unify that.

Change-Id: I8a01051bd304039662894b89eed53ce14dde98b6
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2491
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
2013-02-24 17:03:08 +01:00
Martin Roth e533fdaa59 AMD f14 vendorcode: Fix warning
Add brackets around initializer in #define for
PCIE_DDI_DATA_INITIALIZER to fix the warning:
  PlatformGnbPcie.c:89, GNU Compiler 4 (gcc), Priority: Normal
  missing braces around initializer [-Wmissing-braces]

This warning happens for Inagua and South Station

Change-Id: I7d8f742dd8335b704b0493aa6e9eaebc3cc50b1e
Signed-off-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-on: http://review.coreboot.org/2495
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2013-02-24 17:01:20 +01:00
Stefan Reinauer 49428d8403 Add support for Google's Chromebook Pixel
Ladies and gentlemen, I'm very happy to announce coreboot support for
the latest and greatest Google Chromebook: The Chromebook Pixel.

See the link below for more information on the Chromebook Pixel, and
its exciting specs:
http://www.google.com/intl/en/chrome/devices/chromebooks.html#pixel

The device is running coreboot and open source firmware on the EC
(see ChromeEC commit for more information on that exciting topic)

Change-Id: I03d00cf391bbb1a32f330793fe9058493e088571
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2482
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-23 04:27:08 +01:00