* RE: Kernel interrupts disable at user level - RIGHT/ WRONG - Help
@ 2005-12-20 6:57 Mukund JB.
2005-12-20 7:09 ` Dave Jones
0 siblings, 1 reply; 6+ messages in thread
From: Mukund JB. @ 2005-12-20 6:57 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]
Dear Alan,
I want the contents of A, B, C, D registers of CMOS mapped registers.
But instead the driver gives the details about the bit masks of few of register A, B only.
The others are NOT available.
I would also require to retrieve the day of the week info in RTC information.
I tried the /dev/rtc but I don't get it there.
at the same time, I am able to get the entire CMOS information using the application attached which does not use any driver interface and instead use the ports directly.
But, the application tried to disable the interrupts on the processor.
Suggest me the pros & cons of using this application.
Regards,
Mukund Jampala
-----Original Message-----
From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk]
Sent: Monday, December 19, 2005 11:13 PM
To: Mukund JB.
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kernel interrupts disable at user level - RIGHT/ WRONG -
Help
On Llu, 2005-12-19 at 17:45 +0530, Mukund JB. wrote:
> Dear Kernel Developers,
>
> I have a requirement of getting the CMOS details at the user level. I have identified the interfaces as /dev/nvram & /dev/rtc.
> But, the complete CMOS details are available to the user Applications as the driver does not provide the suitable interface to get the complete CMOS details.
Then you'll need to enhance the nvram or rtc driver to support the extra
bits you need. What doesn't it provide access to that you require >
[-- Attachment #2: dmpCmos.c --]
[-- Type: application/octet-stream, Size: 867 bytes --]
/*
* CMOS DUMPER
* Endrazine endrazine@pulltheplug.org
*
*
* compiling : gcc cmosd.c -o cmosd.o
* usage : #cmosd > cmos.dump
*
*/
#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>
int main ()
{
int i;
if (ioperm(0x70, 2, 1)) //Ask Permission (set to 1)
{ //for ports 0x70 and 0x71
perror("ioperm");
exit (1);
}
for (i=0;i<128;i++)
{
outb(i,0x70);// Write to port 0x70
usleep(100000);
printf("%c",inb(0x71));
}
if (ioperm(0x71, 2, 0)) // We don't need Permission anymore
{ // (set permissions to 0).
perror("ioperm");
exit(1);
}
exit (0);// Quit
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Kernel interrupts disable at user level - RIGHT/ WRONG - Help
2005-12-20 6:57 Kernel interrupts disable at user level - RIGHT/ WRONG - Help Mukund JB.
@ 2005-12-20 7:09 ` Dave Jones
0 siblings, 0 replies; 6+ messages in thread
From: Dave Jones @ 2005-12-20 7:09 UTC (permalink / raw)
To: Mukund JB.; +Cc: Alan Cox, linux-kernel
On Tue, Dec 20, 2005 at 12:27:13PM +0530, Mukund JB. wrote:
>
> Dear Alan,
>
> I want the contents of A, B, C, D registers of CMOS mapped registers.
> But instead the driver gives the details about the bit masks of few of register A, B only.
> The others are NOT available.
>
> I would also require to retrieve the day of the week info in RTC information.
> I tried the /dev/rtc but I don't get it there.
Use /dev/nvram instead.
Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Kernel interrupts disable at user level - RIGHT/ WRONG - Help
@ 2005-12-20 9:02 Mukund JB.
0 siblings, 0 replies; 6+ messages in thread
From: Mukund JB. @ 2005-12-20 9:02 UTC (permalink / raw)
To: Dave Jones; +Cc: Alan Cox, linux-kernel
> -----Original Message-----
> From: Dave Jones [mailto:davej@redhat.com]
> Sent: Tuesday, December 20, 2005 12:39 PM
> To: Mukund JB.
> Cc: Alan Cox; linux-kernel@vger.kernel.org
> Subject: Re: Kernel interrupts disable at user level - RIGHT/ WRONG -
> Help
>
>
> On Tue, Dec 20, 2005 at 12:27:13PM +0530, Mukund JB. wrote:
> >
> > Dear Alan,
> >
> > I want the contents of A, B, C, D registers of CMOS mapped
> registers.
> > But instead the driver gives the details about the bit
> masks of few of register A, B only.
> > The others are NOT available.
> >
> > I would also require to retrieve the day of the week info
> in RTC information.
> > I tried the /dev/rtc but I don't get it there.
>
> Use /dev/nvram instead.
>
> Dave
/dev/nvram does not give the cpomplete CMOS details. A part of RTC & date, tine and other info will be missing.
Regards,
Mukund Jampala
^ permalink raw reply [flat|nested] 6+ messages in thread
* Kernel interrupts disable at user level - RIGHT/ WRONG - Help
@ 2005-12-19 12:15 Mukund JB.
2005-12-19 13:51 ` linux-os (Dick Johnson)
2005-12-19 17:42 ` Alan Cox
0 siblings, 2 replies; 6+ messages in thread
From: Mukund JB. @ 2005-12-19 12:15 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
Dear Kernel Developers,
I have a requirement of getting the CMOS details at the user level. I have identified the interfaces as /dev/nvram & /dev/rtc.
But, the complete CMOS details are available to the user Applications as the driver does not provide the suitable interface to get the complete CMOS details.
I found an application that reads directly form the port 70, 71 and gets the complete details about the CMOS. It does not use any Device Interface and at the same disables all the interruptson the HOST system.
I would like to hear from you whether this kind of Applications can be used or NOT? Please see the attached source code I am planning to use to access the CMOS contents.
Please give me ur valuable suggestions.
Regards,
Mukund Jampala
<<dmpCmos.c>>
[-- Attachment #2: dmpCmos.c --]
[-- Type: application/octet-stream, Size: 895 bytes --]
/*
* 0486 5230593 5232717
* CMOS DUMPER
* Endrazine endrazine@pulltheplug.org
*
*
* compiling : gcc cmosd.c -o cmosd.o
* usage : #cmosd > cmos.dump
*
*/
#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>
int main ()
{
int i;
if (ioperm(0x70, 2, 1)) //Ask Permission (set to 1)
{ //for ports 0x70 and 0x71
perror("ioperm");
exit (1);
}
for (i=0;i<128;i++)
{
outb(i,0x70);// Write to port 0x70
usleep(100000);
printf("%c",inb(0x71));
}
if (ioperm(0x71, 2, 0)) // We don't need Permission anymore
{ // (set permissions to 0).
perror("ioperm");
exit(1);
}
exit (0);// Quit
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Kernel interrupts disable at user level - RIGHT/ WRONG - Help
2005-12-19 12:15 Mukund JB.
@ 2005-12-19 13:51 ` linux-os (Dick Johnson)
2005-12-19 17:42 ` Alan Cox
1 sibling, 0 replies; 6+ messages in thread
From: linux-os (Dick Johnson) @ 2005-12-19 13:51 UTC (permalink / raw)
To: Mukund JB.; +Cc: linux-kernel
On Mon, 19 Dec 2005, Mukund JB. wrote:
>
> Dear Kernel Developers,
>
> I have a requirement of getting the CMOS details at the user level.
> I have identified the interfaces as /dev/nvram & /dev/rtc.
> But, the complete CMOS details are available to the user Applications
> as the driver does not provide the suitable interface to get the
> complete CMOS details.
>
> I found an application that reads directly form the port 70, 71
> and gets the complete details about the CMOS. It does not use any Device
> Interface and at the same disables all the interruptson the HOST system.
>
> I would like to hear from you whether this kind of Applications can be
> used or NOT? Please see the attached source code I am planning to use to
> access the CMOS contents.
>
> Please give me ur valuable suggestions.
>
> Regards,
> Mukund Jampala
>
First, only root can disable interrupts in user-mode and read/write
to ports. One must prepare for this with iopl(3).
Second, the RTC is a shared resource. It must be protected with
a lock.
If you want to make your own rtc driver, then feel free. However,
you can't just poke at the ports from user-mode and get away with
it for any period of time. You will find that the CMOS checksum
gets screwed up and/or the time gets changed to a previous epoch.
This is because the kernel may change the index register in between
the time that you set it and when you wrote to the data register.
You need to use the provided spin-lock, rtc_lock. This needs
to be accessed from within the kernel, in your driver.
>
>
> <<dmpCmos.c>>
>
Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.56 BogoMips).
Warning : 98.36% of all statistics are fiction.
.
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Kernel interrupts disable at user level - RIGHT/ WRONG - Help
2005-12-19 12:15 Mukund JB.
2005-12-19 13:51 ` linux-os (Dick Johnson)
@ 2005-12-19 17:42 ` Alan Cox
1 sibling, 0 replies; 6+ messages in thread
From: Alan Cox @ 2005-12-19 17:42 UTC (permalink / raw)
To: Mukund JB.; +Cc: linux-kernel
On Llu, 2005-12-19 at 17:45 +0530, Mukund JB. wrote:
> Dear Kernel Developers,
>
> I have a requirement of getting the CMOS details at the user level. I have identified the interfaces as /dev/nvram & /dev/rtc.
> But, the complete CMOS details are available to the user Applications as the driver does not provide the suitable interface to get the complete CMOS details.
Then you'll need to enhance the nvram or rtc driver to support the extra
bits you need. What doesn't it provide access to that you require >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-12-20 9:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-20 6:57 Kernel interrupts disable at user level - RIGHT/ WRONG - Help Mukund JB.
2005-12-20 7:09 ` Dave Jones
-- strict thread matches above, loose matches on Subject: below --
2005-12-20 9:02 Mukund JB.
2005-12-19 12:15 Mukund JB.
2005-12-19 13:51 ` linux-os (Dick Johnson)
2005-12-19 17:42 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox