From cea2221737df534557b37ffaeca708aec4cedf29 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 9 Jan 2007 01:41:26 +0000 Subject: [PATCH] Use fixed-width fields in struct undi_device, so that pxeprefix.S will be able to populate the structure. --- src/arch/i386/drivers/net/undiload.c | 8 ++--- src/arch/i386/include/undi.h | 44 ++++++++++++++++------------ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/arch/i386/drivers/net/undiload.c b/src/arch/i386/drivers/net/undiload.c index 3f0b392d..7ae62480 100644 --- a/src/arch/i386/drivers/net/undiload.c +++ b/src/arch/i386/drivers/net/undiload.c @@ -76,13 +76,13 @@ static int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) { /* Debug info */ DBGC ( undi, "UNDI %p loading UNDI ROM %p to CS %04x DS %04x for ", undi, undirom, undi_loader.UNDI_CS, undi_loader.UNDI_DS ); - if ( undi->pci_busdevfn ) { + if ( undi->pci_busdevfn != 0xffff ) { unsigned int bus = ( undi->pci_busdevfn >> 8 ); unsigned int devfn = ( undi->pci_busdevfn & 0xff ); DBGC ( undi, "PCI %02x:%02x.%x\n", bus, PCI_SLOT ( devfn ), PCI_FUNC ( devfn ) ); } - if ( undi->isapnp_csn != -1U ) { + if ( undi->isapnp_csn != 0xffff ) { DBGC ( undi, "ISAPnP(%04x) CSN %04x\n", undi->isapnp_read_port, undi->isapnp_csn ); } @@ -149,8 +149,8 @@ static int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) { int undi_load_pci ( struct undi_device *undi, struct undi_rom *undirom, unsigned int bus, unsigned int devfn ) { undi->pci_busdevfn = ( ( bus << 8 ) | devfn ); - undi->isapnp_csn = -1U; - undi->isapnp_read_port = -1U; + undi->isapnp_csn = 0xffff; + undi->isapnp_read_port = 0xffff; return undi_load ( undi, undirom ); } diff --git a/src/arch/i386/include/undi.h b/src/arch/i386/include/undi.h index 67b063b6..e2e3c1d5 100644 --- a/src/arch/i386/include/undi.h +++ b/src/arch/i386/include/undi.h @@ -10,8 +10,31 @@ #include #include -/** An UNDI device */ +/** An UNDI device + * + * This structure is used by assembly code as well as C; do not alter + * this structure without editing pxeprefix.S to match. + */ struct undi_device { + /** PXENV+ structure address */ + SEGOFF16_t pxenv; + /** !PXE structure address */ + SEGOFF16_t ppxe; + /** Entry point */ + SEGOFF16_t entry; + /** Free base memory after load */ + UINT16_t fbms; + /** Free base memory prior to load */ + UINT16_t restore_fbms; + /** PCI bus:dev.fn, or 0xffff */ + UINT16_t pci_busdevfn; + /** ISAPnP card select number, or 0xffff */ + UINT16_t isapnp_csn; + /** ISAPnP read port, or 0xffff */ + UINT16_t isapnp_read_port; + /** Padding */ + UINT16_t pad; + /** Generic device */ struct device dev; /** Driver-private data @@ -20,24 +43,7 @@ struct undi_device { * field. */ void *priv; - - /** PXENV+ structure address */ - SEGOFF16_t pxenv; - /** !PXE structure address */ - SEGOFF16_t ppxe; - /** Entry point */ - SEGOFF16_t entry; - /** PCI bus:dev.fn, or 0 */ - unsigned int pci_busdevfn; - /** ISAPnP card select number, or -1U */ - unsigned int isapnp_csn; - /** ISAPnP read port, or -1U */ - unsigned int isapnp_read_port; - /** Free base memory prior to load */ - unsigned int restore_fbms; - /** Free base memory after load */ - unsigned int fbms; -}; +} __attribute__ (( packed )); /** * Set UNDI driver-private data