Kernel: Don't crash if header type != 0 in bar region creation
Also remove spammy debug printing
This commit is contained in:
		
							parent
							
								
									45a6783c3d
								
							
						
					
					
						commit
						c7b6fc950a
					
				| 
						 | 
					@ -190,7 +190,11 @@ namespace Kernel::PCI
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BAN::ErrorOr<BAN::UniqPtr<BarRegion>> BarRegion::create(PCI::Device& device, uint8_t bar_num)
 | 
						BAN::ErrorOr<BAN::UniqPtr<BarRegion>> BarRegion::create(PCI::Device& device, uint8_t bar_num)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ASSERT(device.header_type() == 0x00);
 | 
							if (device.header_type() != 0x00)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								dprintln("BAR regions for non general devices are not supported");
 | 
				
			||||||
 | 
								return BAN::Error::from_errno(ENOTSUP);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// disable io/mem space while reading bar
 | 
							// disable io/mem space while reading bar
 | 
				
			||||||
		uint16_t command = device.read_word(PCI_REG_COMMAND);
 | 
							uint16_t command = device.read_word(PCI_REG_COMMAND);
 | 
				
			||||||
| 
						 | 
					@ -390,11 +394,9 @@ namespace Kernel::PCI
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				case 0x05:
 | 
									case 0x05:
 | 
				
			||||||
					m_offset_msi = capability_offset;
 | 
										m_offset_msi = capability_offset;
 | 
				
			||||||
					dprintln("{}:{}.{} has MSI", m_bus, m_dev, m_func);
 | 
					 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case 0x11:
 | 
									case 0x11:
 | 
				
			||||||
					m_offset_msi_x = capability_offset;
 | 
										m_offset_msi_x = capability_offset;
 | 
				
			||||||
					dprintln("{}:{}.{} has MSI-X", m_bus, m_dev, m_func);
 | 
					 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				default:
 | 
									default:
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue