diff --git a/sys/yellowstone/hw/gpt.cpp b/sys/yellowstone/hw/gpt.cpp index 5bf4845..06e10d9 100644 --- a/sys/yellowstone/hw/gpt.cpp +++ b/sys/yellowstone/hw/gpt.cpp @@ -7,6 +7,8 @@ #include #include +#define GPT_DEBUG 0 + const uint64_t kSectorSize = 512; const uint64_t kGptPartitionSignature = 0x54524150'20494645; @@ -79,23 +81,26 @@ glcr::ErrorCode GptReader::ParsePartitionTables() { dbgln("Incorrect OS type: {x}", first_partition->os_type); return glcr::FAILED_PRECONDITION; } +#if GPT_DEBUG dbgln("LBAs: ({x}, {x})", first_partition->starting_lba, first_partition->ending_lba); +#endif // FIXME: Don't hardcode sector size. ParititionHeader* header = reinterpret_cast(lba_1_and_2.vaddr() + 512); - dbgln("signature {}", header->signature); - uint64_t num_partitions = header->num_partitions; uint64_t entry_size = header->parition_entry_size; uint64_t num_blocks = (num_partitions * entry_size) / 512; +#if GPT_DEBUG + dbgln("signature {}", header->signature); dbgln("lba_partition_entries {x}", header->lba_partition_entries); dbgln("num_partitions: {x}", num_partitions); dbgln("partition_entry_size: {x}", entry_size); dbgln("Num blocks: {x}", num_blocks); +#endif req.set_device_id(0); req.set_lba(header->lba_partition_entries); @@ -103,16 +108,17 @@ glcr::ErrorCode GptReader::ParsePartitionTables() { RET_ERR(denali_->Read(req, resp)); MappedMemoryRegion part_table = MappedMemoryRegion::FromCapability(resp.memory()); - dbgln("Entries"); for (uint64_t i = 0; i < num_partitions; i++) { PartitionEntry* entry = reinterpret_cast( part_table.vaddr() + (i * entry_size)); if (entry->type_guid_low != 0 || entry->type_guid_high != 0) { +#if GPT_DEBUG dbgln("Entry {}", i); dbgln("T Guid: {x}-{x}", entry->type_guid_high, entry->type_guid_low); dbgln("P Guid: {x}-{x}", entry->part_guid_high, entry->part_guid_low); dbgln("LBA: {x}, {x}", entry->lba_start, entry->lba_end); dbgln("Attrs: {x}", entry->attributes); +#endif // For now we hardcode these values to the type that is // created in our setup script. // FIXME: Set up our own root partition type guid at some diff --git a/sys/yellowstone/hw/pcie.cpp b/sys/yellowstone/hw/pcie.cpp index e5aaa14..2ab13ec 100644 --- a/sys/yellowstone/hw/pcie.cpp +++ b/sys/yellowstone/hw/pcie.cpp @@ -4,6 +4,8 @@ #include #include +#define PCI_DEBUG 0 + namespace { PciDeviceHeader* PciHeader(uint64_t base, uint64_t bus, uint64_t dev, @@ -15,14 +17,10 @@ PciDeviceHeader* PciHeader(uint64_t base, uint64_t bus, uint64_t dev, } // namespace PciReader::PciReader() { - dbgln("Creating addr space"); uint64_t vaddr; check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootPciVmmoCap, &vaddr)); - dbgln("Addr {x}", vaddr); - dbgln("Dumping PCI"); PciDump(vaddr); - dbgln("Done"); header_ = PciHeader(vaddr, 0, 0, 0); } @@ -40,17 +38,21 @@ void PciReader::FunctionDump(uint64_t base, uint64_t bus, uint64_t dev, if (hdr->vendor_id == 0xFFFF) { return; } +#if PCI_DEBUG dbgln( "[{}.{}.{}] (Vendor, Device): ({x}, {x}), (Type, Class, Sub, PIF): ({}, " "{x}, {x}, {x})", bus, dev, fun, hdr->vendor_id, hdr->device_id, hdr->header_type, hdr->class_code, hdr->subclass, hdr->prog_interface); +#endif if ((hdr->class_code == 0x6) && (hdr->subclass == 0x4)) { dbgln("FIXME: Handle PCI to PCI bridge."); } if (hdr->class_code == 0x1) { +#if PCI_DEBUG dbgln("SATA Device at: {x}", reinterpret_cast(hdr) - base); +#endif achi_device_offset_ = reinterpret_cast(hdr) - base; } } diff --git a/sys/yellowstone/yellowstone_server.cpp b/sys/yellowstone/yellowstone_server.cpp index b343192..5ae938e 100644 --- a/sys/yellowstone/yellowstone_server.cpp +++ b/sys/yellowstone/yellowstone_server.cpp @@ -54,7 +54,6 @@ glcr::ErrorCode YellowstoneServer::HandleGetAhciInfo(const Empty&, AhciInfo& info) { info.set_ahci_region(pci_reader_.GetAhciVmmo()); info.set_region_length(kPcieConfigurationSize); - dbgln("Resp ahci"); return glcr::OK; } @@ -88,13 +87,12 @@ glcr::ErrorCode YellowstoneServer::HandleGetDenali(const Empty&, info.set_denali_endpoint(new_denali); info.set_device_id(device_id_); info.set_lba_offset(lba_offset_); - dbgln("Resp denali"); return glcr::OK; } glcr::ErrorCode YellowstoneServer::HandleRegisterEndpoint( const RegisterEndpointRequest& req, Empty&) { - dbgln("Registering."); + dbgln("Registering {}.", req.endpoint_name()); if (req.endpoint_name() == "denali") { // FIXME: Rather than blocking and calling the denali service // immediately we should signal the main thread that it can continue init.