mirror of
https://github.com/ipxe/ipxe
synced 2025-12-29 11:03:15 +03:00
Updated ISAPnP, EISA, MCA and ISA buses to current device model.
ISA 3c509 is currently non-functional, although the EISA (3c509-eisa) and MCA (3c529) variants should build OK. None of this code is yet tested.
This commit is contained in:
@@ -11,18 +11,18 @@
|
||||
#include <gpxe/list.h>
|
||||
#include <gpxe/tables.h>
|
||||
|
||||
/** A PCI device description */
|
||||
struct pci_device_description {
|
||||
/** A hardware device description */
|
||||
struct device_description {
|
||||
/** Bus type
|
||||
*
|
||||
* Must be @c BUS_TYPE_PCI.
|
||||
* This must be a BUS_TYPE_XXX constant.
|
||||
*/
|
||||
unsigned int bus_type;
|
||||
/** Bus:dev.fn address
|
||||
/** Location
|
||||
*
|
||||
* As constructed by PCI_BUSDEVFN().
|
||||
* The interpretation of this field is bus-type-specific.
|
||||
*/
|
||||
unsigned int busdevfn;
|
||||
unsigned int location;
|
||||
/** Vendor ID */
|
||||
unsigned int vendor;
|
||||
/** Device ID */
|
||||
@@ -32,37 +32,24 @@ struct pci_device_description {
|
||||
/** PCI bus type */
|
||||
#define BUS_TYPE_PCI 1
|
||||
|
||||
/** An ISAPnP device description */
|
||||
struct isapnp_device_description {
|
||||
/** Bus type
|
||||
*
|
||||
* Must be @c BUS_TYPE_ISAPNP.
|
||||
*/
|
||||
unsigned int bus_type;
|
||||
};
|
||||
|
||||
/** PCI bus type */
|
||||
/** ISAPnP bus type */
|
||||
#define BUS_TYPE_ISAPNP 2
|
||||
|
||||
/** A hardware device description */
|
||||
union device_description {
|
||||
/** Bus type
|
||||
*
|
||||
* This must be a BUS_TYPE_XXX constant.
|
||||
*/
|
||||
unsigned int bus_type;
|
||||
/** PCI device description */
|
||||
struct pci_device_description pci;
|
||||
/** ISAPnP device description */
|
||||
struct isapnp_device_description isapnp;
|
||||
};
|
||||
/** EISA bus type */
|
||||
#define BUS_TYPE_EISA 3
|
||||
|
||||
/** MCA bus type */
|
||||
#define BUS_TYPE_MCA 4
|
||||
|
||||
/** ISA bus type */
|
||||
#define BUS_TYPE_ISA 5
|
||||
|
||||
/** A hardware device */
|
||||
struct device {
|
||||
/** Name */
|
||||
char name[16];
|
||||
/** Device description */
|
||||
union device_description desc;
|
||||
struct device_description desc;
|
||||
/** Devices on the same bus */
|
||||
struct list_head siblings;
|
||||
/** Devices attached to this device */
|
||||
|
||||
125
src/include/gpxe/eisa.h
Normal file
125
src/include/gpxe/eisa.h
Normal file
@@ -0,0 +1,125 @@
|
||||
#ifndef EISA_H
|
||||
#define EISA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/isa_ids.h>
|
||||
#include <gpxe/device.h>
|
||||
#include <gpxe/tables.h>
|
||||
|
||||
/*
|
||||
* EISA constants
|
||||
*
|
||||
*/
|
||||
|
||||
#define EISA_MIN_SLOT (0x1)
|
||||
#define EISA_MAX_SLOT (0xf) /* Must be 2^n - 1 */
|
||||
#define EISA_SLOT_BASE( n ) ( 0x1000 * (n) )
|
||||
|
||||
#define EISA_VENDOR_ID ( 0xc80 )
|
||||
#define EISA_PROD_ID ( 0xc82 )
|
||||
#define EISA_GLOBAL_CONFIG ( 0xc84 )
|
||||
|
||||
#define EISA_CMD_RESET ( 1 << 2 )
|
||||
#define EISA_CMD_ENABLE ( 1 << 0 )
|
||||
|
||||
/** An EISA device ID list entry */
|
||||
struct eisa_device_id {
|
||||
/** Name */
|
||||
const char *name;
|
||||
/** Manufacturer ID */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID */
|
||||
uint16_t prod_id;
|
||||
};
|
||||
|
||||
/** An EISA device */
|
||||
struct eisa_device {
|
||||
/** Generic device */
|
||||
struct device dev;
|
||||
/** Slot number */
|
||||
unsigned int slot;
|
||||
/** I/O address */
|
||||
uint16_t ioaddr;
|
||||
/** Manufacturer ID */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID */
|
||||
uint16_t prod_id;
|
||||
/** Driver for this device */
|
||||
struct eisa_driver *driver;
|
||||
/** Driver-private data
|
||||
*
|
||||
* Use eisa_set_drvdata() and eisa_get_drvdata() to access
|
||||
* this field.
|
||||
*/
|
||||
void *priv;
|
||||
/** Driver name */
|
||||
const char *driver_name;
|
||||
};
|
||||
|
||||
/** An EISA driver */
|
||||
struct eisa_driver {
|
||||
/** EISA ID table */
|
||||
struct eisa_device_id *ids;
|
||||
/** Number of entries in EISA ID table */
|
||||
unsigned int id_count;
|
||||
/**
|
||||
* Probe device
|
||||
*
|
||||
* @v eisa EISA device
|
||||
* @v id Matching entry in ID table
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ( * probe ) ( struct eisa_device *eisa,
|
||||
const struct eisa_device_id *id );
|
||||
/**
|
||||
* Remove device
|
||||
*
|
||||
* @v eisa EISA device
|
||||
*/
|
||||
void ( * remove ) ( struct eisa_device *eisa );
|
||||
};
|
||||
|
||||
/** Declare an EISA driver */
|
||||
#define __eisa_driver __table ( struct eisa_driver, eisa_drivers, 01 )
|
||||
|
||||
extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled );
|
||||
|
||||
/**
|
||||
* Enable EISA device
|
||||
*
|
||||
* @v eisa EISA device
|
||||
*/
|
||||
static inline void enable_eisa_device ( struct eisa_device *eisa ) {
|
||||
eisa_device_enabled ( eisa, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable EISA device
|
||||
*
|
||||
* @v eisa EISA device
|
||||
*/
|
||||
static inline void disable_eisa_device ( struct eisa_device *eisa ) {
|
||||
eisa_device_enabled ( eisa, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set EISA driver-private data
|
||||
*
|
||||
* @v eisa EISA device
|
||||
* @v priv Private data
|
||||
*/
|
||||
static inline void eisa_set_drvdata ( struct eisa_device *eisa, void *priv ) {
|
||||
eisa->priv = priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get EISA driver-private data
|
||||
*
|
||||
* @v eisa EISA device
|
||||
* @ret priv Private data
|
||||
*/
|
||||
static inline void * eisa_get_drvdata ( struct eisa_device *eisa ) {
|
||||
return eisa->priv;
|
||||
}
|
||||
|
||||
#endif /* EISA_H */
|
||||
92
src/include/gpxe/isa.h
Normal file
92
src/include/gpxe/isa.h
Normal file
@@ -0,0 +1,92 @@
|
||||
#ifndef ISA_H
|
||||
#define ISA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/isa_ids.h>
|
||||
#include <gpxe/device.h>
|
||||
#include <gpxe/tables.h>
|
||||
|
||||
/** An ISA device */
|
||||
struct isa_device {
|
||||
/** Generic device */
|
||||
struct device dev;
|
||||
/** I/O address */
|
||||
uint16_t ioaddr;
|
||||
/** Driver for this device */
|
||||
struct isa_driver *driver;
|
||||
/** Driver-private data
|
||||
*
|
||||
* Use isa_set_drvdata() and isa_get_drvdata() to access
|
||||
* this field.
|
||||
*/
|
||||
void *priv;
|
||||
/** Driver name */
|
||||
const char *driver_name;
|
||||
};
|
||||
|
||||
/*
|
||||
* An individual ISA device, identified by probe address
|
||||
*
|
||||
*/
|
||||
typedef uint16_t isa_probe_addr_t;
|
||||
|
||||
/** An ISA driver */
|
||||
struct isa_driver {
|
||||
/** Name */
|
||||
const char *name;
|
||||
/** Probe address list */
|
||||
isa_probe_addr_t *probe_addrs;
|
||||
/** Number of entries in probe address list */
|
||||
unsigned int addr_count;
|
||||
/** Manufacturer ID to be assumed for this device */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID to be assumed for this device */
|
||||
uint16_t prod_id;
|
||||
/**
|
||||
* Probe device
|
||||
*
|
||||
* @v isa ISA device
|
||||
* @v id Matching entry in ID table
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ( * probe ) ( struct isa_device *isa );
|
||||
/**
|
||||
* Remove device
|
||||
*
|
||||
* @v isa ISA device
|
||||
*/
|
||||
void ( * remove ) ( struct isa_device *isa );
|
||||
};
|
||||
|
||||
/** Declare an ISA driver */
|
||||
#define __isa_driver __table ( struct isa_driver, isa_drivers, 01 )
|
||||
|
||||
/**
|
||||
* Set ISA driver-private data
|
||||
*
|
||||
* @v isa ISA device
|
||||
* @v priv Private data
|
||||
*/
|
||||
static inline void isa_set_drvdata ( struct isa_device *isa, void *priv ) {
|
||||
isa->priv = priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISA driver-private data
|
||||
*
|
||||
* @v isa ISA device
|
||||
* @ret priv Private data
|
||||
*/
|
||||
static inline void * isa_get_drvdata ( struct isa_device *isa ) {
|
||||
return isa->priv;
|
||||
}
|
||||
|
||||
/*
|
||||
* ISA_ROM is parsed by parserom.pl to generate Makefile rules and
|
||||
* files for rom-o-matic.
|
||||
*
|
||||
*/
|
||||
#define ISA_ROM( IMAGE, DESCRIPTION )
|
||||
|
||||
#endif /* ISA_H */
|
||||
|
||||
49
src/include/gpxe/isa_ids.h
Normal file
49
src/include/gpxe/isa_ids.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef ISA_IDS_H
|
||||
#define ISA_IDS_H
|
||||
|
||||
/*
|
||||
* This file defines IDs as used by ISAPnP and EISA devices. These
|
||||
* IDs have the format:
|
||||
*
|
||||
* vendor byte 0 bit 7 must be zero
|
||||
* bits 6-2 first vendor char in compressed ASCII
|
||||
* bits 1-0 second vendor char in compressed ASCII (bits 4-3)
|
||||
* byte 1 bits 7-5 second vendor char in compressed ASCII (bits 2-0)
|
||||
* bits 4-0 third vendor char in compressed ASCII
|
||||
* product byte 0 bits 7-4 first hex digit of product number
|
||||
* bits 3-0 second hex digit of product number
|
||||
* byte 1 bits 7-4 third hex digit of product number
|
||||
* bits 3-0 hex digit of revision level
|
||||
*
|
||||
* ISA IDs are always expressed in little-endian order, even though
|
||||
* the underlying "meaning" is big-endian.
|
||||
*/
|
||||
|
||||
#include <byteswap.h>
|
||||
|
||||
/*
|
||||
* Construct a vendor ID from three ASCII characters
|
||||
*
|
||||
*/
|
||||
#define ISA_VENDOR( a, b, c ) \
|
||||
bswap_16 ( ( ( ( (a) - 'A' + 1 ) & 0x1f ) << 10 ) | \
|
||||
( ( ( (b) - 'A' + 1 ) & 0x1f ) << 5 ) | \
|
||||
( ( ( (c) - 'A' + 1 ) & 0x1f ) << 0 ) )
|
||||
|
||||
#define ISAPNP_VENDOR( a, b, c ) ISA_VENDOR ( a, b, c )
|
||||
#define EISA_VENDOR( a, b, c ) ISA_VENDOR ( a, b, c )
|
||||
|
||||
#define GENERIC_ISAPNP_VENDOR ISAPNP_VENDOR ( 'P','N','P' )
|
||||
|
||||
/*
|
||||
* Extract product ID and revision from combined product field
|
||||
*
|
||||
*/
|
||||
#define ISA_PROD_ID_MASK ( 0xf0ff )
|
||||
#define ISA_PROD_ID(product) ( (product) & ISA_PROD_ID_MASK )
|
||||
#define ISA_PROD_REV(product) ( ( (product) & ~ISA_PROD_ID_MASK ) >> 8 )
|
||||
|
||||
/* Functions in isa_ids.c */
|
||||
extern char * isa_id_string ( unsigned int vendor, unsigned int product );
|
||||
|
||||
#endif /* ISA_IDS_H */
|
||||
268
src/include/gpxe/isapnp.h
Normal file
268
src/include/gpxe/isapnp.h
Normal file
@@ -0,0 +1,268 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* isapnp.h -- Etherboot isapnp support for the 3Com 3c515
|
||||
* Written 2002-2003 by Timothy Legge <tlegge@rogers.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* Portions of this code:
|
||||
* Copyright (C) 2001 P.J.H.Fox (fox@roestock.demon.co.uk)
|
||||
*
|
||||
*
|
||||
*
|
||||
* REVISION HISTORY:
|
||||
* ================
|
||||
* Version 0.1 April 26, 2002 TJL
|
||||
* Version 0.2 01/08/2003 TJL Renamed from 3c515_isapnp.h
|
||||
*
|
||||
*
|
||||
* Generalised into an ISAPnP bus that can be used by more than just
|
||||
* the 3c515 by Michael Brown <mbrown@fensystems.co.uk>
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ISAPNP_H
|
||||
#define ISAPNP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/isa_ids.h>
|
||||
#include <gpxe/device.h>
|
||||
#include <gpxe/tables.h>
|
||||
|
||||
/*
|
||||
* ISAPnP constants
|
||||
*
|
||||
*/
|
||||
|
||||
/* Port addresses */
|
||||
#define ISAPNP_ADDRESS 0x279
|
||||
#define ISAPNP_WRITE_DATA 0xa79
|
||||
#define ISAPNP_READ_PORT_MIN 0x213 /* ISAPnP spec says 0x203, but
|
||||
* Linux ISAPnP starts at
|
||||
* 0x213 with no explanatory
|
||||
* comment. 0x203 probably
|
||||
* clashes with something. */
|
||||
#define ISAPNP_READ_PORT_MAX 0x3ff
|
||||
#define ISAPNP_READ_PORT_STEP 0x10 /* Can be any multiple of 4
|
||||
* according to the spec, but
|
||||
* since ISA I/O addresses are
|
||||
* allocated in blocks of 16,
|
||||
* it makes no sense to use
|
||||
* any value less than 16.
|
||||
*/
|
||||
|
||||
/* Registers */
|
||||
#define ISAPNP_READPORT 0x00
|
||||
#define ISAPNP_SERIALISOLATION 0x01
|
||||
#define ISAPNP_CONFIGCONTROL 0x02
|
||||
#define ISAPNP_WAKE 0x03
|
||||
#define ISAPNP_RESOURCEDATA 0x04
|
||||
#define ISAPNP_STATUS 0x05
|
||||
#define ISAPNP_CARDSELECTNUMBER 0x06
|
||||
#define ISAPNP_LOGICALDEVICENUMBER 0x07
|
||||
#define ISAPNP_ACTIVATE 0x30
|
||||
#define ISAPNP_IORANGECHECK 0x31
|
||||
#define ISAPNP_IOBASE(n) ( 0x60 + ( (n) * 2 ) )
|
||||
#define ISAPNP_IRQNO(n) ( 0x70 + ( (n) * 2 ) )
|
||||
#define ISAPNP_IRQTYPE(n) ( 0x71 + ( (n) * 2 ) )
|
||||
|
||||
/* Bits in the CONFIGCONTROL register */
|
||||
#define ISAPNP_CONFIG_RESET ( 1 << 0 )
|
||||
#define ISAPNP_CONFIG_WAIT_FOR_KEY ( 1 << 1 )
|
||||
#define ISAPNP_CONFIG_RESET_CSN ( 1 << 2 )
|
||||
#define ISAPNP_CONFIG_RESET_DRV ( ISAPNP_CONFIG_RESET | \
|
||||
ISAPNP_CONFIG_WAIT_FOR_KEY | \
|
||||
ISAPNP_CONFIG_RESET_CSN )
|
||||
|
||||
/* The LFSR used for the initiation key and for checksumming */
|
||||
#define ISAPNP_LFSR_SEED 0x6a
|
||||
|
||||
/* Small tags */
|
||||
#define ISAPNP_IS_SMALL_TAG(tag) ( ! ( (tag) & 0x80 ) )
|
||||
#define ISAPNP_SMALL_TAG_NAME(tag) ( ( (tag) >> 3 ) & 0xf )
|
||||
#define ISAPNP_SMALL_TAG_LEN(tag) ( ( (tag) & 0x7 ) )
|
||||
#define ISAPNP_TAG_PNPVERNO 0x01
|
||||
#define ISAPNP_TAG_LOGDEVID 0x02
|
||||
#define ISAPNP_TAG_COMPATDEVID 0x03
|
||||
#define ISAPNP_TAG_IRQ 0x04
|
||||
#define ISAPNP_TAG_DMA 0x05
|
||||
#define ISAPNP_TAG_STARTDEP 0x06
|
||||
#define ISAPNP_TAG_ENDDEP 0x07
|
||||
#define ISAPNP_TAG_IOPORT 0x08
|
||||
#define ISAPNP_TAG_FIXEDIO 0x09
|
||||
#define ISAPNP_TAG_RSVDSHORTA 0x0A
|
||||
#define ISAPNP_TAG_RSVDSHORTB 0x0B
|
||||
#define ISAPNP_TAG_RSVDSHORTC 0x0C
|
||||
#define ISAPNP_TAG_RSVDSHORTD 0x0D
|
||||
#define ISAPNP_TAG_VENDORSHORT 0x0E
|
||||
#define ISAPNP_TAG_END 0x0F
|
||||
/* Large tags */
|
||||
#define ISAPNP_IS_LARGE_TAG(tag) ( ( (tag) & 0x80 ) )
|
||||
#define ISAPNP_LARGE_TAG_NAME(tag) (tag)
|
||||
#define ISAPNP_TAG_MEMRANGE 0x81
|
||||
#define ISAPNP_TAG_ANSISTR 0x82
|
||||
#define ISAPNP_TAG_UNICODESTR 0x83
|
||||
#define ISAPNP_TAG_VENDORLONG 0x84
|
||||
#define ISAPNP_TAG_MEM32RANGE 0x85
|
||||
#define ISAPNP_TAG_FIXEDMEM32RANGE 0x86
|
||||
#define ISAPNP_TAG_RSVDLONG0 0xF0
|
||||
#define ISAPNP_TAG_RSVDLONG1 0xF1
|
||||
#define ISAPNP_TAG_RSVDLONG2 0xF2
|
||||
#define ISAPNP_TAG_RSVDLONG3 0xF3
|
||||
#define ISAPNP_TAG_RSVDLONG4 0xF4
|
||||
#define ISAPNP_TAG_RSVDLONG5 0xF5
|
||||
#define ISAPNP_TAG_RSVDLONG6 0xF6
|
||||
#define ISAPNP_TAG_RSVDLONG7 0xF7
|
||||
#define ISAPNP_TAG_RSVDLONG8 0xF8
|
||||
#define ISAPNP_TAG_RSVDLONG9 0xF9
|
||||
#define ISAPNP_TAG_RSVDLONGA 0xFA
|
||||
#define ISAPNP_TAG_RSVDLONGB 0xFB
|
||||
#define ISAPNP_TAG_RSVDLONGC 0xFC
|
||||
#define ISAPNP_TAG_RSVDLONGD 0xFD
|
||||
#define ISAPNP_TAG_RSVDLONGE 0xFE
|
||||
#define ISAPNP_TAG_RSVDLONGF 0xFF
|
||||
#define ISAPNP_TAG_PSEUDO_NEWBOARD 0x100
|
||||
|
||||
/** An ISAPnP serial identifier */
|
||||
struct isapnp_identifier {
|
||||
/** Vendor ID */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID */
|
||||
uint16_t prod_id;
|
||||
/** Serial number */
|
||||
uint32_t serial;
|
||||
/** Checksum */
|
||||
uint8_t checksum;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** An ISAPnP logical device ID structure */
|
||||
struct isapnp_logdevid {
|
||||
/** Vendor ID */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID */
|
||||
uint16_t prod_id;
|
||||
/** Flags */
|
||||
uint16_t flags;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** An ISAPnP device ID list entry */
|
||||
struct isapnp_device_id {
|
||||
/** Name */
|
||||
const char *name;
|
||||
/** Vendor ID */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID */
|
||||
uint16_t prod_id;
|
||||
};
|
||||
|
||||
/** An ISAPnP device */
|
||||
struct isapnp_device {
|
||||
/** Generic device */
|
||||
struct device dev;
|
||||
/** Vendor ID */
|
||||
uint16_t vendor_id;
|
||||
/** Product ID */
|
||||
uint16_t prod_id;
|
||||
/** I/O address */
|
||||
uint16_t ioaddr;
|
||||
/** Interrupt number */
|
||||
uint8_t irqno;
|
||||
/** Card Select Number */
|
||||
uint8_t csn;
|
||||
/** Logical Device ID */
|
||||
uint8_t logdev;
|
||||
/** Driver for this device */
|
||||
struct isapnp_driver *driver;
|
||||
/** Driver-private data
|
||||
*
|
||||
* Use isapnp_set_drvdata() and isapnp_get_drvdata() to access
|
||||
* this field.
|
||||
*/
|
||||
void *priv;
|
||||
/** Driver name */
|
||||
const char *driver_name;
|
||||
};
|
||||
|
||||
/** An ISAPnP driver */
|
||||
struct isapnp_driver {
|
||||
/** ISAPnP ID table */
|
||||
struct isapnp_device_id *ids;
|
||||
/** Number of entries in ISAPnP ID table */
|
||||
unsigned int id_count;
|
||||
/**
|
||||
* Probe device
|
||||
*
|
||||
* @v isapnp ISAPnP device
|
||||
* @v id Matching entry in ID table
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ( * probe ) ( struct isapnp_device *isapnp,
|
||||
const struct isapnp_device_id *id );
|
||||
/**
|
||||
* Remove device
|
||||
*
|
||||
* @v isapnp ISAPnP device
|
||||
*/
|
||||
void ( * remove ) ( struct isapnp_device *isapnp );
|
||||
};
|
||||
|
||||
/** Declare an ISAPnP driver */
|
||||
#define __isapnp_driver __table ( struct isapnp_driver, isapnp_drivers, 01 )
|
||||
|
||||
extern uint16_t isapnp_read_port;
|
||||
|
||||
extern void isapnp_device_activation ( struct isapnp_device *isapnp,
|
||||
int activation );
|
||||
|
||||
/**
|
||||
* Activate ISAPnP device
|
||||
*
|
||||
* @v isapnp ISAPnP device
|
||||
*/
|
||||
static inline void activate_isapnp_device ( struct isapnp_device *isapnp ) {
|
||||
isapnp_device_activation ( isapnp, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate ISAPnP device
|
||||
*
|
||||
* @v isapnp ISAPnP device
|
||||
*/
|
||||
static inline void deactivate_isapnp_device ( struct isapnp_device *isapnp ) {
|
||||
isapnp_device_activation ( isapnp, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ISAPnP driver-private data
|
||||
*
|
||||
* @v isapnp ISAPnP device
|
||||
* @v priv Private data
|
||||
*/
|
||||
static inline void isapnp_set_drvdata ( struct isapnp_device *isapnp,
|
||||
void *priv ) {
|
||||
isapnp->priv = priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISAPnP driver-private data
|
||||
*
|
||||
* @v isapnp ISAPnP device
|
||||
* @ret priv Private data
|
||||
*/
|
||||
static inline void * isapnp_get_drvdata ( struct isapnp_device *isapnp ) {
|
||||
return isapnp->priv;
|
||||
}
|
||||
|
||||
#endif /* ISAPNP_H */
|
||||
103
src/include/gpxe/mca.h
Normal file
103
src/include/gpxe/mca.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* MCA bus driver code
|
||||
*
|
||||
* Abstracted from 3c509.c.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MCA_H
|
||||
#define MCA_H
|
||||
|
||||
#include <gpxe/isa_ids.h>
|
||||
#include <gpxe/device.h>
|
||||
#include <gpxe/tables.h>
|
||||
|
||||
/*
|
||||
* MCA constants
|
||||
*
|
||||
*/
|
||||
#define MCA_MOTHERBOARD_SETUP_REG 0x94
|
||||
#define MCA_ADAPTER_SETUP_REG 0x96
|
||||
#define MCA_MAX_SLOT_NR 0x07 /* Must be 2^n - 1 */
|
||||
#define MCA_POS_REG(n) (0x100+(n))
|
||||
|
||||
/* Is there a standard that would define this? */
|
||||
#define GENERIC_MCA_VENDOR ISA_VENDOR ( 'M', 'C', 'A' )
|
||||
|
||||
/** An MCA device ID list entry */
|
||||
struct mca_device_id {
|
||||
/** Name */
|
||||
const char *name;
|
||||
/** Device ID */
|
||||
uint16_t id;
|
||||
};
|
||||
|
||||
/** An MCA device */
|
||||
struct mca_device {
|
||||
/** Generic device */
|
||||
struct device dev;
|
||||
/** Slot number */
|
||||
unsigned int slot;
|
||||
/** POS register values */
|
||||
unsigned char pos[8];
|
||||
/** Driver for this device */
|
||||
struct mca_driver *driver;
|
||||
/** Driver-private data
|
||||
*
|
||||
* Use mca_set_drvdata() and mca_get_drvdata() to access
|
||||
* this field.
|
||||
*/
|
||||
void *priv;
|
||||
/** Driver name */
|
||||
const char *driver_name;
|
||||
};
|
||||
|
||||
#define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )
|
||||
|
||||
/** An MCA driver */
|
||||
struct mca_driver {
|
||||
/** MCA ID table */
|
||||
struct mca_device_id *ids;
|
||||
/** Number of entries in MCA ID table */
|
||||
unsigned int id_count;
|
||||
/**
|
||||
* Probe device
|
||||
*
|
||||
* @v mca MCA device
|
||||
* @v id Matching entry in ID table
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ( * probe ) ( struct mca_device *mca,
|
||||
const struct mca_device_id *id );
|
||||
/**
|
||||
* Remove device
|
||||
*
|
||||
* @v mca MCA device
|
||||
*/
|
||||
void ( * remove ) ( struct mca_device *mca );
|
||||
};
|
||||
|
||||
/** Declare an MCA driver */
|
||||
#define __mca_driver __table ( struct mca_driver, mca_drivers, 01 )
|
||||
|
||||
/**
|
||||
* Set MCA driver-private data
|
||||
*
|
||||
* @v mca MCA device
|
||||
* @v priv Private data
|
||||
*/
|
||||
static inline void mca_set_drvdata ( struct mca_device *mca, void *priv ) {
|
||||
mca->priv = priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MCA driver-private data
|
||||
*
|
||||
* @v mca MCA device
|
||||
* @ret priv Private data
|
||||
*/
|
||||
static inline void * mca_get_drvdata ( struct mca_device *mca ) {
|
||||
return mca->priv;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user