UNDI Support Functions

These are the functions required by the PXE standard to support UNDI (Universal Network Device Interface.

pxenv_undi_startup()

This function initializes the UNDI code & data segments. This must be called before any of the other UNDI functions.

pxenv_ret_code_t pxenv_undi_startup(struct pxenv_undi_startup_s undistartup);

undistartup

This is a pointer to a pre-initialized pxenv_undi_startup_s structure.

These are the fields in the pxenv_undi_startup_s structure that get set by this function before returning.

undistartup.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_startup_s structure.


      typedef struct pxenv_undi_startup_s {
          pxenv_status_t status;
      } pxenv_undi_startup_t;

      

pxenv_undi_cleanup()

This function prepares the driver to be unloaded from memory. After this is executed, the UNDI functions won't work.

Note: This cannot be used in protected mode.

pxenv_ret_code_t pxenv_undi_cleanup(struct pxenv_undi_cleanup_s undicleanup);

undicleanup

This is a pointer to a pre-initialized pxenv_undi_cleanup_s structure.

These are the fields in the pxenv_undi_cleanup_s structure that get set by this function before returning.

undicleanup.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_cleanup_s structure.


      typedef struct pxenv_undi_cleanup_s {
          pxenv_status_t status;
      } pxenv_undi_cleanup_t;

      

pxenv_undi_initialize()

This function initializes the adaptor with the data as set by the most recent pxenv_undi_startup(). A pxenv_undi_open() must be executed before the adaptor can transmit packets.

pxenv_ret_code_t pxenv_undi_initialize(struct pxenv_undi_initialize_s undiinit);

undiinit

This is a pointer to a pre-initialized pxenv_undi_initialize_s structure.

These are the fields in the pxenv_undi_initialize_s structure that get set by this function before returning.

undiinit.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undiinit.protocolini

this is the 32 bit address of the memory copy of the driver module in the protocol.ini file. This used to pass into to the ndis driver.

undiinit.reserved

Reserved by Intel for future use.

These are all the fields of the pxenv_undi_initialize_s structure.


      typedef struct pxenv_undi_initialize_s {
          pxenv_status_t status;
	  u_int32_t protocolini;
	  u_int8_t reserved[8];
      } pxenv_undi_initialize_t;

      

pxenv_undi_reset_nic()

This function resets the adaptor to the default values as set with pxenv_undi_initialize() function. Unlike the pxenv_undi_initialize() function, this connects the adaptor to the network.

pxenv_ret_code_t pxenv_undi_reset_nic(struct pxenv_undi_reset_nic_s undireset);

undireset

This is a pointer to a pre-initialized pxenv_undi_reset_nic_s structure.

These are the fields in the pxenv_undi_reset_nic_s structure that get set by this function before returning.

undireset.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undireset.mcast_buf

the multicast address is not stored anywhere, so when a client application resets the adaptor, this must be provided.

These are all the fields of the pxenv_undi_reset_nic_s structure.


      typedef struct pxenv_undi_reset_nics {
          pxenv_status_t status;
	  pxenv_undi_mcast_addr_t mcast_buf;
      } pxenv_undi_reset_nic_t;

      

pxenv_undi_shutdown()

This function resets the adaptor and leaves it in a usable state.

Note: The data passed to the pxenv_undi_startup() function in the pxenv_undi_startup_s structure must be saved for the next call to pxenv_undi_initialize().

pxenv_ret_code_t pxenv_undi_shutdown(struct pxenv_undi_shutdown_s undishut);

undishut

This is a pointer to a pre-initialized pxenv_undi_shutdown_s structure.

These are the fields in the pxenv_undi_shutdown_s structure that get set by this function before returning.

undishut.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_shutdown_s structure.


      typedef struct pxenv_undi_shutdown_s {
          pxenv_status_t status;
      } pxenv_undi_shutdown_t;

      

pxenv_undi_open()

This function activates the adaptor so it can accept packets.

pxenv_ret_code_t pxenv_undi_open(struct pxenv_undi_open_s undiopen);

undiopen

This is a pointer to a pre-initialized pxenv_undi_open_s structure.

These are the fields in the pxenv_undi_open_s structure that must be set before calling this function.

undiopen.open_flag

this is a NIC specific flag used to pass the open flags from the protocol driver. Can be zero.

undiopen.pkt_filter

one of the FLTR_DIRECTED, FLTR_BRDCST, FLTR_PRMSCS, FLTR_SRC_RTG constants, which can be ORed together.

These are the fields in the pxenv_undi_open_s structure that get set by this function before returning.

undiopen.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_open_s structure.


      typedef struct pxenv_undi_open_s {
          pxenv_status_t status;
	  u_int16_t open_flag;
	  u_int16_t pkt_filter;
	  pxenv_undi_mcast_addr_t mcastbuffer;
      } pxenv_undi_open_t;

      

pxenv_undi_close()

This function disconnects the adaptor from the network. The adaptor must be opened with a call to pxenv_undi_open() before it can be used again.

pxenv_ret_code_t pxenv_undi_close(struct pxenv_undi_close_s undiclose);

undiclose

This is a pointer to a pre-initialized pxenv_undi_close_s structure.

These are the fields in the pxenv_undi_close_s structure that get set by this function before returning.

undiclose.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_close_s structure.


      typedef struct pxenv_undi_close_s {
          pxenv_status_t status;
      } pxenv_undi_close_t;

      

pxenv_undi_transmit()

This function transmits a packet over the network. An interupt is generated on the transmissions of a packet(s).

pxenv_ret_code_t pxenv_undi_transmit(struct pxenv_undi_transmit_s unditrans);

unditrans

This is a pointer to a pre-initialized pxenv_undi_transmit_s structure.

These are the fields in the pxenv_undi_transmit_s structure that must be set before calling this function.

unditrans.protocol

the protocol of the upper layer that is making this function call. If the upper layer has filled in the media header, this must be zero.

unditrans.xmit_flags

if zero, use the dest_addr. If 1, the NIC supplies the broadcast address.

unditrans.dest_addr

the hardware address of the destination media in offset:segment format. If this isn't known, this field can be zero, and xmit_flags must be XMT_BROADCAST.

unditrans.tdb_addr

the transmit buffer in offset:segment format.

These are the fields in the pxenv_undi_transmit_s structure that get set by this function before returning.

unditrans.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_transmit_s structure.


      typedef struct pxenv_undi_transmit_s {
          pxenv_status_t status;
	  u_int8_t protocol;
	  u_int8_t xmit_flags;
	  segoff16_t dest_addr;
	  segoff16_t tbd_addr;
	  u_int32_t reserved[2];
      } pxenv_undi_transmit_t;

      

pxenv_undi_set_mcast_addr()

This function changes the list of muticast addresses to the specified list, and resets the adaptor. If there are no multicast addresses, then multicast is disabled.

pxenv_ret_code_t pxenv_undi_set_mcast_addr(struct pxenv_undi_set_mcast_addr_s undimcast);

undimcast

This is a pointer to a pre-initialized pxenv_undi_set_mcast_addr_s structure.

These are the fields in the pxenv_undi_set_mcast_addr_s structure that must be set before calling this function.

undimcast.mcast_buffer

the multicast address.

These are the fields in the pxenv_undi_set_mcast_addr_s structure that get set by this function before returning.

undimcast.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_set_mcast_addr_s structure.


      typedef struct pxenv_undi_set_mcast_addr_s {
          pxenv_status_t status;
	  pxenv_undi_mcast_addr_t mcast_buffer;
      } pxenv_undi_set_mcast_addr_t;

      

pxenv_undi_set_station_addr()

This function sets the MAC address to the specified value, and must be executed before opening the network adaptor with the pxenv_undi_open() function.

pxenv_ret_code_t pxenv_undi_set_station_addr(struct pxenv_undi_set_station_addr_s undistat);

undistat

This is a pointer to a pre-initialized pxenv_undi_set_station_addr_s structure.

These are the fields in the pxenv_undi_set_station_addr_s structure that must be set before calling this function.

undistat.station_addr

the MAC address to be used.

These are the fields in the pxenv_undi_set_station_addr_s structure that get set by this function before returning.

undistat.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_set_station_addr_s structure.


      typedef struct pxenv_undi_set_station_addr_s {
          pxenv_status_t status;
	  mac_addr_t station_addr;
      } pxenv_undi_set_station_addr_t;

      

pxenv_undi_set_packet_filter()

This function resets the NIC to use a new filter.

pxenv_ret_code_t pxenv_undi_set_packet_filter(struct pxenv_undi_set_packet_filter_s undifilter);

undifilter

This is a pointer to a pre-initialized pxenv_undi_set_packet_filter_s structure.

These are the fields in the pxenv_undi_set_packet_filter_s structure that must be set before calling this function.

undifilter.station_addr

the MAC address to use.

These are the fields in the pxenv_undi_set_packet_filter_s structure that get set by this function before returning.

undifilter.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_set_packet_filter_s structure.


      typedef struct pxenv_undi_set_station_addr_s {
          pxenv_status_t status;
	  mac_addr_t station_addr;
      } pxenv_undi_set_station_addr_t;

      

pxenv_undi_get_information()

This function copies all the adaptor variables to the input buffer.

pxenv_ret_code_t pxenv_undi_get_information(struct pxenv_undi_get_information_s undiinfo);

undiinfo

This is a pointer to a pre-initialized pxenv_undi_get_information_s structure. This fills in all the fields in the pxenv_undi_get_information_t structure.

These are the fields in the pxenv_undi_get_information_s structure that get set by this function before returning.

undiinfo.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undiinfo.baseio

he base I/O address of the adpator.

undiinfo.irqnum

the IRQ number of the NIC.

undiinfo.maxmtu

the maxium MTUs.

undiinfo.hwtype

the protocol type at the hardware level. There is an RFRC1010 for "Assigned Numbers". As this number may not be validated by the application and hence adding new numbers to the list should be fine at any time. The current types are ETHER_TYPE, EXP_ETHER_TYPE, IEEE_TYPE, ARCNET_TYPE.

undiinfo.hw_addrlen

the length of the hardware address.

undiinfo.current_node_addr

the current hardware address.

undiinfo.perm_node_addr

the permanent hardware address.

undiinfo.rom_addr

the ROM address.

undiinfo.rxbuflen

the length of the receive buffer in bytes.

undiinfo.txbuflen

the length of the transmit buffer in bytes.

These are all the fields of the pxenv_undi_get_information_s structure.


      typedef struct pxenv_undi_get_information_s {
          pxenv_status_t status;
	  u_int16_t baseio;
	  u_int16_t irqnum;
	  u_int16_t maxmtu;
	  u_int16_t hwtype;
	  u_int16_t hw_addrlen;
	  u_int8_t current_node_addr[ADDR_LEN];
	  u_int8_t perm_node_addr[ADDR_LEN];
	  u_int16_t rom_addr;
	  u_int16_t rxbuflen;
	  u_int16_t txbuflen;
      } pxenv_undi_get_information_t;

      

pxenv_undi_get_statistics()

This function gets the adaptor statistics.

pxenv_ret_code_t pxenv_undi_get_statistics(struct pxenv_undi_get_statistics_s undistats);

undistats

This is a pointer to a pre-initialized pxenv_undi_get_statistics_t structure. This fills in all the fields in the pxenv_undi_get_statistics_t structure.

These are the fields in the pxenv_undi_get_statistics_s structure that get set by this function before returning.

undistats.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undistats.tx_good_frames

the count of good transmissions.

undistats.rx_good_frames

the count of good receptions.

undistats.rx_crc_err

the count of frames with CRC errors.

undistats.rx_discard_err

the count of rames discarded.

These are all the fields of the pxenv_undi_get_statistics_s structure.


      typedef struct pxenv_undi_get_statistics_s {
          pxenv_status_t status;
	  u_int32_t tx_good_frames;
	  u_int32_t rx_good_frames;
	  u_int32_t rx_crc_err;
	  u_int32_t rx_discard_err;
      } pxenv_undi_get_statistics_t;

      

pxenv_undi_clear_statistics()

This function clears the statistics from the adaptor.

pxenv_ret_code_t pxenv_undi_clear_statistics(struct pxenv_undi_clear_statistics_s undiclrstats);

undiclrstats

This is a pointer to a pre-initialized pxenv_undi_clear_statistics_s structure.

These are the fields in the pxenv_undi_clear_statistics_s structure that get set by this function before returning.

undiclrstats.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_clear_statistics_s structure.


      typedef struct pxenv_undi_clear_statistics_s {
          pxenv_status_t status;
      } pxenv_undi_clear_statistics_t;

      

pxenv_undi_initiate_diags()

This functions starts the run-time diagnostics, typically by running the hardware diagnostics.

pxenv_ret_code_t pxenv_undi_initiate_diags(struct pxenv_undi_initiate_diags_s undidiag);

undidiag

This is a pointer to a pre-initialized pxenv_undi_initiate_diags_s structure.

These are the fields in the pxenv_undi_initiate_diags_s structure that get set by this function before returning.

undidiag.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_initiate_diags_s structure.


      typedef struct pxenv_undi_initiate_diags_s {
          pxenv_status_t status;
      } pxenv_undi_initiate_diags_t;

      

pxenv_undi_force_interrupt()

This function forces the adaptor to generate and interupt. This is done to simulate and interupt on receiving a packet to clear the adaptor.

pxenv_ret_code_t pxenv_undi_force_interrupt(struct pxenv_undi_force_interrupt_s undiint);

undiint

This is a pointer to a pre-initialized pxenv_undi_force_interrupt_s structure.

These are the fields in the pxenv_undi_force_interrupt_s structure that get set by this function before returning.

.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

These are all the fields of the pxenv_undi_force_interrupt_s structure.


      typedef struct pxenv_undi_force_interrupt_s {
          pxenv_status_t status;
      } pxenv_undi_force_interrupt_t;

      

pxenv_undi_get_mcast_addr()

This function converts the specified IP multicast address to it's hardware multicast address.

pxenv_ret_code_t pxenv_undi_get_mcast_addr(struct pxenv_undi_get_mcast_addr_s undimcast);

undimcast

This is a pointer to a pre-initialized pxenv_undi_get_mcast_addr_s structure. This sets the MAC field in the pxenv_undi_get_mcast_addr_t structure.

These are the fields in the pxenv_undi_get_mcast_addr_s structure that must be set before calling this function.

undimcast.ip_addr

the multicast IP number.

These are the fields in the pxenv_undi_get_mcast_addr_s structure that get set by this function before returning.

undimcast.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undimcast.mcast_addr

the hardware multicast address.

These are all the fields of the pxenv_undi_get_mcast_addr_s structure.


      typedef struct pxenv_undi_get_mcast_addr_s {
          pxenv_status_t status;
	  ip4_t ip_ddr;
	  mac_addr_t mcast_addr;
      } pxenv_undi_get_mcast_addr_t;

     

pxenv_undi_get_nic_type()

This function retrieves the adaptor specifc info required to identify the adaptor.

Note: pxenv_start_undi(), pxenv_undi_startup(), and pxenv_undi_initialize() must be called before this info is valid.

pxenv_ret_code_t pxenv_undi_get_nic_type(struct pxenv_undi_get_nic_type_s undinic);

undinic

This is a pointer to a pre-initialized pxenv_undi_get_nic_type_s structure. This sets the NIC type and and the Info fields in the pxenv_undi_get_nic_type_s structure.

These are the fields in the pxenv_undi_get_nic_type_s structure that get set by this function before returning.

undinic.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undinic.pci.vendor_id

the vendor ID.

undinic.pci.dev_id

the device ID.

undinic.pci.base_class

the base class of the device.

undinic.pci.sub_class

the sub class of the device.

undinic.pci.prog_inf

the program interface.

undinic.pci.rev

the revision number.

undinic.busdevfunc

bus device and function numbers.

undinic.subvendor_id

the sub vendor ID.

undinic.subdevice_id

the sub device ID.

undinic.pnp.eisa_dev_id

the EISA device ID.

undinic.pnp.base_class

the base class of the device.

undinic.pnp.sub_class

the sub class of the device.

undinic.pnp.prog_intf

the program interface.

undinic.pnp.cardselnum

the card selector number.

undinic.pnp.reserved

data structure padding to make this aligned.

These are all the fields of the pxenv_undi_get_nic_type_s structure.


      typedef struct pxenv_undi_get_nic_type_s {
          pxenv_status_t status;
	  u_int8_t nictype;
	  union {
	      struct {
	          u_int16_t vendor_id;
		  u_int16_t dev_id;
		  u_int8_t base_class;
		  u_int8_t sub_class;
		  u_int8_t prog_intf;
		  u_int8_t rev;
		  u_int16_t busdevfunc;
		  u_int16_t subvendor_id;
		  u_int16_t subdevice_id;
              } pci;
              struct {
                  u_int32_t eisa_dev_id;
		  u_int8_t base_class;
		  u_int8_t sub_class;
		  u_int8_t prog_intf;
		  u_int16_t cardselnum;
		  u_int8_t reserved;
              } pnp;
          } pci_pnp_info;
      } pxenv_undi_get_nic_type_t;

      

pxenv_undi_get_iface_info()

This function gets the link level infterface type and the link speed.

Note: pxenv_start_undi(), pxenv_undi_startup(), and pxenv_undi_initialize() must be called before this info is valid. Also the info must be in an NDIS2 format.

pxenv_ret_code_t pxenv_undi_get_iface_info(struct pxenv_undi_get_iface_info_s undiiface);

undiiface

This is a pointer to a pre-initialized pxenv_undi_get_iface_info_s structure.

These are the fields in the pxenv_undi_get_iface_info_s structure that get set by this function before returning.

undiiface.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undiiface.iface_type

this is the type of interface in ASCIIZ format.

undiiface.link_speed

as defined in the NDIS 2.0x specification.

undiiface.service_flags

as defined in the NDIS 2.0x specification.

undiiface.reserved

must be set to all zeros as it's undefined for now.

These are all the fields of the pxenv_undi_get_iface_info_s structure.


      typedef struct pxenv_undi_get_iface_info_s {
          pxenv_status_t status;
	  u_int8_t iface_type[16];
	  u_int32_t link_speed;
	  u_int32_t service_flags;
	  u_int32_t reserved[4];
      } pxenv_undi_get_iface_info_t;

      

pxenv_undi_get_state()

This function gets the state of the UNDI system.

pxenv_ret_code_t pxenv_undi_get_state(struct pxenv_undi_get_state_s undistate);

undistate

This is a pointer to a pre-initialized pxenv_undi_get_state_s structure. FIXME: add return params

These are the fields in the pxenv_undi_get_state_s structure that get set by this function before returning.

undistate.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undistate.undi_state

the state of the UNDI engine.

These are all the fields of the pxenv_undi_get_state_s structure.


      typedef struct pxenv_undi_get_state_s {
          pxenv_status_t status;
	  u_int16_t undi_State;
      } pxenv_undi_get_state_t;

      

pxenv_undi_isr()

This function is the Interupt Service Routine for the UNDI.

pxenv_ret_code_t pxenv_undi_isr(struct pxenv_undi_isr_s undiisr);

undiisr

This is a pointer to a pre-initialized pxenv_undi_isr_s structure. This must fill in the fields in the pxenv_undi_isr_s structure.

These are the fields in the pxenv_undi_isr_s structure that must be set before calling this function.

undiisr.func_flag

this is set to one of PXENV_UNDI_ISR_IN_START, PXENV_UNDI_ISR_IN_PROCESS, or PXENV_UNDI_ISR_IN_GET_NEXT.

These are the fields in the pxenv_undi_isr_s structure that get set by this function before returning.

undiisr.status

The exit status of this function. This is set to one of the PXENV_STATUS_xxx constants.

undiisr.func_flag

this is set to one of the PXENV_UNDI_ISR_OUT_OURS, PXENV_UNDI_USR_OUT_NOT_OURS, PXENV_UNDI_ISR_OUT_DONE, PXENV_UNDI_ISR_OUT_TRANSMIT, PXENV_UNDI_ISR_OUT_RECEIVE, or PXENV_UNDI_ISR_OUT_BUSY.

undiisr.buffer_length

the length of the buffer in bytes.

undiisr.frame_length

the length of the frame in bytes.

undiisr.frame_header_length

the length of the frame header in bytes.

undiisr.frame_addr

the frame address in offset:segment format.

undiisr.prot_type

the type of the protocol. Valid values are PXENV_UNDI_PROTO_IP, PXENV_UNDI_PROTO_ARP, PXENV_UNDI_PROTO_RARP, or any higher value is other.

undiisr.pkt_type

the type of packet. Valid values are PXENV_PACKET_TYPE_DHCP_DISCOVER, PXENV_PACKET_TYPE_DHCP_ACK, or PXENV_PACKET_TYPE_BINL_REPLY.

These are all the fields of the pxenv_undi_isr_s structure.


      typedef struct pxenv_undi_isr_s {
          pxenv_status_t status;
	  u_int16_t func_flag;
	  u_int16_t buffer_length;
	  u_int16_t frame_length;
	  u_int16_t frame_header_length;
	  segoff16_t frame_addr;
	  u_int8_t  prot_type;
	  u_int8_t  pkt_type;
      } pxenv_undi_isr_t;