#include <stdint.h>#include <string.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <gpxe/io.h>#include <unistd.h>#include <gpxe/eisa.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static void | eisabus_remove (struct root_device *rootdev) |
| Remove EISA root bus. | |
| void | eisa_device_enabled (struct eisa_device *eisa, int enabled) |
| Reset and enable/disable an EISA device. | |
| static int | eisa_probe (struct eisa_device *eisa) |
| Probe an EISA device. | |
| static void | eisa_remove (struct eisa_device *eisa) |
| Remove an EISA device. | |
| static int | eisabus_probe (struct root_device *rootdev) |
| Probe EISA root bus. | |
Variables | |
| static struct root_driver | eisa_root_driver |
| EISA bus root device driver. | |
| struct root_device eisa_root_device | __root_device |
| EISA bus root device. | |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static void eisabus_remove | ( | struct root_device * | rootdev | ) | [static] |
Remove EISA root bus.
| rootdev | EISA bus root device |
Definition at line 160 of file eisa.c.
References device::children, eisa_device::dev, root_device::dev, eisa_remove(), free(), list_del, list_for_each_entry_safe, and device::siblings.
Referenced by eisabus_probe().
00160 { 00161 struct eisa_device *eisa; 00162 struct eisa_device *tmp; 00163 00164 list_for_each_entry_safe ( eisa, tmp, &rootdev->dev.children, 00165 dev.siblings ) { 00166 eisa_remove ( eisa ); 00167 list_del ( &eisa->dev.siblings ); 00168 free ( eisa ); 00169 } 00170 }
| void eisa_device_enabled | ( | struct eisa_device * | eisa, | |
| int | enabled | |||
| ) |
Reset and enable/disable an EISA device.
| eisa | EISA device | |
| enabled | 1=enable, 0=disable |
Definition at line 20 of file eisa.c.
References DBG, EISA_CMD_ENABLE, EISA_CMD_RESET, EISA_GLOBAL_CONFIG, eisa_device::ioaddr, outb, eisa_device::slot, and udelay().
Referenced by disable_eisa_device(), and enable_eisa_device().
00020 { 00021 /* Set reset line high for 1000 µs. Spec says 500 µs, but 00022 * this doesn't work for all cards, so we are conservative. 00023 */ 00024 outb ( EISA_CMD_RESET, eisa->ioaddr + EISA_GLOBAL_CONFIG ); 00025 udelay ( 1000 ); /* Must wait 800 */ 00026 00027 /* Set reset low and write a 1 to ENABLE. Delay again, in 00028 * case the card takes a while to wake up. 00029 */ 00030 outb ( enabled ? EISA_CMD_ENABLE : 0, 00031 eisa->ioaddr + EISA_GLOBAL_CONFIG ); 00032 udelay ( 1000 ); /* Must wait 800 */ 00033 00034 DBG ( "EISA %s device %02x\n", ( enabled ? "enabled" : "disabled" ), 00035 eisa->slot ); 00036 }
| static int eisa_probe | ( | struct eisa_device * | eisa | ) | [static] |
Probe an EISA device.
| eisa | EISA device |
| rc | Return status code |
Definition at line 47 of file eisa.c.
References DBG, eisa_device::driver, eisa_device::driver_name, EISA_DRIVERS, ENOTTY, for_each_table_entry, id, eisa_driver::id_count, eisa_driver::ids, eisa_device::ioaddr, isa_id_string(), ISA_PROD_ID, eisa_driver::probe, eisa_device_id::prod_id, eisa_device::prod_id, eisa_device::slot, eisa_device_id::vendor_id, and eisa_device::vendor_id.
Referenced by eisabus_probe().
00047 { 00048 struct eisa_driver *driver; 00049 struct eisa_device_id *id; 00050 unsigned int i; 00051 int rc; 00052 00053 DBG ( "Adding EISA device %02x (%04x:%04x (\"%s\") io %x)\n", 00054 eisa->slot, eisa->vendor_id, eisa->prod_id, 00055 isa_id_string ( eisa->vendor_id, eisa->prod_id ), eisa->ioaddr ); 00056 00057 for_each_table_entry ( driver, EISA_DRIVERS ) { 00058 for ( i = 0 ; i < driver->id_count ; i++ ) { 00059 id = &driver->ids[i]; 00060 if ( id->vendor_id != eisa->vendor_id ) 00061 continue; 00062 if ( ISA_PROD_ID ( id->prod_id ) != 00063 ISA_PROD_ID ( eisa->prod_id ) ) 00064 continue; 00065 eisa->driver = driver; 00066 eisa->driver_name = id->name; 00067 DBG ( "...using driver %s\n", eisa->driver_name ); 00068 if ( ( rc = driver->probe ( eisa, id ) ) != 0 ) { 00069 DBG ( "......probe failed\n" ); 00070 continue; 00071 } 00072 return 0; 00073 } 00074 } 00075 00076 DBG ( "...no driver found\n" ); 00077 return -ENOTTY; 00078 }
| static void eisa_remove | ( | struct eisa_device * | eisa | ) | [static] |
Remove an EISA device.
| eisa | EISA device |
Definition at line 85 of file eisa.c.
References DBG, eisa_device::driver, eisa_driver::remove, and eisa_device::slot.
Referenced by eisabus_remove().
00085 { 00086 eisa->driver->remove ( eisa ); 00087 DBG ( "Removed EISA device %02x\n", eisa->slot ); 00088 }
| static int eisabus_probe | ( | struct root_device * | rootdev | ) | [static] |
Probe EISA root bus.
| rootdev | EISA bus root device |
Definition at line 98 of file eisa.c.
References device_description::bus_type, BUS_TYPE_EISA, device::children, device::desc, root_device::dev, eisa_device::dev, device_description::device, EISA_MAX_SLOT, EISA_MIN_SLOT, eisa_probe(), EISA_PROD_ID, EISA_SLOT_BASE, EISA_VENDOR_ID, eisabus_remove(), ENOMEM, free(), INIT_LIST_HEAD, inw, eisa_device::ioaddr, le16_to_cpu, list_add, list_del, malloc(), memset(), device::name, NULL, outb, device::parent, eisa_device::prod_id, device::siblings, eisa_device::slot, snprintf(), device_description::vendor, and eisa_device::vendor_id.
00098 { 00099 struct eisa_device *eisa = NULL; 00100 unsigned int slot; 00101 int rc; 00102 00103 for ( slot = EISA_MIN_SLOT ; slot <= EISA_MAX_SLOT ; slot++ ) { 00104 /* Allocate struct eisa_device */ 00105 if ( ! eisa ) 00106 eisa = malloc ( sizeof ( *eisa ) ); 00107 if ( ! eisa ) { 00108 rc = -ENOMEM; 00109 goto err; 00110 } 00111 memset ( eisa, 0, sizeof ( *eisa ) ); 00112 eisa->slot = slot; 00113 eisa->ioaddr = EISA_SLOT_BASE ( eisa->slot ); 00114 00115 /* Test for board present */ 00116 outb ( 0xff, eisa->ioaddr + EISA_VENDOR_ID ); 00117 eisa->vendor_id = 00118 le16_to_cpu ( inw ( eisa->ioaddr + EISA_VENDOR_ID ) ); 00119 eisa->prod_id = 00120 le16_to_cpu ( inw ( eisa->ioaddr + EISA_PROD_ID ) ); 00121 if ( eisa->vendor_id & 0x80 ) { 00122 /* No board present */ 00123 continue; 00124 } 00125 00126 /* Add to device hierarchy */ 00127 snprintf ( eisa->dev.name, sizeof ( eisa->dev.name ), 00128 "EISA%02x", slot ); 00129 eisa->dev.desc.bus_type = BUS_TYPE_EISA; 00130 eisa->dev.desc.vendor = eisa->vendor_id; 00131 eisa->dev.desc.device = eisa->prod_id; 00132 eisa->dev.parent = &rootdev->dev; 00133 list_add ( &eisa->dev.siblings, &rootdev->dev.children ); 00134 INIT_LIST_HEAD ( &eisa->dev.children ); 00135 00136 /* Look for a driver */ 00137 if ( eisa_probe ( eisa ) == 0 ) { 00138 /* eisadev registered, we can drop our ref */ 00139 eisa = NULL; 00140 } else { 00141 /* Not registered; re-use struct */ 00142 list_del ( &eisa->dev.siblings ); 00143 } 00144 } 00145 00146 free ( eisa ); 00147 return 0; 00148 00149 err: 00150 free ( eisa ); 00151 eisabus_remove ( rootdev ); 00152 return rc; 00153 }
struct root_driver eisa_root_driver [static] |
| struct root_device eisa_root_device __root_device |
1.5.7.1