[Yellowstone] Disable most log messages in yellowstone.

This commit is contained in:
Drew Galbraith 2023-11-15 16:26:08 -08:00
parent c080c61398
commit 1ccbf5e12e
3 changed files with 16 additions and 10 deletions

View File

@ -7,6 +7,8 @@
#include <zcall.h> #include <zcall.h>
#include <zglobal.h> #include <zglobal.h>
#define GPT_DEBUG 0
const uint64_t kSectorSize = 512; const uint64_t kSectorSize = 512;
const uint64_t kGptPartitionSignature = 0x54524150'20494645; const uint64_t kGptPartitionSignature = 0x54524150'20494645;
@ -79,23 +81,26 @@ glcr::ErrorCode GptReader::ParsePartitionTables() {
dbgln("Incorrect OS type: {x}", first_partition->os_type); dbgln("Incorrect OS type: {x}", first_partition->os_type);
return glcr::FAILED_PRECONDITION; return glcr::FAILED_PRECONDITION;
} }
#if GPT_DEBUG
dbgln("LBAs: ({x}, {x})", first_partition->starting_lba, dbgln("LBAs: ({x}, {x})", first_partition->starting_lba,
first_partition->ending_lba); first_partition->ending_lba);
#endif
// FIXME: Don't hardcode sector size. // FIXME: Don't hardcode sector size.
ParititionHeader* header = ParititionHeader* header =
reinterpret_cast<ParititionHeader*>(lba_1_and_2.vaddr() + 512); reinterpret_cast<ParititionHeader*>(lba_1_and_2.vaddr() + 512);
dbgln("signature {}", header->signature);
uint64_t num_partitions = header->num_partitions; uint64_t num_partitions = header->num_partitions;
uint64_t entry_size = header->parition_entry_size; uint64_t entry_size = header->parition_entry_size;
uint64_t num_blocks = (num_partitions * entry_size) / 512; 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("lba_partition_entries {x}", header->lba_partition_entries);
dbgln("num_partitions: {x}", num_partitions); dbgln("num_partitions: {x}", num_partitions);
dbgln("partition_entry_size: {x}", entry_size); dbgln("partition_entry_size: {x}", entry_size);
dbgln("Num blocks: {x}", num_blocks); dbgln("Num blocks: {x}", num_blocks);
#endif
req.set_device_id(0); req.set_device_id(0);
req.set_lba(header->lba_partition_entries); req.set_lba(header->lba_partition_entries);
@ -103,16 +108,17 @@ glcr::ErrorCode GptReader::ParsePartitionTables() {
RET_ERR(denali_->Read(req, resp)); RET_ERR(denali_->Read(req, resp));
MappedMemoryRegion part_table = MappedMemoryRegion part_table =
MappedMemoryRegion::FromCapability(resp.memory()); MappedMemoryRegion::FromCapability(resp.memory());
dbgln("Entries");
for (uint64_t i = 0; i < num_partitions; i++) { for (uint64_t i = 0; i < num_partitions; i++) {
PartitionEntry* entry = reinterpret_cast<PartitionEntry*>( PartitionEntry* entry = reinterpret_cast<PartitionEntry*>(
part_table.vaddr() + (i * entry_size)); part_table.vaddr() + (i * entry_size));
if (entry->type_guid_low != 0 || entry->type_guid_high != 0) { if (entry->type_guid_low != 0 || entry->type_guid_high != 0) {
#if GPT_DEBUG
dbgln("Entry {}", i); dbgln("Entry {}", i);
dbgln("T Guid: {x}-{x}", entry->type_guid_high, entry->type_guid_low); 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("P Guid: {x}-{x}", entry->part_guid_high, entry->part_guid_low);
dbgln("LBA: {x}, {x}", entry->lba_start, entry->lba_end); dbgln("LBA: {x}, {x}", entry->lba_start, entry->lba_end);
dbgln("Attrs: {x}", entry->attributes); dbgln("Attrs: {x}", entry->attributes);
#endif
// For now we hardcode these values to the type that is // For now we hardcode these values to the type that is
// created in our setup script. // created in our setup script.
// FIXME: Set up our own root partition type guid at some // FIXME: Set up our own root partition type guid at some

View File

@ -4,6 +4,8 @@
#include <mammoth/init.h> #include <mammoth/init.h>
#include <zcall.h> #include <zcall.h>
#define PCI_DEBUG 0
namespace { namespace {
PciDeviceHeader* PciHeader(uint64_t base, uint64_t bus, uint64_t dev, 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 } // namespace
PciReader::PciReader() { PciReader::PciReader() {
dbgln("Creating addr space");
uint64_t vaddr; uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootPciVmmoCap, &vaddr)); check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootPciVmmoCap, &vaddr));
dbgln("Addr {x}", vaddr);
dbgln("Dumping PCI");
PciDump(vaddr); PciDump(vaddr);
dbgln("Done");
header_ = PciHeader(vaddr, 0, 0, 0); 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) { if (hdr->vendor_id == 0xFFFF) {
return; return;
} }
#if PCI_DEBUG
dbgln( dbgln(
"[{}.{}.{}] (Vendor, Device): ({x}, {x}), (Type, Class, Sub, PIF): ({}, " "[{}.{}.{}] (Vendor, Device): ({x}, {x}), (Type, Class, Sub, PIF): ({}, "
"{x}, {x}, {x})", "{x}, {x}, {x})",
bus, dev, fun, hdr->vendor_id, hdr->device_id, hdr->header_type, bus, dev, fun, hdr->vendor_id, hdr->device_id, hdr->header_type,
hdr->class_code, hdr->subclass, hdr->prog_interface); hdr->class_code, hdr->subclass, hdr->prog_interface);
#endif
if ((hdr->class_code == 0x6) && (hdr->subclass == 0x4)) { if ((hdr->class_code == 0x6) && (hdr->subclass == 0x4)) {
dbgln("FIXME: Handle PCI to PCI bridge."); dbgln("FIXME: Handle PCI to PCI bridge.");
} }
if (hdr->class_code == 0x1) { if (hdr->class_code == 0x1) {
#if PCI_DEBUG
dbgln("SATA Device at: {x}", reinterpret_cast<uint64_t>(hdr) - base); dbgln("SATA Device at: {x}", reinterpret_cast<uint64_t>(hdr) - base);
#endif
achi_device_offset_ = reinterpret_cast<uint64_t>(hdr) - base; achi_device_offset_ = reinterpret_cast<uint64_t>(hdr) - base;
} }
} }

View File

@ -54,7 +54,6 @@ glcr::ErrorCode YellowstoneServer::HandleGetAhciInfo(const Empty&,
AhciInfo& info) { AhciInfo& info) {
info.set_ahci_region(pci_reader_.GetAhciVmmo()); info.set_ahci_region(pci_reader_.GetAhciVmmo());
info.set_region_length(kPcieConfigurationSize); info.set_region_length(kPcieConfigurationSize);
dbgln("Resp ahci");
return glcr::OK; return glcr::OK;
} }
@ -88,13 +87,12 @@ glcr::ErrorCode YellowstoneServer::HandleGetDenali(const Empty&,
info.set_denali_endpoint(new_denali); info.set_denali_endpoint(new_denali);
info.set_device_id(device_id_); info.set_device_id(device_id_);
info.set_lba_offset(lba_offset_); info.set_lba_offset(lba_offset_);
dbgln("Resp denali");
return glcr::OK; return glcr::OK;
} }
glcr::ErrorCode YellowstoneServer::HandleRegisterEndpoint( glcr::ErrorCode YellowstoneServer::HandleRegisterEndpoint(
const RegisterEndpointRequest& req, Empty&) { const RegisterEndpointRequest& req, Empty&) {
dbgln("Registering."); dbgln("Registering {}.", req.endpoint_name());
if (req.endpoint_name() == "denali") { if (req.endpoint_name() == "denali") {
// FIXME: Rather than blocking and calling the denali service // FIXME: Rather than blocking and calling the denali service
// immediately we should signal the main thread that it can continue init. // immediately we should signal the main thread that it can continue init.