mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
Releasing IO permissions was done by hand everywhere
Use a proper abstraction. Kill unneeded #include statements. Corresponding to flashrom svn r672. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Reinauer <stepan@coresystems.de>
This commit is contained in:
parent
be726817f7
commit
db41c59e3b
1
flash.h
1
flash.h
@ -308,6 +308,7 @@ struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
|
|||||||
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
||||||
uint16_t card_vendor, uint16_t card_device);
|
uint16_t card_vendor, uint16_t card_device);
|
||||||
void get_io_perms(void);
|
void get_io_perms(void);
|
||||||
|
void release_io_perms(void);
|
||||||
int internal_init(void);
|
int internal_init(void);
|
||||||
int internal_shutdown(void);
|
int internal_shutdown(void);
|
||||||
void internal_chip_writeb(uint8_t val, chipaddr addr);
|
void internal_chip_writeb(uint8_t val, chipaddr addr);
|
||||||
|
11
internal.c
11
internal.c
@ -95,6 +95,13 @@ void get_io_perms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void release_io_perms(void)
|
||||||
|
{
|
||||||
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
close(io_fd);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int internal_init(void)
|
int internal_init(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -128,9 +135,7 @@ int internal_init(void)
|
|||||||
|
|
||||||
int internal_shutdown(void)
|
int internal_shutdown(void)
|
||||||
{
|
{
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
release_io_perms();
|
||||||
close(io_fd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
|
||||||
#define BIOS_ROM_ADDR 0x04
|
#define BIOS_ROM_ADDR 0x04
|
||||||
@ -99,9 +96,7 @@ int nic3com_shutdown(void)
|
|||||||
|
|
||||||
free(pcidev_bdf);
|
free(pcidev_bdf);
|
||||||
pci_cleanup(pacc);
|
pci_cleanup(pacc);
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
release_io_perms();
|
||||||
close(io_fd);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,6 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
|
||||||
#define PCI_VENDOR_ID_SII 0x1095
|
#define PCI_VENDOR_ID_SII 0x1095
|
||||||
@ -77,9 +73,7 @@ int satasii_shutdown(void)
|
|||||||
{
|
{
|
||||||
free(pcidev_bdf);
|
free(pcidev_bdf);
|
||||||
pci_cleanup(pacc);
|
pci_cleanup(pacc);
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
release_io_perms();
|
||||||
close(io_fd);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user