Haiku does not have the required drivers for RAID support( vmd controller for intel processors ).
So I am looking into adding basic support for that. I would have to port the driver from freebsd.
I don’t have experience with the Haiku kernel, Is porting the driver enough or is there a missing functionality I need to add before porting the driver?
Where can I learn more about the Haiku kernel API( I am reading the docs in the source code for now) ?
Let’s look at this one closely, you can start reading at the end of the file where there are two structures with pointers to “hook functions” that implement the driver. There is one structure for the driver, that is tasked with detecting if there is any supported device on the system and attaching to it. Then there are the device hooks, which are related to operations on the device itself (reading and writing blocks as well as handling of the ioctl function).
The IO goes through the IO scheduler, which means eventually all of it ends up in the do_io function. You can probably find a way to rewire FreeBSD code there in some way.
Notice that the domains of the disks are different( 10000 here ) whereas in NVMe mode( no vmd ), the domain for all devices is 0000. I am not sure what this means but stackoverflow suggests the vmd controller could be acting like a host bridge or a root complex. more likely a root complex. I will check how the FreeBSD implementation does this soon.
Correct me if I am wrong but the PCIe device enumeration is done by the BIOS, so maybe Haiku is unable to detect the disks in vmd mode because their domain is different?
The vmd driver should actually act as a PCI bus manager. So the disk driver stuff doesn’t apply.
You can probably see the device in haiku in listdev or device preferences. So, detecting it at the PCI level is not a problem. But then there is no driver handling it, so nothing else happens.
The drivers can run arbitrary code to match with devices, typically they will either check for specific vendor and device id, or check for a specific device type (such as “ahci sata controller” or “raid disk controller”).