MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / ide_identity_buffer

Function ide_identity_buffer

src/ide.cpp:475–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473}
474
475static void ide_identity_buffer(struct ide_hdf *ide)
476{
477 TCHAR tmp[100];
478 bool atapi = ide->atapi;
479 int device_type = ide->atapi_device_type;
480 bool cf = ide->media_type > 0;
481 bool real = false;
482 int v;
483
484 memset(ide->secbuf, 0, 512);
485 if (!device_type)
486 device_type = 5; // CD
487
488 if (ata_get_identity(ide->hdhfd.hfd.geometry, ide->secbuf, true)) {
489
490 if (ini_getval(ide->hdhfd.hfd.geometry, _T("IDENTITY"), _T("atapi"), &v)) {
491 ide->atapi = v != 0;
492 if (ide->atapi) {
493 ide->atapi_device_type = 0;
494 ini_getval(ide->hdhfd.hfd.geometry, _T("IDENTITY"), _T("atapi_type"), &ide->atapi_device_type);
495 if (!ide->atapi_device_type)
496 ide->atapi_device_type = 5;
497 }
498 }
499 if (!ide->byteswap) {
500 ata_byteswapidentity(ide->secbuf);
501 }
502
503 } else if (ide->hdhfd.hfd.ci.loadidentity && (ide->hdhfd.hfd.identity[0] || ide->hdhfd.hfd.identity[1])) {
504
505 memcpy(ide->secbuf, ide->hdhfd.hfd.identity, 512);
506 if (!ide->byteswap) {
507 ata_byteswapidentity(ide->secbuf);
508 }
509 real = true;
510
511 } else {
512
513 pw(ide, 0, atapi ? 0x80c0 | (device_type << 8) : (cf ? 0x848a : (1 << 6)));
514 pw(ide, 1, ide->hdhfd.cyls_def);
515 pw(ide, 2, 0xc837);
516 pw(ide, 3, ide->hdhfd.heads_def);
517 pw(ide, 4, ide->blocksize * ide->hdhfd.secspertrack_def);
518 pw(ide, 5, ide->blocksize);
519 pw(ide, 6, ide->hdhfd.secspertrack_def);
520 ps(ide, 10, _T("68000"), 20); /* serial */
521 pw(ide, 20, 3);
522 pw(ide, 21, ide->blocksize);
523 pw(ide, 22, 4);
524 ps(ide, 23, _T("0.7"), 8); /* firmware revision */
525 if (ide->atapi)
526 _tcscpy (tmp, _T("UAE-ATAPI"));
527 else
528 _sntprintf (tmp, sizeof tmp, _T("UAE-IDE %s"), ide->hdhfd.hfd.product_id);
529 ps(ide, 27, tmp, 40); /* model */
530 pw(ide, 47, ide->max_multiple_mode ? (0x8000 | (ide->max_multiple_mode >> (ide->blocksize / 512 - 1))) : 0); /* max sectors in multiple mode */
531 pw(ide, 48, 1);
532 pw(ide, 49, (ide->lba ? (1 << 9) : 0) | (1 << 8)); /* LBA and DMA supported */

Callers 2

ide_identify_driveFunction · 0.85
add_ide_unitFunction · 0.85

Calls 9

ata_get_identityFunction · 0.85
ini_getvalFunction · 0.85
ata_byteswapidentityFunction · 0.85
psFunction · 0.85
pqFunction · 0.85
pworFunction · 0.85
pwandFunction · 0.85
pwFunction · 0.70
plFunction · 0.70

Tested by

no test coverage detected