static int get_mca_info(char *page, char **start, off_t off, int count, int *eof, void *data) { int i, len = 0; if(MCA_bus) { struct mca_device *mca_dev; /* Format POS registers of eight MCA slots */ for(i=0; i<MCA_MAX_SLOT_NR; i++) { mca_dev = mca_find_device_by_slot(i); len += sprintf(page+len, "Slot %d: ", i+1); len = get_mca_info_helper(mca_dev, page, len); } /* Format POS registers of integrated video subsystem */ mca_dev = mca_find_device_by_slot(MCA_INTEGVIDEO); len += sprintf(page+len, "Video : "); len = get_mca_info_helper(mca_dev, page, len); /* Format POS registers of integrated SCSI subsystem */ mca_dev = mca_find_device_by_slot(MCA_INTEGSCSI); len += sprintf(page+len, "SCSI : "); len = get_mca_info_helper(mca_dev, page, len); /* Format POS registers of motherboard */ mca_dev = mca_find_device_by_slot(MCA_MOTHERBOARD); len += sprintf(page+len, "Planar: "); len = get_mca_info_helper(mca_dev, page, len); } else { /* Leave it empty if MCA not detected - this should *never* * happen! */ } if (len <= off+count) *eof = 1; *start = page + off; len -= off; if (len>count) len = count; if (len<0) len = 0; return len; }
void mca_set_adapter_name(int slot, char* name) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return; mca_device_set_name(mca_dev, name); }
void mca_mark_as_unused(int slot) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return; mca_device_set_claim(mca_dev, 0); }
void mca_write_pos(int slot, int reg, unsigned char byte) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return; mca_device_write_pos(mca_dev, reg, byte); }
unsigned char mca_read_pos(int slot, int reg) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return 0; return mca_device_read_pos(mca_dev, reg); }
static int get_mca_info(char *page, char **start, off_t off, int count, int *eof, void *data) { int i, len = 0; if(MCA_bus) { struct mca_device *mca_dev; for(i=0; i<MCA_MAX_SLOT_NR; i++) { mca_dev = mca_find_device_by_slot(i); len += sprintf(page+len, "Slot %d: ", i+1); len = get_mca_info_helper(mca_dev, page, len); } mca_dev = mca_find_device_by_slot(MCA_INTEGVIDEO); len += sprintf(page+len, "Video : "); len = get_mca_info_helper(mca_dev, page, len); mca_dev = mca_find_device_by_slot(MCA_INTEGSCSI); len += sprintf(page+len, "SCSI : "); len = get_mca_info_helper(mca_dev, page, len); mca_dev = mca_find_device_by_slot(MCA_MOTHERBOARD); len += sprintf(page+len, "Planar: "); len = get_mca_info_helper(mca_dev, page, len); } else { } if (len <= off+count) *eof = 1; *start = page + off; len -= off; if (len>count) len = count; if (len<0) len = 0; return len; }
void mca_set_adapter_procfn(int slot, MCA_ProcFn procfn, void* proc_dev) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return; mca_dev->procfn = procfn; mca_dev->proc_dev = proc_dev; }
int mca_mark_as_used(int slot) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return 1; if(mca_device_claimed(mca_dev)) return 1; mca_device_set_claim(mca_dev, 1); return 0; }
int mca_mark_as_used(int slot) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) /* FIXME: this is actually a severe error */ return 1; if(mca_device_claimed(mca_dev)) return 1; mca_device_set_claim(mca_dev, 1); return 0; }
void __init mca_do_proc_init(void) { int i; struct proc_dir_entry *proc_mca; struct proc_dir_entry* node = NULL; struct mca_device *mca_dev; proc_mca = proc_mkdir("mca", NULL); create_proc_read_entry("pos",0,proc_mca,get_mca_info,NULL); create_proc_read_entry("machine",0,proc_mca,get_mca_machine_info,NULL); /* Initialize /proc/mca entries for existing adapters */ for(i = 0; i < MCA_NUMADAPTERS; i++) { enum MCA_AdapterStatus status; mca_dev = mca_find_device_by_slot(i); if(!mca_dev) continue; mca_dev->procfn = NULL; if(i < MCA_MAX_SLOT_NR) sprintf(mca_dev->procname,"slot%d", i+1); else if(i == MCA_INTEGVIDEO) sprintf(mca_dev->procname,"video"); else if(i == MCA_INTEGSCSI) sprintf(mca_dev->procname,"scsi"); else if(i == MCA_MOTHERBOARD) sprintf(mca_dev->procname,"planar"); status = mca_device_status(mca_dev); if (status != MCA_ADAPTER_NORMAL && status != MCA_ADAPTER_DISABLED) continue; node = create_proc_read_entry(mca_dev->procname, 0, proc_mca, mca_read_proc, (void *)mca_dev); if(node == NULL) { printk("Failed to allocate memory for MCA proc-entries!"); return; } } } /* mca_do_proc_init() */