[haiku-development] About combining multiple freebsd drivers into single haiku add-on.

  • From: Siarzhuk Zharski <zharik@xxxxxx>
  • To: <haiku-development@xxxxxxxxxxxxx>
  • Date: Fri, 19 Aug 2011 15:34:46 +0200

Hi All,

Are there any objections about the following improvements into Haiku's freebsd network compatibility layer?

1) Modify folowing routines

status_t _fbsd_init_hardware(driver_t *driver);
status_t _fbsd_init_driver(driver_t *driver);
void _fbsd_uninit_driver(driver_t *driver);

to accept the NULL-terminated list of driver_t* pointers to let handle multiple fbsd sub-drivers:

status_t _fbsd_init_hardware(driver_t *drivers[]);
status_t _fbsd_init_driver(driver_t *drivers[]);
void _fbsd_uninit_driver(driver_t *drivers[]);

2) Modify

#define HAIKU_FBSD_DRIVER_GLUE(publicname, name, busname)

to

#define HAIKU_FBSD_DRIVERS_GLUE(publicname)

calling new versions of _fbsd_**(driver_t* drivers[]) routines.

3) Introduse the

driver_t** _haiku_list_fbsd_sub_drivers()

routine used to feed the _fbsd_***(driver_t* drivers[]) handler with the list of supported fbsd sub-drivers;

4) For backward compatibility provide the

#define HAIKU_FBSD_DRIVER_GLUE(publicname, name, busname)

that wil reuse mentioned above HAIKU_FBSD_DRIVERS_GLUE for Haiku add-on implementation.

I have successfully used this technique to add code of if_de (AKA "tulip" that is emulated by MS Virtual PC) into dec21xxx driver. Testing this driver using both two dec21143 cards and dec21143 + dec21140 cards combination show no visible connection problems. So I'm ready to commit it. ;-)

Note that some tweaking is required in case of different interrupt handlers, so I have to use driver_t::device_name field as key to route the execution to corresponding handler.

Are there any suggestions too?

--
Kind Regards,
   S.Zharski

Other related posts: