mirror of
				https://gitlab.com/qemu-project/ipxe.git
				synced 2025-11-03 07:59:06 +08:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 6677a5a290 | 
@ -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 );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user