21#include "pedigree/kernel/Log.h"
22#include "pedigree/kernel/machine/Disk.h"
23#include "pedigree/kernel/processor/types.h"
24#include "pedigree/kernel/utilities/String.h"
25#include "pedigree/kernel/utilities/utility.h"
31bool appleProbeDisk(
Disk* pDisk) {
38 WARNING(
"Disk read failure during Apple partition table search.");
43 MemoryCopy(&map, buffer.data(),
sizeof(map));
50 if (map.pmSig != BIG_TO_HOST16(APPLE_PM_SIG)) {
51 NOTICE(
"Apple partition map not found on disk " << diskName);
55 NOTICE(
"Apple partition map found on disk " << diskName);
58 size_t nEntries = BIG_TO_HOST32(map.pmMapBlkCnt);
59 for (
size_t i = 0; i < nEntries; i++) {
63 const uint64_t diskLocation = 512ULL + i * 512ULL;
64 buffer = pDisk->
read(diskLocation);
67 pDisk->
unpin(diskLocation);
69 WARNING(
"Disk read failure during partition table recognition.");
72 MemoryCopy(&map, buffer.data(),
sizeof(map));
73 pDisk->
unpin(diskLocation);
76 NOTICE(
"Detected partition '" << map.pmPartName <<
"', type '" << map.pmParType <<
"'");
80 String(map.pmParType),
static_cast<uint64_t
>(BIG_TO_HOST32(map.pmPyPartStart)) * 512ULL,
81 static_cast<uint64_t
>(BIG_TO_HOST32(map.pmPartBlkCnt)) * 512ULL);
void addChild(Device *pDevice)
void setParent(Device *p)
virtual BufferView read(uint64_t location)
virtual void getName(String &str)
virtual void unpin(uint64_t location)=0