| 253 | } |
| 254 | |
| 255 | static rt_uint16_t pci_cfg_space_size(struct rt_pci_device *pdev) |
| 256 | { |
| 257 | int pos; |
| 258 | rt_uint32_t status; |
| 259 | rt_uint16_t class = pdev->class >> 8; |
| 260 | |
| 261 | if (class == PCIS_BRIDGE_HOST) |
| 262 | { |
| 263 | return pci_cfg_space_size_ext(pdev); |
| 264 | } |
| 265 | |
| 266 | if (rt_pci_is_pcie(pdev)) |
| 267 | { |
| 268 | return pci_cfg_space_size_ext(pdev); |
| 269 | } |
| 270 | |
| 271 | pos = rt_pci_find_capability(pdev, PCIY_PCIX); |
| 272 | if (!pos) |
| 273 | { |
| 274 | return PCI_REGMAX + 1; |
| 275 | } |
| 276 | |
| 277 | rt_pci_read_config_u32(pdev, pos + PCIXR_STATUS, &status); |
| 278 | if (status & (PCIXM_STATUS_266CAP | PCIXM_STATUS_533CAP)) |
| 279 | { |
| 280 | return pci_cfg_space_size_ext(pdev); |
| 281 | } |
| 282 | |
| 283 | return PCI_REGMAX + 1; |
| 284 | } |
| 285 | |
| 286 | static void pci_init_capabilities(struct rt_pci_device *pdev) |
| 287 | { |
no test coverage detected