MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / init_card

Function init_card

rEFIt_UEFI/Platform/ati.cpp:1923–2079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1921#endif
1922
1923static BOOLEAN init_card(pci_dt_t *pci_dev)
1924{
1925 BOOLEAN add_vbios = gSettings.LoadVBios;
1926 CHAR8 *name;
1927 CHAR8 *name_parent;
1928 // CHAR8 *model;
1929 INTN NameLen = 0;
1930 UINTN i, j;
1931 INTN n_ports = 0;
1932 UINTN ExpansionRom = 0;
1933 UINTN Reg1, Reg3, Reg5;
1934
1935 card = (__typeof__(card))AllocateZeroPool(sizeof(card_t));
1936 if (!card) {
1937 return FALSE;
1938 }
1939 card->pci_dev = pci_dev;
1940
1941 for (i = 0; radeon_cards[i].device_id ; i++) {
1942 if (radeon_cards[i].device_id != pci_dev->device_id) {
1943 continue;
1944 }
1945 card->info = (__typeof__(card->info))AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
1946 if (!card->info->cfg_name) {
1947 card->info->cfg_name = kRadeon;
1948 }
1949 break;
1950 }
1951
1952 for (j = 0; j < NGFX; j++) {
1953 if ((gGraphics[j].Vendor == Ati) &&
1954 (gGraphics[j].DeviceID == pci_dev->device_id)) {
1955 // model = gGraphics[j].Model;
1956 n_ports = gGraphics[j].Ports;
1957 add_vbios = gGraphics[j].LoadVBios;
1958 break;
1959 }
1960 }
1961
1962 if (!card->info || !card->info->device_id || !card->info->cfg_name) {
1963 DBG("Unsupported ATI card! Device ID: [%04hX:%04hX] Subsystem ID: [%08X] \n",
1964 pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id.subsys_id);
1965 DBG("search for brothers family\n");
1966 for (i = 0; radeon_cards[i].device_id ; i++) {
1967 if ((radeon_cards[i].device_id & ~0xf) == (pci_dev->device_id & ~0xf)) {
1968 card->info = (__typeof__(card->info))AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
1969 break;
1970 }
1971 }
1972 if (!card->info->cfg_name) {
1973 DBG("...compatible config is not found, set common\n");
1974 card->info->cfg_name = kRadeon;
1975// return FALSE;
1976 }
1977 }
1978
1979 card->fb = (UINT8 *)(UINTN)(pci_config_read32(pci_dev, PCI_BASE_ADDRESS_0) & ~0x0f);
1980 Reg1 = (UINTN)(pci_config_read32(pci_dev, PCI_BASE_ADDRESS_1) & ~0x0f);

Callers 1

setup_ati_devpropFunction · 0.85

Calls 15

AllocateCopyPoolFunction · 0.85
radeon_card_postedFunction · 0.85
get_vram_sizeFunction · 0.85
load_vbios_fileFunction · 0.85
read_vbiosFunction · 0.85
read_disabled_vbiosFunction · 0.85
S8PrintfFunction · 0.85
AsciiStrCmpFunction · 0.85
snprintfFunction · 0.85
AsciiStrLenFunction · 0.85
pci_config_read32Function · 0.70

Tested by

no test coverage detected