Page 1 of 1
Writing Ethernet Adapter Driver
Posted: Fri May 27, 2022 5:22 pm
by abcdabcd
I'm looking to write a basic OS to do some simple tasks and run on bare-metal (Macbook Pro 2010).
It turns out I have a Broadcom NetXtreme 57XX Gigabit adapter, but I cannot find any information about how to program it anywhere, only a user manual that doesn't tell me what I need to know.
Is there some general architecture for network adapters so that I can handle multiple of them the same way, which is why I can't find specific information about this card? If so, how should it be handled?
Thanks!
Re: Writing Ethernet Adapter Driver
Posted: Fri May 27, 2022 5:28 pm
by Ethin
I will be extremely surprised if you can find anything. Broadcom is one of those notorious companies who majorly dislikes open-source of any kind. You'd have to purchase the developer documentation from them -- and that's assuming they'd even sell it to you at all. Even their Linux drivers are closed-source (at least last time I checked) and (in some cases) highly unreliable. If you can, replace your NIC with an Intel one -- I'm pretty sure Intel provides developer documentation for NICs even now, though I might be wrong about that.
Re: Writing Ethernet Adapter Driver
Posted: Sat May 28, 2022 2:14 am
by iansjack
I'm not convinced that a MacBook is the best hardware to target, unless you are very experienced. Information about the hardware is rather harder to find than for a conventional PC.
Have you written drivers for the screen, the keyboard, and the storage devices yet? I'd have thought that networking came pretty far down the list of things to implement.
But that's just my opinion - it's your OS so you are free to implement it on whatever hardware you choose and in whichever order you choose; just be sure you aren't making things too difficult for yourself. Developing on bare metal is hard enough when you have all the relevant documentation.
Re: Writing Ethernet Adapter Driver
Posted: Sat May 28, 2022 9:26 am
by abcdabcd
Ethin wrote:I will be extremely surprised if you can find anything. Broadcom is one of those notorious companies who majorly dislikes open-source of any kind. You'd have to purchase the developer documentation from them -- and that's assuming they'd even sell it to you at all. Even their Linux drivers are closed-source (at least last time I checked) and (in some cases) highly unreliable. If you can, replace your NIC with an Intel one -- I'm pretty sure Intel provides developer documentation for NICs even now, though I might be wrong about that.
iansjack wrote:I'm not convinced that a MacBook is the best hardware to target, unless you are very experienced. Information about the hardware is rather harder to find than for a conventional PC.
Have you written drivers for the screen, the keyboard, and the storage devices yet? I'd have thought that networking came pretty far down the list of things to implement.
But that's just my opinion - it's your OS so you are free to implement it on whatever hardware you choose and in whichever order you choose; just be sure you aren't making things too difficult for yourself. Developing on bare metal is hard enough when you have all the relevant documentation.
It does seem going with a MacBook is not the way to go, it was just the only laptop I had on hand.
I will see what kind of hardware that I am actually able to buy I can also emulate through QEMU and such.
Thanks to both of you for the reply, hard to know as a beginner if I'm not searching in the right place or the information is just not out there.
Re: Writing Ethernet Adapter Driver
Posted: Sat May 28, 2022 9:49 am
by iansjack
Emulating through qemu is definitely the way to go. Not only can it tell you which exceptions have occurred but also you can use gdb with it to set breakpoints in your code, single-step code, examine memory, and all the other debugger facilities. This makes OS development so much easier. Also, it means you can go with a simple, well documented NIC - such as the E1000 - if you want to play with networking. Writing a driver for this is fairly straightforward, as is implementing IP and UDP. TCP is rather more challenging.
Re: Writing Ethernet Adapter Driver
Posted: Sat May 28, 2022 12:13 pm
by Klakap
I’ve found two specs for broadcom ethernet cards:
https://docs.broadcom.com/doc/1211168564335 https://docs.broadcom.com/doc/5718-PG108-R
However, I do not have working driver. It is one thing on my osdev wishlist.