* Need help on understanding hardware detection
@ 2013-08-19 11:47 Tao Jiang (姜涛)
2013-08-19 11:53 ` Saqlain Abbas
2013-08-19 22:41 ` /dev/sda to ata_host Com Developer
0 siblings, 2 replies; 10+ messages in thread
From: Tao Jiang (姜涛) @ 2013-08-19 11:47 UTC (permalink / raw)
To: kernelnewbies
Hi All:
I did some search on "how does linux kernel detect hardware?" and got what udev is.
I konw Linux kernel will send a netlink message to udevd.
But I still do not understand how the kernel can decide to send a netlink message.
What happend before the netlink message?
Take an usb stick for example, what will happen and what the kernel do from the very beginning of it been plugged in?
Thank you for advance. Any references will be appreciated.
--------------
Tao Jiang (??)
2013-08-19
^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help on understanding hardware detection
2013-08-19 11:47 Need help on understanding hardware detection Tao Jiang (姜涛)
@ 2013-08-19 11:53 ` Saqlain Abbas
2013-08-20 1:46 ` Tao Jiang (姜涛)
2013-08-19 22:41 ` /dev/sda to ata_host Com Developer
1 sibling, 1 reply; 10+ messages in thread
From: Saqlain Abbas @ 2013-08-19 11:53 UTC (permalink / raw)
To: kernelnewbies
have a look at http://blogas.sysadmin.lt/?p=141 will give you a nice idea...
Cheers,
Saqlain.
On Mon, Aug 19, 2013 at 4:47 PM, Tao Jiang (??) <jiangtao.jit@gmail.com>wrote:
> Hi All:
> I did some search on "how does linux kernel detect hardware?" and
> got what udev is.
> I konw Linux kernel will send a netlink message to udevd.
> But I still do not understand how the kernel can decide to send a
> netlink message.
> What happend before the netlink message?
> Take an usb stick for example, what will happen and what the
> kernel do from the very beginning of it been plugged in?
> Thank you for advance. Any references will be appreciated.
>
> --------------
> Tao Jiang (??)
> 2013-08-19
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Kind Regards,
Saqlain Abbas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130819/05c90648/attachment.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* /dev/sda to ata_host
2013-08-19 11:47 Need help on understanding hardware detection Tao Jiang (姜涛)
2013-08-19 11:53 ` Saqlain Abbas
@ 2013-08-19 22:41 ` Com Developer
2013-08-20 6:09 ` Valdis.Kletnieks at vt.edu
1 sibling, 1 reply; 10+ messages in thread
From: Com Developer @ 2013-08-19 22:41 UTC (permalink / raw)
To: kernelnewbies
Hello List,
Is there any way to reverse map device name? /dev/sda to a the ata_host structure the drive is attached to?
I can go with a misc driver and register ata_host at AHCI? detectation time, but I would like to get ata_host pointer
anytime I load my module.
Thanks
Cam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130819/56caab4d/attachment.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help on understanding hardware detection
2013-08-19 11:53 ` Saqlain Abbas
@ 2013-08-20 1:46 ` Tao Jiang (姜涛)
2013-08-20 3:28 ` Saqlain Abbas
0 siblings, 1 reply; 10+ messages in thread
From: Tao Jiang (姜涛) @ 2013-08-20 1:46 UTC (permalink / raw)
To: kernelnewbies
Saqlain:
Thanks for your reply.
The article really opened my eyes.
But in that article wrote as
1. " Linux kernel constantly scans all your computer bus?es for any changes and new hardware. Once any change on any bus is detected magic begins "
And in the comments at the bottom,
2. "a bus controller notifies the CPU through an interrupt which allows the kernel to query the controller back for information"
So my question is which one is right?
And can you show me more details on Linux kernel's implementation about "constantly scans" or "notifies the CPU through an interrupt"?
------------------
Tao Jiang (??)
2013-08-20
-------------------------------------------------------------
????Saqlain Abbas <saqlain.abbas.7@gmail.com>
?????2013-08-19 19:53
????Tao Jiang (??)
???kernelnewbies
???Re: Need help on understanding hardware detection
have a look at http://blogas.sysadmin.lt/?p=141 will give you a nice idea...
Cheers,
Saqlain.
On Mon, Aug 19, 2013 at 4:47 PM, Tao Jiang (??) <jiangtao.jit@gmail.com>wrote:
> Hi All:
> I did some search on "how does linux kernel detect hardware?" and
> got what udev is.
> I konw Linux kernel will send a netlink message to udevd.
> But I still do not understand how the kernel can decide to send a
> netlink message.
> What happend before the netlink message?
> Take an usb stick for example, what will happen and what the
> kernel do from the very beginning of it been plugged in?
> Thank you for advance. Any references will be appreciated.
>
> --------------
> Tao Jiang (??)
> 2013-08-19
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Kind Regards,
Saqlain Abbas.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help on understanding hardware detection
2013-08-20 1:46 ` Tao Jiang (姜涛)
@ 2013-08-20 3:28 ` Saqlain Abbas
2013-08-20 4:53 ` Tao Jiang (姜涛)
0 siblings, 1 reply; 10+ messages in thread
From: Saqlain Abbas @ 2013-08-20 3:28 UTC (permalink / raw)
To: kernelnewbies
I believe "CPU through an interrupt" is correct, dude there is lot material
on Google on this topic, just try to search using terms "how kernel detect
a hardware" or "kernel plug and play" etc, try to use different queries and
you will find lot of stuff.
Cheers,
On Tue, Aug 20, 2013 at 6:46 AM, Tao Jiang (??) <jiangtao.jit@gmail.com>wrote:
> Saqlain:
> Thanks for your reply.
> The article really opened my eyes.
> But in that article wrote as
> 1. " Linux kernel constantly scans all your computer bus?es for any
> changes and new hardware. Once any change on any bus is detected magic
> begins "
> And in the comments at the bottom,
> 2. "a bus controller notifies the CPU through an interrupt which
> allows the kernel to query the controller back for information"
> So my question is which one is right?
> And can you show me more details on Linux kernel's implementation
> about "constantly scans" or "notifies the CPU through an interrupt"?
>
> ------------------
> Tao Jiang (??)
> 2013-08-20
>
> -------------------------------------------------------------
> ????Saqlain Abbas <saqlain.abbas.7@gmail.com>
> ?????2013-08-19 19:53
> ????Tao Jiang (??)
> ???kernelnewbies
> ???Re: Need help on understanding hardware detection
>
> have a look at http://blogas.sysadmin.lt/?p=141 will give you a nice
> idea...
>
> Cheers,
> Saqlain.
>
>
> On Mon, Aug 19, 2013 at 4:47 PM, Tao Jiang (??) <jiangtao.jit@gmail.com
> >wrote:
>
> > Hi All:
> > I did some search on "how does linux kernel detect hardware?" and
> > got what udev is.
> > I konw Linux kernel will send a netlink message to udevd.
> > But I still do not understand how the kernel can decide to send a
> > netlink message.
> > What happend before the netlink message?
> > Take an usb stick for example, what will happen and what the
> > kernel do from the very beginning of it been plugged in?
> > Thank you for advance. Any references will be appreciated.
> >
> > --------------
> > Tao Jiang (??)
> > 2013-08-19
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
> Kind Regards,
> Saqlain Abbas.
>
>
>
--
Kind Regards,
Saqlain Abbas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130820/fc32d3da/attachment.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help on understanding hardware detection
2013-08-20 3:28 ` Saqlain Abbas
@ 2013-08-20 4:53 ` Tao Jiang (姜涛)
0 siblings, 0 replies; 10+ messages in thread
From: Tao Jiang (姜涛) @ 2013-08-20 4:53 UTC (permalink / raw)
To: kernelnewbies
Saqlain:
Thanks for your guide.
I'll do more search.
------------------
Tao Jiang (??)
2013-08-20
-------------------------------------------------------------
????Saqlain Abbas <saqlain.abbas.7@gmail.com>
?????2013-08-20 11:28
????Tao Jiang (??)
???kernelnewbies
???Re: Re: Need help on understanding hardware detection
I believe "CPU through an interrupt" is correct, dude there is lot material
on Google on this topic, just try to search using terms "how kernel detect
a hardware" or "kernel plug and play" etc, try to use different queries and
you will find lot of stuff.
Cheers,
On Tue, Aug 20, 2013 at 6:46 AM, Tao Jiang (??) <jiangtao.jit@gmail.com>wrote:
> Saqlain:
> Thanks for your reply.
> The article really opened my eyes.
> But in that article wrote as
> 1. " Linux kernel constantly scans all your computer bus?es for any
> changes and new hardware. Once any change on any bus is detected magic
> begins "
> And in the comments at the bottom,
> 2. "a bus controller notifies the CPU through an interrupt which
> allows the kernel to query the controller back for information"
> So my question is which one is right?
> And can you show me more details on Linux kernel's implementation
> about "constantly scans" or "notifies the CPU through an interrupt"?
>
> ------------------
> Tao Jiang (??)
> 2013-08-20
>
> -------------------------------------------------------------
> ????Saqlain Abbas <saqlain.abbas.7@gmail.com>
> ?????2013-08-19 19:53
> ????Tao Jiang (??)
> ???kernelnewbies
> ???Re: Need help on understanding hardware detection
>
> have a look at http://blogas.sysadmin.lt/?p=141 will give you a nice
> idea...
>
> Cheers,
> Saqlain.
>
>
> On Mon, Aug 19, 2013 at 4:47 PM, Tao Jiang (??) <jiangtao.jit@gmail.com
> >wrote:
>
> > Hi All:
> > I did some search on "how does linux kernel detect hardware?" and
> > got what udev is.
> > I konw Linux kernel will send a netlink message to udevd.
> > But I still do not understand how the kernel can decide to send a
> > netlink message.
> > What happend before the netlink message?
> > Take an usb stick for example, what will happen and what the
> > kernel do from the very beginning of it been plugged in?
> > Thank you for advance. Any references will be appreciated.
> >
> > --------------
> > Tao Jiang (??)
> > 2013-08-19
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
> Kind Regards,
> Saqlain Abbas.
>
>
>
--
Kind Regards,
Saqlain Abbas.
^ permalink raw reply [flat|nested] 10+ messages in thread
* /dev/sda to ata_host
2013-08-19 22:41 ` /dev/sda to ata_host Com Developer
@ 2013-08-20 6:09 ` Valdis.Kletnieks at vt.edu
2013-08-20 7:25 ` Com Developer
2013-08-20 12:39 ` Greg Freemyer
0 siblings, 2 replies; 10+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2013-08-20 6:09 UTC (permalink / raw)
To: kernelnewbies
On Mon, 19 Aug 2013 15:41:15 -0700, Com Developer said:
> Is there any way to reverse map device name? /dev/sda to a the ata_host
> structure the drive is attached to?
What problem are you trying to solve with this reverse mapping?
(Hint - I'm not convinced that all devices named /dev/sd* have an ata_host
structure. I'm reasonably sure that the large disk arrays I have on some systems
at work are *not* ATA, as they present as SCSI fiberchannel devices.
% ls -l /dev/sdaaw
brw-r----- 1 root disk 133, 576 Aug 17 07:57 /dev/sdaaw
and dmesg tells me:
Vendor: IBM Model: DCS9550 Rev: 4.03
Type: Direct-Access ANSI SCSI revision: 05
sdaaw : very big device. try to use READ CAPACITY(16).
SCSI device sdaaw: 15628087296 512-byte hdwr sectors (8001581 MB)
sdaaw: Write Protect is off
sdaaw: Mode Sense: a7 00 10 08
SCSI device sdaaw: drive cache: write through w/ FUA
sdaaw : very big device. try to use READ CAPACITY(16).
SCSI device sdaaw: 15628087296 512-byte hdwr sectors (8001581 MB)
sdaaw: Write Protect is off
sdaaw: Mode Sense: a7 00 10 08
SCSI device sdaaw: drive cache: write through w/ FUA
sdaaw: unknown partition table
sd 3:0:7:96: Attached scsi disk sdaaw
sd 3:0:7:96: Attached scsi generic sg731 type 0
I'm suspecting there's no ata_host involved here, as we never notice it
as an ATA drive.
(And no, that device name isn't a boo-boo - the box really *does*
have visibility to 768 8T LUNs (OK, so it's actually 8 fiberchannel
paths to 96 LUNs. ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130820/cd0e09e9/attachment.bin
^ permalink raw reply [flat|nested] 10+ messages in thread
* /dev/sda to ata_host
2013-08-20 6:09 ` Valdis.Kletnieks at vt.edu
@ 2013-08-20 7:25 ` Com Developer
2013-08-20 12:28 ` Valdis.Kletnieks at vt.edu
2013-08-20 12:39 ` Greg Freemyer
1 sibling, 1 reply; 10+ messages in thread
From: Com Developer @ 2013-08-20 7:25 UTC (permalink / raw)
To: kernelnewbies
Yes, you are right not all drives are ata_host.
But if you connect a SATA drive it is assigned ata_host
look at ahci driver and how it attaches to libata.
I am doing some custom work and I am not interested in recompiling kernel with
ahci and libata compiled separately.
Thanks
________________________________
From: "Valdis.Kletnieks at vt.edu" <Valdis.Kletnieks@vt.edu>
To: Com Developer <comdeveloper@yahoo.com>
Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>
Sent: Monday, August 19, 2013 11:09 PM
Subject: Re: /dev/sda to ata_host
On Mon, 19 Aug 2013 15:41:15 -0700, Com Developer said:
> Is there any way to reverse map device name? /dev/sda to a the ata_host
> structure the drive is attached to?
What problem are you trying to solve with this reverse mapping?
(Hint - I'm not convinced that all devices named /dev/sd* have an ata_host
structure.? I'm reasonably sure that the large disk arrays I have on some systems
at work are *not* ATA, as they present as SCSI fiberchannel devices.
% ls -l /dev/sdaaw
brw-r----- 1 root disk 133, 576 Aug 17 07:57 /dev/sdaaw
and dmesg tells me:
? Vendor: IBM? ? ? Model: DCS9550? ? ? ? ? Rev: 4.03
? Type:? Direct-Access? ? ? ? ? ? ? ? ? ? ? ANSI SCSI revision: 05
sdaaw : very big device. try to use READ CAPACITY(16).
SCSI device sdaaw: 15628087296 512-byte hdwr sectors (8001581 MB)
sdaaw: Write Protect is off
sdaaw: Mode Sense: a7 00 10 08
SCSI device sdaaw: drive cache: write through w/ FUA
sdaaw : very big device. try to use READ CAPACITY(16).
SCSI device sdaaw: 15628087296 512-byte hdwr sectors (8001581 MB)
sdaaw: Write Protect is off
sdaaw: Mode Sense: a7 00 10 08
SCSI device sdaaw: drive cache: write through w/ FUA
sdaaw: unknown partition table
sd 3:0:7:96: Attached scsi disk sdaaw
sd 3:0:7:96: Attached scsi generic sg731 type 0
I'm suspecting there's no ata_host involved here, as we never notice it
as an ATA drive.
(And no, that device name isn't a boo-boo - the box really *does*
have visibility to 768 8T LUNs (OK, so it's actually 8 fiberchannel
paths to 96 LUNs. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130820/d8cc35d4/attachment-0001.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* /dev/sda to ata_host
2013-08-20 7:25 ` Com Developer
@ 2013-08-20 12:28 ` Valdis.Kletnieks at vt.edu
0 siblings, 0 replies; 10+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2013-08-20 12:28 UTC (permalink / raw)
To: kernelnewbies
On Tue, 20 Aug 2013 00:25:24 -0700, Com Developer said:
> I am doing some custom work and I am not interested in recompiling kernel with
> ahci and libata compiled separately.
That still doesn't actually explain what problem you're trying to solve
by finding the ata_host structure. I suspect it's something along the
lines of "Once I have the ata_host structure, then I can XYZ in order
to ABC". There's a very good chance that either (a) there's a better way
to XYZ already in-kernel, so there's no need to find the ata_host structure
first (and thus no easy way to do so), or (b) you probably should be doing DEF
instead of ABC.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130820/43492dd7/attachment.bin
^ permalink raw reply [flat|nested] 10+ messages in thread
* /dev/sda to ata_host
2013-08-20 6:09 ` Valdis.Kletnieks at vt.edu
2013-08-20 7:25 ` Com Developer
@ 2013-08-20 12:39 ` Greg Freemyer
1 sibling, 0 replies; 10+ messages in thread
From: Greg Freemyer @ 2013-08-20 12:39 UTC (permalink / raw)
To: kernelnewbies
Valdis.Kletnieks at vt.edu wrote:
>(Hint - I'm not convinced that all devices named /dev/sd* have an
>ata_host
>structure.
Libata is a self admitted kludge.
/dev/sdx => scsi disk
Libata has stuck itself under the scsi disk driver, so you are right that not all scsi disks have a ata_host kludge, only the imposers should have one.
One path I have never chased is for an external usb connected drive. Scsi commands are sent a across the usb bus so there is probably not any libata involvement.
Greg
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-08-20 12:39 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-19 11:47 Need help on understanding hardware detection Tao Jiang (姜涛)
2013-08-19 11:53 ` Saqlain Abbas
2013-08-20 1:46 ` Tao Jiang (姜涛)
2013-08-20 3:28 ` Saqlain Abbas
2013-08-20 4:53 ` Tao Jiang (姜涛)
2013-08-19 22:41 ` /dev/sda to ata_host Com Developer
2013-08-20 6:09 ` Valdis.Kletnieks at vt.edu
2013-08-20 7:25 ` Com Developer
2013-08-20 12:28 ` Valdis.Kletnieks at vt.edu
2013-08-20 12:39 ` Greg Freemyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).