Re: how to allocate an alined address for a device?

2000-01-31 Thread YAMAMOTO Shigeru


> "Warner" == Warner Losh  writes:
: +u_int32_t
: +rman_make_alignment_flags(int size) {
: + int i;
: +
: + for (i = 0; i < 32 && size > 0x01; i ++) {
: + size = (size >> 1);
: + }
: +
: + if (i > 31) {
: + i = 0;
: + }
: +
: + return(RF_ALIGNMENT_LOG2(i));
:  }

I found my mistake in my patch.
Following is right.

 u_int32_t
rman_make_alignment_flags(int size) {
int i;
+   int count;

-   for (i = 0; i < 32 && size > 0x01; i ++) {
+   for (i = 0, count = 0; i < 32 && size > 0x01; i ++) {
+   if (size & 0x01) {
+   count ++;
+   }
size = (size >> 1);
}
+
+   if (count > 0) {
+   i ++;
+   }

if (i > 31) {
i = 0;
}

return(RF_ALIGNMENT_LOG2(i));
}



Warner> This could more simply be stated as RF_ALIGNMENT_LOG2(ffs(size)).  I
Warner> don't think that it is really needed.

Maybe, 'RF_ALIGNMENT_LOG2(ffs(size) - 1)'.

It is very simple.
But can we have an assumption that we never pass non 2^n to ffs(3)?
I read 'man ffs(3)' and '@src/sys/libkern/ffs.c'.
ffs(3), it seems me finding a first set bit from LSB.
If we pass a non 2^n value to ffs(3), we have a wrong result.

ex.
ffs(4) = 3
--> 4 = 2^2
  = (1 << 2)
  = (1 << (ffs(4) - 1))
ffs(6) = 2, ffs(8) = 4
--> 6 < 8 = 2^3
  = (1 << 3)
  = (1 << (ffs(8) - 1))
  = (1 << (ffs(6) + 1))
 != (1 << (ffs(6) - 1))
  = (1 << (2 - 1)) = 2
ffs(63) = 1, ffs(64) = 7
--> 63 < 64 = 2^6
= (1 << 6)
= (1 << (ffs(64) - 1))
= (1 << (ffs(63) + 5))
   != (1 << (ffs(63) - 1))
= (1 << (1 - 1)) = 1

Warner> : +#define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT)
Warner> You might want to add:
Warner> #define RF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT)

I add it.

I send my new patch and ffs(3) test program.
Thanks,

---
YAMAMOTO ShigeruInternet Initiative Japan Inc.
<[EMAIL PROTECTED]> Network Engineering Div.


--- kern/subr_rman.c.orgTue Nov 16 08:28:57 1999
+++ kern/subr_rman.cSun Jan 30 23:55:28 2000
@@ -227,7 +227,19 @@
continue;
}
rstart = max(s->r_start, start);
-   rend = min(s->r_end, max(start + count, end));
+   if (flags & RF_ALIGNMENT_MASK) {
+   /* need to align an address */
+   u_long  aligned_rstart;
+   u_long  alignment_size;
+
+   alignment_size = (1u << RF_ALIGNMENT(flags));
+   aligned_rstart = (rstart & (~alignment_size + 1u));
+   if ((rstart & (~(~alignment_size + 1u))) != 0) {
+   aligned_rstart += alignment_size;
+   }
+   rstart = aligned_rstart;
+   }
+   rend = min(s->r_end, max(max(start + count, end), rstart + count));
 #ifdef RMAN_DEBUG
printf("truncated region: [%#lx, %#lx]; size %#lx (requested %#lx)\n",
   rstart, rend, (rend - rstart + 1), count);
@@ -608,4 +620,27 @@
rv = int_rman_release_resource(rm, r);
simple_unlock(rm->rm_slock);
return (rv);
+}
+
+u_int32_t
+rman_make_alignment_flags(int size) {
+   int i;
+   int count;
+
+   for (i = 0, count = 0; i < 32 && size > 0x01; i ++) {
+   if (size & 0x01) {
+   count ++;
+   }
+   size = (size >> 1);
+   }
+
+   if (count > 0) {
+   i ++;
+   }
+
+   if (i > 31) {
+   i = 0;
+   }
+
+   return(RF_ALIGNMENT_LOG2(i));
 }
--- sys/rman.h.org  Mon Jan 10 08:48:52 2000
+++ sys/rman.h  Sun Jan 30 22:43:19 2000
@@ -64,7 +64,12 @@
 #defineRF_WANTED   0x0010  /* somebody is waiting for this resource */
 #defineRF_FIRSTSHARE   0x0020  /* first in sharing list */
 
-#define RF_PCCARD_ATTR 0x1 /* PCCARD attribute memory */
+#defineRF_PCCARD_ATTR  0x1 /* PCCARD attribute memory */
+
+#defineRF_ALIGNMENT_SHIFT  10  /* alignment size bit starts bit 10 */
+#defineRF_ALIGNMENT_MASK   (0x003F << RF_ALIGNMENT_SHIFT)  /* resource 
+address alignemnt size bit mask */
+#defineRF_ALIGNMENT_LOG2(x)((x) << RF_ALIGNMENT_SHIFT)
+#defineRF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> 
+RF_ALIGNMENT_SHIFT)
 
 enum   rman_type { RMAN_UNINIT = 0, RMAN_GAUGE, RMAN_ARRAY };
 
@@ -91,6 +96,8 @@
 struct resource *rman_reserve_resource(struct rman *rm, u_long start,
u_long end, u_long count,
u_i

Re: clk0 interrupt accounting weirdness ???

2000-01-31 Thread Panagiotis Astithas

On Sun, Jan 30, 2000 at 01:51:29PM +, Scott Mitchell wrote:
> Essentially, the irq line to which clk0 interrupts are accounted (in the
> output from vmstat -i) changes when pccards are inserted/removed.  The same 
> effect has been seen with cards using the xe0 and ed0 drivers.

FWIW, I also experience the same behavior:
past@laptop$ vmstat -i
interrupt  total  rate
clk0 irq10 488774  100
...

past@laptop$ grep config /etc/pccard.conf
config 0x0 "ed0" 10
...

I did mention it on this list a while ago. Perhaps we should move this to 
-stable?

-past


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



make release + X

2000-01-31 Thread R.I.Pienaar

hi,

I have been looking at the make release process, and have succesfully made a
3.4 snapshot release, my problem is it doesnt build/install any X stuff.

how do i incorporate the XFree stuff into a freebsd release so that it is in
acceptable format for sysinstall?

-- 
R.I. Pienaar  [EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



NFS and removable disks

2000-01-31 Thread Theo PAGTZIS


Hi all,


  I have the following problem. I have moved my disk with Fbsd 3.3 onto a diff 
machine with exactly the same network interface on both machines de0.

However when I am trying to do mount on the machines NFS responds with

NFS Portmap: RPC: Port mapper failure - RPC: Timed out

When I ask people what does NFS depend on between client and servers I get the 
response of only IP address. So since the IP address is the same I am puzzled 
as to why there is port map failure.

Could anyone enlighten on the reason of why this happens?

BTW when I ping the ping works ok as well as telnet does


Theo




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



HP Type C1559 problems

2000-01-31 Thread Dmitry Samersoff

I have problem with HP SureStore 24x6  
I can read(write) only from one tape from catridge

Could anybody send me ether shell or C (preferable)
sequence need to read tapes one by one?

i.e something like:
  cat /dev/rsa0
  camcontrol cmd -n rsa0.ctl -c "1B 00 00"
  cat /dev/rsa0

Thank you!




-- 
Dmitry Samersoff, [EMAIL PROTECTED], ICQ:3161705
http://devnull.wplus.net
* There will come soft rains ...


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: NFS and removable disks

2000-01-31 Thread David Malone

On Mon, Jan 31, 2000 at 05:29:43PM +, Theo PAGTZIS wrote:

> NFS Portmap: RPC: Port mapper failure - RPC: Timed out

Check you've enableld the portmapper on the server in rc.conf.
(Or check it's running "ps -auxwww | fgrep portmap").

David.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: HP Type C1559 problems

2000-01-31 Thread Dan Nelson

In the last episode (Jan 31), Dmitry Samersoff said:
> I have problem with HP SureStore 24x6 I can read(write) only from one
> tape from catridge
> 
> Could anybody send me ether shell or C (preferable) sequence need to
> read tapes one by one?
> 
> i.e something like:
>   cat /dev/rsa0
>   camcontrol cmd -n rsa0.ctl -c "1B 00 00"

You'll probably want to check out the "mt" and "chio" commands instead
of sending raw SCSI commands :)  "mt rewoffl" will rewind and eject a
tape.  The chio command manages autoloaders.  "man mtio" for the C tape
interface, and "man ch" for the C autoloader interface.

>   cat /dev/rsa0

-- 
Dan Nelson
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Bad memory suspected

2000-01-31 Thread Willem Jan Withagen

Hi,

Being probably bitten again by some bad memory, I'm considering applying
some of my old (VLSI) testingskills to this. However.

I'm in dire need of some hints, some because I haven't kept up with the
intimate details of Intel hardware, nor do I know how to get a lineair
memory space for all the fysical memory available in the system.

The starting problems are:
1) I'd like to do this als a loadable kernel module, so one would load this
module on the boot-prompt and let it eat away CPU time until it is rebooted.
Now is there a module example which I can use to get me an easy setup for
plugging inthe memory-test modules. Starting with simple things like
"walking 0 and 1's", but ending up with O(n^2) tests to check for
dependancies on surrounding values

2) Cache is a friend and a fiend in this: It helps fast execution of the
code, but prevents data really getting to the silicon. So all experience in
this is welcomed. Bluntly I can disable all caching (which would be nice for
starters), but once we get to the more complex testingpatterns CPU-cycles do
start to count.

3) PC memory layouts used to be a major art just by itself in the old days
when we still used DIP 4116's, how is that in the current time with SIMM,
DIMM, RAMBUS, PCI-bridges, ECC, .
Any pointers to nightly reading material??

Thanx,
--Willem Jan

I once had a TRS-80 test run for 3 days, before it gave in, but then the
error was reproducable and pinpointed the actual chip to be replaced. Which
did fix the problem. 
-- 
Internet Access Eindhoven BV.,  voice: +31-40-2 393 393, data: +31-40-2 606 606
P.O. 928, 5600 AX Eindhoven, The Netherlands
Full Internet connectivity for only fl 9.95 a month.
Call now, and login as 'new'.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: HP Type C1559 problems

2000-01-31 Thread Dmitry Samersoff

Dan Nelson wrote:
> 
> In the last episode (Jan 31), Dmitry Samersoff said:
> > I have problem with HP SureStore 24x6 I can read(write) only from one
> > tape from catridge
> >
> > Could anybody send me ether shell or C (preferable) sequence need to
> > read tapes one by one?
> >
> > i.e something like:
> >   cat /dev/rsa0
> >   camcontrol cmd -n rsa0.ctl -c "1B 00 00"
> 
> You'll probably want to check out the "mt" and "chio" commands instead
> of sending raw SCSI commands :)  "mt rewoffl" will rewind and eject a
> tape.  The chio command manages autoloaders.  "man mtio" for the C tape
> interface, and "man ch" for the C autoloader interface.

I'm not so lazy as you belive ;-)) I tried all above before going 
to camcontrol. 
mt can rewind, erase end so on current tape, but can't change 
current slot number.
chio report error for every comand except "chio status" .

I find now (after lots of experiments) that sending raw SCSI command
helps me.
Right command causing changer to load next tape looks like:
  camcontrol stop -n sa -t 100 -v  
  camcontrol cmd -n sa -t 100 -v -c "1B 00 00 00 00 00"


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



video board

2000-01-31 Thread Gustavo V G C Rios

I have a video board which is hanging my FreeBSD BOX (Virge S3 GX/2,
diamond stealth 3d 4000)

I am considering changing it to a new one, which one do you suggest me?

PS: I don't need a expensive one, all i need is a video board in the
same level of quality than the current one (Obvious, not buggy).


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: HP Type C1559 problems

2000-01-31 Thread Matthew Jacob


It sounds to me that you have this device strapped to be in 'stacker' mode-
the command you're sending is the same as an 'mt offline' command- so it's
loading the next tape in the changer.

that means it won't show up as a changer on lun 1. I haven't seen one these
beasts for 5-6 years- I don't recall what the switch settings are, but IIRC HP
switch settings made no sense.


On Tue, 1 Feb 2000, Dmitry Samersoff wrote:

> Dan Nelson wrote:
> > 
> > In the last episode (Jan 31), Dmitry Samersoff said:
> > > I have problem with HP SureStore 24x6 I can read(write) only from one
> > > tape from catridge
> > >
> > > Could anybody send me ether shell or C (preferable) sequence need to
> > > read tapes one by one?
> > >
> > > i.e something like:
> > >   cat /dev/rsa0
> > >   camcontrol cmd -n rsa0.ctl -c "1B 00 00"
> > 
> > You'll probably want to check out the "mt" and "chio" commands instead
> > of sending raw SCSI commands :)  "mt rewoffl" will rewind and eject a
> > tape.  The chio command manages autoloaders.  "man mtio" for the C tape
> > interface, and "man ch" for the C autoloader interface.
> 
> I'm not so lazy as you belive ;-)) I tried all above before going 
> to camcontrol. 
> mt can rewind, erase end so on current tape, but can't change 
> current slot number.
> chio report error for every comand except "chio status" .
> 
> I find now (after lots of experiments) that sending raw SCSI command
> helps me.
> Right command causing changer to load next tape looks like:
>   camcontrol stop -n sa -t 100 -v  
>   camcontrol cmd -n sa -t 100 -v -c "1B 00 00 00 00 00"
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



RE: make release + X

2000-01-31 Thread Daniel O'Connor


On 31-Jan-00 R.I.Pienaar wrote:
>  how do i incorporate the XFree stuff into a freebsd release so that
>  it is in
>  acceptable format for sysinstall?

Download the binary packages from XFree86.org..

Someone was working on making the port produce tarballs that look like
the XFree86 ones but I don't know how far that got.

---
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Bad memory suspected

2000-01-31 Thread Doug White

On Tue, 1 Feb 2000, Willem Jan  Withagen wrote:

> Being probably bitten again by some bad memory, I'm considering applying
> some of my old (VLSI) testingskills to this. However.
> 
> I'm in dire need of some hints, some because I haven't kept up with the
> intimate details of Intel hardware, nor do I know how to get a lineair
> memory space for all the fysical memory available in the system.
> 
> The starting problems are:
> 1) I'd like to do this als a loadable kernel module, so one would load this
> module on the boot-prompt and let it eat away CPU time until it is rebooted.

I've found that multiple, parallel `make world's is a better tester than
the pattern testers/"Burn-in" tools (ie AMIDiag) that are floating around.  
Compiling is a full-body workout -- when it hits a bad bit, it'll tank
rather spectactularly.  

I have systems that pass repeated AMIDiag sweeps but couldn't build a
kernel or survive a database churn to save their lives.

Doug White|  FreeBSD: The Power to Serve
[EMAIL PROTECTED] |  www.FreeBSD.org



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message