Rev 1221 | Rev 1268 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1221 | Rev 1233 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | #include "atom.h" |
31 | #include "atom.h" |
Line 32... | Line 32... | ||
32 | 32 | ||
33 | /* |
33 | /* |
34 | * BIOS. |
34 | * BIOS. |
- | 35 | */ |
|
- | 36 | ||
- | 37 | /* If you boot an IGP board with a discrete card as the primary, |
|
- | 38 | * the IGP rom is not accessible via the rom bar as the IGP rom is |
|
- | 39 | * part of the system bios. On boot, the system bios puts a |
|
- | 40 | * copy of the igp rom at the start of vram if a discrete card is |
|
- | 41 | * present. |
|
- | 42 | */ |
|
- | 43 | static bool igp_read_bios_from_vram(struct radeon_device *rdev) |
|
- | 44 | { |
|
- | 45 | uint8_t __iomem *bios; |
|
- | 46 | resource_size_t vram_base; |
|
- | 47 | resource_size_t size = 256 * 1024; /* ??? */ |
|
- | 48 | ||
- | 49 | rdev->bios = NULL; |
|
- | 50 | vram_base = drm_get_resource_start(rdev->ddev, 0); |
|
- | 51 | bios = ioremap(vram_base, size); |
|
- | 52 | if (!bios) { |
|
- | 53 | DRM_ERROR("Unable to mmap vram\n"); |
|
- | 54 | return false; |
|
- | 55 | } |
|
- | 56 | ||
- | 57 | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { |
|
- | 58 | iounmap(bios); |
|
- | 59 | DRM_ERROR("bad rom signature\n"); |
|
- | 60 | return false; |
|
- | 61 | } |
|
- | 62 | rdev->bios = kmalloc(size, GFP_KERNEL); |
|
- | 63 | if (rdev->bios == NULL) { |
|
- | 64 | iounmap(bios); |
|
- | 65 | DRM_ERROR("kmalloc failed\n"); |
|
- | 66 | return false; |
|
- | 67 | } |
|
- | 68 | memcpy(rdev->bios, bios, size); |
|
- | 69 | iounmap(bios); |
|
- | 70 | return true; |
|
- | 71 | } |
|
35 | */ |
72 | |
36 | static bool radeon_read_bios(struct radeon_device *rdev) |
73 | static bool radeon_read_bios(struct radeon_device *rdev) |
37 | { |
74 | { |
38 | uint8_t __iomem *bios; |
75 | uint8_t __iomem *bios; |
Line 340... | Line 377... | ||
340 | return r; |
377 | return r; |
341 | } |
378 | } |
Line 342... | Line 379... | ||
342 | 379 | ||
343 | static bool radeon_read_disabled_bios(struct radeon_device *rdev) |
380 | static bool radeon_read_disabled_bios(struct radeon_device *rdev) |
- | 381 | { |
|
- | 382 | if (rdev->flags & RADEON_IS_IGP) |
|
344 | { |
383 | return igp_read_bios_from_vram(rdev); |
345 | if (rdev->family >= CHIP_RV770) |
384 | else if (rdev->family >= CHIP_RV770) |
346 | return r700_read_disabled_bios(rdev); |
385 | return r700_read_disabled_bios(rdev); |
347 | else if (rdev->family >= CHIP_R600) |
386 | else if (rdev->family >= CHIP_R600) |
348 | return r600_read_disabled_bios(rdev); |
387 | return r600_read_disabled_bios(rdev); |
349 | else if (rdev->family >= CHIP_RS600) |
388 | else if (rdev->family >= CHIP_RS600) |
Line 355... | Line 394... | ||
355 | bool radeon_get_bios(struct radeon_device *rdev) |
394 | bool radeon_get_bios(struct radeon_device *rdev) |
356 | { |
395 | { |
357 | bool r; |
396 | bool r; |
358 | uint16_t tmp; |
397 | uint16_t tmp; |
Line -... | Line 398... | ||
- | 398 | ||
- | 399 | if (rdev->flags & RADEON_IS_IGP) { |
|
- | 400 | r = igp_read_bios_from_vram(rdev); |
|
- | 401 | if (r == false) |
|
- | 402 | r = radeon_read_bios(rdev); |
|
359 | 403 | } else |
|
360 | r = radeon_read_bios(rdev); |
404 | r = radeon_read_bios(rdev); |
361 | if (r == false) { |
405 | if (r == false) { |
362 | r = radeon_read_disabled_bios(rdev); |
406 | r = radeon_read_disabled_bios(rdev); |
363 | } |
407 | } |