From 7e07dfb2f4a9e65052aada20295784bcae1eb3e0 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 4 Jan 2007 19:38:34 +0000 Subject: Added PXE bus driver (with support only for using PXE structures found lying about in memory, not for loading from ROM), and UNDI net driver. --- src/include/pxe.h | 72 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 27 deletions(-) (limited to 'src/include') diff --git a/src/include/pxe.h b/src/include/pxe.h index 93d950c3e..497f20c4a 100644 --- a/src/include/pxe.h +++ b/src/include/pxe.h @@ -3,6 +3,7 @@ #include "pxe_types.h" #include "pxe_api.h" +#include /* Parameter block for pxenv_unknown() */ struct s_PXENV_UNKNOWN { @@ -61,38 +62,55 @@ union u_PXENV_ANY { typedef union u_PXENV_ANY PXENV_ANY_t; -/* PXE stack status indicator. See pxe_export.c for further - * explanation. - */ -typedef enum { - CAN_UNLOAD = 0, - MIDWAY, - READY -} pxe_stack_state_t; +/** A PXE device */ +struct pxe_device { + /** Generic device */ + struct device dev; + /** Driver-private data + * + * Use pxe_set_drvdata() and pxe_get_drvdata() to access this + * field. + */ + void *priv; -#define ENSURE_CAN_UNLOAD(structure) if ( ! ensure_pxe_state(CAN_UNLOAD) ) { \ - structure->Status = PXENV_STATUS_UNDI_INVALID_STATE; \ - return PXENV_EXIT_FAILURE; } -#define ENSURE_MIDWAY(structure) if ( ! ensure_pxe_state(MIDWAY) ) { \ - structure->Status = PXENV_STATUS_UNDI_INVALID_STATE; \ - return PXENV_EXIT_FAILURE; } -#define ENSURE_READY(structure) if ( ! ensure_pxe_state(READY) ) { \ - structure->Status = PXENV_STATUS_UNDI_INVALID_STATE; \ - return PXENV_EXIT_FAILURE; } + /** PXENV+ structure address */ + SEGOFF16_t pxenv; + /** !PXE structure address */ + SEGOFF16_t ppxe; + /** Entry point */ + SEGOFF16_t entry; + /** MAC address */ + MAC_ADDR_t hwaddr; + /** Assigned IRQ number */ + UINT16_t irq; + /** ROM address */ + SEGSEL_t rom; +}; -/* Data structures installed as part of a PXE stack. Architectures - * will have extra information to append to the end of this. +/** + * Set PXE driver-private data + * + * @v pxe PXE device + * @v priv Private data */ -#define PXE_TFTP_MAGIC_COOKIE ( ( 'P'<<24 ) | ( 'x'<<16 ) | ( 'T'<<8 ) | 'f' ) -typedef struct pxe_stack { - struct s_PXE pxe __attribute__ ((aligned(16))); - struct s_PXENV pxenv __attribute__ ((aligned(16))); - pxe_stack_state_t state; -} pxe_stack_t; +static inline void pxe_set_drvdata ( struct pxe_device *pxe, void *priv ) { + pxe->priv = priv; +} -extern int ensure_pxe_state ( pxe_stack_state_t wanted ); +/** + * Get PXE driver-private data + * + * @v pxe PXE device + * @ret priv Private data + */ +static inline void * pxe_get_drvdata ( struct pxe_device *pxe ) { + return pxe->priv; +} -extern pxe_stack_t *pxe_stack; +extern int pxe_call ( struct pxe_device *pxe, unsigned int function, + void *params, size_t params_len ); +extern int undi_probe ( struct pxe_device *pxe ); +extern void undi_remove ( struct pxe_device *pxe ); extern struct net_device *pxe_netdev; -- cgit v1.2.3-55-g7522