RadeonHD: Fix incorrect name -> chipset mapping

* Put names and chipsets next to each other to
  help prevent further mismatch.
* Fix potential (but unlikely) string overflow
* CID 611140
This commit is contained in:
Alexander von Gluck IV 2013-07-16 11:20:24 -05:00
parent 1207554139
commit 42eed3ba69
2 changed files with 62 additions and 55 deletions

View File

@ -41,6 +41,8 @@
#define DEVICE_NAME "radeon_hd"
#define RADEON_ACCELERANT_NAME "radeon_hd.accelerant"
#define MAX_NAME_LENGTH 32
// Used to collect EDID from boot loader
#define EDID_BOOT_INFO "vesa_edid/v1"
#define MODES_BOOT_INFO "vesa_modes/v1"
@ -52,6 +54,7 @@
// Radeon Chipsets
// !! Must match chipset names below
enum radeon_chipset {
RADEON_R420 = 0, //r400, Radeon X700-X850
RADEON_R423,
@ -97,12 +100,64 @@ enum radeon_chipset {
RADEON_TAHITI, // DCE 6.0
RADEON_ARUBA, // DCE 6.1 Trinity/Richland
RADEON_OLAND, // DCE 6.4
RADEON_HAINAN, // NO DCE
RADEON_HAINAN, // NO DCE, only compute
RADEON_KAVERI, //Sea Islands, DCE 8.1
RADEON_BONAIRE, // DCE 8.2
RADEON_KABINI, // DCE 8.3
};
// !! Must match chipset families above
static const char radeon_chip_name[][MAX_NAME_LENGTH] = {
"R420",
"R423",
"RV410",
"RS400",
"RS480",
"RS600",
"RS690",
"RS740",
"RV515",
"R520",
"RV530",
"RV560",
"RV570",
"R580",
"R600",
"RV610",
"RV630",
"RV670",
"RV620",
"RV635",
"RS780",
"RS880",
"RV770",
"RV730",
"RV710",
"RV740",
"Cedar",
"Redwood",
"Juniper",
"Cypress",
"Hemlock",
"Palm",
"Sumo",
"Sumo2",
"Caicos",
"Turks",
"Barts",
"Cayman",
"Antilles",
"Cape Verde",
"Pitcairn",
"Tahiti",
"Aruba",
"Oland",
"Hainan",
"Kaveri",
"Bonaire",
"Kabini"
};
struct ring_buffer {
struct lock lock;
@ -170,9 +225,9 @@ struct radeon_shared_info {
uint16 cursor_hot_x;
uint16 cursor_hot_y;
char deviceName[32];
char deviceName[MAX_NAME_LENGTH];
uint16 chipsetID;
char chipsetName[16];
char chipsetName[MAX_NAME_LENGTH];
uint32 chipsetFlags;
uint8 dceMajor;
uint8 dceMinor;

View File

@ -38,55 +38,6 @@
#define ERROR(x...) dprintf("radeon_hd: " x)
// Must match chipset families in radeon_hd.h
static const char radeon_chip_name[][16] = {
"R420",
"R423",
"RV410",
"RS400",
"RS480",
"RS600",
"RS690",
"RS740",
"RV515",
"R520",
"RV530",
"RV560",
"RV570",
"R580",
"R600",
"RV610",
"RV630",
"RV670",
"RV620",
"RV635",
"RS780",
"RS880",
"RV770",
"RV730",
"RV710",
"RV740",
"Cedar",
"Redwood",
"Juniper",
"Cypress",
"Hemlock",
"Palm",
"Sumo",
"Sumo2",
"Caicos",
"Turks",
"Barts",
"Cayman",
"Antilles",
"Lombok",
"Cape Verde",
"Pitcairn",
"Tahiti",
"New Zealand"
};
// #pragma mark -
@ -693,9 +644,10 @@ radeon_hd_init(radeon_info &info)
info.shared_info->dceMajor = info.dceMajor;
info.shared_info->dceMinor = info.dceMinor;
info.shared_info->registers_area = info.registers_area;
strcpy(info.shared_info->deviceName, info.deviceName);
strcpy(info.shared_info->chipsetName,
radeon_chip_name[info.chipsetID]);
strncpy(info.shared_info->deviceName,
info.deviceName, MAX_NAME_LENGTH);
strncpy(info.shared_info->chipsetName,
radeon_chip_name[info.chipsetID], MAX_NAME_LENGTH);
// *** AtomBIOS mapping
// First we try an active bios read