Rev 2997 | Rev 5078 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2997 | Rev 3764 | ||
---|---|---|---|
Line 1234... | Line 1234... | ||
1234 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
1234 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
Line 1235... | Line 1235... | ||
1235 | 1235 | ||
1236 | static void atom_index_iio(struct atom_context *ctx, int base) |
1236 | static void atom_index_iio(struct atom_context *ctx, int base) |
1237 | { |
1237 | { |
- | 1238 | ctx->iio = kzalloc(2 * 256, GFP_KERNEL); |
|
- | 1239 | if (!ctx->iio) |
|
1238 | ctx->iio = kzalloc(2 * 256, GFP_KERNEL); |
1240 | return; |
1239 | while (CU8(base) == ATOM_IIO_START) { |
1241 | while (CU8(base) == ATOM_IIO_START) { |
1240 | ctx->iio[CU8(base + 1)] = base + 2; |
1242 | ctx->iio[CU8(base + 1)] = base + 2; |
1241 | base += 2; |
1243 | base += 2; |
1242 | while (CU8(base) != ATOM_IIO_END) |
1244 | while (CU8(base) != ATOM_IIO_END) |
Line 1283... | Line 1285... | ||
1283 | } |
1285 | } |
Line 1284... | Line 1286... | ||
1284 | 1286 | ||
1285 | ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR); |
1287 | ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR); |
1286 | ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR); |
1288 | ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR); |
- | 1289 | atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4); |
|
- | 1290 | if (!ctx->iio) { |
|
- | 1291 | atom_destroy(ctx); |
|
- | 1292 | return NULL; |
|
Line 1287... | Line 1293... | ||
1287 | atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4); |
1293 | } |
1288 | 1294 | ||
1289 | str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); |
1295 | str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); |
1290 | while (*str && ((*str == '\n') || (*str == '\r'))) |
1296 | while (*str && ((*str == '\n') || (*str == '\r'))) |
Line 1331... | Line 1337... | ||
1331 | return ret; |
1337 | return ret; |
1332 | } |
1338 | } |
Line 1333... | Line 1339... | ||
1333 | 1339 | ||
1334 | void atom_destroy(struct atom_context *ctx) |
1340 | void atom_destroy(struct atom_context *ctx) |
1335 | { |
- | |
1336 | if (ctx->iio) |
1341 | { |
1337 | kfree(ctx->iio); |
1342 | kfree(ctx->iio); |
1338 | kfree(ctx); |
1343 | kfree(ctx); |
Line 1339... | Line 1344... | ||
1339 | } |
1344 | } |
Line 1385... | Line 1390... | ||
1385 | 1390 | ||
1386 | if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { |
1391 | if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { |
Line 1387... | Line 1392... | ||
1387 | firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); |
1392 | firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); |
1388 | 1393 | ||
1389 | DRM_DEBUG("atom firmware requested %08x %dkb\n", |
1394 | DRM_DEBUG("atom firmware requested %08x %dkb\n", |
Line 1390... | Line 1395... | ||
1390 | firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware, |
1395 | le32_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware), |
1391 | firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb); |
1396 | le16_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb)); |
1392 | 1397 | ||
1393 | usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024; |
1398 | usage_bytes = le16_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb) * 1024; |
1394 | } |
1399 | } |
1395 | ctx->scratch_size_bytes = 0; |
1400 | ctx->scratch_size_bytes = 0; |