Skip to contentSkip to conversation

off topic a bit but i realy need help c++ and kernel

DISCUSSION david 3 participants 4 messages Nov 8, 2000 – Nov 9, 2000

lore
Share & tools
lore

david

author
#0 lore raw

hi i am writing a video kernel driver for linux lexos and have got stuck

this is how NVIDIA do their regs

#define NV_PFIFO_RAMHT 0x00002210 /*
RW-4R */
#define NV_PFIFO_RAMHT_BASE_ADDRESS 8:4 /*
RWIUF */
#define NV_PFIFO_RAMHT_BASE_ADDRESS_10000 0x00000010 /*
RWI-V */
#define NV_PFIFO_RAMHT_SIZE 17:16 /*
RWIUF */
#define NV_PFIFO_RAMHT_SIZE_4K 0x00000000 /*
RWI-V */
#define NV_PFIFO_RAMHT_SIZE_8K 0x00000001 /*
RW--V */
#define NV_PFIFO_RAMHT_SIZE_16K 0x00000002 /*
RW--V */
#define NV_PFIFO_RAMHT_SIZE_32K 0x00000003 /*
RW--V */
#define NV_PFIFO_RAMHT_SEARCH 25:24 /*
RWIUF */
#define NV_PFIFO_RAMHT_SEARCH_16 0x00000000 /*
RWI-V */
#define NV_PFIFO_RAMHT_SEARCH_32 0x00000001 /*
RW--V */
#define NV_PFIFO_RAMHT_SEARCH_64 0x00000002 /*
RW--V */
#define NV_PFIFO_RAMHT_SEARCH_128 0x00000003 /*
RW--V */

this can be used like setreg( NV_PFIFO_RAMHT , htbase << ( 0 ? NV_PFIFO_RAMHT_BASE_ADDRESS)) ;
but i wont to make it better so i tried it this way

#define NV_PFIFO_RAMHT_BASE_ADDRESS 0x00002210:8:4:3 /* address : high bit : low bit : mode 3 = rw
this seemed much better all on one line so you can do setreg(NV_PFIFO_RAMHT_BASE_ADDRESS , htbase) ;
but ( 2 ? 1:2:3 ) dose not work
and NV_PFIFO_RAMHT_BASE_ADDRESS 0x00002210,8,4,3 dose not work as setreg(a,h,l,m) thinks this is
all one agr
the other would be to have it as a big struct

but then compiler can not optimize it ( i think )
if i can use #define 's the it quicker and setreg can be an inline asm marco

how would it work if i used 64 bit like this

bits 32 - 63 reg address
bits 24 - 31 high bit
bits 16 - 23 low bit
bits 0 - 7 mode

#define NV_PFIFO_RAMHT_BASE_ADDRESS 0x0000221008040003

so if i sent this to the setreg(unsigned long long , data) asm macro it would be in EAX:EDX (64 bit)
can the kernel use (long long) and (unsigned long long) ( 64 bit ints)

that 64 bit way look good but is it ?
( opps i wold need an extr 32 bits for value but can
have 64:32 i think )

has anyone got any help they can give me on this !please email me thank you!
as i am stuck
also is there a down loadable book on c++ as i am just learning from others ppl code and really
need a book to do it right

thank you david rundle <[email protected]>

#1 lore raw

Nvidia GeForce2 kernel driver - kernel 2.4.0 test-10

Speaking of Nvidia, I have a Nvidia GeForce2, and had problems loading the NV kernel module with a patched test10 kernel (i was running test9 before). I took a look at the test10 patch, and noticed the following 2 lines were taken out of <linux_dir>/include/linux/wrapper.h:

#define mem_map_inc_count(p) atomic_inc(&(p->count)) #define mem_map_dec_count(p) atomic_dec(&(p->count))

I added those two defines back into wrapper.h and then was able to load the NVdriver successfully, with no problems. This doesn't appear to break compiliation of the test10 kernel either. I thought I'd let everyone know if anyone was having problems with the NV kernel driver. Please note, I am not a C programmer, but more of a C hacker, and this worked for me on my Slackware 7.1 machine. I have no idea what this may have broken in the kernel or whatnot. I only know that this fixed the problem on this particular box with the NV kernel driver, so proceed at your own risk ;-)

Quoted 4 lines · david

hi i am writing a video kernel driver for linux lexos and have got stuck

this is how NVIDIA do their regs

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw

Re: Nvidia GeForce2 kernel driver - kernel 2.4.0 test-10

In reply to david
Quoted 9 lines · On Wed, 08 Nov 2000 10:52:41 Anthony Chatman wrote:

Speaking of Nvidia, I have a Nvidia GeForce2, and had problems loading the NV kernel module with a patched test10 kernel (i was running test9 before). I took a look at the test10 patch, and noticed the following 2 lines were taken out of <linux_dir>/include/linux/wrapper.h:

#define mem_map_inc_count(p) atomic_inc(&(p->count)) #define mem_map_dec_count(p) atomic_dec(&(p->count))

I added those two defines back into wrapper.h and then was able to load

I think you should never do that. Those macros are outdated and were removed from kernel. Patch NVdriver instead. Patch is attached.

BTW: does your board run ok on 2.4 ? I have a TNT2 and have not been able to get it working on a 2.4-smp. In 2.2-smp works fine. I don't know what is bad...In a recent strace (with test10), it seemed to be hanged on a poll() call...

Signature · 7 lines
Juan Antonio Magallon Lacarta                                 #> cd /pub
mailto:[email protected]                                     #> more beer

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#3 lore raw

Re: Nvidia GeForce2 kernel driver - kernel 2.4.0 test-10

In reply to david
Quoted 2 lines · On Thu, 09 Nov 2000 08:54:36 Athanasius wrote:
   Oh no it wasn't, doh *;-).

One other try...

Signature · 2 lines
Juan Antonio Magallon Lacarta                                 #> cd /pub
mailto:[email protected]                                     #> more beer