LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices



Reply
 
Search this Thread
Old 01-09-2013, 01:55 PM   #1
beandigital
LQ Newbie
 
Registered: Jan 2013
Posts: 17

Rep: Reputation: Disabled
Hard disk device driver


Hi

I have Linux running on an embedded board that uses a processor running inside an FPGA. I have developed a custom SATA controller and a device driver in Linux. I have managed to load my device driver using "ismod" and I can confirm it is live using "lsmod". I have also created a device node in /dev using "mknod". My problem is that I cant figure out how to get the Kernel to read or write the drive. I have tried "mkfs" but it says the image is too small. I have also tried fdisk but it says it cant read from the drive. I have a lot of printk statements in my driver but the only ones I see is when it initially creates the module. I don't see the Kernel trying to use the driver in normal operation. Also if I look in /sys/block I don't see any mention of my device which I would of thought I should. So if anyone has any thoughts I would love to hear them.

Thanks

Jon
 
Old 01-12-2013, 12:00 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 1,773

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
What's the return value from scsi_add_host?
 
Old 01-12-2013, 02:21 PM   #3
beandigital
LQ Newbie
 
Registered: Jan 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Hi

I think some of my problem is that I didn't have some filesystems like ext2 compiled into the Kernel. My problem now is that when I insmod my driver I get the following. As I am not an expert I am not quite sure what it is saying. If anyone has an idea then I would appreciate it.

Thanks

Jon

-----------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:455 sysfs_add_one+0xb0/0xdc()
sysfs: cannot create duplicate filename '/block/xsa'
Modules linked in: bean(+)
Kernel Stack:
c7873b0c: c000fd44
c7873b10: 00000e9e 00000000 00292b28 00000009 c7873b74 c028e400 c000fe0c c027a0f0
c7873b30: c028e400 000001c7 c00d51e8 00000e0c 00000e0d c7879000 ffffffef c7873bc4
c7873b50: c7878b20 00000000 c00d51e0 c7275880 000041ed 00000001 c726ea60 c7878b20
c7873b70: ffffffef c028e430 c7873b8c c00d5cd8 00000000 c78749c0 c028e430 c7879000
c7873b90: c71679bc 00000001 c7878b20 00000000 fffffff4 c7873bc4 c00d5fa4 c7237140
c7873bb0: c018b084 fffffffd c78749c0 00000004 c0159888 c783c1e0 00000000 00000000
c7873bd0: c726ea60 00000000 c783c1e0 c7835388 00000000 00000078 c01586d0 c7237148
c7873bf0: c7835b70 c7823e68 c015869c c7823a20 c0160414 c72371cc 00000000 c726ea60
c7873c10: c7835388 fffffffe c0158924 c7873cec c01588f4 c0162abc c726ea0f c0304480
c7873c30: c01878f4 00000000 c726ea60 c7835388 ffffffea c726ea60 c0158e8c c72758a0
c7873c50: c726ea60 c0186500 c726ea0c 00000000 c726ea58 c726ea58 c726ea58 c726ea00
c7873c70: c0187424 c01873f4 c0285c08 00000000 c726ea58 c726ea58 c726ea00 c7873ca0
c7873c90: c014da9c 00000000 c0186888 00000000 00000007 c014c418 c014d034 00000000
c7873cb0: 00000001 c723c5c0 c726ea58 c723c5c0 c726ea58 c726ea00 c726ea00 c726ea60
c7873cd0: 00000000 00000078 bff3feb4 00000000 c014e018 c726ea00 c726ea0c 00000020
c7873cf0: 00000000 c014c418 c014d034 00000000 c014e010 c014dfec 00000000 c723c5c0
c7873d10: c723a0d4 c726ea00 00000000 c726ea60 c805c7c8 c7840088 00000000 00000078
c7873d30: c723c5c0 00000000 7a800000 0fd00000 c723c5c0 00000000 7a800000 00000001
c7873d50: c7840088 c018b9d4 c805c8fc 01500034 c805c910 00000061 c7253210 00000001
c7873d70: 7a800000 7a80ffff c7fffdb0 00000200 00000000 00000000 00000000 c7840088
c7873d90: ffffffed c805cc74 c805cc74 c030849c c018a2c8 c026980c c02697f4 bff3feb4
c7873db0: c7840088 ffffffed c805cc74 c018a620 c784f0f0 c0188f38 c018a608 c723c620
c7873dd0: 00000000 fffffffe c7840088 c78400bc c805cc74 c01890d8 c018a5b4 c805cc74
c7873df0: c01890e8 00000000 c723c620 00000000 00000000 c7873e28 c018a5b4 c018a084
c7873e10: 800061a6 100f38b8 000080d0 c7800180 c030849c fffffff4 c7835bf8 c784f0f0
c7873e30: fffffff4 100f38b8 c805cc74 c723c620 c0189bb0 00000000 fffffff4 c7873e70
c7873e50: 100f38b8 c805cc74 c723c620 c018aadc 00000000 c7873edc c00474cc c02a5700
c7873e70: c805c88c 00000d4c fffffff4 100f38b8 c805cc74 c805e000 00000000 00000002
c7873e90: c018bd04 00000000 c014d73c 00000000 6e72656b fffffff4 100f38b8 fffffff4
c7873eb0: 100f38b8 10118088 c805e000 00000000 00000002 c805e054 00000000 00000000
c7873ed0: fffffff4 100f38b8 10118088 c7873ee8 c00002f8 c805c9e4 800061a6 ffffffff
c7873ef0: 00000009 00000000 c015934c c805ccbc c0047508 00000015 c805ccbc 100f38b8
c7873f10: 10118088 00000000 1000be80 00000002 00000078 c00474f4 00000000 c805ccbc
c7873f30: 100f38b8 10118088 00000000 1000be80 c0005b98 c0005b98 37131eea bff3febc
c7873f50: bff3feb8 00000069 00000000 bff3febc bff3feb8 00000069 00000080 bff3fa8c
c7873f70: 00000000 00000000 00000000 10118088 0000237d 100f38b8 1011a408 00020f80
c7873f90: 00000000 00000000 00000080 00000000 00000000 10025554 00000000 481e9620
c7873fb0: ffffebe7 bff3febc 4825aff4 00000000 bff3feb8 00000069 00000000 1000be80
c7873fd0: 00000002 00000078 bff3feb4 00000000 bff3feb4 00000000 481e9628 000051aa
c7873ff0: 481e9620 00000000 00000000 00000000


Call Trace:
[<c00040ac>] microblaze_unwind+0x54/0x78
[<c0003db8>] show_stack+0x120/0x158
[<c0003df8>] dump_stack+0x8/0x20
[<c000fd40>] warn_slowpath_common+0x80/0xbc
[<c000fe08>] warn_slowpath_fmt+0x28/0x40
[<c00d51dc>] sysfs_add_one+0xa4/0xdc
[<c00d5cd4>] create_dir+0x80/0x100
[<c00d5fa0>] sysfs_create_dir+0x138/0x16c
[<c01586cc>] kobject_add_internal+0xc4/0x1dc
[<c0158920>] kobject_add_varg+0x4c/0x78
[<c0158e88>] kobject_add+0x68/0x80
[<c0187420>] device_add+0xac/0x56c
[<c014da98>] register_disk+0x48/0x1b8
[<c014e014>] add_disk+0x110/0x2c8
[<c805c7c4>] bean_of_probe+0x25c/0x324 [bean]
[<c018b9d0>] platform_drv_probe+0xc/0x24
[<c018a2c4>] driver_probe_device+0xe0/0x1b8
[<c018a61c>] __driver_attach+0x68/0xb4
[<c01890d4>] bus_for_each_dev+0x50/0xa8
[<c018a080>] driver_attach+0x18/0x30
[<c0189bac>] bus_add_driver+0xc4/0x2a0
[<c018aad8>] driver_register+0xf0/0x1ac
[<c018bd00>] platform_driver_register+0x58/0x70
[<c805e050>] bean_init+0x50/0xbc [bean]
[<c00002f4>] do_one_initcall+0x11c/0x220
[<c0047504>] sys_init_module+0x84/0x200
SYSCALL

---[ end trace 56a543209f1c03c6 ]---
kobject_add_internal failed for xsa with -EEXIST, don't try to register things with the same name in the same directory.
Kernel Stack:
c7873bfc: c0158770
c7873c00: c0160414 00000000 00000000 c726ea60 c7835388 c7873c20 c0158924 c029f998
c7873c20: c029fae0 c72758a0 00000029 c7835388 00000001 00000000 c726ea60 c7835388
c7873c40: ffffffea c726ea60 c0158e8c c72758a0 c726ea60 c0186500 c726ea0c 00000000
c7873c60: c726ea58 c726ea58 c726ea58 c726ea00 c0187424 c01873f4 c0285c08 00000000
c7873c80: c726ea58 c726ea58 c726ea00 c7873ca0 c014da9c 00000000 c0186888 00000000
c7873ca0: 00000007 c014c418 c014d034 00000000 00000001 c723c5c0 c726ea58 c723c5c0
c7873cc0: c726ea58 c726ea00 c726ea00 c726ea60 00000000 00000078 bff3feb4 00000000
c7873ce0: c014e018 c726ea00 c726ea0c 00000020 00000000 c014c418 c014d034 00000000
c7873d00: c014e010 c014dfec 00000000 c723c5c0 c723a0d4 c726ea00 00000000 c726ea60
c7873d20: c805c7c8 c7840088 00000000 00000078 c723c5c0 00000000 7a800000 0fd00000
c7873d40: c723c5c0 00000000 7a800000 00000001 c7840088 c018b9d4 c805c8fc 01500034
c7873d60: c805c910 00000061 c7253210 00000001 7a800000 7a80ffff c7fffdb0 00000200
c7873d80: 00000000 00000000 00000000 c7840088 ffffffed c805cc74 c805cc74 c030849c
c7873da0: c018a2c8 c026980c c02697f4 bff3feb4 c7840088 ffffffed c805cc74 c018a620
c7873dc0: c784f0f0 c0188f38 c018a608 c723c620 00000000 fffffffe c7840088 c78400bc
c7873de0: c805cc74 c01890d8 c018a5b4 c805cc74 c01890e8 00000000 c723c620 00000000
c7873e00: 00000000 c7873e28 c018a5b4 c018a084 800061a6 100f38b8 000080d0 c7800180
c7873e20: c030849c fffffff4 c7835bf8 c784f0f0 fffffff4 100f38b8 c805cc74 c723c620
c7873e40: c0189bb0 00000000 fffffff4 c7873e70 100f38b8 c805cc74 c723c620 c018aadc
c7873e60: 00000000 c7873edc c00474cc c02a5700 c805c88c 00000d4c fffffff4 100f38b8
c7873e80: c805cc74 c805e000 00000000 00000002 c018bd04 00000000 c014d73c 00000000
c7873ea0: 6e72656b fffffff4 100f38b8 fffffff4 100f38b8 10118088 c805e000 00000000
c7873ec0: 00000002 c805e054 00000000 00000000 fffffff4 100f38b8 10118088 c7873ee8
c7873ee0: c00002f8 c805c9e4 800061a6 ffffffff 00000009 00000000 c015934c c805ccbc
c7873f00: c0047508 00000015 c805ccbc 100f38b8 10118088 00000000 1000be80 00000002
c7873f20: 00000078 c00474f4 00000000 c805ccbc 100f38b8 10118088 00000000 1000be80
c7873f40: c0005b98 c0005b98 37131eea bff3febc bff3feb8 00000069 00000000 bff3febc
c7873f60: bff3feb8 00000069 00000080 bff3fa8c 00000000 00000000 00000000 10118088
c7873f80: 0000237d 100f38b8 1011a408 00020f80 00000000 00000000 00000080 00000000
c7873fa0: 00000000 10025554 00000000 481e9620 ffffebe7 bff3febc 4825aff4 00000000
c7873fc0: bff3feb8 00000069 00000000 1000be80 00000002 00000078 bff3feb4 00000000
c7873fe0: bff3feb4 00000000 481e9628 000051aa 481e9620 00000000 00000000 00000000


Call Trace:
[<c00040ac>] microblaze_unwind+0x54/0x78
[<c0003db8>] show_stack+0x120/0x158
[<c0003df8>] dump_stack+0x8/0x20
[<c015876c>] kobject_add_internal+0x164/0x1dc
[<c0158920>] kobject_add_varg+0x4c/0x78
[<c0158e88>] kobject_add+0x68/0x80
[<c0187420>] device_add+0xac/0x56c
[<c014da98>] register_disk+0x48/0x1b8
[<c014e014>] add_disk+0x110/0x2c8
[<c805c7c4>] bean_of_probe+0x25c/0x324 [bean]
[<c018b9d0>] platform_drv_probe+0xc/0x24
[<c018a2c4>] driver_probe_device+0xe0/0x1b8
[<c018a61c>] __driver_attach+0x68/0xb4
[<c01890d4>] bus_for_each_dev+0x50/0xa8
[<c018a080>] driver_attach+0x18/0x30
[<c0189bac>] bus_add_driver+0xc4/0x2a0
[<c018aad8>] driver_register+0xf0/0x1ac
[<c018bd00>] platform_driver_register+0x58/0x70
[<c805e050>] bean_init+0x50/0xbc [bean]
[<c00002f4>] do_one_initcall+0x11c/0x220
[<c0047504>] sys_init_module+0x84/0x200
SYSCALL

Oops: kernel access of bad area, sig: 11
Registers dump: mode=AF873BB4
r1=00000000, r2=00000000, r3=C726EA60, r4=000061A2
r5=C723A1A4, r6=00000022, r7=C029E61C, r8=C723A1A4
r9=FFFFFFFF, r10=00002F76, r11=00000000, r12=FFFFFFE4
r13=00000000, r14=C0160414, r15=C01586D0, r16=00000000
r17=C00D5EBC, r18=00000010, r19=00000000, r20=4825AFF4
r21=00000000, r22=C723A1A4, r23=C726EA60, r24=00000000
r25=C726EA60, r26=00000000, r27=00000078, r28=BFF3FEB4
r29=00000000, r30=BFF3FEB4, r31=C7160040, rPC=C00D5EBC
msr=000042A2, ear=00000021, esr=00000072, fsr=C029E618
Segmentation fault
 
Old 01-12-2013, 07:36 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 1,773

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Looks like the driver is being added ok. It calls your probe routine which finds a drive and tries to register it. That fails because the name is not unique. Normally disks would we named sda, sdb, etc. It looks like you are naming the disk xsa but there is already a /sys/block/xsa directory.
 
Old 01-13-2013, 03:53 AM   #5
beandigital
LQ Newbie
 
Registered: Jan 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Thanks for the help. How would you normally setup the name? The xsa is assigned to a compact flash card. Is it something that needs to be done in Kernel config or some script that is run?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
device driver for hard disk kashyapvirgo Linux - Hardware 3 03-02-2007 02:11 PM
device driver for hard disk kashyapvirgo Linux - General 1 03-02-2007 11:30 AM
hard disk device name bytez Linux - General 2 09-15-2006 07:55 PM
Use part of hard disk as backup device? doris Linux - General 2 06-01-2001 09:38 AM


All times are GMT -5. The time now is 08:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration