From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 8 Nov 2000 01:44:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 8 Nov 2000 01:44:10 -0500 Received: from smtp2.ihug.co.nz ([203.109.252.8]:16397 "EHLO smtp2.ihug.co.nz") by vger.kernel.org with ESMTP id ; Wed, 8 Nov 2000 01:44:05 -0500 Message-ID: <3A08F5E9.61F424A0@ihug.co.nz> Date: Wed, 08 Nov 2000 19:42:49 +1300 From: david X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17 i686) X-Accept-Language: en MIME-Version: 1.0 To: Linux Kernel List Subject: off topic a bit but i realy need help c++ and kernel X-Priority: 2 (High) Content-Type: multipart/alternative; boundary="------------4212772E468A86840C898065" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --------------4212772E468A86840C898065 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 --------------4212772E468A86840C898065 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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 <sector2@ihug.co.nz>
 
 
 
 
 
 
  --------------4212772E468A86840C898065-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 8 Nov 2000 09:54:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 8 Nov 2000 09:54:09 -0500 Received: from mailhub.icx.net ([206.96.250.12]:13832 "EHLO icx.net") by vger.kernel.org with ESMTP id ; Wed, 8 Nov 2000 09:54:04 -0500 Message-ID: <3A092269.9020501@edge.net> Date: Wed, 08 Nov 2000 09:52:41 +0000 From: Anthony Chatman User-Agent: Mozilla/5.0 (X11; U; Linux 2.4.0-test10 i686; en-US; m18) Gecko/20000929 Netscape6/6.0b3 X-Accept-Language: en MIME-Version: 1.0 To: linux-kernel@vger.kernel.org Subject: Nvidia GeForce2 kernel driver - kernel 2.4.0 test-10 In-Reply-To: <3A08F5E9.61F424A0@ihug.co.nz> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 /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 ;-) david wrote: > 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 majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 8 Nov 2000 19:10:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 8 Nov 2000 19:09:51 -0500 Received: from jalon.able.es ([212.97.163.2]:7370 "EHLO jalon.able.es") by vger.kernel.org with ESMTP id ; Wed, 8 Nov 2000 19:08:55 -0500 Date: Thu, 9 Nov 2000 01:08:48 +0100 From: "J . A . Magallon" To: Anthony Chatman Cc: linux-kernel@vger.kernel.org Subject: Re: Nvidia GeForce2 kernel driver - kernel 2.4.0 test-10 Message-ID: <20001109010848.A709@werewolf.able.es> Reply-To: jamagallon@able.es In-Reply-To: <3A08F5E9.61F424A0@ihug.co.nz> <3A092269.9020501@edge.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT In-Reply-To: <3A092269.9020501@edge.net>; from anthony@edge.net on Wed, Nov 08, 2000 at 10:52:41 +0100 X-Mailer: Balsa 1.0.pre2 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 /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... -- Juan Antonio Magallon Lacarta #> cd /pub mailto:jamagallon@able.es #> more beer - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 9 Nov 2000 05:09:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 9 Nov 2000 05:09:30 -0500 Received: from jalon.able.es ([212.97.163.2]:60113 "EHLO jalon.able.es") by vger.kernel.org with ESMTP id ; Thu, 9 Nov 2000 05:09:27 -0500 Date: Thu, 9 Nov 2000 11:09:20 +0100 From: "J . A . Magallon" To: Athanasius Cc: "J . A . Magallon" , Linux Kernel List Subject: Re: Nvidia GeForce2 kernel driver - kernel 2.4.0 test-10 Message-ID: <20001109110920.A1423@werewolf.able.es> Reply-To: jamagallon@able.es In-Reply-To: <3A08F5E9.61F424A0@ihug.co.nz> <3A092269.9020501@edge.net> <20001109010848.A709@werewolf.able.es> <20001109075436.U17457@miggy.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="AWniW0JNca5xppdA" Content-Transfer-Encoding: 8bit In-Reply-To: <20001109075436.U17457@miggy.org>; from Athanasius@miggy.org on Thu, Nov 09, 2000 at 08:54:36 +0100 X-Mailer: Balsa 1.0.pre2 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --AWniW0JNca5xppdA Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit On Thu, 09 Nov 2000 08:54:36 Athanasius wrote: > > Oh no it wasn't, doh *;-). One other try... -- Juan Antonio Magallon Lacarta #> cd /pub mailto:jamagallon@able.es #> more beer --AWniW0JNca5xppdA Content-Type: application/octet-stream; charset=us-ascii Content-Disposition: attachment; filename="patch-nvdriver-2.4.0-test11" diff -ru NVIDIA_kernel-0.9-5/nv.c nvdriver_/nv.c --- NVIDIA_kernel-0.9-5/nv.c Sat Aug 26 02:48:38 2000 +++ nvdriver_/nv.c Thu Nov 9 00:23:42 2000 @@ -49,6 +49,13 @@ #include #endif +#ifndef mem_map_dec_count + #define mem_map_dec_count(p) atomic_inc(&((p)->count)); +#endif +#ifndef mem_map_inc_count + #define mem_map_inc_count(p) atomic_dec(&((p)->count)); +#endif + #include // needs to precede other headers (SMP) #include diff -ru NVIDIA_kernel-0.9-5/os-interface.c nvdriver_/os-interface.c --- NVIDIA_kernel-0.9-5/os-interface.c Fri Sep 1 04:19:17 2000 +++ nvdriver_/os-interface.c Thu Nov 9 00:22:45 2000 @@ -1331,6 +1331,11 @@ char *parmp; char ch; + spinlock_t unload_lock = SPIN_LOCK_UNLOCKED; + struct module *mp = THIS_MODULE; + struct module_symbol *sym; + int i; + if ((strlen(regParmStr) + NV_SYM_PREFIX_LENGTH) > NV_MAX_SYM_NAME) goto done; @@ -1351,11 +1356,17 @@ *symp = '\0'; - symbol_value = get_module_symbol(NV_MODULE_NAME, symbol_name); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) - put_module_symbol(symbol_value); -#endif + spin_lock(&unload_lock); + if (MOD_CAN_QUERY(mp) && (mp->nsyms > 0)) { + for (i = mp->nsyms, sym = mp->syms; + i > 0; --i, ++sym) { + + if (strcmp(sym->name, symbol_name) == 0) { + symbol_value = sym->value; + break; + } + } + } + spin_unlock(&unload_lock); done: return (void *) symbol_value; --AWniW0JNca5xppdA-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/