Updated all common buses to new API.

This commit is contained in:
Michael Brown
2005-04-22 02:28:16 +00:00
parent 4e3ebba8e6
commit 924143661a
9 changed files with 542 additions and 371 deletions

View File

@@ -1,8 +1,9 @@
#ifndef EISA_H
#define EISA_H
#include "stdint.h"
#include "isa_ids.h"
#include "dev.h"
#include "nic.h"
/*
* EISA constants
@@ -10,7 +11,7 @@
*/
#define EISA_MIN_SLOT (0x1)
#define EISA_MAX_SLOT (0xf)
#define EISA_MAX_SLOT (0xf) /* Must be 2^n - 1 */
#define EISA_SLOT_BASE( n ) ( 0x1000 * (n) )
#define EISA_MFG_ID_HI ( 0xc80 )
@@ -22,18 +23,24 @@
#define EISA_CMD_RESET ( 1 << 2 )
#define EISA_CMD_ENABLE ( 1 << 0 )
/*
* A location on an EISA bus
*
*/
struct eisa_loc {
unsigned int slot;
};
/*
* A physical EISA device
*
*/
struct eisa_device {
char *magic; /* must be first */
const char *name;
unsigned int slot;
uint16_t ioaddr;
uint16_t mfg_id;
uint16_t prod_id;
int already_tried;
};
/*
@@ -59,20 +66,22 @@ struct eisa_driver {
* Define an EISA driver
*
*/
#define EISA_DRIVER( driver_name, eisa_ids ) { \
.name = driver_name, \
.ids = eisa_ids, \
.id_count = sizeof ( eisa_ids ) / sizeof ( eisa_ids[0] ), \
#define EISA_DRIVER( _ids ) { \
.ids = _ids, \
.id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \
}
/*
* Functions in eisa.c
*
*/
extern int find_eisa_device ( struct eisa_device *eisa,
struct eisa_driver *driver );
extern int find_eisa_boot_device ( struct dev *dev,
struct eisa_driver *driver );
extern void enable_eisa_device ( struct eisa_device *eisa );
extern void fill_eisa_nic ( struct nic *nic, struct eisa_device *eisa );
/*
* EISA bus global definition
*
*/
extern struct bus_driver eisa_driver;
#endif /* EISA_H */

View File

@@ -1,18 +1,29 @@
#ifndef ISA_H
#define ISA_H
#include "stdint.h"
#include "isa_ids.h"
#include "dev.h"
#include "nic.h"
/*
* A location on an ISA bus
*
*/
struct isa_loc {
unsigned int probe_idx;
};
#define ISA_MAX_PROBE_IDX 255 /* Unlikely to ever be more than ~20 */
/*
* A physical ISA device
*
*/
struct isa_device {
char *magic; /* must be first */
unsigned int probe_idx;
const char *name;
unsigned int driver_probe_idx;
uint16_t ioaddr;
int already_tried;
uint16_t mfg_id;
uint16_t prod_id;
};
/*
@@ -41,8 +52,7 @@ struct isa_driver {
* Define an ISA driver
*
*/
#define ISA_DRIVER( _name, _probe_addrs, _probe_addr, _mfg_id, _prod_id ) { \
.name = _name, \
#define ISA_DRIVER( _probe_addrs, _probe_addr, _mfg_id, _prod_id ) { \
.probe_addrs = _probe_addrs, \
.addr_count = sizeof ( _probe_addrs ) / sizeof ( _probe_addrs[0] ), \
.probe_addr = _probe_addr, \
@@ -61,10 +71,13 @@ struct isa_driver {
* Functions in isa.c
*
*/
extern int find_isa_device ( struct isa_device *eisa,
struct isa_driver *driver );
extern int find_isa_boot_device ( struct dev *dev,
struct isa_driver *driver );
extern void fill_isa_nic ( struct nic *nic, struct isa_device *isa );
/*
* ISA bus global definition
*
*/
extern struct bus_driver isa_driver;
#endif /* ISA_H */

View File

@@ -36,8 +36,9 @@
#ifndef ISAPNP_H
#define ISAPNP_H
#include "stdint.h"
#include "nic.h"
#include "isa_ids.h"
#include "dev.h"
/*
* ISAPnP constants
@@ -154,12 +155,20 @@ struct isapnp_logdevid {
uint16_t flags;
} __attribute__ (( packed ));
/*
* A location on an ISAPnP bus
*
*/
struct isapnp_loc {
uint8_t csn;
uint8_t logdev;
};
/*
* A physical ISAPnP device
*
*/
struct isapnp_device {
char *magic; /* must be first */
const char *name;
uint8_t csn;
uint8_t logdev;
@@ -167,7 +176,6 @@ struct isapnp_device {
uint16_t prod_id;
uint16_t ioaddr;
uint8_t irqno;
int already_tried;
};
/*
@@ -184,7 +192,6 @@ struct isapnp_id {
*
*/
struct isapnp_driver {
const char *name;
struct isapnp_id *ids;
unsigned int id_count;
};
@@ -193,21 +200,29 @@ struct isapnp_driver {
* Define an ISAPnP driver
*
*/
#define ISAPNP_DRIVER( driver_name, isapnp_ids ) { \
.name = driver_name, \
.ids = isapnp_ids, \
.id_count = sizeof ( isapnp_ids ) / sizeof ( isapnp_ids[0] ), \
#define ISAPNP_DRIVER( _ids ) { \
.ids = _ids, \
.id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \
}
/*
* Functions in isapnp.c
*
*/
extern int find_isapnp_device ( struct isapnp_device *isapnp,
struct isapnp_driver *driver );
extern int find_isapnp_boot_device ( struct dev *dev,
struct isapnp_driver *driver );
extern void activate_isapnp_device ( struct isapnp_device *isapnp,
int active );
extern void isapnp_fill_nic ( struct nic *nic, struct isapnp_device *isapnp );
/*
* ISAPnP bus global definition
*
*/
extern struct bus_driver isapnp_driver;
/*
* ISAPnP read port. ROM prefix may be able to set this address.
*
*/
extern uint16_t isapnp_read_port;
#endif /* ISAPNP_H */

View File

@@ -20,22 +20,28 @@
#define MCA_MOTHERBOARD_SETUP_REG 0x94
#define MCA_ADAPTER_SETUP_REG 0x96
#define MCA_MAX_SLOT_NR 8
#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' )
/*
* A location on an MCA bus
*
*/
struct mca_loc {
unsigned int slot;
};
/*
* A physical MCA device
*
*/
struct mca_device {
char *magic; /* must be first */
const char *name;
unsigned int slot;
unsigned char pos[8];
int already_tried;
};
#define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )
@@ -53,7 +59,6 @@ struct mca_id {
*
*/
struct mca_driver {
const char *name;
struct mca_id *ids;
unsigned int id_count;
};
@@ -62,18 +67,15 @@ struct mca_driver {
* Define an MCA driver
*
*/
#define MCA_DRIVER( driver_name, mca_ids ) { \
.name = driver_name, \
.ids = mca_ids, \
.id_count = sizeof ( mca_ids ) / sizeof ( mca_ids[0] ), \
#define MCA_DRIVER( _ids ) { \
.ids = _ids, \
.id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \
}
/*
* Functions in mca.c
* MCA bus global definition
*
*/
extern int find_mca_device ( struct mca_device *mca,
struct mca_driver *driver );
extern int find_mca_boot_device ( struct dev *dev, struct mca_driver *driver );
extern struct bus_driver mca_driver;
#endif