summaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorSimon Rettberg2023-04-04 15:12:41 +0200
committerSimon Rettberg2023-04-04 15:12:41 +0200
commit5ba496dce11d10198a0eae0c8440dccb256fbf32 (patch)
tree549903f1dab893870335a6e4767a4530444d2e83 /src/drivers/bus
parent[vesafb] Map Unicode characters to CP437 if possible (diff)
parent[tls] Handle fragmented handshake records (diff)
downloadipxe-5ba496dce11d10198a0eae0c8440dccb256fbf32.tar.gz
ipxe-5ba496dce11d10198a0eae0c8440dccb256fbf32.tar.xz
ipxe-5ba496dce11d10198a0eae0c8440dccb256fbf32.zip
Merge branch 'master' into openslx
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/eisa.c8
-rw-r--r--src/drivers/bus/pci.c1
-rw-r--r--src/drivers/bus/pcibackup.c10
-rw-r--r--src/drivers/bus/pciextra.c9
4 files changed, 22 insertions, 6 deletions
diff --git a/src/drivers/bus/eisa.c b/src/drivers/bus/eisa.c
index a4efe2621..68837eb4d 100644
--- a/src/drivers/bus/eisa.c
+++ b/src/drivers/bus/eisa.c
@@ -98,8 +98,16 @@ static void eisa_remove ( struct eisa_device *eisa ) {
static int eisabus_probe ( struct root_device *rootdev ) {
struct eisa_device *eisa = NULL;
unsigned int slot;
+ uint8_t system;
int rc;
+ /* Check for EISA system board */
+ system = inb ( EISA_VENDOR_ID );
+ if ( system & 0x80 ) {
+ DBG ( "No EISA system board (read %02x)\n", system );
+ return -ENODEV;
+ }
+
for ( slot = EISA_MIN_SLOT ; slot <= EISA_MAX_SLOT ; slot++ ) {
/* Allocate struct eisa_device */
if ( ! eisa )
diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c
index 7953aaedd..92b389641 100644
--- a/src/drivers/bus/pci.c
+++ b/src/drivers/bus/pci.c
@@ -205,6 +205,7 @@ int pci_read_config ( struct pci_device *pci ) {
pci_read_config_dword ( pci, PCI_REVISION, &tmp );
pci->class = ( tmp >> 8 );
pci_read_config_byte ( pci, PCI_INTERRUPT_LINE, &pci->irq );
+ pci_read_config_byte ( pci, PCI_HEADER_TYPE, &pci->hdrtype );
pci_read_bases ( pci );
/* Initialise generic device component */
diff --git a/src/drivers/bus/pcibackup.c b/src/drivers/bus/pcibackup.c
index fecad8192..4cf126f83 100644
--- a/src/drivers/bus/pcibackup.c
+++ b/src/drivers/bus/pcibackup.c
@@ -61,14 +61,15 @@ pci_backup_excluded ( struct pci_device *pci, unsigned int offset,
*
* @v pci PCI device
* @v backup PCI configuration space backup
+ * @v limit Maximum offset in PCI configuration space
* @v exclude PCI configuration space backup exclusion list, or NULL
*/
void pci_backup ( struct pci_device *pci, struct pci_config_backup *backup,
- const uint8_t *exclude ) {
+ unsigned int limit, const uint8_t *exclude ) {
unsigned int offset;
uint32_t *dword;
- for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
+ for ( offset = 0, dword = backup->dwords ; offset < limit ;
offset += sizeof ( *dword ) , dword++ ) {
if ( ! pci_backup_excluded ( pci, offset, exclude ) )
pci_read_config_dword ( pci, offset, dword );
@@ -80,14 +81,15 @@ void pci_backup ( struct pci_device *pci, struct pci_config_backup *backup,
*
* @v pci PCI device
* @v backup PCI configuration space backup
+ * @v limit Maximum offset in PCI configuration space
* @v exclude PCI configuration space backup exclusion list, or NULL
*/
void pci_restore ( struct pci_device *pci, struct pci_config_backup *backup,
- const uint8_t *exclude ) {
+ unsigned int limit, const uint8_t *exclude ) {
unsigned int offset;
uint32_t *dword;
- for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
+ for ( offset = 0, dword = backup->dwords ; offset < limit ;
offset += sizeof ( *dword ) , dword++ ) {
if ( ! pci_backup_excluded ( pci, offset, exclude ) )
pci_write_config_dword ( pci, offset, *dword );
diff --git a/src/drivers/bus/pciextra.c b/src/drivers/bus/pciextra.c
index 23617bc9a..1eeb9b2a0 100644
--- a/src/drivers/bus/pciextra.c
+++ b/src/drivers/bus/pciextra.c
@@ -3,6 +3,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/timer.h>
#include <ipxe/pci.h>
+#include <ipxe/pcibackup.h>
static int pci_find_capability_common ( struct pci_device *pci,
uint8_t pos, int cap ) {
@@ -121,8 +122,12 @@ unsigned long pci_bar_size ( struct pci_device *pci, unsigned int reg ) {
* @v exp PCI Express Capability address
*/
void pci_reset ( struct pci_device *pci, unsigned int exp ) {
+ struct pci_config_backup backup;
uint16_t control;
+ /* Back up configuration space */
+ pci_backup ( pci, &backup, PCI_CONFIG_BACKUP_STANDARD, NULL );
+
/* Perform a PCIe function-level reset */
pci_read_config_word ( pci, ( exp + PCI_EXP_DEVCTL ), &control );
control |= PCI_EXP_DEVCTL_FLR;
@@ -131,6 +136,6 @@ void pci_reset ( struct pci_device *pci, unsigned int exp ) {
/* Allow time for reset to complete */
mdelay ( PCI_EXP_FLR_DELAY_MS );
- /* Re-enable device */
- adjust_pci_device ( pci );
+ /* Restore configuration */
+ pci_restore ( pci, &backup, PCI_CONFIG_BACKUP_STANDARD, NULL );
}