85 #define ISAPNP_CARD_ID_FMT "ID %04x:%04x (\"%s\") serial %x" 86 #define ISAPNP_CARD_ID_DATA(identifier) \ 87 (identifier)->vendor_id, (identifier)->prod_id, \ 88 isa_id_string ( (identifier)->vendor_id, (identifier)->prod_id ), \ 90 #define ISAPNP_DEV_ID_FMT "ID %04x:%04x (\"%s\")" 91 #define ISAPNP_DEV_ID_DATA(isapnp) \ 92 (isapnp)->vendor_id, (isapnp)->prod_id, \ 93 isa_id_string ( (isapnp)->vendor_id, (isapnp)->prod_id ) 108 unsigned int value ) {
237 unsigned int input_bit ) {
240 lfsr_next = lfsr >> 1;
241 lfsr_next |= ( ( ( lfsr ^ lfsr_next ) ^ input_bit ) ) << 7;
260 for ( i = 0 ; i < 32 ; i++ ) {
278 for ( i = 0 ; i < 8 ; i++ ) {
279 byte = * ( ( (
uint8_t * ) identifier ) + i );
280 for ( j = 0 ; j < 8 ; j++ ) {
297 for ( i = 0 ; i < 20 ; i++ ) {
321 for ( i = 0 ; i <
len ; i++) {
341 unsigned int tag_len;
343 DBG2 (
"ISAPnP read tag" );
354 DBG2 (
" %02x (%02x)",
tag, tag_len );
355 if (
tag == wanted_tag ) {
381 for ( i = 0 ; i <= logdev ; i++ ) {
383 sizeof ( *logdevid ) ) ) != 0 )
403 unsigned int seen_55aa, seen_life;
404 unsigned int csn = 0;
408 DBG (
"ISAPnP attempting isolation at read port %04x\n",
443 memset ( &identifier, 0,
sizeof ( identifier ) );
444 seen_55aa = seen_life = 0;
445 for ( i = 0 ; i < 9 ; i++ ) {
447 for ( j = 0 ; j < 8 ; j++ ) {
453 if (
data != 0xffff ) {
455 if (
data == 0x55aa ) {
461 *( ( (
uint8_t * ) &identifier ) + i ) =
byte;
467 DBG (
"ISAPnP found no more cards\n" );
470 DBG (
"ISAPnP saw life but no cards, " 471 "trying new read port\n" );
474 DBG (
"ISAPnP saw no signs of life, " 475 "abandoning isolation\n" );
483 DBG (
"ISAPnP found malformed card " 485 "(should be %02x), trying new read port\n",
496 ", assigning CSN %02x\n",
514 DBG (
"ISAPnP found %d cards at read port %04x\n",
569 DBG (
"ISAPnP %s device %02x:%02x\n",
570 ( activation ?
"activated" :
"deactivated" ),
589 DBG (
"Adding ISAPnP device %02x:%02x (%04x:%04x (\"%s\") " 590 "io %x irq %d)\n", isapnp->
csn, isapnp->
logdev,
596 for ( i = 0 ; i < driver->
id_count ; i++ ) {
597 id = &driver->
ids[i];
606 if ( (
rc = driver->
probe ( isapnp,
id ) ) != 0 ) {
607 DBG (
"......probe failed\n" );
614 DBG (
"...no driver found\n" );
625 DBG (
"Removed ISAPnP device %02x:%02x\n",
649 for ( csn = 1 ; csn <= 0xff ; csn++ ) {
650 for ( logdev = 0 ; logdev <= 0xff ; logdev++ ) {
654 isapnp =
malloc (
sizeof ( *isapnp ) );
659 memset ( isapnp, 0,
sizeof ( *isapnp ) );
669 isapnp_peek ( &identifier,
sizeof ( identifier ) );
697 "ISAPnP%02x:%02x", csn, logdev );
struct device dev
Generic device.
int(* probe)(struct isapnp_device *isapnp, const struct isapnp_device_id *id)
Probe device.
struct arbelprm_rc_send_wqe rc
unsigned int id_count
Number of entries in ISAPnP ID table.
struct root_device isapnp_root_device __root_device
ISAPnP bus root device.
#define ISAPNP_WRITE_DATA
static unsigned int isapnp_read_iobase(unsigned int index)
static unsigned int isapnp_peek_byte(void)
static void isapnp_wake(uint8_t csn)
Place a specified card into the Config state.
static void isapnp_write_address(unsigned int address)
static struct root_driver isapnp_root_driver
ISAPnP bus root device driver.
#define list_add(new, head)
Add a new entry to the head of a list.
uint16_t vendor_id
Vendor ID.
An ISAPnP device ID list entry.
static void isapnp_write_byte(unsigned int address, unsigned int value)
uint64_t address
Base address.
unsigned long ioaddr
I/O address.
void(* remove)(struct isapnp_device *isapnp)
Remove device.
uint16_t prod_id
Product ID.
An ISAPnP logical device ID structure.
#define ISAPNP_CONFIGCONTROL
#define ISAPNP_SMALL_TAG_NAME(tag)
#define ISAPNP_CARD_ID_DATA(identifier)
#define ISAPNP_TAG_LOGDEVID
#define ENOENT
No such file or directory.
static int isapnp_probe(struct isapnp_device *isapnp)
Probe an ISAPnP device.
uint16_t ioaddr
I/O address.
#define ISAPNP_CONFIG_RESET_CSN
struct device dev
Device chain.
char * isa_id_string(unsigned int vendor, unsigned int product)
unsigned int vendor
Vendor ID.
struct device * parent
Bus device.
struct isapnp_device_id * ids
ISAPnP ID table.
static unsigned int isapnp_read_status(void)
#define ISAPNP_READ_PORT_MAX
static unsigned int isapnp_read_resourcedata(void)
#define list_del(list)
Delete an entry from a list.
#define ENOMEM
Not enough space.
uint16_t prod_id
Product ID.
#define ISAPNP_CARD_ID_FMT
#define ISAPNP_LOGICALDEVICENUMBER
uint16_t vendor_id
Vendor ID.
static int isapnpbus_probe(struct root_device *rootdev)
Probe ISAPnP root bus.
#define ISAPNP_SMALL_TAG_LEN(tag)
static void isapnp_set_read_port(void)
Inform cards of a new read port address.
#define ISAPNP_LARGE_TAG_NAME(tag)
pseudo_bit_t value[0x00020]
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
struct isapnp_driver * driver
Driver for this device.
static int isapnp_try_isolate(void)
Try isolating ISAPnP cards at the current read port.
static void isapnpbus_remove(struct root_device *rootdev)
Remove ISAPnP root bus.
#define ISAPNP_IS_SMALL_TAG(tag)
#define ISAPNP_READ_PORT_START
const char * driver_name
Driver name.
void isapnp_device_activation(struct isapnp_device *isapnp, int activation)
Activate or deactivate an ISAPnP device.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
uint8_t id
Request identifier.
static void isapnp_deactivate(unsigned int logdev)
static void isapnp_reset_csn(void)
Reset (i.e.
static unsigned int isapnp_read_data(void)
static unsigned int isapnp_read_word(unsigned int address)
static void(* free)(struct refcnt *refcnt))
static void isapnp_delay(void)
struct list_head siblings
Devices on the same bus.
static void isapnp_write_data(unsigned int data)
uint16_t isapnp_read_port
ISAPnP Read Port address.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
static void isapnp_isolate(void)
Find a valid read port and isolate all ISAPnP cards.
#define ISAPNP_DRIVERS
ISAPnP driver table.
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ISAPNP_RESOURCEDATA
int(* probe)(struct root_device *rootdev)
Add root device.
#define ISAPNP_READ_PORT_STEP
void * malloc(size_t size)
Allocate memory.
static void isapnp_peek(void *buf, size_t len)
Read resource data.
static int isapnp_find_logdevid(unsigned int logdev, struct isapnp_logdevid *logdevid)
Find specified Logical Device ID tag.
uint8_t irqno
Interrupt number.
#define INIT_LIST_HEAD(list)
Initialise a list head.
uint16_t vendor_id
Vendor ID.
#define ISA_PROD_ID(product)
#define outb(data, io_addr)
unsigned int bus_type
Bus type.
#define ISAPNP_CARDSELECTNUMBER
static int isapnp_find_tag(unsigned int wanted_tag, void *buf, size_t len)
Find a tag within the resource data.
#define ENOTTY
Inappropriate I/O control operation.
static void isapnp_logicaldevice(unsigned int logdev)
unsigned int device
Device ID.
static void isapnp_write_csn(unsigned int csn)
Assign a Card Select Number to a card, and enter the Config state.
struct list_head children
Devices attached to this device.
static void isapnp_serialisolation(void)
Enter the Isolation state.
static void isapnp_wait_for_key(void)
Enter the Wait for Key state.
static void isapnp_remove(struct isapnp_device *isapnp)
Remove an ISAPnP device.
#define ISAPNP_SERIALISOLATION
An ISAPnP serial identifier.
uint8_t data[48]
Additional event data.
struct device_description desc
Device description.
static unsigned int isapnp_checksum(struct isapnp_identifier *identifier)
Compute ISAPnP identifier checksum.
static unsigned int isapnp_read_byte(unsigned int address)
static void isapnp_send_key(void)
Send the ISAPnP initiation key.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
uint8_t csn
Card Select Number.
uint8_t logdev
Logical Device ID.
static void isapnp_activate(unsigned int logdev)
#define DBG(...)
Print a debugging message.
static unsigned int isapnp_read_irqno(unsigned int index)
uint64_t tag
Identity tag.
#define ISAPNP_CONFIG_WAIT_FOR_KEY
#define NULL
NULL pointer (VOID *)
struct bofm_section_header done
static unsigned int isapnp_lfsr_next(unsigned int lfsr, unsigned int input_bit)
Linear feedback shift register.
#define BUS_TYPE_ISAPNP
ISAPnP bus type.
uint8_t checksum
Checksum.
FILE_LICENCE(GPL2_OR_LATER)
void * memset(void *dest, int character, size_t len) __nonnull