diff options
author | Adam Kaufman <adam.kaufman@pinnacle.com> | 2007-02-06 19:47:50 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2007-02-06 19:47:50 +0000 |
commit | 4f9cf1373c6b9431fd6b84571237a8dee2ab93cd (patch) | |
tree | 7abc7233f1d7f2d74d6fefe892d98a1e95753ae7 /util/flashrom/flash_enable.c | |
parent | bc7ceb1fd1473f0338fee8140356f130d0b615ba (diff) |
This patch is a rework of Adam Kaufman's Solaris patch.
* flash.h:
- add a license header
- add system definitions
* flash_enable.c:
- put io priviledge access in one single place
- add includes required for Solaris.
* lbtable.c, flash_rom.c, 82802ab.c:
- use MEM_DEV so it works on Solaris
* sst49lfxxxc.c, sharplhf00l04.c, sst_fwhub.c, 82802ab.c
- drop unneeded include to sys/io.h
* Makefile
- adapt to Solaris specifics.
Signed-off-by: Adam Kaufman <adam.kaufman@pinnacle.com>
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Adam Kaufman <adam.kaufman@pinnacle.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2550 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom/flash_enable.c')
-rw-r--r-- | util/flashrom/flash_enable.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/util/flashrom/flash_enable.c b/util/flashrom/flash_enable.c index 743fe25696..82dab1a9ab 100644 --- a/util/flashrom/flash_enable.c +++ b/util/flashrom/flash_enable.c @@ -11,12 +11,18 @@ * */ -#include <sys/io.h> #include <stdio.h> #include <pci/pci.h> #include <stdlib.h> #include <stdint.h> #include <string.h> +#if defined (__sun) && (defined(__i386) || defined(__amd64)) +#include <strings.h> +#include <sys/sysi86.h> +#include <sys/psw.h> +#include <asm/sunddi.h> +#endif +#include "flash.h" #include "lbtable.h" #include "debug.h" @@ -27,12 +33,6 @@ static int enable_flash_sis630(struct pci_dev *dev, char *name) { char b; - /* get io privilege access PCI configuration space */ - if (iopl(3) != 0) { - perror("Can not set io priviliage"); - exit(1); - } - /* Enable 0xFFF8000~0xFFFF0000 decoding on SiS 540/630 */ outl(0x80000840, 0x0cf8); b = inb(0x0cfc) | 0x0b; @@ -164,12 +164,6 @@ static int enable_flash_vt8235(struct pci_dev *dev, char *name) unsigned int base; int ok; - /* get io privilege access PCI configuration space */ - if (iopl(3) != 0) { - perror("Can not set io priviliage"); - exit(1); - } - old = pci_read_byte(dev, 0x40); new = old | 0x10; @@ -347,12 +341,6 @@ static int enable_flash_sb400(struct pci_dev *dev, char *name) struct pci_filter f; struct pci_dev *smbusdev; - /* get io privilege access */ - if (iopl(3) != 0) { - perror("Can not set io priviliage"); - exit(1); - } - /* then look for the smbus device */ pci_filter_init((struct pci_access *) 0, &f); f.vendor = 0x1002; @@ -491,12 +479,6 @@ static int mbenable_island_aruma(void) * connected to the WinBond w83627hf GPIO 24. */ - /* get io privilege access winbond config space */ - if (iopl(3) != 0) { - perror("Can not set io priviliage"); - exit(1); - } - printf("Disabling mainboard flash write protection.\n"); outb(0x87, EFIR); // sequence to unlock extended functions @@ -552,6 +534,18 @@ int enable_flash_write() struct pci_dev *dev = 0; FLASH_ENABLE *enable = 0; + /* get io privilege access PCI configuration space */ +#if defined (__sun) && (defined(__i386) || defined(__amd64)) + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0){ +#else + if (iopl(3) != 0) { +#endif + perror("Can not set io privilege"); + exit(1); + } + + + /* Initialize PCI access */ pacc = pci_alloc(); /* Get the pci_access structure */ /* Set all options you want -- here we stick with the defaults */ pci_init(pacc); /* Initialize the PCI library */ |