1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

13 Commits

Author SHA1 Message Date
Carl-Daniel Hailfinger
a2faddf7d3 Decouple BAR reading from pci device init, handle errors gracefully
Pcidev_init() now returns struct pci_device * instead of a BAR stored in
PCI config space. This allows for real error checking instead of having
exit(1) everywhere in pcidev.c.
Thanks to Niklas Söderlund for coming up with the original error
handling patch which was slightly modified and folded into this patch.
Move the declaration of struct pci_device in programmer.h before the
first user.

Corresponding to flashrom svn r1644.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-01-05 23:52:45 +00:00
Stefan Tauner
5561955b11 Unify PCI init and let pcidev clean itself up
Previously the internal programmer used its own code to initialize pcilib.
This patch extracts the common code from the internal programmer and
pcidev_init() into pcidev_init_common().
This fixes the non-existent PCI cleanup of the internal programmer and adds
an additional safety by checking for an already existing PCI context.

We got a nice shutdown function registration infrastructure, but did not use it
very wisely. Instead we added shutdown functions to a myriad of programmers
unnecessarily. In this patch we get rid of those that do only call pci_cleanup(pacc)
by adding a shutdown function the pcidev.c itself that gets registered by
pcidev_init().

Corresponding to flashrom svn r1642.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-01-04 22:24:58 +00:00
Stefan Tauner
4b24a2d70b Unify usbdev_status and pcidev_status into dev_entry
Once upon a time usbdev_status was created for the ft2232
programmer. Its IDs are semantically different to pcidev_status
because they indicate USB instead of PCI IDs, but apart from that
both data structures are equal. This change makes life easier for
everything involved in handling and printing the status of devices
that is noted in those structures by combining them into dev_entry.

It is still possible to distinguish between PCI and USB devices
indirectly by using the struct programmer's type field.

Also, add a programmer column to the PCI and USB devices lists.

Corresponding to flashrom svn r1632.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-12-27 18:40:36 +00:00
Carl-Daniel Hailfinger
1c6d2ff03d Some ISO C fixes
This patch just fixes a limited number of bits not conforming to c99 by using
 - __asm__ instead of just asm
 - {0} instead of {} for struct initialization
 - h_addr_list[0] instead of h_addr to access the host address in
   struct hostent
 - #include <strings.h> where needed (for ffs and strcasecmp)

Based on a previous patch by Carl-Daniel.

Corresponding to flashrom svn r1585.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-08-27 00:44:42 +00:00
Carl-Daniel Hailfinger
d6bb828b01 Automatically release I/O permissions on shutdown
Get_io_perms() is renamed to rget_io_perms() and automatically registers
a function to release I/O permissions on shutdown.

Actually release I/O permissions on Solaris and iopl()-supporting
operating systems like Linux.

This patch fixes quite a few programmers which forgot to release I/O
permissions on shutdown, and it simplifies the shutdown and error
handling code for all others.

Do not call exit(1) if I/O permissions are denied and return an error
instead. This part of the patch was written by Niklas Söderlund.

Corresponding to flashrom svn r1551.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Niklas Söderlund <niso@kth.se>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2012-07-21 17:27:08 +00:00
Patrick Georgi
32508eb304 Hide hwaccess.h from public API
Move hwaccess.h #include from flash.h to individual drivers.
libflashrom users need flash.h, but they do not care about hwaccess.h
and should not see its definitions because they may conflict with
other hardware access functions and #defines used by the libflashrom
user.

Corresponding to flashrom svn r1549.

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-07-20 20:35:14 +00:00
Carl-Daniel Hailfinger
3834c2d7e5 Check vendor_id for PCI based external programmers
Restructure PCI device detection code.
Rename pcidev_validate to pcidev_readbar.

Note: Slight changes in behaviour are possible, especially on dual/quad
chip NICs which appear as more than one PCI device. Found devices are no
longer printed at _pinfo level, but rather at _pdbg level.

Corresponding to flashrom svn r1548.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2012-07-16 21:32:19 +00:00
Carl-Daniel Hailfinger
8a3c60cdd0 Add struct flashctx * parameter to all functions accessing flash chips
All programmer access function prototypes except init have been made
static and moved to the respective file.

A few internal functions in flash chip drivers had chipaddr parameters
which are no longer needed.

The lines touched by flashctx changes have been adjusted to 80 columns
except in header files.

Corresponding to flashrom svn r1474.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-12-18 15:01:24 +00:00
Carl-Daniel Hailfinger
eaacd2d4e7 Register Parallel/LPC/FWH programmers the same way SPI programmers are registered
All programmers are now calling programmer registration functions and
direct manipulations of buses_supported are not needed/possible anymore.

Note: Programmers without parallel/LPC/FWH chip support should not call
register_par_programmer().

Additional fixes:
Set max_rom_decode.parallel for drkaiser.
Remove abuse of programmer_map_flash_region in it85spi.
Annotate several FIXMEs in it85spi.

Corresponding to flashrom svn r1463.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-11-09 23:40:00 +00:00
Sylvain "ythier" Hitier
3093f8f75e Add a bunch of new/tested stuff and various small changes 7
- add Asus Crosshair IV Extreme to the list of supported boards
  http://www.flashrom.org/pipermail/flashrom/2011-August/007640.html
- add Biostar N68S3+ to the list of supported boards
  http://www.flashrom.org/pipermail/flashrom/2011-September/007788.html
- add P7H55-M LX to the list of supported boards
  although flashrom works correctly, it is marked as not ok, because flashing the
  vendor image will break the LAN interface.
- add GA-X58A-UD7 to the list of supported boards
  http://paste.flashrom.org/view.php?id=739
- add Asus P4P800-VM to print.c
  (has a working board enable)
- add Asus K8V-X to print.c
  reported by florz
  http://paste.flashrom.org/view.php?id=742
- add Intel D865GLC to print.c as non-working (ICH5 with BIOS lock enable)
  reported by jmd on IRC
  http://paste.flashrom.org/view.php?id=775
- add Intel DH67CF to print.c as non-working (H67 with BIOS lock enable and locked ME region)
  http://www.flashrom.org/pipermail/flashrom/2011-September/007789.html
- add ECS P4M800PRO-M (V1.0A) to the list of supported boards
  reported by dweg on IRC (hot flashed a SST49LF040B, original was W39V040B)
- add X8DTU-6TF+ to print.c (needs ME unlocking)
  http://www.flashrom.org/pipermail/flashrom/2011-August/007553.html
- add Shuttle FH67 (used in the SH67H3 barebone) to the list of supported boards
  http://www.flashrom.org/pipermail/flashrom/2011-August/007749.html
- add Tyan S2912 to the list of supported boards
  reported by erlan on IRC
- add ZOTAC GeForce 8200 to the list of supported boards
  http://www.flashrom.org/pipermail/flashrom/2011-August/007612.html

- mark AT25DF321A as TEST_OK_PROBE
  http://www.flashrom.org/pipermail/flashrom/2011-August/007553.html
- mark 28F001BN/BX-T as TEST_OK_PR
  http://www.flashrom.org/pipermail/flashrom/2011-July/007208.html
- rename MX29F002
  http://patchwork.coreboot.org/patch/2794/
- mark SST39SF040 as fully tested
  reported by Florian 'florz' Zumbiehl
  http://paste.flashrom.org/view.php?id=742
- mark SST49LF040B as fully tested
  reported by dweg on IRC and later by Armin on the ml:
  http://www.flashrom.org/pipermail/flashrom/2011-August/007764.html

- mark H55 chipset as OK
  http://www.flashrom.org/pipermail/flashrom/2011-July/007432.html
- mark H67 chipset as OK
  http://www.flashrom.org/pipermail/flashrom/2011-August/007749.html
- mark a MCP61 version as OK
  http://www.flashrom.org/pipermail/flashrom/2011-September/007788.html
- add preliminary X79 (patsburg) PCI IDs
  0x1d40 was reported already as working (not archived in our pipermail?)
  http://marc.info/?l=flashrom&m=130683026218257&w=2

- mark "82557/8/9/0/1 Ethernet Pro 100" in nicintel.c as working
  http://www.flashrom.org/pipermail/flashrom/2011-August/007480.html

- rename some chips that had gratuitous "probing" suffixes:
  - SST25VF010.REMS
  - SST25VF040.REMS
  - M25P05.RES
  - M25P10.RES
  some other chip names with suffixes are needed due to lack of support
  for multiple probe functions per chip. this is explained here:
  http://www.flashrom.org/pipermail/flashrom/2011-August/007597.html

- remove unneeded nicintel_spi-related function declarations in programmer.h

- typos and whitespace fixes

- fix Asus P4P800-E Deluxe detection
  The original board enable was added before DMI matching and used
  the IDs of a Promise controller as secondary PCI ID set. The
  controller could be disabled in the BIOS which would make the
  board not match. This patch uses the SMBus controller instead and
  adds a DMI pattern. This was
Tested-by: Michael Schneider <vdrportal_midas at gmx dot de>

Corresponding to flashrom svn r1425.

- add "Sealed-case PC" to the list of chassis type (as indicating "not a laptop")
This is
Acked-by: Idwer Vollering <vidwer@gmail.com>

the fix for the typo unusued -> unused is
Signed-off-by: Sylvain "ythier" Hitier <sylvain.hitier@gmail.com>

everything else is
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>

And everything was reviewed and
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-09-03 11:22:27 +00:00
Carl-Daniel Hailfinger
1a227954f2 Rename CHIP_BUSTYPE_FOO to BUS_FOO
It's shorter to type, and we have less problems with the 80 column limit.

Corresponding to flashrom svn r1396.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-07-27 07:13:06 +00:00
David Hendricks
8bb2021d77 Use shutdown callback mechanism to shutdown programmers
This patch attempts to resolve some programmer shutdown ordering issues
by having the programmer init functions register shutdown callbacks explicitly
wherever it makes most sense. Before, assumptions were made that could lead to
the internal programmer's state changing before the external programmer could be
shut down properly. Now, each programmer cleans up after itself and (hopefully)
performs each operation in the correct order.

As a side-effect, this patch gives us a better usage model for reverse
operations such as rpci_* and rmmio_*. In the long-run, this should make
reversing the initialization process easier to understand, less tedious, and
less error-prone.

In short, this patch does the following:
- Registers a shutdown callback during initialization for each programmer.
- Kills the .shutdown function pointer from programmer_entry struct. Also,
  make most shutdown functions static.
- Adds a few minor clean-ups and corrections (e.g. missing physunmap() calls).

TODO: Remove forward declaration of serprog_shutdown() (added to simplify diff)

Corresponding to flashrom svn r1338.

Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-14 01:35:36 +00:00
Carl-Daniel Hailfinger
b713d2e35c Intel NIC with parallel flash support
Tested-by: Maciej Pijanka <maciej.pijanka@gmail.com>

Corresponding to flashrom svn r1297.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Anton Kochkov <anton.kochkov@gmail.com>
Acked-by: Anton Kochkov <anton.kochkov@gmail.com>
2011-05-08 00:24:18 +00:00