Lines Matching refs:adev

90 static bool igp_read_bios_from_vram(struct amdgpu_device *adev)  in igp_read_bios_from_vram()  argument
96 if (!(adev->flags & AMD_IS_APU)) in igp_read_bios_from_vram()
97 if (amdgpu_device_need_post(adev)) in igp_read_bios_from_vram()
101 if (pci_resource_len(adev->pdev, 0) == 0) in igp_read_bios_from_vram()
104 adev->bios = NULL; in igp_read_bios_from_vram()
105 vram_base = pci_resource_start(adev->pdev, 0); in igp_read_bios_from_vram()
111 adev->bios = kmalloc(size, GFP_KERNEL); in igp_read_bios_from_vram()
112 if (!adev->bios) { in igp_read_bios_from_vram()
116 adev->bios_size = size; in igp_read_bios_from_vram()
117 memcpy_fromio(adev->bios, bios, size); in igp_read_bios_from_vram()
120 if (!check_atom_bios(adev->bios, size)) { in igp_read_bios_from_vram()
121 kfree(adev->bios); in igp_read_bios_from_vram()
128 bool amdgpu_read_bios(struct amdgpu_device *adev) in amdgpu_read_bios() argument
133 adev->bios = NULL; in amdgpu_read_bios()
135 bios = pci_map_rom(adev->pdev, &size); in amdgpu_read_bios()
140 adev->bios = kzalloc(size, GFP_KERNEL); in amdgpu_read_bios()
141 if (adev->bios == NULL) { in amdgpu_read_bios()
142 pci_unmap_rom(adev->pdev, bios); in amdgpu_read_bios()
145 adev->bios_size = size; in amdgpu_read_bios()
146 memcpy_fromio(adev->bios, bios, size); in amdgpu_read_bios()
147 pci_unmap_rom(adev->pdev, bios); in amdgpu_read_bios()
149 if (!check_atom_bios(adev->bios, size)) { in amdgpu_read_bios()
150 kfree(adev->bios); in amdgpu_read_bios()
157 static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev) in amdgpu_read_bios_from_rom() argument
162 if (!adev->asic_funcs || !adev->asic_funcs->read_bios_from_rom) in amdgpu_read_bios_from_rom()
166 if (amdgpu_asic_read_bios_from_rom(adev, &header[0], sizeof(header)) == false) in amdgpu_read_bios_from_rom()
179 adev->bios = kmalloc(len, GFP_KERNEL); in amdgpu_read_bios_from_rom()
180 if (!adev->bios) { in amdgpu_read_bios_from_rom()
184 adev->bios_size = len; in amdgpu_read_bios_from_rom()
187 amdgpu_asic_read_bios_from_rom(adev, adev->bios, len); in amdgpu_read_bios_from_rom()
189 if (!check_atom_bios(adev->bios, len)) { in amdgpu_read_bios_from_rom()
190 kfree(adev->bios); in amdgpu_read_bios_from_rom()
197 static bool amdgpu_read_platform_bios(struct amdgpu_device *adev) in amdgpu_read_platform_bios() argument
199 phys_addr_t rom = adev->pdev->rom; in amdgpu_read_platform_bios()
200 size_t romlen = adev->pdev->romlen; in amdgpu_read_platform_bios()
203 adev->bios = NULL; in amdgpu_read_platform_bios()
208 adev->bios = kzalloc(romlen, GFP_KERNEL); in amdgpu_read_platform_bios()
209 if (!adev->bios) in amdgpu_read_platform_bios()
216 memcpy_fromio(adev->bios, bios, romlen); in amdgpu_read_platform_bios()
219 if (!check_atom_bios(adev->bios, romlen)) in amdgpu_read_platform_bios()
222 adev->bios_size = romlen; in amdgpu_read_platform_bios()
226 kfree(adev->bios); in amdgpu_read_platform_bios()
278 static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev) in amdgpu_atrm_get_bios() argument
289 if (adev->flags & AMD_IS_APU) in amdgpu_atrm_get_bios()
321 adev->bios = kmalloc(size, GFP_KERNEL); in amdgpu_atrm_get_bios()
322 if (!adev->bios) { in amdgpu_atrm_get_bios()
323 dev_err(adev->dev, "Unable to allocate bios\n"); in amdgpu_atrm_get_bios()
329 adev->bios, in amdgpu_atrm_get_bios()
336 if (!check_atom_bios(adev->bios, size)) { in amdgpu_atrm_get_bios()
337 kfree(adev->bios); in amdgpu_atrm_get_bios()
340 adev->bios_size = size; in amdgpu_atrm_get_bios()
344 static inline bool amdgpu_atrm_get_bios(struct amdgpu_device *adev) in amdgpu_atrm_get_bios() argument
350 static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev) in amdgpu_read_disabled_bios() argument
352 if (adev->flags & AMD_IS_APU) in amdgpu_read_disabled_bios()
353 return igp_read_bios_from_vram(adev); in amdgpu_read_disabled_bios()
355 return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ? in amdgpu_read_disabled_bios()
356 false : amdgpu_asic_read_disabled_bios(adev); in amdgpu_read_disabled_bios()
360 static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) in amdgpu_acpi_vfct_bios() argument
371 dev_info(adev->dev, "ACPI VFCT table present but broken (too short #1),skipping\n"); in amdgpu_acpi_vfct_bios()
384 dev_info(adev->dev, "ACPI VFCT image header truncated,skipping\n"); in amdgpu_acpi_vfct_bios()
390 dev_info(adev->dev, "ACPI VFCT image truncated,skipping\n"); in amdgpu_acpi_vfct_bios()
395 vhdr->PCIBus == adev->pdev->bus->number && in amdgpu_acpi_vfct_bios()
396 vhdr->PCIDevice == PCI_SLOT(adev->pdev->devfn) && in amdgpu_acpi_vfct_bios()
397 vhdr->PCIFunction == PCI_FUNC(adev->pdev->devfn) && in amdgpu_acpi_vfct_bios()
398 vhdr->VendorID == adev->pdev->vendor && in amdgpu_acpi_vfct_bios()
399 vhdr->DeviceID == adev->pdev->device) { in amdgpu_acpi_vfct_bios()
400 adev->bios = kmemdup(&vbios->VbiosContent, in amdgpu_acpi_vfct_bios()
404 if (!check_atom_bios(adev->bios, vhdr->ImageLength)) { in amdgpu_acpi_vfct_bios()
405 kfree(adev->bios); in amdgpu_acpi_vfct_bios()
408 adev->bios_size = vhdr->ImageLength; in amdgpu_acpi_vfct_bios()
413 dev_info(adev->dev, "ACPI VFCT table present but broken (too short #2),skipping\n"); in amdgpu_acpi_vfct_bios()
417 static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) in amdgpu_acpi_vfct_bios() argument
423 bool amdgpu_get_bios(struct amdgpu_device *adev) in amdgpu_get_bios() argument
425 if (amdgpu_atrm_get_bios(adev)) { in amdgpu_get_bios()
426 dev_info(adev->dev, "Fetched VBIOS from ATRM\n"); in amdgpu_get_bios()
430 if (amdgpu_acpi_vfct_bios(adev)) { in amdgpu_get_bios()
431 dev_info(adev->dev, "Fetched VBIOS from VFCT\n"); in amdgpu_get_bios()
435 if (igp_read_bios_from_vram(adev)) { in amdgpu_get_bios()
436 dev_info(adev->dev, "Fetched VBIOS from VRAM BAR\n"); in amdgpu_get_bios()
440 if (amdgpu_read_bios(adev)) { in amdgpu_get_bios()
441 dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n"); in amdgpu_get_bios()
445 if (amdgpu_read_bios_from_rom(adev)) { in amdgpu_get_bios()
446 dev_info(adev->dev, "Fetched VBIOS from ROM\n"); in amdgpu_get_bios()
450 if (amdgpu_read_disabled_bios(adev)) { in amdgpu_get_bios()
451 dev_info(adev->dev, "Fetched VBIOS from disabled ROM BAR\n"); in amdgpu_get_bios()
455 if (amdgpu_read_platform_bios(adev)) { in amdgpu_get_bios()
456 dev_info(adev->dev, "Fetched VBIOS from platform\n"); in amdgpu_get_bios()
460 dev_err(adev->dev, "Unable to locate a BIOS ROM\n"); in amdgpu_get_bios()
464 adev->is_atom_fw = (adev->asic_type >= CHIP_VEGA10) ? true : false; in amdgpu_get_bios()