rpms/vbetool/devel pciaccess.patch, NONE, 1.1 vgaarbpost.patch, NONE, 1.1 vbetool.spec, 1.11, 1.12
Dave Airlie
airlied at fedoraproject.org
Fri Jul 31 01:54:39 UTC 2009
- Previous message (by thread): rpms/libpciaccess/devel libpciaccess-vga-arbiter.patch,1.1,1.2
- Next message (by thread): rpms/couchdb/devel .cvsignore, 1.3, 1.4 couchdb.spec, 1.4, 1.5 import.log, 1.3, 1.4 sources, 1.3, 1.4 couchdb-0.9.0-pid.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: airlied
Update of /cvs/pkgs/rpms/vbetool/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17104
Modified Files:
vbetool.spec
Added Files:
pciaccess.patch vgaarbpost.patch
Log Message:
* Fri Jul 31 2009 Dave Airlie <airlied at redhat.com> 1.2-0.1
- pciacccess.patch: post to use libpciaccess
- vgaarbpost.patch: use vga arb to post secondaries
pciaccess.patch:
Makefile.am | 2 +-
Makefile.am~ |only
vbetool.c | 39 ++++++++++++++++++++-------------------
vbetool.c~ |only
4 files changed, 21 insertions(+), 20 deletions(-)
--- NEW FILE pciaccess.patch ---
diff -ur vbetool-1.1/Makefile.am vbetool-dave/Makefile.am
--- vbetool-1.1/Makefile.am 2008-05-16 22:52:33.000000000 +1000
+++ vbetool-dave/Makefile.am 2009-07-27 14:09:51.000000000 +1000
@@ -2,7 +2,7 @@
sbin_PROGRAMS = vbetool
-vbetool_LDADD = $(libdir)/libpci.a
+vbetool_LDADD = $(VBETOOL_LIBS) -lpciaccess -lz
man_MANS = vbetool.1
vbetool_SOURCES = vbetool.c $(x86)
Only in vbetool-dave: Makefile.am~
diff -ur vbetool-1.1/vbetool.c vbetool-dave/vbetool.c
--- vbetool-1.1/vbetool.c 2008-05-16 22:56:30.000000000 +1000
+++ vbetool-dave/vbetool.c 2009-07-27 14:12:41.000000000 +1000
@@ -8,7 +8,7 @@
version 2
*/
-#include <pci/pci.h>
+#include <pciaccess.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,8 +36,6 @@
#define DPMS_STATE_OFF 0x0400
#define DPMS_STATE_LOW 0x0800
-static struct pci_access *pacc;
-
int vbetool_init (void) {
if (!LRMI_init()) {
fprintf(stderr, "Failed to initialise LRMI (Linux Real-Mode Interface).\n");
@@ -46,9 +44,7 @@
iopl(3);
- pacc = pci_alloc();
- pacc->numeric_ids = 1;
- pci_init(pacc);
+ pci_system_init();
return 0;
}
@@ -220,25 +216,30 @@
int do_post(void)
{
- struct pci_dev *p;
unsigned int c;
- unsigned int pci_id;
int error;
+ struct pci_id_match dev_match = {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
+ (0x03 << 16), 0xff000, 0 };
+ struct pci_device *dev, *first_dev = NULL;
+ struct pci_device_iterator *iter;
+ unsigned pci_id;
- pci_scan_bus(pacc);
+ iter = pci_id_match_iterator_create(&dev_match);
+ if (iter == NULL) {
+ return 1;
+ }
- for (p = pacc->devices; p; p = p->next) {
- c = pci_read_word(p, PCI_CLASS_DEVICE);
- if (c == 0x300) {
- pci_id =
- (p->bus << 8) + (p->dev << 3) +
- (p->func & 0x7);
- error = do_real_post(pci_id);
- if (error != 0) {
- return error;
- }
+ while ((dev = pci_device_next(iter)) != NULL) {
+ pci_id = (dev->bus << 8) + (dev->dev << 3) +
+ (dev->func & 0x7);
+
+ error = do_real_post(dev);
+ if (error != 0) {
+ return error;
}
}
+ pci_iterator_destroy(iter);
return 0;
}
Only in vbetool-dave: vbetool.c~
vgaarbpost.patch:
vbetool.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 72 insertions(+), 10 deletions(-)
--- NEW FILE vgaarbpost.patch ---
diff -up vbetool-1.1/vbetool.c.da vbetool-1.1/vbetool.c
--- vbetool-1.1/vbetool.c.da 2009-07-31 11:14:18.000000000 +1000
+++ vbetool-1.1/vbetool.c 2009-07-31 11:45:39.000000000 +1000
@@ -119,7 +119,14 @@ int main(int argc, char *argv[])
MAP_FIXED|MAP_PRIVATE, romfd, 0);
}
- return do_post();
+ return do_post(0);
+ } else if (!strcmp(argv[1], "bootpost")) {
+ int err = check_console();
+
+ if (err) {
+ return err;
+ }
+ return do_post(1);
} else if (!strcmp(argv[1], "vgastate")) {
if (!strcmp(argv[2], "on")) {
return enable_vga();
@@ -143,7 +150,7 @@ int main(int argc, char *argv[])
} else {
usage:
fprintf(stderr,
- "%s: Usage %s [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post [romfile]]|[vgastate on|off]|[vbefp panelid|panelsize|getbrightness|setbrightness|invert]]\n",
+ "%s: Usage %s [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post [romfile]]|[bootpost]|[vgastate on|off]|[vbefp panelid|panelsize|getbrightness|setbrightness|invert]]\n",
argv[0], argv[0]);
return 1;
}
@@ -214,7 +221,48 @@ int do_real_post(unsigned pci_device)
return error;
}
-int do_post(void)
+#define MAX_ROMSIZE 64*1024
+void *rom_cseg;
+unsigned char romfile[MAX_ROMSIZE];
+
+void setup_rom_section(void)
+{
+ munmap((void *)0xc0000, MAX_ROMSIZE);
+ rom_cseg = mmap((void *)0xc0000, MAX_ROMSIZE, PROT_READ|PROT_WRITE|PROT_EXEC,
+ MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+ if (!rom_cseg) {
+ fprintf(stdrer,"unable to setup fake rom\n");
+ return -1
+ }
+ return 0;
+}
+
+int do_device_post(struct pci_device *dev)
+{
+ int error = 0;
+ /* need to pull the ROM file */
+ unsigned int pci_id;
+ int ret;
+
+ pci_device_vgaarb_set_target(dev);
+ pci_device_vgaarb_lock(dev);
+ ret = pci_device_read_rom(dev, romfile);
+ if (ret) {
+ pci_device_vgaarb_unlock(dev);
+ fprintf(stderr,"rom read returned %d\n");
+ return 0;
+ }
+
+ memcpy(rom_cseg, romfile, MAX_ROMSIZE);
+
+ pci_id = (dev->bus << 8) + (dev->dev << 3) +
+ (dev->func & 0x7);
+ error = do_real_post(pci_id);
+ pci_device_vgaarb_unlock(dev);
+ return error;
+}
+
+int do_post(int boot_flag)
{
unsigned int c;
int error;
@@ -225,21 +273,35 @@ int do_post(void)
struct pci_device_iterator *iter;
unsigned pci_id;
+ if (setup_rom_section())
+ return -1;
+
+ pci_device_vgaarb_init();
iter = pci_id_match_iterator_create(&dev_match);
if (iter == NULL) {
return 1;
}
-
+
while ((dev = pci_device_next(iter)) != NULL) {
- pci_id = (dev->bus << 8) + (dev->dev << 3) +
- (dev->func & 0x7);
-
- error = do_real_post(dev);
- if (error != 0) {
- return error;
+ if (!first_dev)
+ first_dev = dev;
+
+ if (pci_device_is_boot_vga(dev) && (boot_flag == 1)) {
+ continue;
+ }
+ if (pci_device_has_kernel_driver(dev)) {
+ continue;
}
+ error = do_device_post(dev);
+ if (error)
+ return error;
}
+
pci_iterator_destroy(iter);
+ pci_device_vgaarb_set_target(first_dev);
+ pci_device_vgaarb_lock(first_dev);
+ pci_device_vgaarb_unlock(first_dev);
+ pci_device_vgaarb_fini();
return 0;
}
Index: vbetool.spec
===================================================================
RCS file: /cvs/pkgs/rpms/vbetool/devel/vbetool.spec,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- vbetool.spec 27 Jul 2009 06:44:54 -0000 1.11
+++ vbetool.spec 31 Jul 2009 01:54:39 -0000 1.12
@@ -1,6 +1,6 @@
Name: vbetool
-Version: 1.1
-Release: 4%{?dist}.1
+Version: 1.2
+Release: 0.1%{?dist}
Summary: Run real-mode video BIOS code to alter hardware state
Group: System Environment/Base
@@ -9,7 +9,9 @@ URL: http://www.codon.org.uk/
Source0: http://www.codon.org.uk/~mjg59/vbetool/download/vbetool-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires: libpciaccess > 0.10.6-2
BuildRequires: zlib-devel pciutils-devel libx86-devel
+BuildRequires: libpciaccess-devel >= 0.10.6-2
# does not build on ppc, ppc64 and sparc arches, see #285361 (RedHat Bugzilla)
# on ppc sys/io.h is missing, on ppc64 there are more complaints
# build.logs are attached in the bug report
@@ -17,6 +19,8 @@ ExcludeArch: ppc ppc64 %{sparc} s390
# vbetool is included in (some of) these pm-utils releases
Conflicts: pm-utils <= 0.99.3-11
+Patch0: pciaccess.patch
+Patch1: vgaarbpost.patch
%description
vbetool uses lrmi in order to run code from the video BIOS. Currently, it is
@@ -26,6 +30,8 @@ initialize the video card from scratch.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1 -b .vga
%build
%configure --with-x86emu
@@ -49,6 +55,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Fri Jul 31 2009 Dave Airlie <airlied at redhat.com> 1.2-0.1
+- pciacccess.patch: post to use libpciaccess
+- vgaarbpost.patch: use vga arb to post secondaries
+
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1-4.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
- Previous message (by thread): rpms/libpciaccess/devel libpciaccess-vga-arbiter.patch,1.1,1.2
- Next message (by thread): rpms/couchdb/devel .cvsignore, 1.3, 1.4 couchdb.spec, 1.4, 1.5 import.log, 1.3, 1.4 sources, 1.3, 1.4 couchdb-0.9.0-pid.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list