Commit graph

208 commits

Author SHA1 Message Date
Stefan Reinauer
12a0bfac72 fix i386-elf binutils weirdness. Thanks to Segher Boessenkool for finding this
out. (trivial)
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@655 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-04-04 23:38:51 +00:00
Stefan Reinauer
47854e08ca This adds the glibc elf.h to allow compilation on non-glibc platforms.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@652 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-04-04 13:10:05 +00:00
Stefan Reinauer
a8b10df926 Undo the other patches that sneaked in in my last commit.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@650 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-04-04 03:33:08 +00:00
Stefan Reinauer
d11478e45c This patch uses the svn version as the sublevel part of the coreboot
version string.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ward Vandewege <ward@gnu.org>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@648 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-04-04 03:29:26 +00:00
Carl-Daniel Hailfinger
5de785e23b Alvar Kusma found a bug in util/lar: If you try to add a file to a full
LAR archive, the LAR utility will segfault. This is reproduced easily by
zerofilling the LAR, then adding anything to it.

Looking at the code, the reason is obvious:
lar_empty_offset() can return an error code (-1). None of the callers
check for an error code, they simply assume the return value is valid.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@647 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-03-27 23:56:36 +00:00
Uwe Hermann
2620213302 Make util/lzma compile under gcc-4.3.0.
Signed-off-by: Klaus Schnass <dev@stuffit.at>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@646 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-03-25 19:52:13 +00:00
Myles Watson
689dad6eab This patch fixes lar options parsing, a seg fault with long path names, and
makes use of functions that were already defined.  It also adds greedy name
matching for listing and extracting archives, which allows recursive descent
into the lar directory structure.

changes file-by-file:

util/lar/lar.c:
	add more options to the usage message
	use get_larsize() instead of using larsize
	rearrange errors from parsing args to be more correct

util/lar/stream.c:
	change elfname size to MAX_PATHLEN instead of 64
	make file_in_list greedy with filename matches
	change total_size calculation to include file names
	change lar_add_entry to use header_len function instead of reinventing

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@632 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-03-05 14:51:35 +00:00
Myles Watson
66843bacbf This patch fixes lar path handling. In particular, it adds new members to the
file struct for pathname and compression, so that directories can be correctly
recursed.

file-by-file:

util/lar/lar.c:
	make error messages more verbose
	pass a pointer to the file structure instead of the name
	parse the name here with lar_process_name

util/lar/lib.c:
	change handle_directory to use a path name and respect nocompress
	change add_files to use pre-processed names
	use sensible defaults for new file members when listing or extracting
	free pathname if allocated	

util/lar/lib.h:
	add new members to struct file
	change prototypes of add_files and lar_add_file

util/lar/stream.c:
	change lar_add_file to use pathname and compression from struct file
	
Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@623 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-28 14:56:43 +00:00
Myles Watson
548bf497a7 This is a simple patch which corrects directory handling for add
(makes it the same as create.)

Without this patch you can create a lar and recursively add a
directory to it, but you can't add one with add.

Another patch might be to make lar -l print something when you use the
directory option, but I'm not sure what was intended originally.

Myles

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Peter Stuge <peter@stuge.se>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@618 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-25 16:06:36 +00:00
Myles Watson
897ea2e08b This is a pretty trivial patch that returns an error message when the
file is not found instead of seg faulting.

test with:

lar -a coreboot.rom nonexistant_file.bin

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@615 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-21 21:02:19 +00:00
Ronald G. Minnich
61cd5ae455 This discussion is too useful to lose.
Carl-Daniel Hailfinger wrote:
> On 18.02.2008 23:55, Marc Jones wrote:
>> Carl-Daniel Hailfinger wrote:
>>> it seems that executing VSA requires vm86 to be useful. Since we
>>> unconditionally execute the VSA, we should unconditionally require 
vm86
>>> support (PCI_OPTION_ROM_RUN_VM86) via Kconfig for Geode targets. Not
>>> doing so will either cause compile failures or runtime failures.
>>>
>>> Adding
>>> select PCI_OPTION_ROM_RUN_VM86
>>> below
>>> config CPU_AMD_GEODELX
>>> did not work out for me.
>> Sorry I missed this.
>>
>> VSA requires the GDT that is in vm86.c. VSA loads similar to an 
option
>> ROM so the loader does go into VM86 mode. All the other stuff like
>> interrupt support and PCI BIOS isn't needed by VSA. I think that the
>> GDT at the top of vm86.c can be moved to a header file, gdt.h or
>> something like that.
>
> northbridge/amd/geodelx/vsmsetup.c uses
> util/x86emu/vm86.c:setup_realmode_idt() but it seems most/all of the
> setup there is not needed at all for VSA. Pulling in 
setup_realmode_idt
> pulls in the rest of vm86 through direct and indirect dependencies.
>
>> Care to make a patch? :)
>

I am also leaning towards removing the IDT for VSA init. There is a risk
if either an exception happens or a software interrupt is used you will
get unexpected results. What probably happens is that you jump off to
something that will eventually cause a triple fault and reboot. You may
think this is bad (and it is) but it is the same risk that coreboot runs
today. If coreboot had a generic IDT to handle exceptions, VSA init
would use the same IDT. Note that hardware INT (even timers) should
never happen as they are always masked.

I have built with no PCI_OPTION_ROM_RUN_VM86 and run this to filo.
- Show quoted text -

Marc







--
Marc Jones
Senior Firmware Engineer
(970) 226-9684 Office
mailto:Marc.Jones@amd.com
http://www.amd.com/embeddedprocessors

Reduce the amount of compilation errors for Geode LX targets if x86emu
or no emulation is selected instead of vm86.
Factor out GDT code from vm86.c to vm86_gdt.c
Remove IDT setup for VSA init.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-of-by: Marc Jones <marc.jones@amd.com>

This has booted to runlevel 3 and the ethernet works fine. 
Acked-by: Ronald G. Minnich <rminnich@gmail.com>




git-svn-id: svn://coreboot.org/repository/coreboot-v3@613 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-21 05:20:14 +00:00
Carl-Daniel Hailfinger
4ad45fd6c7 The commit in r558 had this:
> > Author: rminnich
> > util/x86emu/vm86.c
> > Change uses of dev_find_device to dev_find_pci_device

Unfortunately, x86emu/pcbios/pcibios.c was missed in the conversion. Fix 
it to get builds with x86emu compiling again.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Corey Osgood <corey.osgood@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@612 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-20 13:33:36 +00:00
Carl-Daniel Hailfinger
24d743968a Print name of compression algorithm in addition to the corresponding
number during boot.
Convert process_file() to use enum compalgo instead of hardcoded 
"1","2","3" and change the control structure from a series of if() 
statements to a switch() statement.

Uppercasing enum compalgo also found a name clash between NONE as 
compression algo and NONE as operation mode of util/lar.

Compile and boot tested on Qemu.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de> 


git-svn-id: svn://coreboot.org/repository/coreboot-v3@606 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-18 00:48:25 +00:00
Carl-Daniel Hailfinger
9f07a52934 On 16.02.2008 07:41, ron minnich wrote:
> Alix1c won't boot with the zero decompress code.
> I think the code is using the wrong address on decompress.

Indeed, r601 broke all targets, you were just lucky that qemu didn't
explode as well.
It's the seemingly easy patches which break booting. With your hint, I
found the bug. Myles made a small, but important mistake with the memset
for the "zeroes" decompression.
The memset zeroed the archive instead of the destination. No wonder it
did explode.
This patch fixes it and also reverts the emergency commit r604 because
that one is no longer necessary.

Ron tested on the Alix1c, boots fine, ethernet and IDE working.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@605 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-16 19:18:32 +00:00
Ronald G. Minnich
24a06158ba This is an emergency commit because the zero compression, as
it stands, is causing coreboot on the alix1c to hang. I don't know why. 

But this patch is the difference between works and hangs. I think 
the memset in the decompress is not using the right start value? Not sure. 

This simple change allows us to fix the zero decompress later, when 
we figure it out. I just lost a few hours to this and I want to make
sure the repo works before I go to bed. 

This fix tested on alix1c. Alix1c now works fine.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>




git-svn-id: svn://coreboot.org/repository/coreboot-v3@604 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-16 06:38:45 +00:00
Ronald G. Minnich
f7ad196c0a This started out as a trivial change and turned into a big change. This
code boots and works on qemu and
alix1c. It represents a huge change and a huge improvement. There are a
few fixes left to do, which 
will come once this is in. 

This change started out easy: get the device IDs OUT of the the dts, and
into one place. We
decided the device IDs should be in the constructors ONLY. To make a
long story short, that just did 
not work out, and it revealed a flaw in the design. The result? 

- no more ids in the various dts files. 
- the constructor struct is gone -- one less struct, nobody liked the
  name anyway
- the device_operations struct now includes the device id.
- constructor property no longer used; use device_operations instead. 
- lpc replaced with ioport

All the changes below stem from this "simple" change. 

I am finding this new structure much easier to work with. I hope we're
done
on this for real, however!

TODO: 
1. Change limitation in dtc that makes it hard to use hex in pci@
notation. 

Now for the bad news. Sometime today, interrupts or io or something
stopped working between r596 and r602 -- but I did no commits at
that point. So something has gone wrong, but I don't think it's this
stuff.

I did try a build of HEAD, and it fails really, really badly. Much
more badly than this fails, so I think this commit is only going
to improve things. It does work fine on qemu, fails on alix1c, 
so I suspect one of today's "clean up commits" broke something. 


Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@603 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-16 04:13:44 +00:00
Myles Watson
2f5c48d0b2 This patch adds zero compression for bss segments. One of the reasons
for this is that currently, if you select no compression, the bss
segment of filo takes up 153K with just zeroes.  With this patch, it
always takes up a lar header + 1 byte.  I left the one byte so that
the checksum wouldn't be broken.

This patch could have taken out the calloc in the compression area,
but since it only uses compile-time memory, I decided to keep this
simple.

Myles

Signed-off-by: Myles Watson <myles@pel.cs.byu.edu>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@601 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-15 19:27:13 +00:00
Myles Watson
89b00ed4f0 This patch adds dst_len for the lar uncompress functions, enabling
buffer overflow checks.  It exits with an error instead of
overflowing.

Signed-off-by: Myles Watson <myles@pel.cs.byu.edu>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@594 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-13 22:15:59 +00:00
Ronald G. Minnich
4a6a5313bf The real change here is that paths can now be part of the node label
in dts. This gets rid of the ugly pcipath etc. properties. 

So, instead of

  somedevice {pcipath="1,0";};

We say pci@1,0{ etc. etc. };

As per my agreement I agree to document this in the design doc. 
The alix1c compiles but is untested, and will probably need some work. 
I will do these additional tasks on friday.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by:  Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

M    include/device/path.h
Add LPC path type, replacing SUPERIO path type, since SUPERIO is only
one type of LPC. Clean up tabbing in parts of the file (cosmetic).

M    mainboard/emulation/qemu-x86/dts
Modify this dts for the new path naming scheme.

M    device/pci_device.c
Change what used to be a BIOS_ERR (but is no longer) to a BIOS_NOTICE. 
The change is that the device tree includes more than just PCI devices, 
so finding a non-PCI device is no longer fatal; a notice is useful. 

M    device/device_util.c
Add string creation for PCI_BUS nad LPC.

M    northbridge/intel/i440bxemulation/dts
Add ID info for the chip. 

M    northbridge/intel/i440bxemulation/i440bx.c
Change initialization so it is explicitly for the .ops struct member. 

M    util/dtc/flattree.c
Add support for the new path naming scheme. 
I'm in the middle of this commit so I'll fix the hard-coded lengths 
next commit. 
Also delete dead code between #if 0 and /* and //

M    util/x86emu/vm86.c
comment out unused variables. these may someday be use, not ready
to delete them yet. 

M    Makefile
Change -O2 to -g. We need debugging on LAR far more than we need performance. 



git-svn-id: svn://coreboot.org/repository/coreboot-v3@593 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-13 21:00:20 +00:00
Myles Watson
6c88373502 This patch fixes a memory corruption error in lar when compiled on a 64-bit
architecture.  The function prototypes had a size mismatch, which overwrote
other things on the stack.  Now the prototypes use int for lengths.

Signed-off-by: Myles Watson <myles@pel.cs.byu.edu>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@592 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-13 17:30:49 +00:00
Myles Watson
5383c948f8 This patch makes lar -l print a total of the bytes used in an archive.
I did it because I wanted to know the differences between preparsing
elf files and compressing the pieces. 

Signed-off-by: Myles Watson <myles@pel.cs.byu.edu>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@588 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-12 20:31:42 +00:00
Ronald G. Minnich
6b4477c8cb Add a zero-fill command to lar.
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


Note: the following discussion applies to this patch. 

This patch is basically limited. It is mostly useful for newly-created
LARs. 

On Feb 9, 2008 1:06 PM, Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006@gmx.net> wrote:

> If I read the code correctly, the command will try to fill the first
> occurrence of free space in the lar, not the biggest one. That means
> we
> might have to call it multiple times.

hmm. I obviously did not think of this.

> And a general problem with the code: If it finds the offset of the
> first
> empty area, it checks whether the area is big enough. If not, it does
> not search for another empty area, but returns instead with an error.

Actually, I think as written it is broken for the general case of lots
of empty spots. It should just look for the room left from start of
empty space to next LAR header. It's just that I have never had a LAR
that has more than one block of empty space, and that empty space is
always at the gap before the bootblock.

How about this. I'd like to commit now, and then fix this later, as I
really need this code in there for speed and it works fine with all
"fresh" images built with v3.

> Should we really call this "zerofill"?

"emptyfill"? I'll let it go for now but you make  good point.


> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


OK, this is clearly a work in progress but even in this form it is so
useful I'm going to commit it with a note, "This needs more work", and
with luck someone else will improve it once we need it improved -- the
basic structure is there.

Index: util/lar/stream.c
Add hlen (header len) and maxsize (max size left in lar) functions. 

Index: util/lar/lib.h
Add function prototypes and new ZEROFILL enum.

Index: util/lar/lar.c
Add -z option and command support. 



git-svn-id: svn://coreboot.org/repository/coreboot-v3@583 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-09 21:16:42 +00:00
Ronald G. Minnich
0044d53a10 This set of changes creates irq tables for alix1c and adds the functions
from v2 to install them. Linux boots fine and all interrupts
seem to work correctly -- the network comes up, USB hot plug works, 
I can mount the USB disk, etc. 

To enable pirq tables for a given mainboard, simply add the 
select PIRQ_TABLE (see below) to the Kconfig for that board. 

Again, this code builds and boots linux on the alix1c.

I think, with this change, we are very close to moving ALL LX boards to 
v3 and deprecating v2. The major remaining fix is to add an empty LAR 
entry to fill empty space in LAR and speed up the LAR file search 
process. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>

Index: include/tables.h
Add prototype, conditioned on CONFIG_PIRQ_TABLE

Index: util/x86emu/vm86.c
Comment out 'debug trap' code that scribbles vectors at 0x4000. 
I don't know why this is here, but I'd like to leave it #if'ed out --
somebody, at some point, thought we needed it. To reenable, we will need
to move stage2 code or these magic vectors. 

Index: arch/x86/Makefile
Add support for conditional compilation of pirq support code. 

Index: arch/x86/pirq_routing.c
Add this file from v2. 

Index: arch/x86/archtables.c
Add call to write_pirq_routing_table (controlled by #ifdef
CONFIG_PIRQ_TABLE)

Index: arch/x86/Kconfig
Add new config variable: PIRQ_TABLE

Index: device/device.c
Fix some trivial bugs. 

Index: mainboard/pcengines/alix1c/Makefile
Add pirq table code for stage2

Index: mainboard/pcengines/alix1c/dts
Modify dts to properly set southbridge variables

Index: mainboard/pcengines/alix1c/irq_tables.c
Add code from v2 for the alix1c. 

Index: mainboard/pcengines/Kconfig
Add 'select PIRQ_TABLE'

Index: include/arch/x86/pirq_routing.h
Add include file from v2.
Remove all the SLOTCOUNT nonsense. This hack was only needed
for a very early version of gcc 3.x, where they screwed up the 
creation of struct members that used the [] syntax for variable-length
array at the end of the struct. 

Index: include/device/pci.h
Add prototype



git-svn-id: svn://coreboot.org/repository/coreboot-v3@582 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-09 16:32:59 +00:00
Carl-Daniel Hailfinger
d3a11c8953 Fix lar so that it parses .bss section headers.
This is not terribly clean but it works. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

Tested with a qemu boot to work correctly.
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@580 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-08 12:15:46 +00:00
Myles Watson
2b66702db7 This patch adds support for make defconfig in v3. Those that port v3
to a board should add a defconfig in mainboard/vendor/board/defconfig.
 I think that the defconfig should:

1. Use the ROM size that comes with the board
2. Enable compression
3. Not include a payload

This will make it easy for buildrom or anyone who wants to build it
manually to use lar to add their payloads. It also allows buildrom to
keep the configs in the coreboot tree.

The patch also adds mainboard/emulation/qemu-x86/defconfig

Signed-off-by: Myles Watson <myles@pel.cs.byu.edu>
Acked-by: Ward Vandewege <ward@gnu.org>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@578 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-07 16:50:44 +00:00
Marc Jones
5917206641 Cache the ROM to speed up stage2 and payload decompression.
Due to some problems with PCI transactions, Geode LX needs the ROM cache properties to be write-serialize + cache disabled by runtime. More details below.

Add mainboard_pre_payload() call to each mainboard as the final coreboot function before the payload is called by stage1.

Note that this patch also grows the bootblock from 16K to 20K to make room for mainboard_pre_payload().

"The problem is a transaction depth issue and bottlenecks inside the GX
and LX that go across PCI.  The conditions are very complicated but it
comes down to we need write serialization for writes to PCI. If you
look in the data book you can't have write serialization and the cache
enabled on a given area. During coreboot we don't have to worry about
a write or a PCI bus master so I think we can enable caching the ROM.
After coreboot we can't be sure what will happen in the system so we
need to set it up to be safe. For example flashrom just clears the
write protect bit. If the cache were enabled (no write serialization)
and flashrom was writing the ROM we would be in a precarious position.
A PCI  bus master doing a read or a write that has a hit on a tag
would cause enough bottleneck conditions that it might hit the bug. We
could change flashrom but that doesn't help other tools. We need to
leave the system in a safe state. Also, caching the ROM after it is no
longer used doesn't make much sense. So, we need a call just before
the payload runs to clean up the system."

Signed-off-by: Marc Jones <marc.jones@amd.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@573 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-06 02:36:50 +00:00
Ronald G. Minnich
ce5a0d5574 with VSA operating correctly. This is tested with AMD's recently
released new-model VSA code. 


Changes:
Index: util/dtc/flattree.c
Add an ID entry for apic properties.

Index: northbridge/amd/geodelx/apic
This is a new dts for the northbridge used as an APIC.

Index: northbridge/amd/geodelx/pci
This is a new dts for the northbridge used as a PCI device.

Index: northbridge/amd/geodelx/geodelx.c
Fix a non-obvious bug: we had set phase3 scan bus for both the 
domain AND the PCI device, which is a mistake: can't scan from the 
PCI device too. 

Index: northbridge/amd/geodelx/domain
This is a new dts for the northbridge used as an pci domain.
Created via svn move dts domain

Index: device/pci_device.c
If there are leftover devices, it is now a warning, not an error, 
since there are 
some no-pci devices in the tree now. For future: only complain about
leftover PCI devices ...

Index: device/device.c
make devcnt a global and initialize it in init_dev. Add a debug printk. 

Index: mainboard/pcengines/alix1c/dts
Add an 'apic' entry for the mainboard. This actually looks pretty clean
to me, the way it went in. 

Index: northbridge/amd/geodelx/vsmsetup.c
Delete all pcibios int support, no longer needed for VSA. 

Please note that this patch includes Carl-Daniel's improvements 
below, which I have Ack-ed. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

A few minor comments. It would be great if you could address them before
committing.

northbridge/amd/geodelx/domain is a copy of northbridge/amd/geodelx/dts.
You probably want to use "svn mv" for that because it preserves history
and the old file was probably intended to have been moved, not copied.

northbridge/amd/geodelx/vsmsetup.c:247: warning: ‘biosint’ defined but
not used
Since the new VSA does not use BIOSINT services anymore, deleting
biosint and related functions from vsmsetup.c would shrink vsmsetup.c by
one fourth. Patch follows (could you merge it into your patch?):

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@571 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-02-01 20:35:53 +00:00
Ronald G. Minnich
643d952c5b In the current version of dtc, if one has the line:
/config/ = "northbridge/amd/geodelx";

Then the file northbridge/amd/geodelx/dts is read in and processed. 
Magic(TM) appends the name "/dts" to the path. 

This hack is fine with chips that only do one thing. 
But some (all) northbridge parts play several roles: APIC cluster, PCI domain
device, and PCI device. The result is a need for more than one dts, since
there are three possible devices, with three types of IDs, and so on. 

To keep things sane, I am proposing to enable multiple dts files in a
directory, names (e.g., nothing required here):
domaindts
pcidts
apicdts

(of course these names can be anything, this is just an example).
This change will require a change to the dtc, since we can no longer
assume just one dts file, and hence need a way to name these different 
files. 

The proposed change is very simple. We now require the full path name 
for the file, and eliminate the Magic(TM).

So, 
/config/ = "northbridge/amd/geodelx/pcidts";

will open the pcidts file. 
/config/ = "northbridge/amd/geodelx/domaindts";
will open the domain dts. 

Maybe we should just call it domain and pci and apic? works for me.
/config/ = "northbridge/amd/geodelx/domain";
/config/ = "northbridge/amd/geodelx/pcibridge";
/config/ = "northbridge/amd/geodelx/apic";

Changes: 
dtc.c: create a new function, fopenfile, that will only open a path if it 
really is a file. Modify dtc_open_file to use this function. fopenfile
assumes "-" means stdin; should it, or should I move that assumption back
to dtc_open_file?
dtc.h: add prototypes
dtc-parser.y: Given a config path, open the path.
southbridge/amd/cs5536/cs5536.c: example of how C code changes


Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Please see the comments below, but they do not have to be addressed for
this commit, just keep them in mind for future commits in that area.



git-svn-id: svn://coreboot.org/repository/coreboot-v3@566 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-01-29 17:48:10 +00:00
Stefan Reinauer
6220b632e7 Now version 3: LinuxBIOS -> coreboot rename.
- I left LB_TAG_ intact because they are used by the payloads
- file renames are still missing. see next commit
- some lb_ renames might be missing. feel free to provide patches.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@564 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-01-27 18:54:57 +00:00
Ronald G. Minnich
3ac5450814 This is a first cut at the implementation of VSM support. What has do be
done, long term, 
is to remove almost all of the vsmsetup.c file and use functions in the
vm86.c file.
 

The barrier to achieving that goal is the specialized nature of the vga
bios support code vs. the vsm bios support code. 
There are a few issues to resolve but what I'd like
to do is get VSA working first, then work out how to merge the rest of
the code. 

I have already done some merging at this point. 

This code does not yet work. But the board does not work either, and I 
want to get the code into the repo in case my hard drive dies.

Makefile: add vmsetup.o 

vsmsetup.c: Add this file from v2. Fix copyright and includes. 
Remove almost all assembly code in favor of code in vm86.c. 
In future, almost all code will be removed and the vm86.c code used
instead. 

vm86.c: make some assembly symbols .globl so that vsmsetup.c can use
them. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@560 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-01-24 21:54:22 +00:00
Carl-Daniel Hailfinger
68b97a6034 include/device/device.h
Remove old vendor,device struct members since we are now using the
device_id struct. 
Change declaration of dev_find_device to use device_id struct. 

device/device_util.c
Change dev_find_device to use device_id struct instead of vendor, device
parameters.
Add convenience function, dev_find_pci_device, to make it easier for
users. 

device/pci_device.c
Change uses of dev->vendor and dev->device to dev->id. 
Change prints of dev->vendor, dev->device to use the 
dev_id_string function. 

device/pci_rom.c
Change uses of dev->vendor and dev->device to dev->id. 

southbridge/amd/cs5536/cs5536.c
Change uses of dev_find_device to dev_find_pci_device

southbridge/amd/cs5536/dts
Add pciid of the cs5536

northbridge/amd/geodelx/dts
add pciid of the geodelx northbridge. 

util/x86emu/vm86.c
Change uses of dev_find_device to dev_find_pci_device

With these changes, the chipsetinit function now finds the southbridge
in the static tree, which is the first time this has worked in v3.
This success in turn means that the chipsetinit code is running for the
first time. 
We are still failing in "Finding PCI configuration type"

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@558 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-01-20 23:03:40 +00:00
Ronald G. Minnich
7c1623aec3 include/device/device.h:
Change the ID constants so they are more useful for debugging. 
Instead of simple 1,2,3 they now are a 4-byte value which can be more
useful when looking at memory with a debugger. Lots of variables can be 
'1', but fewer variables will match to 'PCID'. 

include/device/pci.h: 
Include pci_ids.h in pci.h

device/device.c: remove silly comment. Change memcpy to struct assign, this makes it possible 
for the C compiler to do type checking. Add assign for the dev->id. 

flattree.c: Support the use of 'domainid' and 'pciid' in the per-chip dts. These IDs will be assigned
to the static tree device struct. In conjunction with the earlier patch, this change removes the need
for users to assign the ops struct member in the dts by hand, as it is done in the qemu port today. 
The ops struct member will automatically be assigned by the dev_init function, which is run 
in stage2 before any actual device code is run. (This change to dev_init was in the previous patch). 
Added two comments that document what is going on. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@557 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-01-19 06:29:14 +00:00
Carl-Daniel Hailfinger
61f0d0cfc8 util/lar/lar.h was accidentially changed to point to the wrong other
header.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@541 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-12-06 16:06:07 +00:00
Carl-Daniel Hailfinger
73a83c1f17 Change wrong "LAR: NO FILE FOUND!" message to "LAR: File not found!".
The message appears if a file has not been found in the LAR archive and
is triggered even by lookup routines. Normal capitalization helps
reducing the frightening effect of the message.

Correct a few typos in other areas of the LAR code as well.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@538 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-12-04 23:15:33 +00:00
Carl-Daniel Hailfinger
d3a96b3f67 Make the lar more informative about loadaddress and entry point.
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@522 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-11-27 01:12:48 +00:00
Carl-Daniel Hailfinger
b9c8454adf Fix a corner case access to uninitialized memory (NULL pointer
dereference or worse) in case the archive length is exactly
sizeof(struct lar_header). Such an archive is invalid because the
filename directly after the LAR header is always dereferenced and has to
be at least 1 byte in the "empty filename" case (only terminating \0).
Improve LAR code documentation and reorder variables in one assignment
to make the code more obvious and readable. This will help people
understand what the code does when they look at it half a year from now.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@506 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-10-16 18:59:36 +00:00
Uwe Hermann
c8ea006269 When outputting ELF segments in LAR, the utility will use the segment
number from ELF as segment number in the file. This works nicely when
there are no skips (e.g. not PT_LOAD segments, which are discarded).

If one segment is skipped, we get a bump:

normal/payload0/segment0 (27288 bytes, lzma compressed to 14506 bytes @0x64c0)
normal/payload0/segment2 (211136 bytes, lzma compressed to 70905 bytes @0x9dc0)

The LAR loader wont load segment2, and in this particular case, grub2-lb
will only boot into rescue mode (segment0 contains it).

Attached patch adds a counter for segment number in the LAR utility to
solve this bug:

normal/payload0/segment0 (27288 bytes, lzma compressed to 14506 bytes @0x64c0)
normal/payload0/segment1 (211136 bytes, lzma compressed to 70905 bytes @0x9dc0)

Also the eagle eyed can see that I merged in Uwe's multiple-payload
patch into current stage1, which includes the segment support. And this
means that grub2-lb without any hacks works when loaded from LAR segments.

Signed-off-by: Alex Beregszaszi <alex@rtfs.hu>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@498 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-09-16 14:37:59 +00:00
Ronald G. Minnich
94864de286 These are type cleanups and a genuine bug fix.
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@494 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-09-05 15:17:20 +00:00
Stefan Reinauer
dde116bd69 this patch changes vm86.c:do_bios to run_bios(dev, addr).
While doing this, we can remove lot of code duplication about searching
the device, which is already done in the parent pci_device.c.

Signed-off-by: Alex Beregszaszi <alex@rtfs.hu>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@487 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-09-05 01:41:52 +00:00
Ronald G. Minnich
ca1953808e Make the load address and entry 64 bits.
Remove a broken proto from a c file.
Fix protos etc. per uwe's request for const where it made 
sense. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

Acked-by: Peter Stuge <peter@stuge.se>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@485 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-29 22:27:31 +00:00
Ronald G. Minnich
c664a6953a This patch also includes an EXPERT option for enabling no-ELF mode.
The system will default to old behaviour. See Kconfig in the root. 

I still wish to kill ELF mode very soon, however. 

LAR is a very capable format. With two simple extensions, we can use
LAR to replace all that we are using ELF for now. This change can
really make life better:
1. we can use streaming decompress instead of the current "uncompress
elf to memory and then copy segments" approach. So we can get rid of
THIS hardcode:
#define UNCOMPRESS_AREA (0x400000)
2. A simple lar l can show ALL segments, including payload segments
3. It's really easy to see where things will go in memory, and catch problems
4. We can figure out an ELF input file is bogus BEFORE we flash, not
AFTER we flash and try to boot it
5. did I mention streaming decompress?
6. We no longer have to worry about where we decompress the elf in
memory (this problem was causing trouble when the payload was a linux
kernel -- it was so big)
7. Since we have a load address, we can create this lar entry:
normal/cmdline
and specify that it be loaded at a place where linux will find it as
the cmdline.
8. The decision on whether to XIP can be made in the LAR entry, not in
hardcode. For example, if initram needs to be XIP, set the load
address to 0xffffffff. Done.

The change is simple. Add a load address and entry point to the lar
header. Extend the lar tool to parse the elf file and create multiple
lar segments. It looks like this:
 normal/payload0 (33192 bytes, lzma compressed to 18088 bytes @0x38
load @0x100000, entry 0x105258)
 normal/payload1 (72 bytes, lzma compressed to 47 bytes @0x4718 load
@0x1225a0, entry 0x105258)
 normal/option_table (932 bytes @0x4798 load @0, entry 0)
 normal/stage2 (33308 bytes, lzma compressed to 15474 bytes @0x4b78
load @0, entry 0)
 normal/initram (4208 bytes @0x8828 load @0, entry 0)
 linuxbios.bootblock (16384 bytes @0xfc000 load @0, entry 0)

note that the payload is now payload/segment0, payload/segment1, etc. I've extended
linuxbios to look for these. Note that you can now see all the things
that get loaded ;they're no longer hidden in an ELF header somewhere.
Elf failures are gone!

Note that I've left legacy elf support in, for now, but recommend we
get rid of it as soon as possible.

patch attached. This is a first pass. lar.c needs some refactoring but
I want to get the cmdline going. You can now have a linux payload and
it will uncompress with no problems.

This has been tested with filo and BOCHS.

This patch includes ONLY the lar changes, the other changes are next. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@481 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-29 14:59:25 +00:00
Uwe Hermann
eb1a12cf8d The checksum creation in lar starts somewhere in the lar image,
and ends at the end of a temporary buffer, which doesn't look
right to me (and segfaults if between those two there's an unmapped
region, as happened here).

Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@480 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-26 12:12:22 +00:00
Stefan Reinauer
9cf00d18d4 small typo
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@478 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-20 18:21:52 +00:00
Stefan Reinauer
7fb3e5a9c5 Fixes nocompress:-handling in lar
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@477 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-20 17:55:32 +00:00
Stefan Reinauer
dd35e9c402 fix mkdirp_below calls like I think Peter intended them
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@476 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-20 00:48:06 +00:00
Stefan Reinauer
55c50f085b Add another field to the filename specified for create and add
operations to specify the intended pathname for the blob.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@474 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-20 00:08:18 +00:00
Stefan Reinauer
fa71bfb180 Provide the ability to add arbitrary files to an existing LAR. Also
fleshed out the "usage" screen.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@473 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-19 23:53:16 +00:00
Stefan Reinauer
ee1bb1bc8d missing svn add for r470.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@472 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-19 23:37:34 +00:00
Stefan Reinauer
fd18b05542 Add another field to the filename specified for create and add
operations to specify the intended pathname for the blob.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@471 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-19 23:33:41 +00:00
Stefan Reinauer
f2f4fc5fe7 In preparation for adding new LAR functionality - this patch
consolidates
creating and accessing the LAR into new code utilizing mmap which
facilitates moving about within the archive. 

This code also turns the bootblock path name as a constant value.
It also requires that the user specify a size when the LAR is
created.

This patch was missing do_no_uncompress() which was fixed before
commit. This part should be reviewed.

Signed-off-by: Jordan crouse <jordan.crouse@amd.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@470 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-08-19 23:31:58 +00:00