blob: 0d8e161a5f0065bd06e6f6c9d07160212cb5abf7 [file] [log] [blame]
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +00001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2000 Ronald G. Minnich <rminnich@gmail.com>
6 * Copyright (C) 2005-2009 coresystems GmbH
7 * Copyright (C) 2006-2009 Carl-Daniel Hailfinger
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef __PROGRAMMER_H__
25#define __PROGRAMMER_H__ 1
26
27enum programmer {
28#if CONFIG_INTERNAL == 1
29 PROGRAMMER_INTERNAL,
30#endif
31#if CONFIG_DUMMY == 1
32 PROGRAMMER_DUMMY,
33#endif
34#if CONFIG_NIC3COM == 1
35 PROGRAMMER_NIC3COM,
36#endif
37#if CONFIG_NICREALTEK == 1
38 PROGRAMMER_NICREALTEK,
39 PROGRAMMER_NICREALTEK2,
Idwer Vollering004f4b72010-09-03 18:21:21 +000040#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000041#if CONFIG_NICNATSEMI == 1
42 PROGRAMMER_NICNATSEMI,
Idwer Vollering004f4b72010-09-03 18:21:21 +000043#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000044#if CONFIG_GFXNVIDIA == 1
45 PROGRAMMER_GFXNVIDIA,
46#endif
47#if CONFIG_DRKAISER == 1
48 PROGRAMMER_DRKAISER,
49#endif
50#if CONFIG_SATASII == 1
51 PROGRAMMER_SATASII,
52#endif
53#if CONFIG_ATAHPT == 1
54 PROGRAMMER_ATAHPT,
55#endif
56#if CONFIG_INTERNAL == 1
57#if defined(__i386__) || defined(__x86_64__)
58 PROGRAMMER_IT87SPI,
59#endif
60#endif
61#if CONFIG_FT2232_SPI == 1
62 PROGRAMMER_FT2232_SPI,
63#endif
64#if CONFIG_SERPROG == 1
65 PROGRAMMER_SERPROG,
66#endif
67#if CONFIG_BUSPIRATE_SPI == 1
68 PROGRAMMER_BUSPIRATE_SPI,
69#endif
70#if CONFIG_DEDIPROG == 1
71 PROGRAMMER_DEDIPROG,
72#endif
73#if CONFIG_RAYER_SPI == 1
74 PROGRAMMER_RAYER_SPI,
75#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +000076#if CONFIG_NICINTEL_SPI == 1
77 PROGRAMMER_NICINTEL_SPI,
78#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000079 PROGRAMMER_INVALID /* This must always be the last entry. */
80};
81
82extern enum programmer programmer;
83
84struct programmer_entry {
85 const char *vendor;
86 const char *name;
87
88 int (*init) (void);
89 int (*shutdown) (void);
90
91 void * (*map_flash_region) (const char *descr, unsigned long phys_addr,
92 size_t len);
93 void (*unmap_flash_region) (void *virt_addr, size_t len);
94
95 void (*chip_writeb) (uint8_t val, chipaddr addr);
96 void (*chip_writew) (uint16_t val, chipaddr addr);
97 void (*chip_writel) (uint32_t val, chipaddr addr);
98 void (*chip_writen) (uint8_t *buf, chipaddr addr, size_t len);
99 uint8_t (*chip_readb) (const chipaddr addr);
100 uint16_t (*chip_readw) (const chipaddr addr);
101 uint32_t (*chip_readl) (const chipaddr addr);
102 void (*chip_readn) (uint8_t *buf, const chipaddr addr, size_t len);
103 void (*delay) (int usecs);
104};
105
106extern const struct programmer_entry programmer_table[];
107
108int programmer_init(char *param);
109int programmer_shutdown(void);
110
111enum bitbang_spi_master_type {
112 BITBANG_SPI_INVALID = 0, /* This must always be the first entry. */
113#if CONFIG_RAYER_SPI == 1
114 BITBANG_SPI_MASTER_RAYER,
115#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +0000116#if CONFIG_NICINTEL_SPI == 1
117 BITBANG_SPI_MASTER_NICINTEL,
118#endif
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000119#if CONFIG_INTERNAL == 1
120#if defined(__i386__) || defined(__x86_64__)
121 BITBANG_SPI_MASTER_MCP,
122#endif
123#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000124};
125
126struct bitbang_spi_master {
127 enum bitbang_spi_master_type type;
128
129 /* Note that CS# is active low, so val=0 means the chip is active. */
130 void (*set_cs) (int val);
131 void (*set_sck) (int val);
132 void (*set_mosi) (int val);
133 int (*get_miso) (void);
134};
135
136#if CONFIG_INTERNAL == 1
137struct penable {
138 uint16_t vendor_id;
139 uint16_t device_id;
140 int status;
141 const char *vendor_name;
142 const char *device_name;
143 int (*doit) (struct pci_dev *dev, const char *name);
144};
145
146extern const struct penable chipset_enables[];
147
148struct board_pciid_enable {
149 /* Any device, but make it sensible, like the ISA bridge. */
150 uint16_t first_vendor;
151 uint16_t first_device;
152 uint16_t first_card_vendor;
153 uint16_t first_card_device;
154
155 /* Any device, but make it sensible, like
156 * the host bridge. May be NULL.
157 */
158 uint16_t second_vendor;
159 uint16_t second_device;
160 uint16_t second_card_vendor;
161 uint16_t second_card_device;
162
163 /* Pattern to match DMI entries */
164 const char *dmi_pattern;
165
166 /* The vendor / part name from the coreboot table. */
167 const char *lb_vendor;
168 const char *lb_part;
169
170 const char *vendor_name;
171 const char *board_name;
172
173 int max_rom_decode_parallel;
174 int status;
175 int (*enable) (void);
176};
177
178extern const struct board_pciid_enable board_pciid_enables[];
179
180struct board_info {
181 const char *vendor;
182 const char *name;
183 const int working;
184#ifdef CONFIG_PRINT_WIKI
185 const char *url;
186 const char *note;
187#endif
188};
189
190extern const struct board_info boards_known[];
191extern const struct board_info laptops_known[];
192#endif
193
194/* udelay.c */
195void myusec_delay(int usecs);
196void myusec_calibrate_delay(void);
197void internal_delay(int usecs);
198
199#if NEED_PCI == 1
200/* pcidev.c */
201extern uint32_t io_base_addr;
202extern struct pci_access *pacc;
203extern struct pci_dev *pcidev_dev;
204struct pcidev_status {
205 uint16_t vendor_id;
206 uint16_t device_id;
207 int status;
208 const char *vendor_name;
209 const char *device_name;
210};
211uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar, const struct pcidev_status *devs);
212uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, const struct pcidev_status *devs);
213#endif
214
215/* print.c */
Idwer Vollering004f4b72010-09-03 18:21:21 +0000216#if CONFIG_NIC3COM+CONFIG_NICREALTEK+CONFIG_NICNATSEMI+CONFIG_GFXNVIDIA+CONFIG_DRKAISER+CONFIG_SATASII+CONFIG_ATAHPT+CONFIG_NICINTEL_SPI >= 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000217void print_supported_pcidevs(const struct pcidev_status *devs);
218#endif
219
220/* board_enable.c */
221void w836xx_ext_enter(uint16_t port);
222void w836xx_ext_leave(uint16_t port);
223int it8705f_write_enable(uint8_t port);
224uint8_t sio_read(uint16_t port, uint8_t reg);
225void sio_write(uint16_t port, uint8_t reg, uint8_t data);
226void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
227int board_flash_enable(const char *vendor, const char *part);
228
229/* chipset_enable.c */
230int chipset_flash_enable(void);
231
232/* processor_enable.c */
233int processor_flash_enable(void);
234
235/* physmap.c */
236void *physmap(const char *descr, unsigned long phys_addr, size_t len);
237void *physmap_try_ro(const char *descr, unsigned long phys_addr, size_t len);
238void physunmap(void *virt_addr, size_t len);
239int setup_cpu_msr(int cpu);
240void cleanup_cpu_msr(void);
241
242/* cbtable.c */
243void lb_vendor_dev_from_string(char *boardstring);
244int coreboot_init(void);
245extern char *lb_part, *lb_vendor;
246extern int partvendor_from_cbtable;
247
248/* dmi.c */
249extern int has_dmi_support;
250void dmi_init(void);
251int dmi_match(const char *pattern);
252
253/* internal.c */
254#if NEED_PCI == 1
255struct superio {
256 uint16_t vendor;
257 uint16_t port;
258 uint16_t model;
259};
260extern struct superio superio;
261#define SUPERIO_VENDOR_NONE 0x0
262#define SUPERIO_VENDOR_ITE 0x1
263struct pci_dev *pci_dev_find_filter(struct pci_filter filter);
264struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t class);
265struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
266struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
267 uint16_t card_vendor, uint16_t card_device);
268#endif
269void get_io_perms(void);
270void release_io_perms(void);
271#if CONFIG_INTERNAL == 1
272extern int is_laptop;
273extern int force_boardenable;
274extern int force_boardmismatch;
275void probe_superio(void);
276int internal_init(void);
277int internal_shutdown(void);
278void internal_chip_writeb(uint8_t val, chipaddr addr);
279void internal_chip_writew(uint16_t val, chipaddr addr);
280void internal_chip_writel(uint32_t val, chipaddr addr);
281uint8_t internal_chip_readb(const chipaddr addr);
282uint16_t internal_chip_readw(const chipaddr addr);
283uint32_t internal_chip_readl(const chipaddr addr);
284void internal_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
285#endif
286
287/* hwaccess.c */
288void mmio_writeb(uint8_t val, void *addr);
289void mmio_writew(uint16_t val, void *addr);
290void mmio_writel(uint32_t val, void *addr);
291uint8_t mmio_readb(void *addr);
292uint16_t mmio_readw(void *addr);
293uint32_t mmio_readl(void *addr);
294void mmio_le_writeb(uint8_t val, void *addr);
295void mmio_le_writew(uint16_t val, void *addr);
296void mmio_le_writel(uint32_t val, void *addr);
297uint8_t mmio_le_readb(void *addr);
298uint16_t mmio_le_readw(void *addr);
299uint32_t mmio_le_readl(void *addr);
300#define pci_mmio_writeb mmio_le_writeb
301#define pci_mmio_writew mmio_le_writew
302#define pci_mmio_writel mmio_le_writel
303#define pci_mmio_readb mmio_le_readb
304#define pci_mmio_readw mmio_le_readw
305#define pci_mmio_readl mmio_le_readl
306
307/* programmer.c */
308int noop_shutdown(void);
309void *fallback_map(const char *descr, unsigned long phys_addr, size_t len);
310void fallback_unmap(void *virt_addr, size_t len);
311uint8_t noop_chip_readb(const chipaddr addr);
312void noop_chip_writeb(uint8_t val, chipaddr addr);
313void fallback_chip_writew(uint16_t val, chipaddr addr);
314void fallback_chip_writel(uint32_t val, chipaddr addr);
315void fallback_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
316uint16_t fallback_chip_readw(const chipaddr addr);
317uint32_t fallback_chip_readl(const chipaddr addr);
318void fallback_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
319
320/* dummyflasher.c */
321#if CONFIG_DUMMY == 1
322int dummy_init(void);
323int dummy_shutdown(void);
324void *dummy_map(const char *descr, unsigned long phys_addr, size_t len);
325void dummy_unmap(void *virt_addr, size_t len);
326void dummy_chip_writeb(uint8_t val, chipaddr addr);
327void dummy_chip_writew(uint16_t val, chipaddr addr);
328void dummy_chip_writel(uint32_t val, chipaddr addr);
329void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
330uint8_t dummy_chip_readb(const chipaddr addr);
331uint16_t dummy_chip_readw(const chipaddr addr);
332uint32_t dummy_chip_readl(const chipaddr addr);
333void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
334int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt,
335 const unsigned char *writearr, unsigned char *readarr);
336int dummy_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
337int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
338#endif
339
340/* nic3com.c */
341#if CONFIG_NIC3COM == 1
342int nic3com_init(void);
343int nic3com_shutdown(void);
344void nic3com_chip_writeb(uint8_t val, chipaddr addr);
345uint8_t nic3com_chip_readb(const chipaddr addr);
346extern const struct pcidev_status nics_3com[];
347#endif
348
349/* gfxnvidia.c */
350#if CONFIG_GFXNVIDIA == 1
351int gfxnvidia_init(void);
352int gfxnvidia_shutdown(void);
353void gfxnvidia_chip_writeb(uint8_t val, chipaddr addr);
354uint8_t gfxnvidia_chip_readb(const chipaddr addr);
355extern const struct pcidev_status gfx_nvidia[];
356#endif
357
358/* drkaiser.c */
359#if CONFIG_DRKAISER == 1
360int drkaiser_init(void);
361int drkaiser_shutdown(void);
362void drkaiser_chip_writeb(uint8_t val, chipaddr addr);
363uint8_t drkaiser_chip_readb(const chipaddr addr);
364extern const struct pcidev_status drkaiser_pcidev[];
365#endif
366
367/* nicrealtek.c */
368#if CONFIG_NICREALTEK == 1
369int nicrealtek_init(void);
370int nicsmc1211_init(void);
371int nicrealtek_shutdown(void);
372void nicrealtek_chip_writeb(uint8_t val, chipaddr addr);
373uint8_t nicrealtek_chip_readb(const chipaddr addr);
374extern const struct pcidev_status nics_realtek[];
375extern const struct pcidev_status nics_realteksmc1211[];
376#endif
377
378/* nicnatsemi.c */
379#if CONFIG_NICNATSEMI == 1
380int nicnatsemi_init(void);
381int nicnatsemi_shutdown(void);
382void nicnatsemi_chip_writeb(uint8_t val, chipaddr addr);
383uint8_t nicnatsemi_chip_readb(const chipaddr addr);
384extern const struct pcidev_status nics_natsemi[];
385#endif
386
Idwer Vollering004f4b72010-09-03 18:21:21 +0000387/* nicintel_spi.c */
388#if CONFIG_NICINTEL_SPI == 1
389int nicintel_spi_init(void);
390int nicintel_spi_shutdown(void);
391int nicintel_spi_send_command(unsigned int writecnt, unsigned int readcnt,
392 const unsigned char *writearr, unsigned char *readarr);
393void nicintel_spi_chip_writeb(uint8_t val, chipaddr addr);
394extern const struct pcidev_status nics_intel_spi[];
395#endif
396
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000397/* satasii.c */
398#if CONFIG_SATASII == 1
399int satasii_init(void);
400int satasii_shutdown(void);
401void satasii_chip_writeb(uint8_t val, chipaddr addr);
402uint8_t satasii_chip_readb(const chipaddr addr);
403extern const struct pcidev_status satas_sii[];
404#endif
405
406/* atahpt.c */
407#if CONFIG_ATAHPT == 1
408int atahpt_init(void);
409int atahpt_shutdown(void);
410void atahpt_chip_writeb(uint8_t val, chipaddr addr);
411uint8_t atahpt_chip_readb(const chipaddr addr);
412extern const struct pcidev_status ata_hpt[];
413#endif
414
415/* ft2232_spi.c */
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000416#if CONFIG_FT2232_SPI == 1
417struct usbdev_status {
Uwe Hermann48ec1b12010-08-08 17:01:18 +0000418 uint16_t vendor_id;
419 uint16_t device_id;
420 int status;
421 const char *vendor_name;
422 const char *device_name;
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000423};
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000424int ft2232_spi_init(void);
425int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
426int ft2232_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
427int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000428extern const struct usbdev_status devs_ft2232spi[];
429void print_supported_usbdevs(const struct usbdev_status *devs);
430#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000431
432/* rayer_spi.c */
433#if CONFIG_RAYER_SPI == 1
434int rayer_spi_init(void);
435#endif
436
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000437/* mcp6x_spi.c */
438#if CONFIG_INTERNAL == 1
439#if defined(__i386__) || defined(__x86_64__)
440int mcp6x_spi_init(int want_spi);
441#endif
442#endif
443
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000444/* bitbang_spi.c */
445int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod);
446int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
447int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
448int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
449
450/* buspirate_spi.c */
451struct buspirate_spispeeds {
452 const char *name;
453 const int speed;
454};
455int buspirate_spi_init(void);
456int buspirate_spi_shutdown(void);
457int buspirate_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
458int buspirate_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
459int buspirate_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
460
461/* dediprog.c */
462int dediprog_init(void);
463int dediprog_shutdown(void);
464int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
465int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
466
467/* flashrom.c */
468struct decode_sizes {
469 uint32_t parallel;
470 uint32_t lpc;
471 uint32_t fwh;
472 uint32_t spi;
473};
474extern struct decode_sizes max_rom_decode;
475extern int programmer_may_write;
476extern unsigned long flashbase;
477void check_chip_supported(struct flashchip *flash);
478int check_max_decode(enum chipbustype buses, uint32_t size);
479char *extract_programmer_param(char *param_name);
480
481/* layout.c */
482int show_id(uint8_t *bios, int size, int force);
483
484/* spi.c */
485enum spi_controller {
486 SPI_CONTROLLER_NONE,
487#if CONFIG_INTERNAL == 1
488#if defined(__i386__) || defined(__x86_64__)
489 SPI_CONTROLLER_ICH7,
490 SPI_CONTROLLER_ICH9,
491 SPI_CONTROLLER_IT87XX,
492 SPI_CONTROLLER_SB600,
493 SPI_CONTROLLER_VIA,
494 SPI_CONTROLLER_WBSIO,
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000495 SPI_CONTROLLER_MCP6X_BITBANG,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000496#endif
497#endif
498#if CONFIG_FT2232_SPI == 1
499 SPI_CONTROLLER_FT2232,
500#endif
501#if CONFIG_DUMMY == 1
502 SPI_CONTROLLER_DUMMY,
503#endif
504#if CONFIG_BUSPIRATE_SPI == 1
505 SPI_CONTROLLER_BUSPIRATE,
506#endif
507#if CONFIG_DEDIPROG == 1
508 SPI_CONTROLLER_DEDIPROG,
509#endif
510#if CONFIG_RAYER_SPI == 1
511 SPI_CONTROLLER_RAYER,
512#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +0000513#if CONFIG_NICINTEL_SPI == 1
514 SPI_CONTROLLER_NICINTEL,
515#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000516 SPI_CONTROLLER_INVALID /* This must always be the last entry. */
517};
518extern const int spi_programmer_count;
519struct spi_programmer {
520 int (*command)(unsigned int writecnt, unsigned int readcnt,
521 const unsigned char *writearr, unsigned char *readarr);
522 int (*multicommand)(struct spi_command *cmds);
523
524 /* Optimized functions for this programmer */
525 int (*read)(struct flashchip *flash, uint8_t *buf, int start, int len);
526 int (*write_256)(struct flashchip *flash, uint8_t *buf, int start, int len);
527};
528
529extern enum spi_controller spi_controller;
530extern const struct spi_programmer spi_programmer[];
531int default_spi_send_command(unsigned int writecnt, unsigned int readcnt,
532 const unsigned char *writearr, unsigned char *readarr);
533int default_spi_send_multicommand(struct spi_command *cmds);
534
535/* ichspi.c */
536#if CONFIG_INTERNAL == 1
537extern uint32_t ichspi_bbar;
538int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
539 int ich_generation);
540int via_init_spi(struct pci_dev *dev);
541int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt,
542 const unsigned char *writearr, unsigned char *readarr);
543int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
544int ich_spi_write_256(struct flashchip *flash, uint8_t * buf, int start, int len);
545int ich_spi_send_multicommand(struct spi_command *cmds);
546#endif
547
548/* it87spi.c */
549void enter_conf_mode_ite(uint16_t port);
550void exit_conf_mode_ite(uint16_t port);
551struct superio probe_superio_ite(void);
552int init_superio_ite(void);
553int it87spi_init(void);
554int it8716f_spi_send_command(unsigned int writecnt, unsigned int readcnt,
555 const unsigned char *writearr, unsigned char *readarr);
556int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
557int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
558
559/* sb600spi.c */
560#if CONFIG_INTERNAL == 1
561int sb600_probe_spi(struct pci_dev *dev);
562int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt,
563 const unsigned char *writearr, unsigned char *readarr);
564int sb600_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
565int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
566#endif
567
568/* wbsio_spi.c */
569#if CONFIG_INTERNAL == 1
570int wbsio_check_for_spi(void);
571int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt,
572 const unsigned char *writearr, unsigned char *readarr);
573int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
574#endif
575
576/* serprog.c */
577int serprog_init(void);
578int serprog_shutdown(void);
579void serprog_chip_writeb(uint8_t val, chipaddr addr);
580uint8_t serprog_chip_readb(const chipaddr addr);
581void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
582void serprog_delay(int delay);
583
584/* serial.c */
585#if _WIN32
586typedef HANDLE fdtype;
587#else
588typedef int fdtype;
589#endif
590
591void sp_flush_incoming(void);
592fdtype sp_openserport(char *dev, unsigned int baud);
593void __attribute__((noreturn)) sp_die(char *msg);
594extern fdtype sp_fd;
595int serialport_shutdown(void);
596int serialport_write(unsigned char *buf, unsigned int writecnt);
597int serialport_read(unsigned char *buf, unsigned int readcnt);
598
599#endif /* !__PROGRAMMER_H__ */