diff options
author | Adam Kaufman <adam.kaufman@pinnacle.com> | 2007-02-06 19:47:50 +0000 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2007-02-06 19:47:50 +0000 |
commit | 064b1f23fa507878bddca3c308e5e6034b06c998 (patch) | |
tree | 53d889789d8317e36e0f3238902e3d268fd5d05e /flash_enable.c | |
parent | 474230ad421b2e2e4ca26493292d224a22a262c2 (diff) | |
download | ast2050-flashrom-064b1f23fa507878bddca3c308e5e6034b06c998.zip ast2050-flashrom-064b1f23fa507878bddca3c308e5e6034b06c998.tar.gz |
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.
Corresponding to flashrom svn r88 and coreboot v2 svn r2550.
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>
Diffstat (limited to 'flash_enable.c')
-rw-r--r-- | flash_enable.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/flash_enable.c b/flash_enable.c index 743fe25..82dab1a 100644 --- a/flash_enable.c +++ b/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 */ |