Returns the physical RCBA base address or zero on error. */
| 11 | |
| 12 | /* Returns the physical RCBA base address or zero on error. */ |
| 13 | u32 get_rcba_phys(void) |
| 14 | { |
| 15 | struct pci_access *pacc; |
| 16 | struct pci_dev *sb; |
| 17 | uint32_t rcba_phys; |
| 18 | |
| 19 | pacc = pci_alloc(); |
| 20 | pacc->method = PCI_ACCESS_I386_TYPE1; |
| 21 | |
| 22 | pci_init(pacc); |
| 23 | pci_scan_bus(pacc); |
| 24 | |
| 25 | sb = pci_get_dev(pacc, 0, 0, 0x1f, 0); |
| 26 | if (!sb) { |
| 27 | printf("Uh oh, southbridge not on BDF(0:31:0), please report " |
| 28 | "this error, exiting.\n"); |
| 29 | pci_cleanup(pacc); |
| 30 | return 0; |
| 31 | } |
| 32 | pci_fill_info(sb, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_SIZES | |
| 33 | PCI_FILL_CLASS); |
| 34 | |
| 35 | rcba_phys = pci_read_long(sb, 0xf0) & 0xfffffffe; |
| 36 | |
| 37 | pci_free_dev(sb); |
| 38 | pci_cleanup(pacc); |
| 39 | |
| 40 | return rcba_phys; |
| 41 | } |
| 42 | |
| 43 | /* |
| 44 | * Writes 'val' to RCBA register at address 'addr'. |
no test coverage detected