int shim_osLoadFWImage(unsigned char *ptr) { unsigned int bytesRead; mm_segment_t oldfs; static struct file *filp; unsigned int imageLength=0x5ffff; dgprintf(4, "tn7dsl_read_dsp()\n"); dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH); filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY); if(filp ==NULL) { printk("Failed: Could not open DSP binary file\n"); return -1; } if (filp->f_dentry != NULL) { if (filp->f_dentry->d_inode != NULL) { printk ("DSP binary filesize = %d bytes\n", (int) filp->f_dentry->d_inode->i_size); imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200; } } if (filp->f_op->read==NULL) return -1; /* File(system) doesn't allow reads */ /* * Disable parameter checking */ oldfs = get_fs(); set_fs(KERNEL_DS); /* * Now read bytes from postion "StartPos" */ filp->f_pos = 0; bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos); dgprintf(4,"file length = %d\n", bytesRead); set_fs(oldfs); /* * Close the file */ fput(filp); return bytesRead; }