From: Nico v. H. <va...@va...> - 2006-10-22 22:26:22
|
Hello, I`m making some progress in understanding on how to port drivers to syllable, but not understanding all of it. I`m comparing the syllable r8169 driver to the linux tg3 driver and finding some structs that are in linux header files, is there a syllable replacement for these? or can i just copy them from the linux source: From: netdevice.h struct net_device_stats From: linux/timer.h struct list_head timer_list From: workqueue.h struct work_struct From: ethtool.h struct ethtool_coalesce Now i`m having difficulties with the following struct: static DeviceOperations_s g_sDevOps = { device_3c59x_open, device_3c59x_close, device_3c59x_ioctl, device_3c59x_read, device_3c59x_write, NULL, // dop_readv NULL, // dop_writev NULL, // dop_add_select_req NULL // dop_rem_select_req }; How do i implement this for the tg3? can i copy the 5 functions into the tg3 driver from the 3c59x driver? Or.....? Nico ----- Original Message ----- From: "Nico van Huis" <va...@va...> To: <syl...@li...> Sent: Monday, October 16, 2006 7:11 PM Subject: Re: Syllable-kernel Digest, Vol 2, Issue 2 >I don`t understand the following lines, so i can`t solve the problem, > please help!! > > 325 static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) > 326 { > 327 //PCI_bus_s *psBus = g_psBus; > 328 PCI_bus_s* psBus = get_busmanager( PCI_BUS_NAME, PCI_BUS_VERSION ); > 329 if( psBus == NULL ) { > 330 return( NULL ); > 331 } > 332 333 unsigned long flags; > 334 335 spin_lock_irqsave(&tp->indirect_lock, flags); > 336 psBus->write_pci_config( > 337 &(tp)->pdev->nBus, 338 &tp->pdev->nDevice, 339 > &tp->pdev->nFunction, 340 TG3PCI_REG_BASE_ADDR, 341 sizeof(off), 342 > (uint32)off); > 343 //pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); > 344 psBus->write_pci_config( > 345 &tp->pdev->nBus, 346 &tp->pdev->nDevice, 347 > &tp->pdev->nFunction, 348 TG3PCI_REG_DATA, 349 val); > 350 //pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); > 351 spin_unlock_irqrestore(&tp->indirect_lock, flags); > 352 } > > bash-2.03$ make > cc -kernel -fno-PIC -c tg3.c -o objs/tg3.o > tg3.c:218: warning: parameter names (without types) in function > declaration > tg3.c:218: warning: data definition has no type or storage class > tg3.c: In function `tg3_write_indirect_reg32': > tg3.c:330: warning: `return' with a value, in function returning void > tg3.c:337: error: dereferencing pointer to incomplete type > tg3.c:338: error: dereferencing pointer to incomplete type > tg3.c:339: error: dereferencing pointer to incomplete type > tg3.c:345: error: dereferencing pointer to incomplete type > tg3.c:346: error: dereferencing pointer to incomplete type > tg3.c:347: error: dereferencing pointer to incomplete type > tg3.c:349: error: too few arguments to function > tg3.c:352:2: warning: no newline at end of file > make: *** [objs/tg3.o] Error 1 > > I really want to understand what the psBus does and their functions... > can anyone explain and help to solve this?? > |
From: Kristian V. D. V. <va...@li...> - 2006-10-23 00:22:46
|
On Sunday 22 October 2006 23:25, Nico van Huis wrote: > I`m making some progress in understanding on how to port drivers to > syllable, but not understanding all of it. > I`m comparing the syllable r8169 driver to the linux tg3 driver > and finding some structs that are in linux header files, is there a > syllable replacement for these? Some of them are unesacary on Syllable: > or can i just copy them from the > linux source: > > From: netdevice.h > struct net_device_stats Take a look in some of the other drivers; possibly the Via Rhine driver has an implementation for this. Other drivers just remove the stats code, because there is no API to retrieve the stats information on Syllable anyway. > From: linux/timer.h > struct list_head > timer_list Timers work differently and these lists are not needed. See the rtl8169 driver for create_timer(), start_timer() and delete_timer() as an example, or <atheos/timer.h> > From: workqueue.h > struct work_struct I assume these are for creating worker processes E.g. bottom-half tasks? If so you'll have to find a different way to handle this on Syllable. You may find these are not needed, otherwise creating a kernel thread and running these tasks inside it may be appropriate. > From: ethtool.h > struct ethtool_coalesce Ethertool is not available on Syllable so these are not required. You should remove any ethtool related code from the driver. > Now i`m having difficulties with the following struct: > > static DeviceOperations_s g_sDevOps = > { > device_3c59x_open, > device_3c59x_close, > device_3c59x_ioctl, > device_3c59x_read, > device_3c59x_write, > NULL, // dop_readv > NULL, // dop_writev > NULL, // dop_add_select_req > NULL // dop_rem_select_req > }; > > How do i implement this for the tg3? > can i copy the 5 functions into the tg3 driver from the 3c59x driver? > Or.....? This describes the device interface for the device; that is, the device node in /dev/net/eth/... , not the "eth0" virtual device. If you take a look at the device_3c59x_* functions listed there you'll see they are pretty simple. You should be able to copy & paste them into your driver and make the simple modifications required. -- Vanders http://www.syllable.org http://www.liqwyd.com |
From: Kristian V. D. V. <va...@li...> - 2006-11-13 07:41:06
|
On Sunday 22 October 2006 23:25, Nico van Huis wrote: > I`m making some progress in understanding on how to port drivers to > syllable, but not understanding all of it. Hi Nico, I'd be interesting in hearing how you're getting on with the tg3 driver. My machine with a Broadcom 57xx in it is working again now, so I'm in a position to test and debug a driver. If you've abandoned your work (it happens) I can take anything you have and finish it. -- Vanders http://www.syllable.org http://www.liqwyd.com |