Felix Held | 1d66ad1 | 2023-03-27 14:39:29 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <device/pci_rom.h> |
| 5 | #include <stdint.h> |
| 6 | |
Felix Held | e30532d | 2023-03-27 14:52:36 +0200 | [diff] [blame^] | 7 | #define ST_GPU_FIRST_VID_DID 0x100298e0 |
| 8 | #define ST_GPU_LAST_VID_DID 0x100298ef |
| 9 | #define ST_VBIOS_VID_DID 0x100298e0 |
| 10 | #define CZ_GPU_FIRST_VID_DID 0x10029870 |
| 11 | #define CZ_GPU_LAST_VID_DID 0x1002987f |
| 12 | #define CZ_VBIOS_VID_DID 0x10029870 |
| 13 | |
Felix Held | 1d66ad1 | 2023-03-27 14:39:29 +0200 | [diff] [blame] | 14 | /* Change the vendor / device IDs to match the generic VBIOS header. */ |
| 15 | u32 map_oprom_vendev(u32 vendev) |
| 16 | { |
| 17 | u32 new_vendev; |
| 18 | |
Felix Held | e30532d | 2023-03-27 14:52:36 +0200 | [diff] [blame^] | 19 | if ((vendev >= ST_GPU_FIRST_VID_DID) && (vendev <= ST_GPU_LAST_VID_DID)) |
| 20 | new_vendev = ST_VBIOS_VID_DID; |
| 21 | else if ((vendev >= CZ_GPU_FIRST_VID_DID) && (vendev <= CZ_GPU_LAST_VID_DID)) |
| 22 | new_vendev = CZ_VBIOS_VID_DID; |
Felix Held | 1d66ad1 | 2023-03-27 14:39:29 +0200 | [diff] [blame] | 23 | else |
| 24 | new_vendev = vendev; |
| 25 | |
| 26 | if (vendev != new_vendev) |
| 27 | printk(BIOS_NOTICE, "Mapping PCI device %8x to %8x\n", vendev, new_vendev); |
| 28 | |
| 29 | return new_vendev; |
| 30 | } |