mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:12:44 +00:00 
			
		
		
		
	Kernel: Move the Storage directory to be a new directory under Devices
The Storage subsystem, like the Audio and HID subsystems, exposes Unix device files (for example, in the /dev directory). To ensure consistency across the repository, we should make the Storage subsystem to reside in the Kernel/Devices directory like the two other mentioned subsystems.
This commit is contained in:
		
							parent
							
								
									f3a58f3a5a
								
							
						
					
					
						commit
						500b7b08d6
					
				
					 59 changed files with 133 additions and 133 deletions
				
			
		
							
								
								
									
										52
									
								
								Kernel/Devices/Storage/SD/SDMemoryCard.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Kernel/Devices/Storage/SD/SDMemoryCard.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,52 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2023, the SerenityOS developers. | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <Kernel/Devices/Storage/SD/Commands.h> | ||||
| #include <Kernel/Devices/Storage/SD/SDHostController.h> | ||||
| #include <Kernel/Devices/Storage/SD/SDMemoryCard.h> | ||||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| SDMemoryCard::SDMemoryCard(SDHostController& sdhc, StorageDevice::LUNAddress lun_address, u32 hardware_relative_controller_id, u32 block_len, u64 capacity_in_blocks, u32 relative_card_address, SD::OperatingConditionRegister ocr, SD::CardIdentificationRegister cid, SD::SDConfigurationRegister scr) | ||||
|     : StorageDevice(lun_address, hardware_relative_controller_id, block_len, | ||||
|         capacity_in_blocks) | ||||
|     , m_sdhc(sdhc) | ||||
|     , m_relative_card_address(relative_card_address) | ||||
|     , m_ocr(ocr) | ||||
|     , m_cid(cid) | ||||
|     , m_scr(scr) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void SDMemoryCard::start_request(AsyncBlockDeviceRequest& request) | ||||
| { | ||||
|     // FIXME: Make this asynchronous
 | ||||
|     MutexLocker locker(m_lock); | ||||
| 
 | ||||
|     VERIFY(request.block_size() == block_size()); | ||||
| 
 | ||||
|     auto buffer = request.buffer(); | ||||
|     u32 block_address = request.block_index(); | ||||
|     if (card_addressing_mode() == CardAddressingMode::ByteAddressing) { | ||||
|         block_address *= block_size(); | ||||
|     } | ||||
| 
 | ||||
|     if (request.request_type() == AsyncBlockDeviceRequest::RequestType::Write) { | ||||
|         if (m_sdhc.write_block({}, block_address, request.block_count(), buffer).is_error()) { | ||||
|             request.complete(AsyncDeviceRequest::Failure); | ||||
|             return; | ||||
|         } | ||||
|     } else { | ||||
|         if (m_sdhc.read_block({}, block_address, request.block_count(), buffer).is_error()) { | ||||
|             request.complete(AsyncDeviceRequest::Failure); | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     request.complete(AsyncDeviceRequest::Success); | ||||
| } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A