mirror of
https://review.coreboot.org/flashrom.git
synced 2025-09-17 18:35:24 +02:00
pcidev.h: Extract pcidev declarations to a separate header
This patch moves all the declarations relevant to PCI into their own header in include/pcidev.h This is a simple refactor that aims to simplify maintenance and to clarify file dependency inside the project. Currently, most of the declarations reside in programmer.h making it difficult to really understand file dependency. Change-Id: Ie7cefa012d43e03d2d3886f1567ad9b3fe1b148c Signed-off-by: Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/89094 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
b6843e012e
commit
05976c7e93
@@ -18,6 +18,7 @@
|
||||
#include "programmer.h"
|
||||
#include "platform/pci.h"
|
||||
#include "platform/udelay.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_ASMEDIA 0x1b21
|
||||
|
||||
|
2
atahpt.c
2
atahpt.c
@@ -19,7 +19,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_x86_io.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define BIOS_ROM_ADDR 0x90
|
||||
#define BIOS_ROM_DATA 0x94
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_x86_io.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define MAX_ROM_DECODE (32 * 1024)
|
||||
#define ADDR_MASK (MAX_ROM_DECODE - 1)
|
||||
|
2
atavia.c
2
atavia.c
@@ -20,8 +20,8 @@
|
||||
#include <string.h>
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "platform/pci.h"
|
||||
#include "platform/udelay.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_VIA 0x1106
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define NOT_DONE_YET 1
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_DRKAISER 0x1803
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_NVIDIA 0x10de
|
||||
|
||||
|
47
include/pcidev.h
Normal file
47
include/pcidev.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of the flashrom project.
|
||||
*
|
||||
* Copyright (C) 2025 Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __PCIDEV_H__
|
||||
#define __PCIDEV_H__
|
||||
|
||||
#include "platform/pci.h"
|
||||
#include "programmer.h"
|
||||
|
||||
// FIXME: This needs to be local, not global(?)
|
||||
extern struct pci_access *pacc;
|
||||
|
||||
int pci_init_common(void);
|
||||
uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
|
||||
struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
|
||||
struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start);
|
||||
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func);
|
||||
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass);
|
||||
struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device);
|
||||
struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device);
|
||||
|
||||
/* rpci_write_* are reversible writes. The original PCI config space register
|
||||
* contents will be restored on shutdown.
|
||||
* To clone the pci_dev instances internally, the `pacc` global
|
||||
* variable has to reference a pci_access method that is compatible
|
||||
* with the given pci_dev handle. The referenced pci_access (not
|
||||
* the variable) has to stay valid until the shutdown handlers are
|
||||
* finished.
|
||||
*/
|
||||
int rpci_write_byte(struct pci_dev *dev, int reg, uint8_t data);
|
||||
int rpci_write_word(struct pci_dev *dev, int reg, uint16_t data);
|
||||
int rpci_write_long(struct pci_dev *dev, int reg, uint32_t data);
|
||||
|
||||
#endif
|
@@ -120,33 +120,9 @@ struct bitbang_spi_master {
|
||||
unsigned int half_period;
|
||||
};
|
||||
|
||||
struct pci_dev;
|
||||
struct pci_filter;
|
||||
|
||||
/* pcidev.c */
|
||||
// FIXME: This needs to be local, not global(?)
|
||||
extern struct pci_access *pacc;
|
||||
int pci_init_common(void);
|
||||
uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
|
||||
struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
|
||||
struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start);
|
||||
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func);
|
||||
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass);
|
||||
struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device);
|
||||
struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device);
|
||||
/* rpci_write_* are reversible writes. The original PCI config space register
|
||||
* contents will be restored on shutdown.
|
||||
* To clone the pci_dev instances internally, the `pacc` global
|
||||
* variable has to reference a pci_access method that is compatible
|
||||
* with the given pci_dev handle. The referenced pci_access (not
|
||||
* the variable) has to stay valid until the shutdown handlers are
|
||||
* finished.
|
||||
*/
|
||||
int rpci_write_byte(struct pci_dev *dev, int reg, uint8_t data);
|
||||
int rpci_write_word(struct pci_dev *dev, int reg, uint16_t data);
|
||||
int rpci_write_long(struct pci_dev *dev, int reg, uint32_t data);
|
||||
|
||||
#if CONFIG_INTERNAL == 1
|
||||
struct pci_dev;
|
||||
struct penable {
|
||||
uint16_t vendor_id;
|
||||
uint16_t device_id;
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include "hwaccess_x86_io.h"
|
||||
|
2
it8212.c
2
it8212.c
@@ -18,7 +18,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
struct it8212_data {
|
||||
struct pci_dev *dev;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
/* Bit positions for each pin. */
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_x86_io.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define BIOS_ROM_ADDR 0x04
|
||||
#define BIOS_ROM_DATA 0x08
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
struct nicintel_data {
|
||||
uint8_t *nicintel_bar;
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "platform/udelay.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||
#define MEMMAP_SIZE 0x1c /* Only EEC, EERD and EEWR are needed. */
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||
#define MEMMAP_SIZE getpagesize()
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_x86_io.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_NATSEMI 0x100b
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_x86_io.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_REALTEK 0x10ec
|
||||
#define PCI_VENDOR_ID_SMC1211 0x1113
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_OGP 0x1227
|
||||
|
||||
|
4
pcidev.c
4
pcidev.c
@@ -15,11 +15,13 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "pcidev.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "flash.h"
|
||||
#include "programmer.h"
|
||||
#include "platform/pci.h"
|
||||
|
||||
struct pci_access *pacc;
|
||||
|
||||
|
2
satamv.c
2
satamv.c
@@ -21,7 +21,7 @@
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_x86_io.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
struct satamv_data {
|
||||
uint8_t *bar;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
#define PCI_VENDOR_ID_SII 0x1095
|
||||
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "programmer.h"
|
||||
#include "hwaccess_physmap.h"
|
||||
#include "spi.h"
|
||||
#include "platform/pci.h"
|
||||
#include "pcidev.h"
|
||||
|
||||
/* This struct is unused, but helps visualize the SB600 SPI BAR layout.
|
||||
*struct sb600_spi_controller {
|
||||
|
Reference in New Issue
Block a user