Lines Matching +full:rom +full:-

53 	uint8_t *bios = adev->bios;  in check_atom_bios()
56 dev_dbg(adev->dev, "VBIOS mem is null or mem size is wrong\n"); in check_atom_bios()
61 dev_dbg(adev->dev, "VBIOS signature incorrect %x %x\n", bios[0], in check_atom_bios()
68 dev_dbg(adev->dev, "Can't locate VBIOS header\n"); in check_atom_bios()
74 dev_dbg(adev->dev, "VBIOS header is broken\n"); in check_atom_bios()
80 dev_dbg(adev->dev, "ATOMBIOS detected\n"); in check_atom_bios()
88 * the IGP rom is not accessible via the rom bar as the IGP rom is
90 * copy of the igp rom at the start of vram if a discrete card is
92 * For SR-IOV, the vbios image is also put in VRAM in the VF.
100 if (!(adev->flags & AMD_IS_APU)) in amdgpu_read_bios_from_vram()
105 if (pci_resource_len(adev->pdev, 0) == 0) in amdgpu_read_bios_from_vram()
108 adev->bios = NULL; in amdgpu_read_bios_from_vram()
109 vram_base = pci_resource_start(adev->pdev, 0); in amdgpu_read_bios_from_vram()
114 adev->bios = kmalloc(size, GFP_KERNEL); in amdgpu_read_bios_from_vram()
115 if (!adev->bios) { in amdgpu_read_bios_from_vram()
119 adev->bios_size = size; in amdgpu_read_bios_from_vram()
120 memcpy_fromio(adev->bios, bios, size); in amdgpu_read_bios_from_vram()
124 kfree(adev->bios); in amdgpu_read_bios_from_vram()
136 adev->bios = NULL; in amdgpu_read_bios()
137 /* XXX: some cards may return 0 for rom size? ddx has a workaround */ in amdgpu_read_bios()
138 bios = pci_map_rom(adev->pdev, &size); in amdgpu_read_bios()
142 adev->bios = kzalloc(size, GFP_KERNEL); in amdgpu_read_bios()
143 if (adev->bios == NULL) { in amdgpu_read_bios()
144 pci_unmap_rom(adev->pdev, bios); in amdgpu_read_bios()
147 adev->bios_size = size; in amdgpu_read_bios()
148 memcpy_fromio(adev->bios, bios, size); in amdgpu_read_bios()
149 pci_unmap_rom(adev->pdev, bios); in amdgpu_read_bios()
152 kfree(adev->bios); in amdgpu_read_bios()
164 if (!adev->asic_funcs || !adev->asic_funcs->read_bios_from_rom) in amdgpu_read_bios_from_rom()
181 adev->bios = kmalloc(len, GFP_KERNEL); in amdgpu_read_bios_from_rom()
182 if (!adev->bios) { in amdgpu_read_bios_from_rom()
186 adev->bios_size = len; in amdgpu_read_bios_from_rom()
189 amdgpu_asic_read_bios_from_rom(adev, adev->bios, len); in amdgpu_read_bios_from_rom()
192 kfree(adev->bios); in amdgpu_read_bios_from_rom()
201 phys_addr_t rom = adev->pdev->rom; in amdgpu_read_platform_bios() local
202 size_t romlen = adev->pdev->romlen; in amdgpu_read_platform_bios()
205 adev->bios = NULL; in amdgpu_read_platform_bios()
207 if (!rom || romlen == 0) in amdgpu_read_platform_bios()
210 adev->bios = kzalloc(romlen, GFP_KERNEL); in amdgpu_read_platform_bios()
211 if (!adev->bios) in amdgpu_read_platform_bios()
214 bios = ioremap(rom, romlen); in amdgpu_read_platform_bios()
218 memcpy_fromio(adev->bios, bios, romlen); in amdgpu_read_platform_bios()
224 adev->bios_size = romlen; in amdgpu_read_platform_bios()
228 kfree(adev->bios); in amdgpu_read_platform_bios()
234 * dual-gpu systems.
236 /* retrieve the ROM in 4k blocks */
239 * amdgpu_atrm_call - fetch a chunk of the vbios
270 return -ENODEV; in amdgpu_atrm_call()
274 memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); in amdgpu_atrm_call()
275 len = obj->buffer.length; in amdgpu_atrm_call()
290 /* ATRM is for on-platform devices only */ in amdgpu_atrm_get_bios()
291 if (dev_is_removable(&adev->pdev->dev)) in amdgpu_atrm_get_bios()
295 if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) && in amdgpu_atrm_get_bios()
296 (pdev->class != PCI_CLASS_DISPLAY_OTHER << 8)) in amdgpu_atrm_get_bios()
299 dhandle = ACPI_HANDLE(&pdev->dev); in amdgpu_atrm_get_bios()
314 adev->bios = kmalloc(size, GFP_KERNEL); in amdgpu_atrm_get_bios()
315 if (!adev->bios) { in amdgpu_atrm_get_bios()
316 dev_err(adev->dev, "Unable to allocate bios\n"); in amdgpu_atrm_get_bios()
322 adev->bios, in amdgpu_atrm_get_bios()
330 kfree(adev->bios); in amdgpu_atrm_get_bios()
333 adev->bios_size = size; in amdgpu_atrm_get_bios()
345 return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ? in amdgpu_read_disabled_bios()
359 tbl_size = hdr->length; in amdgpu_acpi_vfct_bios()
361 dev_info(adev->dev, "ACPI VFCT table present but broken (too short #1),skipping\n"); in amdgpu_acpi_vfct_bios()
366 offset = vfct->VBIOSImageOffset; in amdgpu_acpi_vfct_bios()
370 VFCT_IMAGE_HEADER *vhdr = &vbios->VbiosHeader; in amdgpu_acpi_vfct_bios()
374 dev_info(adev->dev, "ACPI VFCT image header truncated,skipping\n"); in amdgpu_acpi_vfct_bios()
378 offset += vhdr->ImageLength; in amdgpu_acpi_vfct_bios()
380 dev_info(adev->dev, "ACPI VFCT image truncated,skipping\n"); in amdgpu_acpi_vfct_bios()
384 if (vhdr->ImageLength && in amdgpu_acpi_vfct_bios()
385 vhdr->PCIBus == adev->pdev->bus->number && in amdgpu_acpi_vfct_bios()
386 vhdr->PCIDevice == PCI_SLOT(adev->pdev->devfn) && in amdgpu_acpi_vfct_bios()
387 vhdr->PCIFunction == PCI_FUNC(adev->pdev->devfn) && in amdgpu_acpi_vfct_bios()
388 vhdr->VendorID == adev->pdev->vendor && in amdgpu_acpi_vfct_bios()
389 vhdr->DeviceID == adev->pdev->device) { in amdgpu_acpi_vfct_bios()
390 adev->bios = kmemdup(&vbios->VbiosContent, in amdgpu_acpi_vfct_bios()
391 vhdr->ImageLength, in amdgpu_acpi_vfct_bios()
394 if (!check_atom_bios(adev, vhdr->ImageLength)) { in amdgpu_acpi_vfct_bios()
395 kfree(adev->bios); in amdgpu_acpi_vfct_bios()
398 adev->bios_size = vhdr->ImageLength; in amdgpu_acpi_vfct_bios()
403 dev_info(adev->dev, "ACPI VFCT table present but broken (too short #2),skipping\n"); in amdgpu_acpi_vfct_bios()
416 dev_info(adev->dev, "Fetched VBIOS from VFCT\n"); in amdgpu_get_bios_apu()
421 dev_info(adev->dev, "Fetched VBIOS from VRAM BAR\n"); in amdgpu_get_bios_apu()
426 dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n"); in amdgpu_get_bios_apu()
431 dev_info(adev->dev, "Fetched VBIOS from platform\n"); in amdgpu_get_bios_apu()
435 dev_err(adev->dev, "Unable to locate a BIOS ROM\n"); in amdgpu_get_bios_apu()
444 struct resource *res = &adev->pdev->resource[PCI_ROM_RESOURCE]; in amdgpu_prefer_rom_resource()
446 return (res->flags & IORESOURCE_ROM_SHADOW); in amdgpu_prefer_rom_resource()
452 dev_info(adev->dev, "Fetched VBIOS from ATRM\n"); in amdgpu_get_bios_dgpu()
457 dev_info(adev->dev, "Fetched VBIOS from VFCT\n"); in amdgpu_get_bios_dgpu()
461 /* this is required for SR-IOV */ in amdgpu_get_bios_dgpu()
463 dev_info(adev->dev, "Fetched VBIOS from VRAM BAR\n"); in amdgpu_get_bios_dgpu()
469 dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n"); in amdgpu_get_bios_dgpu()
474 dev_info(adev->dev, "Fetched VBIOS from platform\n"); in amdgpu_get_bios_dgpu()
480 dev_info(adev->dev, "Fetched VBIOS from platform\n"); in amdgpu_get_bios_dgpu()
485 dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n"); in amdgpu_get_bios_dgpu()
491 dev_info(adev->dev, "Fetched VBIOS from ROM\n"); in amdgpu_get_bios_dgpu()
496 dev_info(adev->dev, "Fetched VBIOS from disabled ROM BAR\n"); in amdgpu_get_bios_dgpu()
500 dev_err(adev->dev, "Unable to locate a BIOS ROM\n"); in amdgpu_get_bios_dgpu()
511 if (adev->flags & AMD_IS_APU) in amdgpu_get_bios()
517 adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10; in amdgpu_get_bios()
522 /* helper function for soc15 and onwards to read bios from rom */
537 if (adev->flags & AMD_IS_APU) in amdgpu_soc15_read_bios_from_rom()
539 if (!adev->smuio.funcs || in amdgpu_soc15_read_bios_from_rom()
540 !adev->smuio.funcs->get_rom_index_offset || in amdgpu_soc15_read_bios_from_rom()
541 !adev->smuio.funcs->get_rom_data_offset) in amdgpu_soc15_read_bios_from_rom()
548 adev->smuio.funcs->get_rom_index_offset(adev); in amdgpu_soc15_read_bios_from_rom()
550 adev->smuio.funcs->get_rom_data_offset(adev); in amdgpu_soc15_read_bios_from_rom()
552 if (adev->nbio.funcs && in amdgpu_soc15_read_bios_from_rom()
553 adev->nbio.funcs->get_rom_offset) { in amdgpu_soc15_read_bios_from_rom()
554 rom_offset = adev->nbio.funcs->get_rom_offset(adev); in amdgpu_soc15_read_bios_from_rom()
560 /* set rom index to rom_offset */ in amdgpu_soc15_read_bios_from_rom()
562 /* read out the rom data */ in amdgpu_soc15_read_bios_from_rom()