MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Port

Class Port

Kernel/include/ahci.h:349–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347 };
348
349 class Port : public DiskDevice{
350 public:
351 Port(int num, hba_port_t* portStructure, hba_mem_t* hbaMem);
352
353 int ReadDiskBlock(uint64_t lba, uint32_t count, void* buffer);
354 int WriteDiskBlock(uint64_t lba, uint32_t count, void* buffer);
355
356 int blocksize = 512;
357 AHCIStatus status = AHCIStatus::Uninitialized;
358 private:
359 unsigned AcquireBuffer();
360 void ReleaseBuffer(unsigned index);
361
362 int FindCmdSlot();
363 int Access(uint64_t lba, uint32_t count, uintptr_t physBuffer, int write);
364 void Identify();
365
366 hba_port_t* registers;
367
368 hba_cmd_header_t* commandList; // Address Mapping of the Command List
369 hba_fis_t* fis; // Address Mapping of the FIS
370
371 hba_cmd_tbl_t* commandTables[8];
372
373 uint64_t physBuffers[8];
374 void* buffers[8];
375 lock_t bufferLocks[8];
376
377 Semaphore bufferSemaphore = Semaphore(8);
378 //Semaphore portLock = Semaphore(1); // Binary semaphore for the AHCI port
379 lock_t portLock = 0;
380 };
381
382 int Init();
383

Callers

nothing calls this directly

Calls 1

SemaphoreClass · 0.85

Tested by

no test coverage detected