/DragonOS/kernel/src/driver/base/device/ |
H A D | dd.rs | 302 fn do_driver_attach(&self, device: &Arc<dyn Device>, driver: &Arc<dyn Driver>) -> bool { in do_driver_attach() 303 let r = self.match_device(driver, device).unwrap_or(false); in do_driver_attach() 316 if self.probe_device(driver, device).is_err() { in do_driver_attach() 327 device: &Arc<dyn Device>, in match_device() 333 .match_device(device, driver); in match_device() 349 device: &Arc<dyn Device>, in probe_device() 351 let r = self.do_probe_device(driver, device); in probe_device() 359 device: &Arc<dyn Device>, in do_probe_device() 361 if device.is_dead() || (!device.is_registered()) { in do_probe_device() 364 if device.driver().is_some() { in do_probe_device() [all …]
|
H A D | mod.rs | 482 pub fn register(&self, device: Arc<dyn Device>) -> Result<(), SystemError> { in register() 483 self.device_default_initialize(&device); in register() 484 return self.add_device(device); in register() 497 pub fn add_device(&self, device: Arc<dyn Device>) -> Result<(), SystemError> { in add_device() 499 let deivce_parent = device.dev_parent().and_then(|x| x.upgrade()); in add_device() 503 device.name().to_string(), in add_device() 507 let kobject_parent = self.get_device_parent(&device, deivce_parent)?; in add_device() 518 device.set_parent(Some(Arc::downgrade(&kobject_parent))); in add_device() 521 KObjectManager::add_kobj(device.clone() as Arc<dyn KObject>, None).map_err(|e| { in add_device() 522 error!("add device '{:?}' failed: {:?}", device.name(), e); in add_device() [all …]
|
H A D | driver.rs | 7 device::{bus::BusNotifyEvent, dd::DeviceAttrCoredump, device_manager}, 69 fn add_device(&self, device: Arc<dyn Device>); in add_device() 72 fn delete_device(&self, device: &Arc<dyn Device>); in delete_device() 124 pub fn push_device(&mut self, device: Arc<dyn Device>) { in push_device() 125 if !self.devices.iter().any(|d| Arc::ptr_eq(d, &device)) { in push_device() 126 self.devices.push(device); in push_device() 130 pub fn delete_device(&mut self, device: &Arc<dyn Device>) { in delete_device() 131 self.devices.retain(|d| !Arc::ptr_eq(d, device)); in delete_device()
|
/DragonOS/kernel/src/driver/input/serio/ |
H A D | serio_device.rs | 4 use crate::driver::base::device::{bus::Bus, device_manager, Device}; 24 fn write(&self, device: &Arc<dyn SerioDevice>, data: u8) -> Result<(), SystemError>; in write() 26 fn open(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in open() 28 fn close(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in close() 30 fn start(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in start() 32 fn stop(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in stop() 51 pub fn register_port(&self, device: Arc<dyn SerioDevice>) -> Result<(), SystemError> { in register_port() 52 self.init_port(device) in register_port() 65 pub fn init_port(&self, device: Arc<dyn SerioDevice>) -> Result<(), SystemError> { in init_port() 66 device.set_bus(Some(Arc::downgrade(&(serio_bus() as Arc<dyn Bus>)))); in init_port() [all …]
|
H A D | serio_driver.rs | 4 use crate::driver::base::device::{ 17 fn write_wakeup(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in write_wakeup() 32 device: &Arc<dyn SerioDevice>, in interrupt() 37 fn connect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in connect() 39 fn reconnect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in reconnect() 41 fn fast_reconnect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in fast_reconnect() 43 fn disconnect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in disconnect() 45 fn cleanup(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in cleanup()
|
H A D | subsys.rs | 13 device::{bus::Bus, driver::Driver, Device}, 60 fn probe(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() 61 let drv = device.driver().ok_or(SystemError::EINVAL)?; in probe() 65 device.name() in probe() 70 let pdev = device.clone().cast::<dyn SerioDevice>().map_err(|_| { in probe() 73 device.name() in probe() 99 device: &Arc<dyn Device>, in match_device() 103 if let Ok(x) = acpi_manager().driver_match_device(driver, device) { in match_device() 111 let pdev = device in match_device() 121 return Ok(device.name().eq(&driver.name())); in match_device()
|
/DragonOS/kernel/src/driver/pci/ |
H A D | driver.rs | 4 use crate::driver::base::device::{ 9 use super::{dev_id::PciDeviceID, device::PciDevice, subsys::pci_bus}; 27 fn probe(&self, device: &Arc<dyn PciDevice>, id: &PciDeviceID) -> Result<(), SystemError>; in probe() 28 fn remove(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in remove() 29 fn shutdown(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in shutdown() 30 fn suspend(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in suspend() 31 fn resume(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in resume()
|
H A D | subsys.rs | 11 device::{ 24 device::{PciBusDevice, PciDevice}, 32 pub(super) fn set_pci_bus_device(device: Arc<PciBusDevice>) { in set_pci_bus_device() 34 PCI_BUS_DEVICE = Some(device); in set_pci_bus_device() 90 fn probe(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() 91 let drv = device.driver().ok_or(SystemError::EINVAL)?; in probe() 95 device.name() in probe() 99 let pci_dev = device.clone().cast::<dyn PciDevice>().map_err(|_| { in probe() 102 device.name() in probe() 129 device: &Arc<dyn Device>, in match_device() [all …]
|
/DragonOS/kernel/src/driver/base/platform/ |
H A D | platform_driver.rs | 3 use crate::driver::base::device::{ 25 fn probe(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in probe() 26 fn remove(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in remove() 27 fn shutdown(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in shutdown() 28 fn suspend(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in suspend() 29 fn resume(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in resume()
|
H A D | subsys.rs | 15 device::{bus::Bus, driver::Driver, Device}, 61 fn probe(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() 62 let drv = device.driver().ok_or(SystemError::EINVAL)?; in probe() 64 …tformBus::probe() failed: device.driver() is not a PlatformDriver. Device: '{:?}'", device.name()); in probe() 68 let pdev = device.clone().cast::<dyn PlatformDevice>().map_err(|_| { in probe() 71 device.name() in probe() 122 device: &Arc<dyn Device>, in match_device() 126 if let Ok(x) = acpi_manager().driver_match_device(driver, device) { in match_device() 134 let pdev = device in match_device() 144 return Ok(device.name().eq(&driver.name())); in match_device()
|
/DragonOS/kernel/src/driver/input/ps2_mouse/ |
H A D | ps_mouse_driver.rs | 14 device::{bus::Bus, driver::Driver, Device, DeviceId, IdTable}, 108 let device: Option<&Ps2MouseDevice> = guard.devices[0] in process_packet() localVariable 111 let _ = device.unwrap().process_packet(); in process_packet() 135 fn add_device(&self, device: Arc<dyn Device>) { in add_device() 138 if guard.devices.iter().any(|dev| Arc::ptr_eq(dev, &device)) { in add_device() 142 guard.devices.push(device); in add_device() 145 fn delete_device(&self, device: &Arc<dyn Device>) { in delete_device() 147 guard.devices.retain(|dev| !Arc::ptr_eq(dev, device)); in delete_device() 225 device: &Arc<dyn SerioDevice>, in interrupt() 229 let device = device in interrupt() localVariable [all …]
|
/DragonOS/kernel/src/driver/virtio/ |
H A D | mod.rs | 6 use super::base::device::{driver::Driver, Device, DeviceId}; 52 fn probe(&self, device: &Arc<dyn VirtIODevice>) -> Result<(), SystemError>; in probe() 69 pub device: u32, field 74 pub fn new(device: u32, vendor: u32) -> Self { in new() 75 Self { device, vendor } in new()
|
H A D | irq.rs | 7 driver::base::device::DeviceId, 47 pub fn register_device(&self, device: Arc<dyn VirtIODevice>) -> Result<(), SystemError> { in register_device() 50 if map.contains_key(device.dev_id()) { in register_device() 54 map.insert(device.dev_id().clone(), device); in register_device()
|
H A D | transport_pci.rs | 3 use crate::driver::base::device::DeviceId; 104 device: Arc<PciDeviceStructureGeneralDevice>, field 119 device: Arc<PciDeviceStructureGeneralDevice>, in new() 123 let header = &device.common_header; in new() 135 device.bar_ioremap().unwrap()?; in new() 136 device.enable_master(); in new() 137 let standard_device = device.as_standard_device().unwrap(); in new() 144 for capability in device.capabilities().unwrap() { in new() 190 &device.standard_device_bar.read(), in new() 202 get_bar_region_slice::<_>(&device.standard_device_bar.read(), ¬ify_cfg)?; in new() [all …]
|
H A D | virtio.rs | 4 use crate::driver::base::device::bus::Bus; 5 use crate::driver::base::device::{Device, DeviceId}; 92 for device in result { in virtio_device_search() 93 let standard_device = device.as_standard_device().unwrap(); in virtio_device_search()
|
H A D | sysfs.rs | 14 device::{ 80 fn probe(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() 81 let drv = device.driver().ok_or(SystemError::EINVAL)?; in probe() 85 device.name() in probe() 90 let virtio_dev = device.clone().cast::<dyn VirtIODevice>().map_err(|_| { in probe() 93 device.name() in probe() 140 if id.device != virtio_device.device_type_id() && id.vendor != VIRTIO_DEV_ANY_ID { in match_device()
|
/DragonOS/kernel/src/driver/input/serio/i8042/ |
H A D | i8042_driver.rs | 10 device::{bus::Bus, driver::Driver, Device, IdTable}, 67 fn probe(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError> { in probe() 68 let device = device in probe() localVariable 74 device.set_driver(Some(self.inner.lock().self_ref.clone())); in probe() 110 fn add_device(&self, device: Arc<dyn Device>) { in add_device() 113 if guard.devices.iter().any(|dev| Arc::ptr_eq(dev, &device)) { in add_device() 117 guard.devices.push(device); in add_device() 120 fn delete_device(&self, device: &Arc<dyn Device>) { in delete_device() 122 guard.devices.retain(|dev| !Arc::ptr_eq(dev, device)); in delete_device()
|
H A D | i8042_ports.rs | 11 device::{bus::Bus, driver::Driver, Device, DeviceCommonData, DeviceType, IdTable}, 189 fn start(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError> { in start() 190 i8042_start(device) in start() 193 fn stop(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError> { in stop() 194 i8042_stop(device) in stop()
|
/DragonOS/kernel/src/driver/pci/test/ |
H A D | pt_driver.rs | 10 device::{ 18 pci::{dev_id::PciDeviceID, device::PciDevice, driver::PciDriver}, 91 fn add_device(&self, device: Arc<dyn Device>) { in add_device() 94 if guard.devices.iter().any(|dev| Arc::ptr_eq(dev, &device)) { in add_device() 98 guard.devices.push(device); in add_device() 101 fn delete_device(&self, device: &Arc<dyn Device>) { in delete_device() 103 guard.devices.retain(|dev| !Arc::ptr_eq(dev, device)); in delete_device()
|
/DragonOS/kernel/src/driver/block/ |
H A D | virtio_blk.rs | 13 use virtio_drivers::device::blk::{VirtIOBlk, SECTOR_SIZE}; 24 device::{ 74 let device = VirtIOBlkDevice::new(transport, dev_id); in virtio_blk() localVariable 75 if let Some(device) = device { in virtio_blk() 77 device.set_dev_parent(Some(Arc::downgrade(&dev_parent))); in virtio_blk() 80 .device_add(device.clone() as Arc<dyn VirtIODevice>) in virtio_blk() 274 fn device(&self) -> Arc<dyn Device> { in device() method 283 let device = self.self_ref.upgrade().unwrap() as Arc<dyn BlockDevice>; in partitions() localVariable 284 let mbr_table = MbrDiskPartionTable::from_disk(device.clone()) in partitions() 286 mbr_table.partitions(Arc::downgrade(&device)) in partitions() [all …]
|
/DragonOS/kernel/src/driver/serial/serial8250/ |
H A D | serial8250_pio.rs | 16 base::device::{ 214 fn device(&self) -> Option<Arc<Serial8250ISADevices>> { in device() method 215 self.inner.read().device() in device() 218 fn set_device(&self, device: Option<&Arc<Serial8250ISADevices>>) { in set_device() 219 self.inner.write().set_device(device); in set_device() 297 device: Option<Weak<Serial8250ISADevices>>, field 302 Self { device: None } in new() 306 pub fn device(&self) -> Option<Arc<Serial8250ISADevices>> { in device() method 307 if let Some(device) = self.device.as_ref() { in device() 308 return device.upgrade(); in device() [all …]
|
/DragonOS/kernel/src/filesystem/devfs/ |
H A D | mod.rs | 13 driver::base::device::device_number::DeviceNumber, 124 device: Arc<T>, in register_device() 127 let metadata = device.metadata()?; in register_device() 145 dev_char_inode.add_dev(name, device.clone())?; in register_device() 149 dev_root_inode.add_dev(name, device.clone())?; in register_device() 153 dev_root_inode.add_dev(name, device.clone())?; in register_device() 155 device.set_fs(dev_char_inode.0.lock().fs.clone()); in register_device() 172 dev_block_inode.add_dev(name, device.clone())?; in register_device() 173 device.set_fs(dev_block_inode.0.lock().fs.clone()); in register_device() 177 .add_dev(name, device.clone()) in register_device() [all …]
|
/DragonOS/kernel/src/driver/rtc/ |
H A D | rtc_cmos.rs | 17 device::{ 71 fn probe(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError> { in probe() 72 let dev = device in probe() 132 fn add_device(&self, device: Arc<dyn Device>) { in add_device() 133 self.inner().driver_common.push_device(device); in add_device() 136 fn delete_device(&self, device: &Arc<dyn Device>) { in delete_device() 137 self.inner().driver_common.delete_device(device); in delete_device()
|
/DragonOS/kernel/src/driver/base/ |
H A D | subsys.rs | 20 device::{ 184 pub fn add_device_to_vec(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in add_device_to_vec() 186 if devices.iter().any(|d| Arc::ptr_eq(d, device)) { in add_device_to_vec() 189 devices.push(device.clone()); in add_device_to_vec() 194 pub fn remove_device_from_vec(&self, device: &Arc<dyn Device>) { in remove_device_from_vec() 196 let index = devices.iter().position(|d| Arc::ptr_eq(d, device)); in remove_device_from_vec() 211 fn remove_device(&self, device: &Arc<dyn Device>); in remove_device()
|
/DragonOS/kernel/src/driver/video/fbdev/ |
H A D | vesafb.rs | 16 device::{ 663 fn set_fb_device(&self, device: Option<Arc<FbDevice>>) { in set_fb_device() 664 self.inner.lock().fb_device = device; in set_fb_device() 737 fn probe(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError> { in probe() 738 let device = device in probe() localVariable 744 device.set_driver(Some(self.inner.lock_irqsave().self_ref.clone())); in probe() 777 fn add_device(&self, device: Arc<dyn Device>) { in add_device() 780 if guard.devices.iter().any(|dev| Arc::ptr_eq(dev, &device)) { in add_device() 784 guard.devices.push(device); in add_device() 787 fn delete_device(&self, device: &Arc<dyn Device>) { in delete_device() [all …]
|