VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/Etherboot-src/README.pixify@ 61

Last change on this file since 61 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1This file documents the driver changes needed to support use as part
2of a PXE stack.
3
4PROPER WAY
5==========
6
71. The probe() routine.
8
9There are three additional fields that need to be filled in the nic
10structure: ioaddr, irqno and irq.
11
12 ioaddr is the base I/O address and seems to be for information only;
13 no use will be made of this value other than displaying it on the
14 screen.
15
16 irqno must be the IRQ number for the NIC. For PCI NICs this can
17 simply be copied from pci->irq.
18
19 irq is a function pointer, like poll and transmit. It must point to
20 the driver's irq() function.
21
222. The poll() routine.
23
24This must take an additional parameter: "int retrieve". Calling
25poll() with retrieve!=0 should function exactly as before. Calling
26poll() with retrieve==0 indicates that poll() should check for the
27presence of a packet to read, but must *not* read the packet. The
28packet will be read by a subsequent call to poll() with retrieve!=0.
29
30The easiest way to implement this is to insert the line
31 if ( ! retrieve ) return 1;
32between the "is there a packet ready" and the "fetch packet" parts of
33the existing poll() routine.
34
35Care must be taken that a call to poll() with retrieve==0 does not
36clear the NIC's "packet ready" status indicator, otherwise the
37subsequent call to poll() with retrieve!=0 will fail because it will
38think that there is no packet to read.
39
40poll() should also acknowledge and clear the NIC's "packet received"
41interrupt. It does not need to worry about enabling/disabling
42interrupts; this is taken care of by calls to the driver's irq()
43routine.
44
45Etherboot will forcibly regenerate an interrupt if a packet remains
46pending after all interrupts have been acknowledged. You can
47therefore get away with having poll() just acknolwedge and clear all
48NIC interrupts, without particularly worrying about exactly when this
49should be done.
50
513. The irq() routine.
52
53This is a new routine, with prototype
54 void DRIVER_irq ( struct nic *nic, irq_action_t action );
55"action" takes one of three possible values: ENABLE, DISABLE or FORCE.
56ENABLE and DISABLE mean to enable/disable the NIC's "packet received"
57interrupt. FORCE means that the NIC should be forced to generate a
58fake "packet received" interrupt.
59
60If you are unable to implement FORCE, your NIC will not work when
61being driven via the UNDI interface under heavy network traffic
62conditions. Since Etherboot's UNDI driver (make bin/undi.zpxe) is the
63only program known to use this interface, it probably doesn't really
64matter.
65
66
67QUICK AND DIRTY WAY
68===================
69
70It is possible to use the system timer interrupt (IRQ 0) rather than a
71genuine NIC interrupt. Since there is a constant stream of timer
72interrupts, the net upshot is a whole load of spurious "NIC"
73interrupts that have no effect other than to cause unnecessary PXE API
74calls. It's inefficient but it works.
75
76To achieve this, simply set nic->irqno=0 in probe() and point nic->irq
77to a dummy routine that does nothing. Add the line
78 if ( ! retrieve ) return 1;
79at the beginning of poll(), to prevent the packet being read (and
80discarded) when poll() is called with retrieve==0;
81
82
83UNCONVERTED DRIVERS
84===================
85
86Drivers that have not yet been converted should continue to function
87when not used as part of a PXE stack, although there will be a
88harmless compile-time warning about assignment from an incompatible
89pointer type in the probe() function, since the prototype for the
90poll() function is missing the "int retrieve" parameter.
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette