forked from Bananymous/banan-os
				
			
			update main #1
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -73,6 +73,14 @@ namespace Kernel
 | 
			
		|||
		select_delay();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static bool identify_all_ones(BAN::Span<const uint16_t> identify_data)
 | 
			
		||||
	{
 | 
			
		||||
		for (size_t i = 0; i < 256; i++)
 | 
			
		||||
			if (identify_data[i] != 0xFFFF)
 | 
			
		||||
				return false;
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	BAN::ErrorOr<ATABus::DeviceType> ATABus::identify(bool secondary, BAN::Span<uint16_t> buffer)
 | 
			
		||||
	{
 | 
			
		||||
		select_device(secondary);
 | 
			
		||||
| 
						 | 
				
			
			@ -117,6 +125,9 @@ namespace Kernel
 | 
			
		|||
		ASSERT(buffer.size() >= 256);
 | 
			
		||||
		read_buffer(ATA_PORT_DATA, buffer.data(), 256);
 | 
			
		||||
 | 
			
		||||
		if (identify_all_ones(buffer))
 | 
			
		||||
			return BAN::Error::from_errno(ENODEV);
 | 
			
		||||
 | 
			
		||||
		return type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,7 +71,7 @@ namespace Kernel
 | 
			
		|||
		while (model_len > 0 && m_model[model_len - 1] == ' ')
 | 
			
		||||
			model_len--;
 | 
			
		||||
 | 
			
		||||
		dprintln("Initialized disk '{}' {} MB", BAN::StringView(m_model, model_len), total_size() / 1024 / 1024);
 | 
			
		||||
		dprintln("Initialized disk '{}' {} MiB", BAN::StringView(m_model, model_len), total_size() / 1024 / 1024);
 | 
			
		||||
 | 
			
		||||
		add_disk_cache();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue